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
Nested ClassesModifier and TypeClassDescriptionstatic enumAn enum containing configuration keys used by the server. -
Constructor Summary
ConstructorsConstructorDescriptionWorldConfig(File directory, File configFile) Initialize a new ServerConfig and associated settings. -
Method Summary
Modifier and TypeMethodDescriptionbooleanRetrieves an entry as aboolean.org.bukkit.configuration.file.YamlConfigurationThe actual configuration data.The directory configurations are stored in.doublegetDouble(WorldConfig.Key key) Retrieves an entry as adouble.floatgetFloat(WorldConfig.Key key) Retrieves an entry as afloat.intgetInt(WorldConfig.Key key) Retrieves an entry as anint.getString(WorldConfig.Key key) Retrieves an entry as aString.voidload()Loads the configuration from disk if it exists.voidsave()Save the configuration back to file.voidset(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:DynamicallyTypedMapRetrieves an entry as aString.- Specified by:
getStringin interfaceDynamicallyTypedMap<WorldConfig.Key>- Parameters:
key- the key to look up- Returns:
- the value as a String
-
getInt
Description copied from interface:DynamicallyTypedMapRetrieves an entry as anint.- Specified by:
getIntin interfaceDynamicallyTypedMap<WorldConfig.Key>- Parameters:
key- the key to look up- Returns:
- the value as an int
-
getDouble
Description copied from interface:DynamicallyTypedMapWithDoublesRetrieves an entry as adouble.- Specified by:
getDoublein interfaceDynamicallyTypedMapWithDoubles<WorldConfig.Key>- Parameters:
key- the key to look up- Returns:
- the value as a
double
-
getFloat
Description copied from interface:DynamicallyTypedMapWithFloatsRetrieves an entry as afloat.- Specified by:
getFloatin interfaceDynamicallyTypedMapWithFloats<WorldConfig.Key>- Parameters:
key- the key to look up- Returns:
- the value as a
float
-
getBoolean
Description copied from interface:DynamicallyTypedMapRetrieves an entry as aboolean.- Specified by:
getBooleanin 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.
-