Class ActionOption

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

public class ActionOption extends Option<Boolean>
A button. It holds no value and saves nothing; the GUI runs its action when clicked.
  • Constructor Details

    • ActionOption

      public ActionOption(BaseModule owner, String name, String description, Runnable action)
      Parameters:
      owner - The module that owns this option
      name - The name of this option
      description - The description of this option
      action - What clicking the button does
    • ActionOption

      public ActionOption(BaseModule owner, String name, String description, Runnable action, BooleanSupplier visibility)
      Parameters:
      owner - The module that owns this option
      name - The name of this option
      description - The description of this option
      action - What clicking the button does
      visibility - The visibility supplier for this option
  • Method Details

    • run

      public void run()
      Runs the action.
    • getValue

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

      public Boolean setValue(Boolean newValue)
      Runs the action when newValue is true.
      Specified by:
      setValue in class Option<Boolean>
      Parameters:
      newValue - The new value to set
      Returns:
      Always false
    • reset

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

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

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