Class ConfigurableClassParam<T>

java.lang.Object
me.nabdev.oxconfig.ConfigurableClassParam<T>
Type Parameters:
T - The type of the parameter

public class ConfigurableClassParam<T> extends Object
Parameters for use with ConfigurableClass
  • Constructor Details

    • ConfigurableClassParam

      public ConfigurableClassParam(ConfigurableClass myClass, T val, Consumer<T> setter, String key)
      Creates a new ConfigurableClassParam with the given value and key
      Parameters:
      myClass - The ConfigurableClass that this parameter belongs to
      val - Default value
      setter - Setter method for the value
      key - The json key for the value to be stored in (e.g. "kP"), must not include commas
    • ConfigurableClassParam

      public ConfigurableClassParam(ConfigurableClass myClass, T val, String key)
      Creates a new ConfigurableClassParam with the given value and key
      Parameters:
      myClass - The ConfigurableClass that this parameter belongs to
      val - Default value
      key - The json key for the value to be stored in (e.g. "kP"), must not include commas
  • Method Details

    • set

      public void set(T val)
      Sets the value of the parameter and calls the setter method Note: This does not save the value to the config file and will be overwritten on reload
      Parameters:
      val - The new value
    • get

      public T get()
      Gets the current value of the parameter since the last reload
      Returns:
      The current value of the parameter
    • shouldStoreComment

      public boolean shouldStoreComment()
      Whether or not a comment should be stored.
      Returns:
      Whether or not a commentshould be stored.