Class Config

java.lang.Object
com.plotsquared.core.configuration.Config
Direct Known Subclasses:
Settings, Storage

public class Config extends Object
  • Constructor Details

    • Config

      public Config()
  • Method Details

    • get

      public static <T> T get(String key, Class<?> root)
      Get the value for a node
      Probably throws some error if you try to get a non existent key
      Type Parameters:
      T - value type
      Parameters:
      key - configuration key
      root - configuration class
      Returns:
      value
    • set

      public static void set(String key, Object value, Class<? extends Config> root)
      Set the value of a specific node
      Probably throws some error if you supply non existing keys or invalid values
      Parameters:
      key - config node
      value - value
      root - configuration class
    • load

      public static boolean load(File file, Class<? extends Config> root)
    • save

      public static void save(File file, Class<? extends Config> root)
      Set all values in the file (load first to avoid overwriting)
      Parameters:
      file - file
      root - configuration file class
    • getFields

      public static Map<String,​Object> getFields(Class<Settings.Enabled_Components> clazz)
      Get the static fields in a section.
      Parameters:
      clazz - config section
      Returns:
      map or string against object of static fields