Class GlowEntityCleanup
ChunkGlowSpawner and SelectedAreaGlowSpawner.
Every marker carries two persistent data tags: homestead_border_glow, which marks it
as plugin-owned, and homestead_border_viewer, the UUID of the player the border is
for. Because markers are real world entities, they must be explicitly hidden from every
player other than their viewer, otherwise one player's /hs borders would render for
the whole server. The same tags let the plugin sweep away leftovers persisted by older
plugin versions, remove a single player's markers on demand, and drop stale scoreboard
glow-team memberships.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidhideFromEveryoneBut(org.bukkit.entity.Entity entity, UUID viewerId) Hides a marker from every online player except its viewer.static booleanisGlowEntity(org.bukkit.entity.Entity entity) Checks whether an entity is one of the plugin's glowing border markers.static intremoveOwnedBy(UUID viewerId) Sweeps every currently loaded world and removes only the border glow entities belonging to the given player.static intremoveTagged(Collection<? extends org.bukkit.entity.Entity> entities) Removes every tagged border glow entity from the given collection.static intremoveTagged(org.bukkit.entity.Entity[] entities) Removes every tagged border glow entity from the given array.static intSweeps every currently loaded world and removes all leftover border glow entities, regardless of which player they belong to.static voidRecords which player a marker was spawned for.static UUIDviewerOf(org.bukkit.entity.Entity entity) Reads the viewer UUID recorded on a marker.
-
Method Details
-
isGlowEntity
public static boolean isGlowEntity(org.bukkit.entity.Entity entity) Checks whether an entity is one of the plugin's glowing border markers.- Parameters:
entity- the entity to check; null-safe- Returns:
trueif the entity carries the border glow tag
-
tagViewer
Records which player a marker was spawned for.- Parameters:
entity- the marker to tagviewerId- the UUID of the player the border belongs to
-
viewerOf
Reads the viewer UUID recorded on a marker.- Parameters:
entity- the marker to inspect- Returns:
- the viewer's UUID, or
nullif the marker carries no viewer tag
-
hideFromEveryoneBut
Hides a marker from every online player except its viewer.Marker entities exist in the world for all clients by default; the per-player visibility API is what keeps one player's border private to that player.
- Parameters:
entity- the marker to hideviewerId- the UUID of the only player who should see it
-
removeTagged
Removes every tagged border glow entity from the given collection.Also drops the entity from any
homestead_glow_*scoreboard team so that stale team entries are not persisted. Failures on individual entities are ignored.- Parameters:
entities- the entities to filter and remove- Returns:
- the number of entities actually removed
-
removeTagged
public static int removeTagged(org.bukkit.entity.Entity[] entities) Removes every tagged border glow entity from the given array.- Parameters:
entities- the entities to filter and remove- Returns:
- the number of entities actually removed
- See Also:
-
sweepLoadedWorlds
public static int sweepLoadedWorlds()Sweeps every currently loaded world and removes all leftover border glow entities, regardless of which player they belong to.Invoked once on startup, before any border task can be running, so it only ever touches entities persisted by a previous server session.
- Returns:
- the number of entities removed
-
removeOwnedBy
Sweeps every currently loaded world and removes only the border glow entities belonging to the given player.- Parameters:
viewerId- the UUID of the player whose markers should be removed- Returns:
- the number of entities removed
-