Class YamlConfig

java.lang.Object
me.efekos.simpler.config.YamlConfig

public class YamlConfig extends Object
Can be used as a YamlConfiguration. Adds some extra features to default configuration.
  • Constructor Details

    • YamlConfig

      public YamlConfig(String resourceName, org.bukkit.plugin.java.JavaPlugin plugin)
      Can be used as a YamlConfiguration. Adds some extra features to default configuration.
      Parameters:
      resourceName - Name of the resource you want to use as this config. Make sure that your resource name ends with `.yml` and you have a resource with the exact same name on your 'resources' folder.
      plugin - An instance of your plugin.
  • Method Details

    • setup

      public void setup()
      Loads the default configuration file to your plugin's data folder. Recommended to use inside JavaPlugin.onEnable().
    • get

      public org.bukkit.configuration.file.FileConfiguration get()
      Returns the FileConfiguration object of this config.
      Returns:
      The FileConfiguration itself for cases that you need the original methods.
    • getString

      public String getString(String path, String def)
      Finds a String from the configuration
      Parameters:
      path - Path to the String you want.
      def - Default String to be returned in case nothing found in path. There are good reasons behind this parameter being required.
      Returns:
      Whatever found.
    • getInt

      public int getInt(String path, Integer def)
      Finds an Integer from the configuration
      Parameters:
      path - Path to the Integer you want.
      def - Default Integer to be returned in case nothing found in path. There are good reasons behind this parameter being required.
      Returns:
      Whatever found.
    • getBoolean

      public boolean getBoolean(String path, Boolean def)
      Finds a Boolean from the configuration
      Parameters:
      path - Path to the Boolean you want.
      def - Default Boolean to be returned in case nothing found in path. There are good reasons behind this parameter being required.
      Returns:
      Whatever found.
    • getStringList

      public List<String> getStringList(String path)
      Finds a List<String> from the configuration
      Parameters:
      path - Path to the List<String> you want.
      Returns:
      Whatever found.
    • getLocation

      public org.bukkit.Location getLocation(String path, org.bukkit.Location def)
      Finds a Location from the configuration
      Parameters:
      path - Path to the Location you want.
      def - Default Location to be returned in case nothing found in path.
      Returns:
      Whatever found.
    • getLocation

      public org.bukkit.Location getLocation(String path)
      Finds a Location from the configuration
      Parameters:
      path - Path to the Location you want.
      Returns:
      Whatever found.
    • getDouble

      public double getDouble(String path, double def)
      Finds a Double from the configuration
      Parameters:
      path - Path to the Double you want.
      def - Default Double to be returned in case nothing found in path. There are good reasons behind this parameter being required.
      Returns:
      Whatever found.
    • reload

      public void reload()
      Reloads the config by reading the file again.