Package at.hugob.plugin.library.config
Class YamlFileConfig
java.lang.Object
org.bukkit.configuration.MemorySection
org.bukkit.configuration.MemoryConfiguration
org.bukkit.configuration.file.FileConfiguration
org.bukkit.configuration.file.YamlConfiguration
at.hugob.plugin.library.config.YamlFileConfig
- All Implemented Interfaces:
org.bukkit.configuration.Configuration,org.bukkit.configuration.ConfigurationSection
public class YamlFileConfig
extends org.bukkit.configuration.file.YamlConfiguration
An extension for Bukkits YamlConfiguration
-
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
ConstructorsConstructorDescriptionYamlFileConfig(org.bukkit.plugin.java.JavaPlugin plugin, String filePath) Creates a YamlFileConfiguration at the specified path inside the plugins folderYamlFileConfig(org.bukkit.plugin.java.JavaPlugin plugin, String filePath, @Nullable Supplier<InputStream> inputStream) Creates a YamlFileConfiguration at the specified path inside the plugins folder with a specific input stream for where the default file comes from -
Method Summary
Modifier and TypeMethodDescriptionnet.kyori.adventure.text.ComponentgetComponent(@NotNull String path) Gets a Legacy/MiniMessage Hybrid Component at a specific path and also substitutes all placeholders that have values in the config filenet.kyori.adventure.text.ComponentgetComponent(@NotNull String path, @Nullable net.kyori.adventure.text.minimessage.tag.resolver.TagResolver tagResolver) Gets a Legacy/MiniMessage Hybrid Component at a specific path and also substitutes all placeholders that have values in the config filenet.kyori.adventure.text.ComponentgetComponent(@NotNull String path, @Nullable net.kyori.adventure.text.minimessage.tag.resolver.TagResolver tagResolver, @Nullable net.kyori.adventure.pointer.Pointered target) Gets a Legacy/MiniMessage Hybrid Component at a specific path and also substitutes all placeholders that have values in the config file<T extends net.kyori.adventure.text.Component>
net.kyori.adventure.text.ComponentgetComponent(String path, net.kyori.adventure.text.serializer.ComponentSerializer<net.kyori.adventure.text.Component, T, String> serializer, net.kyori.adventure.text.minimessage.tag.resolver.TagResolver tagResolver, net.kyori.adventure.pointer.Pointered target) Gets a Message Component at a specific path and also substitutes all placeholders that have values in the config file@Nullable org.bukkit.inventory.ItemStackgetItemStack(@NotNull String path) @Nullable org.bukkit.inventory.ItemStackgetItemStack(@NotNull String path, @Nullable org.bukkit.inventory.ItemStack def) voidreload()Reload the config file from the disc or copies the default config file to the config location and loads thatvoidsave()saves the config file to the discvoidsaveSync()Saves the config file thread safeMethods 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, 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, 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
-
Constructor Details
-
YamlFileConfig
Creates a YamlFileConfiguration at the specified path inside the plugins folder- Parameters:
plugin- the Plugin that creates the configfilePath- the path to the config
-
YamlFileConfig
public YamlFileConfig(org.bukkit.plugin.java.JavaPlugin plugin, String filePath, @Nullable @Nullable Supplier<InputStream> inputStream) Creates a YamlFileConfiguration at the specified path inside the plugins folder with a specific input stream for where the default file comes from- Parameters:
plugin- the Plugin that creates the configfilePath- the path to the configinputStream- the input stream that gets the default config file
-
-
Method Details
-
reload
public void reload()Reload the config file from the disc or copies the default config file to the config location and loads that -
save
public void save()saves the config file to the disc -
saveSync
public void saveSync()Saves the config file thread safe -
getComponent
Gets a Legacy/MiniMessage Hybrid Component at a specific path and also substitutes all placeholders that have values in the config file- Parameters:
path- the path the component- Returns:
- the Component at the path
-
getComponent
public net.kyori.adventure.text.Component getComponent(@NotNull @NotNull String path, @Nullable @Nullable net.kyori.adventure.text.minimessage.tag.resolver.TagResolver tagResolver) Gets a Legacy/MiniMessage Hybrid Component at a specific path and also substitutes all placeholders that have values in the config file- Parameters:
path- the path the componenttagResolver- An optional TagResolver to use- Returns:
- the Component at the path
-
getComponent
public net.kyori.adventure.text.Component getComponent(@NotNull @NotNull String path, @Nullable @Nullable net.kyori.adventure.text.minimessage.tag.resolver.TagResolver tagResolver, @Nullable @Nullable net.kyori.adventure.pointer.Pointered target) Gets a Legacy/MiniMessage Hybrid Component at a specific path and also substitutes all placeholders that have values in the config file- Parameters:
path- the path the componenttagResolver- An optional TagResolver to usetarget- An optional target for the TagResolver to use- Returns:
- the Component at the path
-
getComponent
public <T extends net.kyori.adventure.text.Component> net.kyori.adventure.text.Component getComponent(String path, net.kyori.adventure.text.serializer.ComponentSerializer<net.kyori.adventure.text.Component, T, String> serializer, net.kyori.adventure.text.minimessage.tag.resolver.TagResolver tagResolver, net.kyori.adventure.pointer.Pointered target) Gets a Message Component at a specific path and also substitutes all placeholders that have values in the config filedeserialized with the specified serializer
- Type Parameters:
T- The type the deserializer uses- Parameters:
path- the path the componentserializer- the serializer to deserialize the messagetagResolver- An optional Tag resolvertarget- An optional target to use for the TagResolver- Returns:
- the Component at the path
-
getItemStack
@Nullable public @Nullable org.bukkit.inventory.ItemStack getItemStack(@NotNull @NotNull String path) - Specified by:
getItemStackin interfaceorg.bukkit.configuration.ConfigurationSection- Overrides:
getItemStackin classorg.bukkit.configuration.MemorySection
-
getItemStack
@Nullable public @Nullable org.bukkit.inventory.ItemStack getItemStack(@NotNull @NotNull String path, @Nullable @Nullable org.bukkit.inventory.ItemStack def) - Specified by:
getItemStackin interfaceorg.bukkit.configuration.ConfigurationSection- Overrides:
getItemStackin classorg.bukkit.configuration.MemorySection
-