Class MetaRegistry<K>

java.lang.Object
com.hypixel.hytale.server.core.meta.MetaRegistry<K>
All Implemented Interfaces:
IMetaRegistry<K>

public class MetaRegistry<K> extends Object implements IMetaRegistry<K>
  • Constructor Details

    • MetaRegistry

      public MetaRegistry()
  • Method Details

    • registerMetaObject

      public <T> MetaKey<T> registerMetaObject(Function<K,T> function, boolean persistent, String keyName, @Nonnull Codec<T> codec)
      Description copied from interface: IMetaRegistry
      This is used to create a new meta object and returns the integer id to lookup the object
      Specified by:
      registerMetaObject in interface IMetaRegistry<K>
      Parameters:
      function - Supplier used to create a new object when a world has no instance
      persistent - True if meta value is persistent
      keyName - Key name of this codec
      codec - Codec to encode this type. Generally a KeyedCodec
      Returns:
      MetaKey to lookup the meta object
    • newMetaObject

      public <T> T newMetaObject(@Nonnull MetaKey<T> key, K parent)
      Description copied from interface: IMetaRegistry
      Returns a new instance of the associated meta object which is created from the Supplier passed in the register method.
      Specified by:
      newMetaObject in interface IMetaRegistry<K>
      Type Parameters:
      T - Type of the returned object
      Parameters:
      key - Metakey from #register(Supplier).
      Returns:
      New instance of Meta object
    • forEachMetaEntry

      public void forEachMetaEntry(@Nonnull IMetaStore<K> store, @Nonnull IMetaRegistry.MetaEntryConsumer consumer)
      Specified by:
      forEachMetaEntry in interface IMetaRegistry<K>
    • getMetaKeyForCodecKey

      @Nullable public PersistentMetaKey<?> getMetaKeyForCodecKey(String codecKey)
      Specified by:
      getMetaKeyForCodecKey in interface IMetaRegistry<K>