Package org.hmcore.modules
Class RegistryModule<T,I extends org.hmcore.registration.ObjectInfo>
- java.lang.Object
-
- org.hmcore.modules.Module
-
- org.hmcore.modules.RegistryModule<T,I>
-
- Type Parameters:
T- The object that should get registeredI- Object that contains information about the object. Like the texture.
public abstract class RegistryModule<T,I extends org.hmcore.registration.ObjectInfo> extends Module
Represents a module that manages the objects that should get registered to Hytale.
-
-
Constructor Summary
Constructors Constructor Description RegistryModule()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidaddInfoToObject(java.lang.String name, java.lang.String infoName, I objectInfo)Adds an option for information to the object.abstract booleancontains(java.lang.String name)For checking if the Module has the object already in its list.abstract voidforceObjectInfoForObject(java.lang.String object, java.lang.String objectInfo)Forces a specific object info to a object so the config the user made is respected.abstract Tget(java.lang.String name)Gets the object for the registered name.abstract org.hmcore.registration.config.ObjectInfoData[]getObjectInfoArray()abstract T[]getObjects()protected booleanhook()Gets called when it is time for the module to hook into Hytale and register their stuff in the hytale apis.abstract booleanobjectAndInfoExist(java.lang.String object, java.lang.String objectInfo)Forces a specific object info to a object so the config the user made is respected.abstract voidregister(java.lang.String name, T object)Registers the object to the module.voidregisterIfNonExistent(java.lang.String name, T object)Simple utility function that automatically checks if the object already exists.protected abstract booleanregisterObjects()Gets called when the phase of object registration to Hytale has come.-
Methods inherited from class org.hmcore.modules.Module
disable, getModuleState, getName, initialize, setModuleState, unload
-
-
-
-
Method Detail
-
contains
public abstract boolean contains(java.lang.String name)
For checking if the Module has the object already in its list.- Parameters:
name- The name or registration key of the object to be checked- Returns:
- true when the object is already registered.
-
get
public abstract T get(java.lang.String name)
Gets the object for the registered name.- Parameters:
name- The name or key for the object that should be returned.- Returns:
- The object under the registered name or null if it doesn't exists.
-
register
public abstract void register(java.lang.String name, T object)Registers the object to the module.- Parameters:
name- The name or key for the object to get registered under.object- The object that should get registered.
-
addInfoToObject
public abstract void addInfoToObject(java.lang.String name, java.lang.String infoName, I objectInfo)Adds an option for information to the object. There can be multiple options for information and the server administrators can choose which to use. Per default the first registered option is used.- Parameters:
name- The name or key for the object the information should be added to.infoName- The name of the option. The name of the mod as example.objectInfo- The info object that supplies the module with the required information.
-
registerIfNonExistent
public void registerIfNonExistent(java.lang.String name, T object)Simple utility function that automatically checks if the object already exists. If not, the object is registered. An easy boilerplate code prevention.- Parameters:
name-object-
-
getObjects
public abstract T[] getObjects()
- Returns:
- An Array of all objects currently registered to the module.
-
registerObjects
protected abstract boolean registerObjects()
Gets called when the phase of object registration to Hytale has come.- Returns:
- true when every object has been registered successfully.
-
getObjectInfoArray
public abstract org.hmcore.registration.config.ObjectInfoData[] getObjectInfoArray()
-
forceObjectInfoForObject
public abstract void forceObjectInfoForObject(java.lang.String object, java.lang.String objectInfo)Forces a specific object info to a object so the config the user made is respected.- Parameters:
object- The name of the object to force toobjectInfo- The object info of the object to apply
-
objectAndInfoExist
public abstract boolean objectAndInfoExist(java.lang.String object, java.lang.String objectInfo)Forces a specific object info to a object so the config the user made is respected.- Parameters:
object- The name of the object to force toobjectInfo- The object info of the object to apply- Returns:
- Returns if both the object and the object info exist.
-
hook
protected boolean hook()
Description copied from class:ModuleGets called when it is time for the module to hook into Hytale and register their stuff in the hytale apis.
-
-