Class Module

  • Direct Known Subclasses:
    RegistryModule

    public abstract class Module
    extends java.lang.Object
    Represents 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 boolean disable()
      Gets called when the module should shut down.
      ModuleState getModuleState()  
      abstract java.lang.String getName()
      Used to be able to request the name the module is registered as.
      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.
      protected abstract boolean initialize()
      Runs some preparation optionally supplied by the module before it can fully work.
      protected void setModuleState​(ModuleState moduleState)  
      protected abstract boolean unload()
      Gets called right before the module is unloaded.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Module

        public Module()
    • 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
      • 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.