moapi
Class ModKeyOption

java.lang.Object
  extended by moapi.ModOption<java.lang.Integer>
      extended by moapi.ModKeyOption

public class ModKeyOption
extends ModOption<java.lang.Integer>

An option for keybindings Enforces the concept of only one key per binding type.

Since:
0.7

Field Summary
static java.lang.Integer defaultVal
          The default Integer
 
Fields inherited from class moapi.ModOption
callback, global, localValue, name, value
 
Constructor Summary
ModKeyOption(java.lang.String name)
          Constructor for key binding option
ModKeyOption(java.lang.String id, java.lang.String name)
          Constructor with ID for key binding option
 
Method Summary
static java.lang.String getKeyName(java.lang.Integer key)
          Get a name of a key.
static boolean isKeyBound(java.lang.Integer c)
          Check if a key is already bound
 void setValue(int value)
          Set the current used value of this option selector
 void setValue(int value, boolean scope)
          Set the current used value of this option selector for a given scope
 void setValue(java.lang.Integer value)
          Set the current used value of this option selector fr a given scope
 void setValue(java.lang.Integer value, boolean scope)
          Set the current used value of this option selector
 
Methods inherited from class moapi.ModOption
getCallback, getGlobalValue, getID, getLocalValue, getName, getValue, getValue, hasCallback, setCallback, setGlobal, setGlobalValue, setLocalValue, setName, useGlobalValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultVal

public static final java.lang.Integer defaultVal
The default Integer

Since:
0.7
Constructor Detail

ModKeyOption

public ModKeyOption(java.lang.String name)
Constructor for key binding option

Parameters:
name - Name of option
Since:
0.7

ModKeyOption

public ModKeyOption(java.lang.String id,
                    java.lang.String name)
Constructor with ID for key binding option

Parameters:
id - ID of option
name - Name of option
Since:
0.8
Method Detail

setValue

public void setValue(int value)
Set the current used value of this option selector

Parameters:
value - New value
Since:
0.7

setValue

public void setValue(java.lang.Integer value)
Set the current used value of this option selector fr a given scope

Overrides:
setValue in class ModOption<java.lang.Integer>
Parameters:
value - New value
Throws:
KeyAlreadyBoundException - When attempting to remind a key
Since:
0.7

setValue

public void setValue(int value,
                     boolean scope)
Set the current used value of this option selector for a given scope

Parameters:
value - New value
Throws:
KeyAlreadyBoundException - When attempting to remind a key
Since:
0.7

setValue

public void setValue(java.lang.Integer value,
                     boolean scope)
Set the current used value of this option selector

Overrides:
setValue in class ModOption<java.lang.Integer>
Parameters:
value - New value
scope - Scope value. True for global
Throws:
KeyAlreadyBoundException - When attempting to remind a key
Since:
0.7

isKeyBound

public static boolean isKeyBound(java.lang.Integer c)
Check if a key is already bound

Parameters:
c - Integer to check
Returns:
True if already bound
Since:
0.7

getKeyName

public static java.lang.String getKeyName(java.lang.Integer key)
Get a name of a key. "INVALID" for no value

Parameters:
key - Key to get value for
Returns:
String for key
Since:
0.7