Package org.bukkit

Class Registry.SimpleRegistry<T extends Enum<T> & Keyed>

java.lang.Object
org.bukkit.Registry.SimpleRegistry<T>
All Implemented Interfaces:
Iterable<T>, Registry<T>
Enclosing interface:
Registry<T extends Keyed>

public static final class Registry.SimpleRegistry<T extends Enum<T> & Keyed> extends Object implements Registry<T>
  • Constructor Details

    • SimpleRegistry

      protected SimpleRegistry(@NotNull Class<T> type)
    • SimpleRegistry

      protected SimpleRegistry(@NotNull Class<T> type, @NotNull Predicate<T> predicate)
  • Method Details

    • get

      @Nullable public T get(@NotNull NamespacedKey key)
      Description copied from interface: Registry
      Get the object by its key.
      Specified by:
      get in interface Registry<T extends Enum<T> & Keyed>
      Parameters:
      key - non-null key
      Returns:
      item or null if does not exist
    • getOrThrow

      @NotNull public T getOrThrow(@NotNull NamespacedKey key)
      Description copied from interface: Registry
      Get the object by its key. If there is no object with the given key, an exception will be thrown.
      Specified by:
      getOrThrow in interface Registry<T extends Enum<T> & Keyed>
      Parameters:
      key - to get the object from
      Returns:
      object with the given key
    • stream

      @NotNull public Stream<T> stream()
      Description copied from interface: Registry
      Returns a new stream, which contains all registry items, which are registered to the registry.
      Specified by:
      stream in interface Registry<T extends Enum<T> & Keyed>
      Returns:
      a stream of all registry items
    • iterator

      @NotNull public Iterator<T> iterator()
      Specified by:
      iterator in interface Iterable<T extends Enum<T> & Keyed>
    • getType

      @Internal @Deprecated(since="1.20.6", forRemoval=true) public Class<T> getType()
      Deprecated, for removal: This API element is subject to removal in a future version.