Package me.hsgamer.minigamecore.base
Class Arena
java.lang.Object
me.hsgamer.minigamecore.base.FeatureUnit
me.hsgamer.minigamecore.base.Arena
- All Implemented Interfaces:
Runnable
,Initializer
- Direct Known Subclasses:
BukkitArena
,StandaloneArena
The arena. The unit that handles the game
-
Constructor Summary
ConstructorDescriptionArena
(List<FeatureUnit> parentList) Create a new arenaArena
(FeatureUnit... parent) Create a new arena -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
callStateChanged
(GameState oldStage, GameState newStage) This is called when the state is changed.final void
clear()
Clear the objectprotected void
Clear 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 void
init()
Init the objectprotected void
Initialize the arenaboolean
isValid()
Check if the arena is valid.Load the featuresLoad the game statesfinal void
postInit()
Called on special event when all the objects are initializedprotected void
Post-initialize the arenafinal void
run()
void
setNextState
(Class<? extends GameState> stateClass) Set the next game state of the arena.Methods inherited from class me.hsgamer.minigamecore.base.FeatureUnit
getFeature, getFeatures, getGameState, getGameStates, getParent, getParentList
-
Constructor Details
-
Arena
Create a new arena- Parameters:
parentList
- the parentFeatureUnit
list
-
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
This is called when the state is changed. This is usually used to do actions on state changed. If you did change the state withsetNextState(Class)
, set the return value to false.- Parameters:
oldStage
- the old statenewStage
- 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
Description copied from class:FeatureUnit
Load the game states- Specified by:
loadGameStates
in classFeatureUnit
- Returns:
- the game states
-
loadFeatures
Description copied from class:FeatureUnit
Load the features- Specified by:
loadFeatures
in classFeatureUnit
- Returns:
- the features
-
init
public final void init()Description copied from interface:Initializer
Init the object- Specified by:
init
in interfaceInitializer
- Overrides:
init
in classFeatureUnit
-
postInit
public final void postInit()Description copied from interface:Initializer
Called on special event when all the objects are initialized- Specified by:
postInit
in interfaceInitializer
- Overrides:
postInit
in classFeatureUnit
-
clear
public final void clear()Description copied from interface:Initializer
Clear the object- Specified by:
clear
in interfaceInitializer
- Overrides:
clear
in 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
-