Class Arena
java.lang.Object
io.github.projectunified.minigamecore.base.FeatureUnit
io.github.projectunified.minigamecore.base.Arena
- All Implemented Interfaces:
Initializer,Runnable
- Direct Known Subclasses:
BukkitArena,StandaloneArena
The arena. The unit that handles the game
-
Constructor Summary
ConstructorsConstructorDescriptionArena(FeatureUnit... parent) Create a new arenaArena(List<FeatureUnit> parentList) Create a new arena -
Method Summary
Modifier and TypeMethodDescriptionprotected booleancallStateChanged(GameState oldStage, GameState newStage) Called when the arena's state is about to change.final voidclear()Clear the objectprotected voidClear the arenaGet the game state of the arenaGet the instance of the current game state of the arenaGet the next game state of the arenaGet the instance of the next game state of the arenafinal voidinit()Init the objectprotected voidInitialize the arenabooleanisValid()Check if the arena is valid.Load the featuresLoad the game statesfinal voidpostInit()Called on special event when all the objects are initializedprotected voidPost-initialize the arenafinal voidrun()voidsetNextState(Class<? extends GameState> stateClass) Set the next game state of the arena.Methods inherited from class io.github.projectunified.minigamecore.base.FeatureUnit
getFeature, getFeatures, getGameState, getGameStates, getParent, getParentList
-
Constructor Details
-
Arena
Create a new arena- Parameters:
parentList- the parentFeatureUnitlist
-
Arena
Create a new arena- Parameters:
parent- the parentFeatureUnit
-
-
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
Called when the arena's state is about to change. This is usually used to perform actions or validations on state transitions. Return false to cancel the state change (e.g., if you manually set a new state viasetNextState(Class)).- Parameters:
oldStage- the old state (may be null)newStage- the new state (may be null)- Returns:
- true if the change should proceed, false to cancel it
-
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
Description copied from class:FeatureUnitLoad the game states- Specified by:
loadGameStatesin classFeatureUnit- Returns:
- the game states
-
loadFeatures
Description copied from class:FeatureUnitLoad the features- Specified by:
loadFeaturesin classFeatureUnit- Returns:
- the features
-
init
public final void init()Description copied from interface:InitializerInit the object- Specified by:
initin interfaceInitializer- Overrides:
initin classFeatureUnit
-
postInit
public final void postInit()Description copied from interface:InitializerCalled on special event when all the objects are initialized- Specified by:
postInitin interfaceInitializer- Overrides:
postInitin classFeatureUnit
-
clear
public final void clear()Description copied from interface:InitializerClear the object- Specified by:
clearin interfaceInitializer- Overrides:
clearin classFeatureUnit
-
run
public final void run() -
getCurrentState
Get the game state of the arena- Returns:
- the class of the game state
-
getCurrentStateInstance
Get the instance of the current game state of the arena- Returns:
- the instance of the game state
-
getNextState
Get the next game state of the arena- Returns:
- the class of the game state
-
setNextState
Set the next game state of the arena.- Parameters:
stateClass- the class of the game state
-
getNextStateInstance
Get the instance of the next game state of the arena- Returns:
- the instance of the game state
-