Class RegistryModule<T,​I extends org.hmcore.registration.ObjectInfo>

  • Type Parameters:
    T - The object that should get registered
    I - 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 void addInfoToObject​(java.lang.String name, java.lang.String infoName, I objectInfo)
      Adds an option for information to the object.
      abstract boolean contains​(java.lang.String name)
      For checking if the Module has the object already in its list.
      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.
      abstract T get​(java.lang.String name)
      Gets the object for the registered name.
      abstract org.hmcore.registration.config.ObjectInfoData[] getObjectInfoArray()  
      abstract T[] getObjects()  
      protected boolean hook()
      Gets called when it is time for the module to hook into Hytale and register their stuff in the hytale apis.
      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.
      abstract void register​(java.lang.String name, T object)
      Registers the object to the module.
      void registerIfNonExistent​(java.lang.String name, T object)
      Simple utility function that automatically checks if the object already exists.
      protected abstract boolean registerObjects()
      Gets called when the phase of object registration to Hytale has come.
      • Methods inherited from class java.lang.Object

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

      • RegistryModule

        public RegistryModule()
    • 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 to
        objectInfo - 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 to
        objectInfo - 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: Module
        Gets called when it is time for the module to hook into Hytale and register their stuff in the hytale apis.
        Specified by:
        hook in class Module
        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.