Class Option<T>

java.lang.Object
dev.boze.api.option.Option<T>
Type Parameters:
T - The type of value stored by this option
All Implemented Interfaces:
Serializable<T>
Direct Known Subclasses:
BindOption, ModeOption, SliderOption, ToggleOption

public abstract class Option<T> extends Object implements Serializable<T>
Base class for all module options

Options are used to store configurable values for modules

All options must implement getValue(), setValue(), and reset() methods

Options also implement Serializable to allow for saving/loading from config files
  • Field Details

    • owner

      public final AddonModule owner
      The module that owns this option
    • name

      public final String name
      The name of this option
    • description

      public final String description
      The description of this option
  • Constructor Details

    • Option

      public Option(AddonModule owner, String name, String description)
      Creates a new option
      Parameters:
      owner - The module that owns this option
      name - The name of this option
      description - The description of this option
  • Method Details

    • getValue

      public abstract T getValue()
      Gets the current value of this option
      Returns:
      The current value
    • setValue

      public abstract T setValue(T newValue)
      Sets the value of this option
      Parameters:
      newValue - The new value to set
      Returns:
      The value that was set (may be different from newValue if validation was performed)
    • reset

      public abstract T reset()
      Resets this option to its default value
      Returns:
      The default value