Klasse ConfigManager

java.lang.Object
de.delinkedde.mobarenareborn.config.ConfigManager

public final class ConfigManager extends Object
Loads and provides access to the plugin's config.yml.

The manager is a thin wrapper around the Bukkit FileConfiguration. It writes the bundled defaults on first start, keeps the in-memory configuration in sync on reload, and exposes typed accessors. Higher-level rendering (turning message strings into chat components) is the responsibility of Messages.

  • Konstruktorübersicht

    Konstruktoren
    Konstruktor
    Beschreibung
    ConfigManager(@NotNull MobArenaPlugin plugin)
    Creates a configuration manager bound to the given plugin.
  • Methodenübersicht

    Modifizierer und Typ
    Methode
    Beschreibung
    boolean
    bool(@NotNull String path, boolean defaultValue)
    Returns a boolean value, falling back to the supplied default when the path is absent.
    int
    integer(@NotNull String path, int defaultValue)
    Returns an integer value, falling back to the supplied default when the path is absent.
    void
    Writes the bundled default configuration if absent and loads it into memory.
    raw()
    Returns the backing configuration.
    double
    real(@NotNull String path, double defaultValue)
    Returns a floating-point value, falling back to the supplied default when the path is absent.
    void
    Re-reads config.yml from disk, discarding the in-memory copy.
    @NotNull String
    string(@NotNull String path, @NotNull String defaultValue)
    Returns a string value, falling back to the supplied default when the path is absent.
    stringList(@NotNull String path)
    Returns a list of strings, or an empty list when the path is absent.

    Von Klasse geerbte Methoden java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Konstruktordetails

    • ConfigManager

      public ConfigManager(@NotNull @NotNull MobArenaPlugin plugin)
      Creates a configuration manager bound to the given plugin.
      Parameter:
      plugin - the owning plugin instance
  • Methodendetails

    • load

      public void load()
      Writes the bundled default configuration if absent and loads it into memory.

      Call this exactly once during plugin start-up.

    • reload

      public void reload()
      Re-reads config.yml from disk, discarding the in-memory copy.
    • raw

      @NotNull public @NotNull FileConfiguration raw()
      Returns the backing configuration.
      Gibt zurück:
      the live FileConfiguration
    • string

      @NotNull public @NotNull String string(@NotNull @NotNull String path, @NotNull @NotNull String defaultValue)
      Returns a string value, falling back to the supplied default when the path is absent.
      Parameter:
      path - the configuration path, for example "messages.prefix"
      defaultValue - the value returned when the path is missing
      Gibt zurück:
      the configured value, or defaultValue if not present
    • integer

      public int integer(@NotNull @NotNull String path, int defaultValue)
      Returns an integer value, falling back to the supplied default when the path is absent.
      Parameter:
      path - the configuration path, for example "arena.min-players"
      defaultValue - the value returned when the path is missing
      Gibt zurück:
      the configured value, or defaultValue if not present
    • real

      public double real(@NotNull @NotNull String path, double defaultValue)
      Returns a floating-point value, falling back to the supplied default when the path is absent.
      Parameter:
      path - the configuration path
      defaultValue - the value returned when the path is missing
      Gibt zurück:
      the configured value, or defaultValue if not present
    • bool

      public boolean bool(@NotNull @NotNull String path, boolean defaultValue)
      Returns a boolean value, falling back to the supplied default when the path is absent.
      Parameter:
      path - the configuration path
      defaultValue - the value returned when the path is missing
      Gibt zurück:
      the configured value, or defaultValue if not present
    • stringList

      @NotNull public List<String> stringList(@NotNull @NotNull String path)
      Returns a list of strings, or an empty list when the path is absent.
      Parameter:
      path - the configuration path
      Gibt zurück:
      the configured values, never null