Interface GamePhase


public interface GamePhase
Represents a read-only view of a game phase configuration.

Game phases define the stages of a Battle Royale match, including timing, border behavior, and actions that occur when the phase starts.

Example Usage


 PhaseService phaseService = ZentrixProvider.get().getPhaseService();

 // Get current phase for a game
 Optional<GamePhase> phase = phaseService.getCurrentPhase(game);
 phase.ifPresent(p -> {
     String name = p.getName();
     String display = p.getDisplayName();
     int duration = p.getDuration();

     if (p.hasBorderShrinkage()) {
         double targetSize = p.getBorderTargetSize();
         player.sendMessage("Border shrinking to " + targetSize + " blocks!");
     }
 });
 
Since:
1.0.0
  • Method Details

    • getName

      @NotNull @NotNull String getName()
      Gets the internal name of this phase.

      This is the identifier used in configuration files.

      Returns:
      The phase name (never null)
    • getDisplayName

      @NotNull @NotNull String getDisplayName()
      Gets the display name of this phase.

      This is the formatted name shown to players, with color codes. Falls back to the internal name if not set.

      Returns:
      The display name (never null)
    • getDuration

      int getDuration()
      Gets the duration of this phase in seconds.
      Returns:
      Duration in seconds
    • hasBorderConfig

      boolean hasBorderConfig()
      Checks if this phase has border configuration.
      Returns:
      true if border settings are configured
    • hasBorderShrinkage

      boolean hasBorderShrinkage()
      Checks if the world border shrinks during this phase.
      Returns:
      true if border shrinkage is enabled
    • getBorderTargetSize

      double getBorderTargetSize()
      Gets the target border size after shrinkage.

      Returns 0 if no border shrinkage is configured.

      Returns:
      Target border diameter in blocks
    • getBorderShrinkDuration

      int getBorderShrinkDuration()
      Gets the duration of the border shrink animation in seconds.

      Returns 0 if no border shrinkage is configured.

      Returns:
      Shrink duration in seconds
    • getBorderDamagePerBlock

      double getBorderDamagePerBlock()
      Gets the damage per block when outside the border.

      Returns 0 if no border configuration exists.

      Returns:
      Damage per block per second
    • getWarningTime

      int getWarningTime()
      Gets the warning time before the phase ends, in seconds.

      A warning may be shown to players when this time remains. Returns 0 if no warning is configured.

      Returns:
      Warning time in seconds
    • hasWarning

      boolean hasWarning()
      Checks if this phase has a warning configured.
      Returns:
      true if a warning is configured
    • hasOnStartActions

      boolean hasOnStartActions()
      Checks if this phase has any on-start actions configured.

      Actions can include announcements, titles, sounds, effects, etc.

      Returns:
      true if actions are configured
    • getOnStartActionCount

      int getOnStartActionCount()
      Gets the number of on-start actions configured for this phase.
      Returns:
      The action count
    • getTimeRemaining

      int getTimeRemaining()
      Gets the time remaining in this phase.

      This is only meaningful when retrieved from an active game context. When retrieved from configuration, returns the full duration.

      Returns:
      Time remaining in seconds
    • getTimeElapsed

      int getTimeElapsed()
      Gets the time elapsed in this phase.

      This is only meaningful when retrieved from an active game context. When retrieved from configuration, returns 0.

      Returns:
      Time elapsed in seconds
    • getProgress

      default double getProgress()
      Gets the progress through this phase as a percentage.

      Returns a value between 0.0 (just started) and 1.0 (complete).

      Returns:
      Progress percentage (0.0 to 1.0)
    • getTogglePvP

      @NotNull @NotNull Optional<Boolean> getTogglePvP()
      Checks if this phase enables PvP.

      Some phases may toggle PvP state when they start.

      Returns:
      true if this phase enables PvP, false if it disables PvP, empty if PvP state is not changed
    • startsDeathmatch

      boolean startsDeathmatch()
      Checks if this phase starts the deathmatch.
      Returns:
      true if this phase triggers deathmatch