Package dev.boze.api.option
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
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 Summary
FieldsModifier and TypeFieldDescriptionfinal String
The description of this optionfinal String
The name of this optionfinal AddonModule
The module that owns this option -
Constructor Summary
ConstructorsConstructorDescriptionOption
(AddonModule owner, String name, String description) Creates a new option -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface dev.boze.api.config.Serializable
fromJson, toJson
-
Field Details
-
owner
The module that owns this option -
name
The name of this option -
description
The description of this option
-
-
Constructor Details
-
Option
Creates a new option- Parameters:
owner
- The module that owns this optionname
- The name of this optiondescription
- The description of this option
-
-
Method Details
-
getValue
Gets the current value of this option- Returns:
- The current value
-
setValue
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
Resets this option to its default value- Returns:
- The default value
-