Klasse ArenaManager

java.lang.Object
de.delinkedde.mobarenareborn.arena.ArenaManager

public final class ArenaManager extends Object
Owns the in-memory registry of arenas and their on-disk representation.

Arenas live in plugins/MobArenaReborn/arenas/, one YAML file per arena. The manager loads them on start-up and provides create, remove, lookup and save operations. Arena identifiers are normalised to lower case and validated against NAME_PATTERN.

  • Felddetails

    • NAME_PATTERN

      public static final Pattern NAME_PATTERN
      Permitted arena identifiers: lower-case letters, digits and underscores, 1 to 32 chars.
  • Konstruktordetails

    • ArenaManager

      public ArenaManager(@NotNull @NotNull MobArenaPlugin plugin)
      Creates an arena manager bound to the plugin's data folder.
      Parameter:
      plugin - the owning plugin instance
  • Methodendetails

    • loadAll

      public void loadAll()
      Loads (or reloads) every arena from disk, replacing the in-memory registry.
    • get

      @NotNull public @NotNull Optional<Arena> get(@NotNull @NotNull String name)
      Looks up an arena by name, ignoring case.
      Parameter:
      name - the arena identifier
      Gibt zurück:
      the arena, if present
    • all

      @NotNull public @NotNull Collection<Arena> all()
      Gibt zurück:
      an unmodifiable view of all loaded arenas
    • arenaAt

      @NotNull public @NotNull Optional<Arena> arenaAt(@NotNull @NotNull Location location)
      Finds the arena whose region contains the given location.
      Parameter:
      location - the location to test
      Gibt zurück:
      the containing arena, if any
    • names

      @NotNull public @NotNull Set<String> names()
      Gibt zurück:
      an unmodifiable view of all arena identifiers
    • create

      @NotNull public @NotNull Arena create(@NotNull @NotNull String name) throws IOException
      Creates a new, empty, disabled arena and persists it.
      Parameter:
      name - the desired identifier
      Gibt zurück:
      the created arena
      Löst aus:
      IllegalArgumentException - if the name is invalid or already in use
      IOException - if the arena file cannot be written
    • remove

      public boolean remove(@NotNull @NotNull String name) throws IOException
      Removes an arena and deletes its file.
      Parameter:
      name - the arena identifier
      Gibt zurück:
      true if an arena was removed
      Löst aus:
      IOException - if the arena file exists but cannot be deleted
    • save

      public void save(@NotNull @NotNull Arena arena) throws IOException
      Persists the current state of an arena to disk.
      Parameter:
      arena - the arena to save
      Löst aus:
      IOException - if the arena file cannot be written