Guides Nomad Compass

For plugin authors

How another plugin sets targets or hands out a pre-set compass.

Other plugins can set and clear targets through a small public API, or give a player a compass that already points at an objective. List co.nomadlabs:NomadCompass under Dependencies in your manifest (or under OptionalDependencies with a null check) so the server loads Compass before your plugin.

  • newCompass() and newCompass(target) make a plain or a pre-set compass.
  • withTarget(compass, target) returns a copy pointed somewhere; a null target clears it.
  • targetOf(stack) reads what a stack points at, or null.
  • giveCompass(player, target) puts a pre-set compass in a player's inventory, hotbar first. It completes true only if the whole stack was taken, and gives nothing at all when the player is offline, has no live world or has no room.

Build a target with TrackingTarget.player or TrackingTarget.at.