Class Arena

All Implemented Interfaces:
Runnable, Initializer
Direct Known Subclasses:
BukkitArena, StandaloneArena

public class Arena extends FeatureUnit implements Runnable
The arena. The unit that handles the game
  • Constructor Details

  • Method Details

    • initArena

      protected void initArena()
      Initialize the arena
      See Also:
    • postInitArena

      protected void postInitArena()
      Post-initialize the arena
      See Also:
    • clearArena

      protected void clearArena()
      Clear the arena
      See Also:
    • callStateChanged

      protected boolean callStateChanged(GameState oldStage, GameState newStage)
      This is called when the state is changed. This is usually used to do actions on state changed. If you did change the state with setNextState(Class), set the return value to false.
      Parameters:
      oldStage - the old state
      newStage - the new state
      Returns:
      true if the change is successful, otherwise false
    • isValid

      public boolean isValid()
      Check if the arena is valid. Mainly called when the arena is being registered to the arena manager.
      Returns:
      true if the arena is valid, otherwise false
    • loadGameStates

      protected List<GameState> loadGameStates()
      Description copied from class: FeatureUnit
      Load the game states
      Specified by:
      loadGameStates in class FeatureUnit
      Returns:
      the game states
    • loadFeatures

      protected List<Feature> loadFeatures()
      Description copied from class: FeatureUnit
      Load the features
      Specified by:
      loadFeatures in class FeatureUnit
      Returns:
      the features
    • init

      public final void init()
      Description copied from interface: Initializer
      Init the object
      Specified by:
      init in interface Initializer
      Overrides:
      init in class FeatureUnit
    • postInit

      public final void postInit()
      Description copied from interface: Initializer
      Called on special event when all the objects are initialized
      Specified by:
      postInit in interface Initializer
      Overrides:
      postInit in class FeatureUnit
    • clear

      public final void clear()
      Description copied from interface: Initializer
      Clear the object
      Specified by:
      clear in interface Initializer
      Overrides:
      clear in class FeatureUnit
    • run

      public final void run()
      Specified by:
      run in interface Runnable
    • getCurrentState

      public Class<? extends GameState> getCurrentState()
      Get the game state of the arena
      Returns:
      the class of the game state
    • getCurrentStateInstance

      public Optional<GameState> getCurrentStateInstance()
      Get the instance of the current game state of the arena
      Returns:
      the instance of the game state
    • getNextState

      public Class<? extends GameState> getNextState()
      Get the next game state of the arena
      Returns:
      the class of the game state
    • setNextState

      public void setNextState(Class<? extends GameState> stateClass)
      Set the next game state of the arena.
      Parameters:
      stateClass - the class of the game state
    • getNextStateInstance

      public Optional<GameState> getNextStateInstance()
      Get the instance of the next game state of the arena
      Returns:
      the instance of the game state