Package dev.deepcore.challenge.session
Class RunHealthCoordinatorService
java.lang.Object
dev.deepcore.challenge.session.RunHealthCoordinatorService
Coordinates shared-vitals event handling and initial-half-heart health state.
-
Constructor Summary
ConstructorsConstructorDescriptionRunHealthCoordinatorService(ChallengeManager challengeManager, Supplier<SharedVitalsService> sharedVitalsServiceSupplier, Supplier<List<org.bukkit.entity.Player>> onlineParticipantsSupplier, Predicate<org.bukkit.entity.Player> isChallengeActive, BooleanSupplier degradingInventoryEnabled, Consumer<org.bukkit.entity.Player> clearLockedBarrierSlots, double halfHeartHealth, double defaultMaxHealth) Creates a run-health coordination service for shared vitals and half-heart rules. -
Method Summary
Modifier and TypeMethodDescriptionvoidapplyInitialHalfHeart(org.bukkit.entity.Player player) Applies initial half-heart max-health and health values to a player.voidApplies initial half-heart rules to all online participants when enabled.voidApplies shared health and hunger baselines when shared vitals are enabled.voidhandleEntityDamage(org.bukkit.event.entity.EntityDamageEvent event) Handles damage events and broadcasts resulting shared-health updates.voidhandleEntityRegainHealth(org.bukkit.event.entity.EntityRegainHealthEvent event) Handles health regain events and applies configured shared-health policies.voidhandleFoodLevelChange(org.bukkit.event.entity.FoodLevelChangeEvent event) Handles hunger changes and synchronizes food state across participants.voidrestoreDefaultMaxHealth(org.bukkit.entity.Player player) Restores the player's original max health after half-heart mode ends.voidSynchronizes shared health from the first active participant snapshot.voidSynchronizes shared hunger from the participant with the highest food level.
-
Constructor Details
-
RunHealthCoordinatorService
public RunHealthCoordinatorService(ChallengeManager challengeManager, Supplier<SharedVitalsService> sharedVitalsServiceSupplier, Supplier<List<org.bukkit.entity.Player>> onlineParticipantsSupplier, Predicate<org.bukkit.entity.Player> isChallengeActive, BooleanSupplier degradingInventoryEnabled, Consumer<org.bukkit.entity.Player> clearLockedBarrierSlots, double halfHeartHealth, double defaultMaxHealth) Creates a run-health coordination service for shared vitals and half-heart rules.- Parameters:
challengeManager- challenge settings and component managersharedVitalsServiceSupplier- supplier for shared vitals serviceonlineParticipantsSupplier- supplier for currently online participantsisChallengeActive- predicate testing participant challenge activitydegradingInventoryEnabled- supplier indicating degrading mode stateclearLockedBarrierSlots- consumer clearing locked barrier slotshalfHeartHealth- configured half-heart health valuedefaultMaxHealth- default max-health base value
-
-
Method Details
-
handleEntityRegainHealth
public void handleEntityRegainHealth(org.bukkit.event.entity.EntityRegainHealthEvent event) Handles health regain events and applies configured shared-health policies.- Parameters:
event- health regain event to process
-
handleEntityDamage
public void handleEntityDamage(org.bukkit.event.entity.EntityDamageEvent event) Handles damage events and broadcasts resulting shared-health updates.- Parameters:
event- damage event to process
-
handleFoodLevelChange
public void handleFoodLevelChange(org.bukkit.event.entity.FoodLevelChangeEvent event) Handles hunger changes and synchronizes food state across participants.- Parameters:
event- food level change event to process
-
applyInitialHalfHeartIfEnabled
public void applyInitialHalfHeartIfEnabled()Applies initial half-heart rules to all online participants when enabled. -
applyInitialHalfHeart
public void applyInitialHalfHeart(org.bukkit.entity.Player player) Applies initial half-heart max-health and health values to a player.- Parameters:
player- participant to apply half-heart values to
-
restoreDefaultMaxHealth
public void restoreDefaultMaxHealth(org.bukkit.entity.Player player) Restores the player's original max health after half-heart mode ends.- Parameters:
player- participant whose max health should be restored
-