Package net.glowstone.util.config
Class WorldConfig
java.lang.Object
net.glowstone.util.config.WorldConfig
- All Implemented Interfaces:
DynamicallyTypedMap<WorldConfig.Key>
,DynamicallyTypedMapWithDoubles<WorldConfig.Key>
,DynamicallyTypedMapWithFloats<WorldConfig.Key>
public final class WorldConfig
extends Object
implements DynamicallyTypedMapWithDoubles<WorldConfig.Key>
Utilities for handling the server configuration files.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
An enum containing configuration keys used by the server. -
Constructor Summary
ConstructorDescriptionWorldConfig
(File directory, File configFile) Initialize a new ServerConfig and associated settings. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Retrieves an entry as aboolean
.org.bukkit.configuration.file.YamlConfiguration
The actual configuration data.The directory configurations are stored in.double
getDouble
(WorldConfig.Key key) Retrieves an entry as adouble
.float
getFloat
(WorldConfig.Key key) Retrieves an entry as afloat
.int
getInt
(WorldConfig.Key key) Retrieves an entry as anint
.getString
(WorldConfig.Key key) Retrieves an entry as aString
.void
load()
Loads the configuration from disk if it exists.void
save()
Save the configuration back to file.void
set
(WorldConfig.Key key, Object value) Change a configuration value at runtime.
-
Constructor Details
-
WorldConfig
Initialize a new ServerConfig and associated settings.- Parameters:
directory
- The config directory, or null for default.configFile
- The config file, or null for default.
-
-
Method Details
-
save
public void save()Save the configuration back to file. -
set
Change a configuration value at runtime.- Parameters:
key
- the config key to write the value tovalue
- value to write to config key- See Also:
-
getString
Description copied from interface:DynamicallyTypedMap
Retrieves an entry as aString
.- Specified by:
getString
in interfaceDynamicallyTypedMap<WorldConfig.Key>
- Parameters:
key
- the key to look up- Returns:
- the value as a String
-
getInt
Description copied from interface:DynamicallyTypedMap
Retrieves an entry as anint
.- Specified by:
getInt
in interfaceDynamicallyTypedMap<WorldConfig.Key>
- Parameters:
key
- the key to look up- Returns:
- the value as an int
-
getDouble
Description copied from interface:DynamicallyTypedMapWithDoubles
Retrieves an entry as adouble
.- Specified by:
getDouble
in interfaceDynamicallyTypedMapWithDoubles<WorldConfig.Key>
- Parameters:
key
- the key to look up- Returns:
- the value as a
double
-
getFloat
Description copied from interface:DynamicallyTypedMapWithFloats
Retrieves an entry as afloat
.- Specified by:
getFloat
in interfaceDynamicallyTypedMapWithFloats<WorldConfig.Key>
- Parameters:
key
- the key to look up- Returns:
- the value as a
float
-
getBoolean
Description copied from interface:DynamicallyTypedMap
Retrieves an entry as aboolean
.- Specified by:
getBoolean
in interfaceDynamicallyTypedMap<WorldConfig.Key>
- Parameters:
key
- the key to look up- Returns:
- the value as a boolean
-
load
public void load()Loads the configuration from disk if it exists. Creates it if it doesn't exist, creating the folder if necessary. Completes and saves the configuration if it's incomplete. -
getDirectory
The directory configurations are stored in. -
getConfig
public org.bukkit.configuration.file.YamlConfiguration getConfig()The actual configuration data.
-