Class ArenaManager

java.lang.Object
me.hsgamer.minigamecore.base.FeatureUnit
me.hsgamer.minigamecore.manager.ArenaManager
All Implemented Interfaces:
Initializer

public abstract class ArenaManager extends FeatureUnit
The manager that handles all arenas
  • Constructor Details

    • ArenaManager

      public ArenaManager(List<FeatureUnit> parentList)
      Create a new arena manager
      Parameters:
      parentList - the parent FeatureUnit list
    • ArenaManager

      public ArenaManager(FeatureUnit... parent)
      Create a new arena manager
      Parameters:
      parent - the parent FeatureUnit
  • Method Details

    • postInit

      public void postInit()
      Specified by:
      postInit in interface Initializer
      Overrides:
      postInit in class FeatureUnit
    • clear

      public void clear()
      Specified by:
      clear in interface Initializer
      Overrides:
      clear in class FeatureUnit
    • getArenaByName

      public Optional<Arena> getArenaByName(String name)
      Get the arena by its name
      Parameters:
      name - the name of the arena
      Returns:
      the arena
    • getAllArenas

      public List<Arena> getAllArenas()
      Get all arenas
      Returns:
      the list of arenas
    • addArena

      public boolean addArena(Arena arena)
      Add an arena
      Parameters:
      arena - the arena
    • removeArena

      public void removeArena(Arena arena)
      Remove an arena
      Parameters:
      arena - the arena
    • removeArena

      public void removeArena(String name)
      Remove an arena
      Parameters:
      name - the name of the arena
    • clearAllArenas

      public void clearAllArenas()
      Clear all arenas
    • createArena

      public <T extends Arena> Optional<T> createArena(String name, Class<T> arenaClass, Consumer<T> onCreateConsumer)
      Create an arena
      Type Parameters:
      T - the type of the arena
      Parameters:
      name - the name of the arena
      arenaClass - the class of the arena
      onCreateConsumer - the consumer that will be called when the arena is created
      Returns:
      the arena or empty if it cannot be created