Class YAML

  • All Implemented Interfaces:
    org.bukkit.configuration.Configuration, org.bukkit.configuration.ConfigurationSection

    public class YAML
    extends org.bukkit.configuration.file.YamlConfiguration
    Create configuration files with custom file names
    • Field Summary

      • Fields inherited from class org.bukkit.configuration.file.YamlConfiguration

        BLANK_CONFIG, COMMENT_PREFIX
      • Fields inherited from class org.bukkit.configuration.file.FileConfiguration

        SYSTEM_UTF, UTF_BIG, UTF8_OVERRIDE
      • Fields inherited from class org.bukkit.configuration.MemoryConfiguration

        defaults, options
      • Fields inherited from class org.bukkit.configuration.MemorySection

        map
    • Constructor Summary

      Constructors 
      Constructor Description
      YAML​(java.lang.String name, org.bukkit.plugin.Plugin plugin)
      Create/get a configuration from the plugin folder
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void create()  
      java.lang.String getString​(java.lang.String path, boolean translateColors)
      Gets the requested String by path, returning null if not found.
      java.lang.String getString​(java.lang.String path, java.lang.String defaultValue, boolean translateColors)
      Gets the requested String by path, returning the default value if not found.
      void reload()
      Reloads the configuration from the file
      void save()
      Saves the configuration to the file.
      • Methods inherited from class org.bukkit.configuration.file.YamlConfiguration

        buildHeader, convertMapsToSections, loadConfiguration, loadConfiguration, loadConfiguration, loadFromString, options, parseHeader, saveToString
      • Methods inherited from class org.bukkit.configuration.file.FileConfiguration

        load, 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, createPath, createPath, createSection, createSection, get, get, getBoolean, getBoolean, getBooleanList, getByteList, getCharacterList, getColor, getColor, getConfigurationSection, getCurrentPath, getDefault, getDefaultSection, getDouble, getDouble, getDoubleList, getFloatList, getInt, getInt, getIntegerList, getItemStack, getItemStack, getKeys, getList, getList, getLong, getLong, getLongList, getMapList, getName, getOfflinePlayer, getOfflinePlayer, getRoot, getShortList, getString, getString, getStringList, getValues, getVector, getVector, isBoolean, isColor, isConfigurationSection, isDouble, isInt, isItemStack, isList, isLong, isOfflinePlayer, isPrimitiveWrapper, isSet, isString, isVector, mapChildrenKeys, mapChildrenValues, set, 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, createSection, createSection, get, get, getBoolean, getBoolean, getBooleanList, getByteList, getCharacterList, getColor, getColor, getConfigurationSection, getCurrentPath, getDefaultSection, getDouble, getDouble, getDoubleList, getFloatList, getInt, getInt, getIntegerList, getItemStack, getItemStack, getKeys, getList, getList, getLong, getLong, getLongList, getMapList, getName, getOfflinePlayer, getOfflinePlayer, getRoot, getShortList, getString, getString, getStringList, getValues, getVector, getVector, isBoolean, isColor, isConfigurationSection, isDouble, isInt, isItemStack, isList, isLong, isOfflinePlayer, isSet, isString, isVector, set
    • Constructor Detail

      • YAML

        public YAML​(java.lang.String name,
                    org.bukkit.plugin.Plugin plugin)
             throws java.io.IOException,
                    org.bukkit.configuration.InvalidConfigurationException
        Create/get a configuration from the plugin folder
        Parameters:
        name - The configuration file name, without .yml at the end
        plugin - An instance of your plugin
        Throws:
        java.io.IOException - Failed to create de configuration file
        org.bukkit.configuration.InvalidConfigurationException - The configuration file represents an invalid YAML Configuration
    • Method Detail

      • save

        public void save()
        Saves the configuration to the file.
      • reload

        public void reload()
        Reloads the configuration from the file
      • getString

        public java.lang.String getString​(java.lang.String path,
                                          boolean translateColors)
        Gets the requested String by path, returning null if not found.
        Parameters:
        path - Path of the String to get.
        translateColors - Translate colors from & color codes
        Returns:
        Requested String.
      • getString

        public java.lang.String getString​(java.lang.String path,
                                          java.lang.String defaultValue,
                                          boolean translateColors)
        Gets the requested String by path, returning the default value if not found.
        Parameters:
        path - Path of the String to get.
        defaultValue - The default value to return if the path is not found or is not a String.
        translateColors - Translate colors from & color codes
        Returns:
        Requested String.
      • create

        public void create()