Class YamlConfig
java.lang.Object
org.bukkit.configuration.MemorySection
org.bukkit.configuration.MemoryConfiguration
org.bukkit.configuration.file.FileConfiguration
org.bukkit.configuration.file.YamlConfiguration
com.thewinterframework.paper.yaml.YamlConfig
- All Implemented Interfaces:
org.bukkit.configuration.Configuration,org.bukkit.configuration.ConfigurationSection
public final class YamlConfig
extends org.bukkit.configuration.file.YamlConfiguration
A
YamlConfiguration attached to a file, which may or
may not reflect a default (in-jar) configuration. (resources)-
Field Summary
Fields inherited from class org.bukkit.configuration.file.YamlConfiguration
BLANK_CONFIG, COMMENT_PREFIXFields inherited from class org.bukkit.configuration.MemoryConfiguration
defaults, optionsFields inherited from class org.bukkit.configuration.MemorySection
map -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull YamlConfigconfiguration(@NotNull org.bukkit.plugin.Plugin plugin, @NotNull String configurationFileName) Creates a newYamlConfigrepresenting the given configuration.static @NotNull YamlConfigCreates a newYamlConfigattached to the given path, note that this method will not load the configuration from the file.voidload()Loads/reloads the configuration from the file to memory.voidsave()Saves the configuration from memory to the file.Methods inherited from class org.bukkit.configuration.file.YamlConfiguration
loadConfiguration, loadConfiguration, loadFromString, options, saveToStringMethods inherited from class org.bukkit.configuration.file.FileConfiguration
buildHeader, load, load, load, save, saveMethods inherited from class org.bukkit.configuration.MemoryConfiguration
addDefault, addDefaults, addDefaults, getDefaults, getParent, setDefaultsMethods inherited from class org.bukkit.configuration.MemorySection
contains, contains, createPath, createPath, createSection, createSection, get, get, getBoolean, getBoolean, getBooleanList, getByteList, getCharacterList, getColor, getColor, getComments, getConfigurationSection, getCurrentPath, getDefault, getDefaultSection, getDouble, getDouble, getDoubleList, getFloatList, getInlineComments, getInt, getInt, getIntegerList, getItemStack, getItemStack, getKeys, getList, getList, getLocation, getLocation, getLong, getLong, getLongList, getMapList, getName, getObject, getObject, getOfflinePlayer, getOfflinePlayer, getRoot, getSerializable, getSerializable, getShortList, getString, getString, getStringList, getValues, getVector, getVector, isBoolean, isColor, isConfigurationSection, isDouble, isInt, isItemStack, isList, isLocation, isLong, isOfflinePlayer, isPrimitiveWrapper, isSet, isString, isVector, mapChildrenKeys, mapChildrenValues, set, setComments, setInlineComments, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.bukkit.configuration.ConfigurationSection
contains, contains, createSection, createSection, get, get, getBoolean, getBoolean, getBooleanList, getByteList, getCharacterList, getColor, getColor, getComments, getComponent, getComponent, getConfigurationSection, getCurrentPath, getDefaultSection, getDouble, getDouble, getDoubleList, getFloatList, getInlineComments, getInt, getInt, getIntegerList, getItemStack, getItemStack, getKeys, getList, getList, getLocation, getLocation, getLong, getLong, getLongList, getMapList, getName, getObject, getObject, getOfflinePlayer, getOfflinePlayer, getRichMessage, getRichMessage, getRoot, getSerializable, getSerializable, getShortList, getString, getString, getStringList, getValues, getVector, getVector, isBoolean, isColor, isConfigurationSection, isDouble, isInt, isItemStack, isList, isLocation, isLong, isOfflinePlayer, isSet, isString, isVector, set, setComments, setComponent, setInlineComments, setRichMessage
-
Method Details
-
load
public void load()Loads/reloads the configuration from the file to memory.If the file doesn't exist AND this configuration reflects a default one (from resources), the default one will copy and loaded.
All the values contained within this configuration will be removed, leaving only settings and defaults, and the new values will be loaded from the given string.
- Throws:
IllegalStateException- If the configuration is invalid or an I/O exception occurs.
-
save
public void save()Saves the configuration from memory to the file.Note that this method will try to create parent folders if they don't exist.
- Throws:
IllegalStateException- If you couldn't create a file or an I/O exception occurs.
-
create
Creates a newYamlConfigattached to the given path, note that this method will not load the configuration from the file.- Parameters:
path- the path- Returns:
- the new configuration
- Throws:
NullPointerException- If a path is null
-
configuration
@NotNull public static @NotNull YamlConfig configuration(@NotNull @NotNull org.bukkit.plugin.Plugin plugin, @NotNull @NotNull String configurationFileName) Creates a newYamlConfigrepresenting the given configuration. Note that this method will perform an initial configuration load from the file (or from the resource if the file doesn't exist).The file will be created if it doesn't exist.
The file will be at the plugin data folder, with the given name.
The default configuration must be a plugin resource, with the same name.
- Parameters:
plugin- The owner pluginconfigurationFileName- The configuration file name- Returns:
- The new configuration
-