Package org.bukkit

Interface ServerTickManager


@Experimental public interface ServerTickManager
Manages ticking within a server.

To learn more about the features surrounding this interface.

See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Gets the amount of frozen ticks left to run.
    float
    Gets the current tick rate of the server.
    boolean
    Checks if the server is currently frozen.
    boolean
    Checks if a given entity is frozen.
    boolean
    Checks if the server is running normally.
    boolean
    Checks if the server is currently sprinting.
    boolean
    Checks if the server is currently stepping.
    boolean
    Attempts to initiate a sprint, which executes all server ticks at a faster rate then normal.
    void
    setFrozen(boolean frozen)
    Sets the server to a frozen state that does not tick most things.
    void
    setTickRate(float tick)
    Sets the tick rate of the server.
    boolean
    stepGameIfFrozen(int ticks)
    Steps the game a certain amount of ticks if the server is currently frozen.
    boolean
    Stops the current sprint if one is currently happening.
    boolean
    Stops the current stepping if stepping is occurring.
  • Method Details

    • isRunningNormally

      boolean isRunningNormally()
      Checks if the server is running normally.

      When the server is running normally it indicates that the server is not currently frozen.

      Returns:
      true if the server is running normally, otherwise false
    • isStepping

      boolean isStepping()
      Checks if the server is currently stepping.
      Returns:
      true if stepping, otherwise false
    • isSprinting

      boolean isSprinting()
      Checks if the server is currently sprinting.
      Returns:
      true if sprinting, otherwise false
    • isFrozen

      boolean isFrozen()
      Checks if the server is currently frozen.
      Returns:
      true if the server is frozen, otherwise false
    • getTickRate

      float getTickRate()
      Gets the current tick rate of the server.
      Returns:
      the current tick rate of the server
    • setTickRate

      void setTickRate(float tick)
      Sets the tick rate of the server.

      The normal tick rate of the server is 20. No tick rate below 1.0F or above 10,000 can be applied to the server.

      Parameters:
      tick - the tick rate to set the server to
      Throws:
      IllegalArgumentException - if tick rate is too low or too high for the server to handle
    • setFrozen

      void setFrozen(boolean frozen)
      Sets the server to a frozen state that does not tick most things.
      Parameters:
      frozen - true to freeze the server, otherwise false
    • stepGameIfFrozen

      boolean stepGameIfFrozen(int ticks)
      Steps the game a certain amount of ticks if the server is currently frozen.

      Steps occur when the server is in a frozen state which can be started by either using the in game /tick freeze command or the setFrozen(boolean) method.

      Parameters:
      ticks - the amount of ticks to step the game for
      Returns:
      true if the game is now stepping. False if the game is not frozen so the request could not be fulfilled.
    • stopStepping

      boolean stopStepping()
      Stops the current stepping if stepping is occurring.
      Returns:
      true if the game is no-longer stepping. False if the server was not stepping or was already done stepping.
    • requestGameToSprint

      boolean requestGameToSprint(int ticks)
      Attempts to initiate a sprint, which executes all server ticks at a faster rate then normal.
      Parameters:
      ticks - the amount of ticks to sprint for
      Returns:
      true if a sprint was already initiated and was stopped, otherwise false
    • stopSprinting

      boolean stopSprinting()
      Stops the current sprint if one is currently happening.
      Returns:
      true if the game is no-longer sprinting, false if the server was not sprinting or was already done sprinting
    • isFrozen

      boolean isFrozen(@NotNull @NotNull Entity entity)
      Checks if a given entity is frozen.
      Parameters:
      entity - the entity to check if frozen.
      Returns:
      true if the entity is currently frozen otherwise false.
    • getFrozenTicksToRun

      int getFrozenTicksToRun()
      Gets the amount of frozen ticks left to run.
      Returns:
      the amount of frozen ticks left to run