public class ServerConfig extends Object implements DynamicallyTypedMap<ServerConfig.Key>
Modifier and Type | Class and Description |
---|---|
static class |
ServerConfig.Key
An enum containing configuration keys used by the server.
|
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_PORT |
Constructor and Description |
---|
ServerConfig(File directory,
File configFile,
Map<ServerConfig.Key,Object> parameters)
Initialize a new ServerConfig and associated settings.
|
Modifier and Type | Method and Description |
---|---|
boolean |
getBoolean(ServerConfig.Key key)
Retrieves an entry as a
boolean . |
org.bukkit.configuration.file.YamlConfiguration |
getConfig() |
org.bukkit.configuration.ConfigurationSection |
getConfigFile(ServerConfig.Key key)
Returns the file that contains a given setting.
|
File |
getDirectory()
The directory configurations are stored in.
|
File |
getFile(@NonNls String filename) |
int |
getInt(ServerConfig.Key key)
Retrieves an entry as an
int . |
List<Map<?,?>> |
getMapList(ServerConfig.Key key)
Retrieves a section as a list of maps.
|
String |
getString(ServerConfig.Key key)
Retrieves an entry as a
String . |
org.bukkit.configuration.ConfigurationSection |
getWorlds() |
void |
load()
Loads the server config from disk.
|
void |
save()
Save the configuration back to file.
|
void |
set(ServerConfig.Key key,
Object value)
Change a configuration value at runtime.
|
public static final int DEFAULT_PORT
public ServerConfig(File directory, File configFile, Map<ServerConfig.Key,Object> parameters)
directory
- The config directory, or null for default.configFile
- The config file, or null for default.parameters
- The command-line parameters used as overrides.public void save()
public void set(ServerConfig.Key key, Object value)
key
- the config key to write the value tovalue
- value to write to config keysave()
public String getString(ServerConfig.Key key)
DynamicallyTypedMap
String
.getString
in interface DynamicallyTypedMap<ServerConfig.Key>
key
- the key to look uppublic int getInt(ServerConfig.Key key)
DynamicallyTypedMap
int
.getInt
in interface DynamicallyTypedMap<ServerConfig.Key>
key
- the key to look uppublic boolean getBoolean(ServerConfig.Key key)
DynamicallyTypedMap
boolean
.getBoolean
in interface DynamicallyTypedMap<ServerConfig.Key>
key
- the key to look uppublic List<Map<?,?>> getMapList(ServerConfig.Key key)
key
- the key to look uppublic org.bukkit.configuration.ConfigurationSection getConfigFile(ServerConfig.Key key)
key
- the configuration settingpublic org.bukkit.configuration.ConfigurationSection getWorlds()
public void load()
public org.bukkit.configuration.file.YamlConfiguration getConfig()
public File getDirectory()
Copyright © 2021. All rights reserved.