Class ArenaManager<T,A extends io.github.projectunified.minigamecore.base.Arena & ManagedArena<T>>
java.lang.Object
io.github.projectunified.minigamecore.base.FeatureUnit
io.github.projectunified.minigamecore.manager.ArenaManager<T,A>
- Type Parameters:
T- the type of the identifier of the arenaA- the type of the arena
- All Implemented Interfaces:
io.github.projectunified.minigamecore.base.Initializer
public abstract class ArenaManager<T,A extends io.github.projectunified.minigamecore.base.Arena & ManagedArena<T>>
extends io.github.projectunified.minigamecore.base.FeatureUnit
The manager that handles all arenas
-
Constructor Summary
ConstructorsConstructorDescriptionArenaManager(io.github.projectunified.minigamecore.base.FeatureUnit... parent) Create a new arena managerArenaManager(List<io.github.projectunified.minigamecore.base.FeatureUnit> parentList) Create a new arena manager -
Method Summary
Modifier and TypeMethodDescriptionbooleanAdd an arenavoidclear()voidClear all arenasbooleancontainsArena(T identifier) Check if the arena manager contains the arenaCreate an arenaGet all arenasGet the arena by its identifierGet the arena mapvoidpostInit()voidremoveArena(T identifier) Remove an arenaMethods inherited from class io.github.projectunified.minigamecore.base.FeatureUnit
getFeature, getFeatures, getGameState, getGameStates, getParent, getParentList, init, loadFeatures, loadGameStates
-
Constructor Details
-
ArenaManager
Create a new arena manager- Parameters:
parentList- the parentFeatureUnitlist
-
ArenaManager
public ArenaManager(io.github.projectunified.minigamecore.base.FeatureUnit... parent) Create a new arena manager- Parameters:
parent- the parentFeatureUnit
-
-
Method Details
-
postInit
public void postInit()- Specified by:
postInitin interfaceio.github.projectunified.minigamecore.base.Initializer- Overrides:
postInitin classio.github.projectunified.minigamecore.base.FeatureUnit
-
clear
public void clear()- Specified by:
clearin interfaceio.github.projectunified.minigamecore.base.Initializer- Overrides:
clearin classio.github.projectunified.minigamecore.base.FeatureUnit
-
containsArena
Check if the arena manager contains the arena- Parameters:
identifier- the identifier- Returns:
- true if it does
-
getArena
Get the arena by its identifier- Parameters:
identifier- the identifier- Returns:
- the arena
-
getArenaMap
Get the arena map- Returns:
- the arena map
-
getAllArenas
Get all arenas- Returns:
- the collection of arenas
-
addArena
Add an arena- Parameters:
arena- the arena
-
removeArena
Remove an arena- Parameters:
identifier- the identifier
-
clearAllArenas
public void clearAllArenas()Clear all arenas -
createArena
public Optional<A> createArena(T identifier, Function<T, A> arenaCreator, Consumer<A> onCreateConsumer) Create an arena- Parameters:
identifier- the identifierarenaCreator- the arena creatoronCreateConsumer- the consumer that will be called when the arena is created- Returns:
- the created arena
-