Package org.hmcore.modules
Class Module
- java.lang.Object
-
- org.hmcore.modules.Module
-
- Direct Known Subclasses:
RegistryModule
public abstract class Module extends java.lang.ObjectRepresents a module with custom features
-
-
Constructor Summary
Constructors Constructor Description Module()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract booleandisable()Gets called when the module should shut down.ModuleStategetModuleState()abstract java.lang.StringgetName()Used to be able to request the name the module is registered as.protected abstract booleanhook()Gets called when it is time for the module to hook into Hytale and register their stuff in the hytale apis.protected abstract booleaninitialize()Runs some preparation optionally supplied by the module before it can fully work.protected voidsetModuleState(ModuleState moduleState)protected abstract booleanunload()Gets called right before the module is unloaded.
-
-
-
Method Detail
-
getName
public abstract java.lang.String getName()
Used to be able to request the name the module is registered as.- Returns:
- The String the module is registered as. So that HMCore.modules.get(name).getName() equals name
-
getModuleState
public ModuleState getModuleState()
-
setModuleState
protected void setModuleState(ModuleState moduleState)
-
initialize
protected abstract boolean initialize()
Runs some preparation optionally supplied by the module before it can fully work. This should only include stuff that isn't needed for calling functions like register(name, object); to a RegistryModule. This should be in the constructor. It can be used as example for creating a namespace or hooking into some Hytale functionalities. If you want to run stuff when the Module is loaded, use the constructor of your main class.- Returns:
- true when initialisation finished without a problem. false when there is a critical problem which won't allow the module to function properly. When false is returned the server is safely shut down.
-
hook
protected abstract boolean hook()
Gets called when it is time for the module to hook into Hytale and register their stuff in the hytale apis.- Returns:
- true when hooking finished without a problem. false when there is a critical problem which won't allow the module to function properly. When false is returned the server is safely shut down.
-
disable
protected abstract boolean disable()
Gets called when the module should shut down. Can be used to save data a last time.- Returns:
- true when disabling finished without a problem. false when there is a critical problem which won't allow the module to disable properly. When false is returned the server is safely shut down with a warning.
-
unload
protected abstract boolean unload()
Gets called right before the module is unloaded. This will be the last call to the module before it is unloaded.- Returns:
- true when disabling finished without a problem. false when there is a critical problem which won't allow the module to disable properly. When false is returned the server is safely shut down with a warning.
-
-