Class SliderOption

java.lang.Object
dev.boze.api.option.Option<Double>
dev.boze.api.option.SliderOption
All Implemented Interfaces:
Serializable<Double>

public class SliderOption extends Option<Double>
A numeric option that can be adjusted using a slider

SliderOption provides a way to store and modify numeric values within a specified range

The value is always clamped between min and max, and can only be set in increments of step
  • Field Details

    • min

      public final double min
      The minimum value this slider can be set to
    • max

      public final double max
      The maximum value this slider can be set to
    • step

      public final double step
      The increment by which this slider's value changes
  • Constructor Details

    • SliderOption

      public SliderOption(AddonModule owner, String name, String description, double value, double min, double max, double step)
      Creates a new slider option
      Parameters:
      owner - The module that owns this option
      name - The name of this option
      description - The description of this option
      value - The initial value
      min - The minimum allowed value
      max - The maximum allowed value
      step - The increment between values
  • Method Details

    • getValue

      public Double getValue()
      Description copied from class: Option
      Gets the current value of this option
      Specified by:
      getValue in class Option<Double>
      Returns:
      The current value
    • setValue

      public Double setValue(Double newValue)
      Description copied from class: Option
      Sets the value of this option
      Specified by:
      setValue in class Option<Double>
      Parameters:
      newValue - The new value to set
      Returns:
      The value that was set (may be different from newValue if validation was performed)
    • reset

      public Double reset()
      Description copied from class: Option
      Resets this option to its default value
      Specified by:
      reset in class Option<Double>
      Returns:
      The default value
    • toJson

      public com.google.gson.JsonObject toJson()
      Returns:
      The object as a JsonObject
    • fromJson

      public Double fromJson(com.google.gson.JsonObject object)
      Parameters:
      object - The JsonObject to deserialize
      Returns:
      The deserialized object