Package dev.deepcore.challenge.preview
Class PreviewEntityService
java.lang.Object
dev.deepcore.challenge.preview.PreviewEntityService
Provides lifecycle helpers for tracked preview display entities.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> booleanhasAnyLiveAndPruneInvalid(List<T> entries, Function<T, UUID> idExtractor) Returns true when any referenced entity is live and prunes invalid entries.booleanReturns whether the entity id resolves to a currently valid entity.voidremoveLive(UUID entityId) Removes a live entity by id when it exists and is valid.voidremoveTaggedPreviewEntities(org.bukkit.World world, String previewEntityTag) Removes block/text preview entities that contain the configured tag.
-
Constructor Details
-
PreviewEntityService
public PreviewEntityService()
-
-
Method Details
-
isLive
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
Removes a live entity by id when it exists and is valid.- Parameters:
entityId- entity UUID to remove
-
hasAnyLiveAndPruneInvalid
Returns true when any referenced entity is live and prunes invalid entries.- Type Parameters:
T- tracked entry type- Parameters:
entries- tracked entries containing entity referencesidExtractor- extractor that maps an entry to its entity UUID- Returns:
- true when at least one entry still points to a live entity
-
removeTaggedPreviewEntities
Removes block/text preview entities that contain the configured tag.- Parameters:
world- world to scan for preview entitiespreviewEntityTag- scoreboard tag used to identify preview entities
-