Package dev.deepcore.challenge.session
Class PrepAreaService
java.lang.Object
dev.deepcore.challenge.session.PrepAreaService
Manages prep-area border assignment and movement clamping.
-
Constructor Summary
ConstructorsConstructorDescriptionPrepAreaService(int prepAreaDiameterBlocks) Creates a prep-area service for the configured border diameter. -
Method Summary
Modifier and TypeMethodDescriptionvoidapplyBorder(org.bukkit.entity.Player player, boolean runningPhase, Predicate<org.bukkit.World> isLobbyWorld) Applies or clears the prep border for a single player.voidapplyBordersToOnlinePlayers(boolean runningPhase, Predicate<org.bukkit.World> isLobbyWorld) Applies prep borders to all online players when the run is not active.org.bukkit.LocationclampToPrepArea(org.bukkit.Location location) Clamps a location to remain within the configured prep area bounds.voidClears per-player world borders for all online players.booleanisWithinPrepArea(org.bukkit.Location location) Returns whether a location lies inside the configured prep area bounds.
-
Constructor Details
-
PrepAreaService
public PrepAreaService(int prepAreaDiameterBlocks) Creates a prep-area service for the configured border diameter.- Parameters:
prepAreaDiameterBlocks- prep border diameter in blocks
-
-
Method Details
-
applyBordersToOnlinePlayers
public void applyBordersToOnlinePlayers(boolean runningPhase, Predicate<org.bukkit.World> isLobbyWorld) Applies prep borders to all online players when the run is not active.- Parameters:
runningPhase- whether the challenge is currently in running phaseisLobbyWorld- predicate identifying lobby worlds where borders should be cleared
-
clearBorders
public void clearBorders()Clears per-player world borders for all online players. -
applyBorder
public void applyBorder(org.bukkit.entity.Player player, boolean runningPhase, Predicate<org.bukkit.World> isLobbyWorld) Applies or clears the prep border for a single player.- Parameters:
player- player whose per-player border should be updatedrunningPhase- whether the challenge is currently in running phaseisLobbyWorld- predicate identifying lobby worlds where borders should be cleared
-
isWithinPrepArea
public boolean isWithinPrepArea(org.bukkit.Location location) Returns whether a location lies inside the configured prep area bounds.- Parameters:
location- location to test- Returns:
- true when location is inside prep bounds
-
clampToPrepArea
public org.bukkit.Location clampToPrepArea(org.bukkit.Location location) Clamps a location to remain within the configured prep area bounds.- Parameters:
location- location to clamp- Returns:
- clamped location guaranteed to stay within prep bounds
-