Class SharedVitalsService

java.lang.Object
dev.deepcore.challenge.vitals.SharedVitalsService

public final class SharedVitalsService extends Object
Synchronizes team health and hunger state for shared-vitals challenge mode.
  • Constructor Details

    • SharedVitalsService

      public SharedVitalsService(org.bukkit.plugin.java.JavaPlugin plugin, Supplier<List<org.bukkit.entity.Player>> playersForSharedVitals)
      Creates a shared-vitals synchronizer.
      Parameters:
      plugin - plugin instance used for scheduler tasks
      playersForSharedVitals - supplier providing current shared-vitals participants
  • Method Details

    • isSyncingHealth

      public boolean isSyncingHealth()
      Returns whether a health sync task is currently applying state.
      Returns:
      true while health synchronization is in progress
    • isSyncingHunger

      public boolean isSyncingHunger()
      Returns whether a hunger sync task is currently applying state.
      Returns:
      true while hunger synchronization is in progress
    • resetSyncFlags

      public void resetSyncFlags()
      Resets internal sync guard flags.
    • syncHealthAcrossParticipants

      public void syncHealthAcrossParticipants(double targetHealth)
      Syncs team health to a target value without damage effects.
      Parameters:
      targetHealth - target health value to apply to non-spectator participants
    • syncHealthAcrossParticipants

      public void syncHealthAcrossParticipants(double targetHealth, UUID damageSourceId, boolean applyHurtEffect)
      Syncs team health to a target value with optional hurt feedback.
      Parameters:
      targetHealth - target health value to apply to non-spectator participants
      damageSourceId - source player UUID for optional hurt feedback filtering
      applyHurtEffect - true to play hurt effects for affected non-source participants
    • syncSharedHealthFromFirstParticipant

      public void syncSharedHealthFromFirstParticipant()
      Copies health from the first active participant to the entire team.
    • syncHungerAcrossParticipants

      public void syncHungerAcrossParticipants(int targetFoodLevel, float targetSaturation)
      Syncs team hunger and saturation to the supplied target values.
      Parameters:
      targetFoodLevel - target food level to apply
      targetSaturation - target saturation value to apply
    • syncSharedHungerFromMostFilledParticipant

      public void syncSharedHungerFromMostFilledParticipant()
      Syncs team hunger from the most-filled active participant.
    • syncHungerFromFoodLevelChange

      public void syncHungerFromFoodLevelChange(org.bukkit.entity.Player source, int eventFoodLevel)
      Derives shared hunger targets from a food-level event and applies sync.
      Parameters:
      source - player whose food-level change triggered this sync
      eventFoodLevel - proposed food level from the event