Class PreviewEntityService

java.lang.Object
dev.deepcore.challenge.preview.PreviewEntityService

public final class PreviewEntityService extends Object
Provides lifecycle helpers for tracked preview display entities.
  • Constructor Details

    • PreviewEntityService

      public PreviewEntityService()
  • Method Details

    • isLive

      public boolean isLive(UUID entityId)
      Returns whether the entity id resolves to a currently valid entity.
      Parameters:
      entityId - entity UUID to resolve
      Returns:
      true when the entity exists and is valid
    • removeLive

      public void removeLive(UUID entityId)
      Removes a live entity by id when it exists and is valid.
      Parameters:
      entityId - entity UUID to remove
    • hasAnyLiveAndPruneInvalid

      public <T> boolean hasAnyLiveAndPruneInvalid(List<T> entries, Function<T,UUID> idExtractor)
      Returns true when any referenced entity is live and prunes invalid entries.
      Type Parameters:
      T - tracked entry type
      Parameters:
      entries - tracked entries containing entity references
      idExtractor - extractor that maps an entry to its entity UUID
      Returns:
      true when at least one entry still points to a live entity
    • removeTaggedPreviewEntities

      public void removeTaggedPreviewEntities(org.bukkit.World world, String previewEntityTag)
      Removes block/text preview entities that contain the configured tag.
      Parameters:
      world - world to scan for preview entities
      previewEntityTag - scoreboard tag used to identify preview entities