Klasse ConfigManager
java.lang.Object
de.delinkedde.mobarenareborn.config.ConfigManager
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
KonstruktorenKonstruktorBeschreibungConfigManager(@NotNull MobArenaPlugin plugin) Creates a configuration manager bound to the given plugin. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungbooleanReturns a boolean value, falling back to the supplied default when the path is absent.intReturns an integer value, falling back to the supplied default when the path is absent.voidload()Writes the bundled default configuration if absent and loads it into memory.@NotNull FileConfigurationraw()Returns the backing configuration.doubleReturns a floating-point value, falling back to the supplied default when the path is absent.voidreload()Re-readsconfig.ymlfrom disk, discarding the in-memory copy.@NotNull StringReturns 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.
-
Konstruktordetails
-
ConfigManager
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-readsconfig.ymlfrom disk, discarding the in-memory copy. -
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
defaultValueif not present
-
integer
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
defaultValueif not present
-
real
Returns a floating-point value, falling back to the supplied default when the path is absent.- Parameter:
path- the configuration pathdefaultValue- the value returned when the path is missing- Gibt zurück:
- the configured value, or
defaultValueif not present
-
bool
Returns a boolean value, falling back to the supplied default when the path is absent.- Parameter:
path- the configuration pathdefaultValue- the value returned when the path is missing- Gibt zurück:
- the configured value, or
defaultValueif not present
-
stringList
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
-