moapi
Class ModOption<E>

java.lang.Object
  extended by moapi.ModOption<E>
Direct Known Subclasses:
ModBooleanOption, ModKeyOption, ModMappedOption, ModMultiOption, ModSliderOption, ModTextOption

public abstract class ModOption<E>
extends java.lang.Object

Abstract base class for individual option classes

Since:
0.1

Field Summary
protected  MOCallback callback
          The callback object
protected  boolean global
          If we should use the global value
protected  E localValue
          Local/ server value f this option
protected  java.lang.String name
          Given name for this option selector
protected  E value
          Global Value of this option selector
 
Constructor Summary
protected ModOption(java.lang.String id)
          Default constructor, requires an ID
protected ModOption(java.lang.String id, java.lang.String name)
          Default constructor with a name
 
Method Summary
 MOCallback getCallback()
          Returns the callback
 E getGlobalValue()
          Returs the global value of this option
 java.lang.String getID()
          Get the ID of this option selector
 E getLocalValue()
          Get the local value
 java.lang.String getName()
          Return the name of this option selector
 E getValue()
          Get value of this option selector
 E getValue(boolean scope)
          Get the value of this selector from the scope given in the first parameter
 boolean hasCallback()
          Check if this option has a callback
 void setCallback(MOCallback callback)
          Set the callback for this option
 void setGlobal(boolean global)
          Set the scope of the value
 void setGlobalValue(E value)
          Sets global value of this option
 void setLocalValue(E value)
          Sets the local value of this option
protected  void setName(java.lang.String name)
          Set the name of this option
 void setValue(E value)
          Set the current used value of this option selector
 void setValue(E value, boolean scope)
          Set the current value used for the given scope
 boolean useGlobalValue()
          Set this option to only use the global value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

protected java.lang.String name
Given name for this option selector


value

protected E value
Global Value of this option selector


localValue

protected E localValue
Local/ server value f this option


global

protected boolean global
If we should use the global value


callback

protected MOCallback callback
The callback object

Constructor Detail

ModOption

protected ModOption(java.lang.String id)
Default constructor, requires an ID

Parameters:
id - Identifier for this option
Since:
0.8

ModOption

protected ModOption(java.lang.String id,
                    java.lang.String name)
Default constructor with a name

Parameters:
id - Identified for this option
name - Name for this option
Since:
0.8
Method Detail

setName

protected void setName(java.lang.String name)
Set the name of this option

Parameters:
name - New name for this option

setValue

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

Parameters:
value - New value

setValue

public void setValue(E value,
                     boolean scope)
Set the current value used for the given scope

Parameters:
value - New value for scope
scope - Scope value. True for global
Since:
0.7

setLocalValue

public void setLocalValue(E value)
Sets the local value of this option

Parameters:
value - New value

setGlobalValue

public void setGlobalValue(E value)
Sets global value of this option

Parameters:
value - New value

setGlobal

public void setGlobal(boolean global)
Set the scope of the value

Parameters:
global - True if use global value only

setCallback

public void setCallback(MOCallback callback)
Set the callback for this option

Parameters:
callback - The callback to set

getID

public final java.lang.String getID()
Get the ID of this option selector

Returns:
ID of this option
Since:
0.8

getName

public java.lang.String getName()
Return the name of this option selector

Returns:
Name of option selector

getValue

public E getValue()
Get value of this option selector

Returns:
Value of this option selector

getValue

public E getValue(boolean scope)
Get the value of this selector from the scope given in the first parameter

Parameters:
scope - True for global value
Returns:
Value of this option in the given scope

getGlobalValue

public E getGlobalValue()
Returs the global value of this option

Returns:
Global value of this option

getLocalValue

public E getLocalValue()
Get the local value

Returns:
Local value of this option selector

useGlobalValue

public boolean useGlobalValue()
Set this option to only use the global value

Returns:
True if only using the global value

getCallback

public MOCallback getCallback()
Returns the callback

Returns:
callback object

hasCallback

public boolean hasCallback()
Check if this option has a callback

Returns:
True if has callback