Package dev.oumaimaa.kawaiiapi.region
Class RegionSelector
java.lang.Object
dev.oumaimaa.kawaiiapi.region.RegionSelector
Modern utility class for visualizing regions using glowing slime entities.
Provides methods to create, remove, and manage visual region selectors without deprecated APIs.
Features:
- Uses Adventure API NamedTextColor for modern color support
- Automatic team management for glow effects
- Tag-based entity tracking for cleanup
- Thread-safe team numbering
- Efficient entity spawning
- Version:
- 1.0
- Author:
- KawaiiDevelopment (Updated by milo)
-
Method Summary
Modifier and TypeMethodDescriptionstatic intcountSelectors(@NotNull String id) Counts the number of selector entities with a specific tag.static voiddrawSelector(@NotNull Region region, @NotNull String id) Draws a selector with default white glow color.static voiddrawSelector(@NotNull Region region, @NotNull String id, @Nullable net.kyori.adventure.text.format.NamedTextColor glowColor) Draws a visual selector for the specified region using glowing slime entities.static List<org.bukkit.entity.Entity> getSelectorEntities(@NotNull String id) Gets all entities belonging to a specific selector.static intGets the current team counter value.static voidRemoves all region selector entities across all worlds.static voidkillSelectorsWithTag(@NotNull String tag) Removes all selector entities with a specific tag.static voidRemoves all temporary scoreboard teams created for region selectors.static voidResets the team counter.static booleanselectorExists(@NotNull String id) Checks if a selector with the given ID exists.static voidupdateSelectorColor(@NotNull String id, @NotNull net.kyori.adventure.text.format.NamedTextColor newColor) Updates the glow color of an existing selector.
-
Method Details
-
killSelectorsWithTag
Removes all selector entities with a specific tag.- Parameters:
tag- The identifier tag to remove selectors for
-
killAllSelectors
public static void killAllSelectors()Removes all region selector entities across all worlds. -
removeTempTeams
public static void removeTempTeams()Removes all temporary scoreboard teams created for region selectors. -
drawSelector
public static void drawSelector(@NotNull @NotNull Region region, @NotNull @NotNull String id, @Nullable @Nullable net.kyori.adventure.text.format.NamedTextColor glowColor) Draws a visual selector for the specified region using glowing slime entities.- Parameters:
region- The region to visualizeid- Unique identifier for this selectorglowColor- The color for the glowing effect (null for white)- Throws:
IllegalStateException- if the region is not fully set
-
drawSelector
-
updateSelectorColor
public static void updateSelectorColor(@NotNull @NotNull String id, @NotNull @NotNull net.kyori.adventure.text.format.NamedTextColor newColor) Updates the glow color of an existing selector.- Parameters:
id- The selector identifiernewColor- The new glow color
-
countSelectors
Counts the number of selector entities with a specific tag.- Parameters:
id- The selector identifier- Returns:
- The number of selector entities found
-
selectorExists
Checks if a selector with the given ID exists.- Parameters:
id- The selector identifier- Returns:
- true if at least one selector entity exists
-
getSelectorEntities
-
resetTeamCounter
public static void resetTeamCounter()Resets the team counter. Useful for testing or when cleaning up all selectors. -
getTeamCounter
public static int getTeamCounter()Gets the current team counter value.- Returns:
- The current team counter
-