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_PREFIX

    Fields inherited from class org.bukkit.configuration.MemoryConfiguration

    defaults, options

    Fields inherited from class org.bukkit.configuration.MemorySection

    map
  • Constructor Summary

    Constructors
    Constructor
    Description
    YamlFileConfig(org.bukkit.plugin.java.JavaPlugin plugin, String filePath)
    Creates a YamlFileConfiguration at the specified path inside the plugins folder
    YamlFileConfig(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 Type
    Method
    Description
    net.kyori.adventure.text.Component
    getComponent(@NotNull String path)
    Gets a Legacy/MiniMessage Hybrid Component at a specific path and also substitutes all placeholders that have values in the config file
    net.kyori.adventure.text.Component
    getComponent(@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 file
    net.kyori.adventure.text.Component
    getComponent(@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.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 file
    @Nullable org.bukkit.inventory.ItemStack
    getItemStack(@NotNull String path)
     
    @Nullable org.bukkit.inventory.ItemStack
    getItemStack(@NotNull String path, @Nullable org.bukkit.inventory.ItemStack def)
     
    void
    Reload the config file from the disc or copies the default config file to the config location and loads that
    void
    saves the config file to the disc
    void
    Saves the config file thread safe

    Methods inherited from class org.bukkit.configuration.file.YamlConfiguration

    loadConfiguration, loadConfiguration, loadFromString, options, saveToString

    Methods inherited from class org.bukkit.configuration.file.FileConfiguration

    buildHeader, load, load, load, save, save

    Methods inherited from class org.bukkit.configuration.MemoryConfiguration

    addDefault, addDefaults, addDefaults, getDefaults, getParent, setDefaults

    Methods 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, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods 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

      public YamlFileConfig(org.bukkit.plugin.java.JavaPlugin plugin, String filePath)
      Creates a YamlFileConfiguration at the specified path inside the plugins folder
      Parameters:
      plugin - the Plugin that creates the config
      filePath - 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 config
      filePath - the path to the config
      inputStream - 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

      public net.kyori.adventure.text.Component getComponent(@NotNull @NotNull String path)
      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 component
      tagResolver - 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 component
      tagResolver - An optional TagResolver to use
      target - 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 file

      deserialized with the specified serializer

      Type Parameters:
      T - The type the deserializer uses
      Parameters:
      path - the path the component
      serializer - the serializer to deserialize the message
      tagResolver - An optional Tag resolver
      target - 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:
      getItemStack in interface org.bukkit.configuration.ConfigurationSection
      Overrides:
      getItemStack in class org.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:
      getItemStack in interface org.bukkit.configuration.ConfigurationSection
      Overrides:
      getItemStack in class org.bukkit.configuration.MemorySection