Package valorless.valorlessutils.file
Class YamlFile
java.lang.Object
org.bukkit.configuration.MemorySection
org.bukkit.configuration.MemoryConfiguration
org.bukkit.configuration.file.FileConfiguration
org.bukkit.configuration.file.YamlConfiguration
valorless.valorlessutils.file.FileStorage
valorless.valorlessutils.file.YamlFile
- All Implemented Interfaces:
org.bukkit.configuration.Configuration,org.bukkit.configuration.ConfigurationSection
-
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 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks if the YamlConfiguration contains a value at the specified path.Gets a value from the YamlConfiguration.<T> TGets a typed value from the YamlConfiguration.org.bukkit.configuration.file.YamlConfigurationGets the underlying YamlConfiguration.<T> TgetOrDefault(String path, T defaultValue) Gets a value from the YamlConfiguration or a default value if the path does not exist.org.bukkit.configuration.ConfigurationSectiongetSection(String path) Gets a ConfigurationSection from the YamlConfiguration.voidreload()Reloads the YamlConfiguration from the associated file.booleansave()Saves the YamlConfiguration to the associated file.voidSets a value in the YamlConfiguration.voidSets a value in the YamlConfiguration only if the path does not already exist.Methods inherited from class valorless.valorlessutils.file.FileStorage
createFile, deleteFile, fileExists, getFile, loadConfigurationMethods inherited from class org.bukkit.configuration.file.YamlConfiguration
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, createPath, createPath, createSection, createSection, 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, 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, createSection, createSection, get, getBoolean, getBoolean, getBooleanList, getByteList, getCharacterList, getColor, getColor, getComments, 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, getRoot, getSerializable, getSerializable, getShortList, getString, getString, getStringList, getValues, getVector, getVector, isBoolean, isColor, isConfigurationSection, isDouble, isInt, isItemStack, isList, isLocation, isLong, isOfflinePlayer, isSet, isString, isVector, setComments, setInlineComments
-
Constructor Details
-
YamlFile
Constructor for YamlFile class using a file path.- Parameters:
file- The file path as a string.
-
YamlFile
Constructor for YamlFile class using a File object.- Parameters:
file- The File object representing the YAML file.
-
-
Method Details
-
reload
public void reload()Reloads the YamlConfiguration from the associated file. -
set
Sets a value in the YamlConfiguration.- Specified by:
setin interfaceorg.bukkit.configuration.ConfigurationSection- Overrides:
setin classorg.bukkit.configuration.MemorySection- Parameters:
path- The path to the value.value- The value to set.
-
get
Gets a value from the YamlConfiguration.- Specified by:
getin interfaceorg.bukkit.configuration.ConfigurationSection- Overrides:
getin classorg.bukkit.configuration.MemorySection- Parameters:
path- The path to the value.- Returns:
- The value at the specified path.
-
get
Gets a typed value from the YamlConfiguration.- Type Parameters:
T- The type of the value.- Parameters:
path- The path to the value.clazz- The class of the value.- Returns:
- The typed value at the specified path.
-
contains
Checks if the YamlConfiguration contains a value at the specified path.- Specified by:
containsin interfaceorg.bukkit.configuration.ConfigurationSection- Overrides:
containsin classorg.bukkit.configuration.MemorySection- Parameters:
path- The path to check.- Returns:
- true if the path exists, false otherwise.
-
setIfNull
Sets a value in the YamlConfiguration only if the path does not already exist.- Parameters:
path- The path to the value.value- The value to set.
-
getOrDefault
Gets a value from the YamlConfiguration or a default value if the path does not exist.- Type Parameters:
T- The type of the value.- Parameters:
path- The path to the value.defaultValue- The default value to return if the path does not exist.- Returns:
- The value at the specified path or the default value if the path does not exist.
-
getSection
Gets a ConfigurationSection from the YamlConfiguration.- Parameters:
path- The path to the ConfigurationSection.- Returns:
- The ConfigurationSection at the specified path.
-
save
public boolean save()Saves the YamlConfiguration to the associated file.- Returns:
- true if the save is successful, false otherwise.
-
getConfig
public org.bukkit.configuration.file.YamlConfiguration getConfig()Gets the underlying YamlConfiguration.- Returns:
- The YamlConfiguration instance.
-