C - Class of the extension of ExtendedConfigpublic abstract class ExtendedConfig<C extends ExtendedConfig<C>> extends java.lang.Object implements java.lang.Comparable<ExtendedConfig<C>>, IInitListener
IConfigurable. Every unique IConfigurable must have one
unique extension of this class. This contains several configurable settings and properties
that can also be set in the config file.IInitListener.Step| Modifier and Type | Field and Description |
|---|---|
java.util.List<ConfigProperty> |
configProperties
A list of
ConfigProperty that can contain additional settings for this configurable. |
| Constructor and Description |
|---|
ExtendedConfig(boolean enabled,
java.lang.String namedId,
java.lang.String comment,
java.lang.Class<?> element)
Create a new config
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(ExtendedConfig<C> o) |
C |
downCast()
Get the lowest castable config.
|
java.lang.String |
getComment() |
protected java.lang.String |
getConfigPropertyPrefix() |
java.lang.Class |
getElement() |
java.lang.String |
getFullUnlocalizedName()
Get the full unlocalized name for this configurable.
|
abstract ConfigurableType |
getHolderType()
Return the configurable type for which this config holds data
|
java.lang.String |
getNamedId() |
IConfigurable |
getSubInstance()
Will return the instance of the object this config refers to
|
java.lang.String |
getSubUniqueName()
Will return the unique name of the object this config refers to
|
abstract java.lang.String |
getUnlocalizedName()
Get the unlocalized name (must be unique!)
|
protected IConfigurable |
initSubInstance()
This method will by default just return null.
|
boolean |
isDisableable()
Override this method to prevent configs to be disabled from the config file.
|
boolean |
isEnabled()
Checks if the eConfig refers to a target that should be enabled.
|
boolean |
isHardDisabled()
If the target should be hard-disabled, this means no occurence in the config file,
total ignorance.
|
void |
onInit(IInitListener.Step step)
This will be called in an init step.
|
void |
onRegistered()
Overridable method that is immediately called after the element of this config is registered.
|
void |
save()
Save this config inside the correct element and inside the implementation if itself.
|
void |
setEnabled(boolean enabled)
Set the enabling of the target.
|
void |
showDoubleInitError()
Call this method in the initInstance method of Configurables if the instance was already set.
|
public java.util.List<ConfigProperty> configProperties
ConfigProperty that can contain additional settings for this configurable.public ExtendedConfig(boolean enabled,
java.lang.String namedId,
java.lang.String comment,
java.lang.Class<?> element)
enabled - If this should is enabled by default. If this is false, this can still
be enabled through the config file.namedId - a unique name idcomment - a comment that can be added to the config file lineelement - the class for the element this config is forpublic java.lang.String getNamedId()
public java.lang.String getComment()
public java.lang.Class getElement()
protected java.lang.String getConfigPropertyPrefix()
ConfigurableProperty's.public void save()
public abstract ConfigurableType getHolderType()
public abstract java.lang.String getUnlocalizedName()
public java.lang.String getFullUnlocalizedName()
protected IConfigurable initSubInstance()
public IConfigurable getSubInstance()
public java.lang.String getSubUniqueName()
public void onRegistered()
public void onInit(IInitListener.Step step)
IInitListeneronInit in interface IInitListenerstep - The init step.public int compareTo(ExtendedConfig<C> o)
compareTo in interface java.lang.Comparable<ExtendedConfig<C extends ExtendedConfig<C>>>public boolean isEnabled()
public void setEnabled(boolean enabled)
enabled - If the target should be enabled.public boolean isHardDisabled()
public boolean isDisableable()
public void showDoubleInitError()
public C downCast()