Class KeyHolder<T>

java.lang.Object
net.mathias2246.buildmc.util.registry.KeyHolder<T>
Type Parameters:
T - The type of the value of this KeyHolder
All Implemented Interfaces:
net.kyori.adventure.key.Keyed, org.bukkit.Keyed

public class KeyHolder<T> extends Object implements org.bukkit.Keyed
A Helper class for storing an object instance with a NamespacedKey as identifier.

This object can then be used for storing a non-Keyed object instance inside a Registry.

See Also:
  • Keyed
  • Constructor Details

    • KeyHolder

      public KeyHolder(@NotNull @NotNull org.bukkit.NamespacedKey key, @NotNull T value)
      Default constructor for creating a basic non-null KeyHolder instance.
      Parameters:
      key - The namespaced identifier for the instance of type T
      value - The actual object of type T that should have a namespaced identifier
  • Method Details

    • getValue

      @Contract(pure=true) @NotNull public T getValue()
      Gets the stored object
    • getKey

      @Contract(pure=true) @NotNull public @NotNull org.bukkit.NamespacedKey getKey()
      Specified by:
      getKey in interface org.bukkit.Keyed