Marker Module
Overview
The marker module allows you to place in-world markers from Lunar Client's Markers mod.
- Place a marker at any exact location, attributed to any owner.
- Pick the marker flag (Normal, Danger, Info, Interest) and optionally override its color.
- Describe what is marked (an item, block, entity or player) to drive the marker's description icon and text.
- Override the appearance per marker
Integration
Explore each integration by cycling through each tab, to find the best fit for your requirements and needs.
Sample Code
Apollo API examples. See General for common patterns and helpers.
Marking a block
public void displayBlockMarkerExample(Player viewer) {
Optional<ApolloPlayer> apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
apolloPlayerOpt.ifPresent(apolloPlayer -> {
Location location = viewer.getLocation();
this.markerModule.displayMarker(apolloPlayer, Marker.builder()
.id("loot-chest")
.location(ApolloLocation.builder()
.world(location.getWorld().getName())
.x(location.getX())
.y(location.getY())
.z(location.getZ())
.build())
.ownerId(viewer.getUniqueId())
.ownerName("")
.flag(MarkerFlag.INTEREST)
.target(BlockMarkerTarget.builder()
.itemStack(ItemStackIcon.builder().itemName("minecraft:chest").build())
.build())
.duration(Duration.ofSeconds(60))
.style(MarkerStyle.builder()
.showOwner(MarkerDisplayCondition.NEVER)
.showDescription(MarkerDisplayCondition.ALWAYS)
.build())
.build()
);
});
}Marking a player
public void displayPlayerMarkerExample(Player viewer) {
Optional<ApolloPlayer> apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
apolloPlayerOpt.ifPresent(apolloPlayer -> {
Location location = viewer.getLocation();
this.markerModule.displayMarker(apolloPlayer, Marker.builder()
.id("bounty")
.location(ApolloLocation.builder()
.world(location.getWorld().getName())
.x(location.getX())
.y(location.getY())
.z(location.getZ())
.build())
.ownerId(viewer.getUniqueId())
.ownerName(viewer.getName())
.flag(MarkerFlag.DANGER)
.color(Color.RED)
.target(PlayerMarkerTarget.builder()
.playerId(UUID.fromString("f17627d8-1a97-487b-92ea-c04f413394bd"))
.playerName("ItsNature")
.build())
.inGameNotification(true)
.style(MarkerStyle.builder()
.showOwner(MarkerDisplayCondition.NEVER)
.showDescription(MarkerDisplayCondition.ALWAYS)
.build())
.build()
);
});
}Marking an item
public void displayItemMarkerExample(Player viewer) {
Optional<ApolloPlayer> apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
apolloPlayerOpt.ifPresent(apolloPlayer -> {
Location location = viewer.getLocation();
this.markerModule.displayMarker(apolloPlayer, Marker.builder()
.id("wither-loot")
.location(ApolloLocation.builder()
.world(location.getWorld().getName())
.x(location.getX())
.y(location.getY())
.z(location.getZ())
.build())
.ownerId(viewer.getUniqueId())
.ownerName(viewer.getName())
.flag(MarkerFlag.INFO)
.target(ItemMarkerTarget.builder()
.itemStack(ItemStackIcon.builder().itemName("minecraft:nether_star").build())
.build())
.chatNotify(true)
.style(MarkerStyle.builder()
.showOwner(MarkerDisplayCondition.NEVER)
.showDescription(MarkerDisplayCondition.ALWAYS)
.build())
.build()
);
});
}Marking an entity
public void displayEntityMarkerExample(Player viewer) {
Optional<ApolloPlayer> apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
apolloPlayerOpt.ifPresent(apolloPlayer -> {
Location location = viewer.getLocation();
this.markerModule.displayMarker(apolloPlayer, Marker.builder()
.id("tutorial-npc")
.location(ApolloLocation.builder()
.world(location.getWorld().getName())
.x(location.getX())
.y(location.getY())
.z(location.getZ())
.build())
.ownerId(UUID.randomUUID())
.ownerName("Tutorial NPC")
.flag(MarkerFlag.INTEREST)
.target(EntityMarkerTarget.builder()
.entityType("minecraft:villager")
.build())
.style(MarkerStyle.builder()
.scale(1.3F)
.ownerSuffix("")
.ownerDisplay(MarkerOwnerDisplay.NAME)
.showOwner(MarkerDisplayCondition.HOVER)
.showDistance(MarkerDisplayCondition.NEVER)
.build())
.build()
);
});
}Removing markers
public void removeMarkersExample(Player viewer) {
Optional<ApolloPlayer> apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
apolloPlayerOpt.ifPresent(apolloPlayer -> {
this.markerModule.removeMarker(apolloPlayer, "loot-chest");
this.markerModule.removeMarker(apolloPlayer, "bounty");
this.markerModule.removeMarker(apolloPlayer, "wither-loot");
this.markerModule.removeMarker(apolloPlayer, "tutorial-npc");
});
}Resetting all markers
public void resetMarkersExample(Player viewer) {
Optional<ApolloPlayer> apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
apolloPlayerOpt.ifPresent(this.markerModule::resetMarkers);
}Marker Options
.id(String) should include a unique identifier for the marker. Re-sending a marker with an existing id updates it in place.
.id("loot-chest").location(ApolloLocation) is the exact location the marker is shown at. See the locations utilities page for more.
.location(ApolloLocation.builder()
.world("world")
.x(0.5D)
.y(64.0D)
.z(0.5D)
.build()
).ownerId(UUID) and .ownerName(String) set the marker's owner. The owner's head is pulled from the player's tab list; if the owner is the viewing player they are shown as themselves.
.ownerId(viewer.getUniqueId())
.ownerName(viewer.getName()).flag(MarkerFlag) is required and is the marker's flag, which sets its icon shape and base color. One of NORMAL, DANGER, INFO, INTEREST.
.flag(MarkerFlag.DANGER).color(java.awt.Color) overrides the color for the chosen flag. Supports alpha. Leave unset to use the player's own configured color for that flag. See the colors page for more.
.color(Color.RED).target(MarkerTarget) is required and describes what is marked, which drives the description icon and text. Use an ItemMarkerTarget or BlockMarkerTarget (each wrapping an ItemStackIcon a block uses its item form), an EntityMarkerTarget (entity registry name) or a PlayerMarkerTarget (a player UUID + name).
.target(BlockMarkerTarget.builder()
.itemStack(ItemStackIcon.builder().itemName("minecraft:chest").build())
.build()).duration(java.time.Duration) is how long the marker stays visible. Leave unset to defer to the player's configured marker visible-duration.
.duration(Duration.ofSeconds(60)).inGameNotification(boolean) shows a Lunar pop-up when the marker first appears. Defaults to false.
.inGameNotification(false).chatNotify(boolean) posts a chat message when the marker first appears. Defaults to false.
.chatNotify(false).middleClickRemove(boolean) lets the player middle-click the marker to remove it. Defaults to true.
.middleClickRemove(true).style(MarkerStyle) overrides the marker's appearance and text. Leave unset (or null) to defer entirely to the player's own Markers mod settings.
.style(MarkerStyle.builder()
.scale(1.0F) // 0.5F to 2.0F
.animateMarkerOnHover(true)
.compactMode(false)
.textShadow(true)
.ownerSuffix("'s Marker") // "" hides the suffix
.ownerDisplay(MarkerOwnerDisplay.HEAD)
.showOwner(MarkerDisplayCondition.ALWAYS)
.showCoordinates(MarkerDisplayCondition.NEVER)
.showDistance(MarkerDisplayCondition.HOVER)
.showDescription(MarkerDisplayCondition.HOVER)
.descriptionDisplay(MarkerDescriptionDisplay.ICON)
.build()
)When compactMode is enabled the marker uses a compact single-row layout, and
ownerDisplay, descriptionDisplay and ownerSuffix are ignored.