Package dev.boze.api.option
Class BindOption
- All Implemented Interfaces:
Serializable<Bind>
An option for keyboard/mouse bindings
BindOption provides a way to store and modify key or mouse button bindings
Can be bound to either a keyboard key or mouse button
-
Field Summary
Fields inherited from class dev.boze.api.option.Option
description, name, owner -
Constructor Summary
ConstructorsConstructorDescriptionBindOption(BaseModule owner, String name, String description) Creates a new bind option with no default bindingBindOption(BaseModule owner, String name, String description, int bind, boolean isButton) Creates a new bind option with a specified default bindingBindOption(BaseModule owner, String name, String description, int bind, boolean isButton, Option<?> parent) Creates a new bind option with a specified default binding and parent -
Method Summary
Modifier and TypeMethodDescriptionfromJson(com.google.gson.JsonObject object) intgetBind()Gets the current key/button codegetValue()Gets the current value of this optionbooleanisButton()Checks if this bind is for a mouse buttonreset()Resets this option to its default valuevoidsetBind(int bind, boolean isButton) Sets the binding using a key/button code and typevoidSets the binding using a Bind objectSets the value of this optioncom.google.gson.JsonObjecttoJson()Methods inherited from class dev.boze.api.option.Option
getFullName, getParent, isParent, setParent
-
Constructor Details
-
BindOption
Creates a new bind option with no default binding- Parameters:
owner- The module that owns this optionname- The name of this optiondescription- The description of this option
-
BindOption
Creates a new bind option with a specified default binding- Parameters:
owner- The module that owns this optionname- The name of this optiondescription- The description of this optionbind- The key/button code to bind toisButton- Whether this is a mouse button (true) or keyboard key (false)
-
BindOption
public BindOption(BaseModule owner, String name, String description, int bind, boolean isButton, Option<?> parent) Creates a new bind option with a specified default binding and parent- Parameters:
owner- The module that owns this optionname- The name of this optiondescription- The description of this optionbind- The key/button code to bind toisButton- Whether this is a mouse button (true) or keyboard key (false)parent- The parent option, or null if this is a root option
-
-
Method Details
-
getValue
Description copied from class:OptionGets the current value of this option -
setValue
Description copied from class:OptionSets the value of this option -
reset
Description copied from class:OptionResets this option to its default value -
getBind
public int getBind()Gets the current key/button code- Returns:
- The key/button code
-
isButton
public boolean isButton()Checks if this bind is for a mouse button- Returns:
- true if this is a mouse button bind, false if it's a keyboard key
-
setBind
Sets the binding using a Bind object- Parameters:
bind- The new binding
-
setBind
public void setBind(int bind, boolean isButton) Sets the binding using a key/button code and type- Parameters:
bind- The key/button codeisButton- Whether this is a mouse button (true) or keyboard key (false)
-
toJson
public com.google.gson.JsonObject toJson()- Returns:
- The object as a JsonObject
-
fromJson
- Parameters:
object- The JsonObject to deserialize- Returns:
- The deserialized object
-