Class CustomItemRegistry

java.lang.Object
net.mathias2246.buildmc.api.item.CustomItemRegistry
All Implemented Interfaces:
Iterable<AbstractCustomItem>, org.bukkit.Registry<AbstractCustomItem>

public class CustomItemRegistry extends Object implements org.bukkit.Registry<AbstractCustomItem>
A Register that stores AbstractCustomItem Instanced to be used somewhere else in your plugin.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.bukkit.Registry

    org.bukkit.Registry.SimpleRegistry<T extends Enum<T> & org.bukkit.Keyed>
  • Field Summary

    Fields inherited from interface org.bukkit.Registry

    ADVANCEMENT, ART, ATTRIBUTE, BANNER_PATTERN, BIOME, BLOCK, BOSS_BARS, CAT_VARIANT, CHICKEN_VARIANT, COW_VARIANT, DAMAGE_TYPE, EFFECT, ENCHANTMENT, ENTITY_TYPE, FLUID, FROG_VARIANT, GAME_EVENT, INSTRUMENT, ITEM, JUKEBOX_SONG, LOOT_TABLES, MAP_DECORATION_TYPE, MATERIAL, MEMORY_MODULE_TYPE, MENU, PARTICLE_TYPE, PIG_VARIANT, POTION, SOUNDS, STATISTIC, STRUCTURE, STRUCTURE_TYPE, TRIM_MATERIAL, TRIM_PATTERN, VILLAGER_PROFESSION, VILLAGER_TYPE, WOLF_VARIANT
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    contains(@NotNull org.bukkit.NamespacedKey key)
     
    get(@Nullable org.bukkit.NamespacedKey namespacedKey)
     
    getFromItemStack(@Nullable org.bukkit.inventory.ItemStack item)
    Helper method for getting AbstractCustomItem Instance from ItemStack.
    getOrThrow(@NotNull org.bukkit.NamespacedKey namespacedKey)
    Tries to get a registry entry by key or throws an IllegalArgumentException.
     
    void
    Registers a AbstractCustomItem Instance inside this registry.
    int
     
     
    void
    Registers a AbstractCustomItem Instance inside this registry.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface java.lang.Iterable

    forEach, spliterator

    Methods inherited from interface org.bukkit.Registry

    match
  • Constructor Details

    • CustomItemRegistry

      public CustomItemRegistry()
  • Method Details

    • register

      public void register(@NotNull @NotNull AbstractCustomItem item) throws IllegalArgumentException
      Registers a AbstractCustomItem Instance inside this registry.
      Throws:
      IllegalArgumentException - When this key already exists inside this registry
    • tryRegister

      public void tryRegister(@NotNull @NotNull AbstractCustomItem item)
      Registers a AbstractCustomItem Instance inside this registry. This method does not throw an Exception when the key already exists inside this registry.
    • get

      @Nullable public @Nullable AbstractCustomItem get(@Nullable @Nullable org.bukkit.NamespacedKey namespacedKey)
      Specified by:
      get in interface org.bukkit.Registry<AbstractCustomItem>
      Returns:
      AbstractCustomItem instance from the registry or null if not found
    • getFromItemStack

      @Nullable public @Nullable AbstractCustomItem getFromItemStack(@Nullable @Nullable org.bukkit.inventory.ItemStack item)
      Helper method for getting AbstractCustomItem Instance from ItemStack.
      Returns:
      The AbstractCustomItem instance represented inside the ItemStack or null if not found
    • getOrThrow

      @NotNull public @NotNull AbstractCustomItem getOrThrow(@NotNull @NotNull org.bukkit.NamespacedKey namespacedKey) throws IllegalArgumentException
      Tries to get a registry entry by key or throws an IllegalArgumentException.
      Specified by:
      getOrThrow in interface org.bukkit.Registry<AbstractCustomItem>
      Throws:
      IllegalArgumentException - When the given key does not exist inside the registry
    • stream

      @NotNull public @NotNull Stream<AbstractCustomItem> stream()
      Specified by:
      stream in interface org.bukkit.Registry<AbstractCustomItem>
    • iterator

      @NotNull public @NotNull Iterator<AbstractCustomItem> iterator()
      Specified by:
      iterator in interface Iterable<AbstractCustomItem>
    • contains

      public boolean contains(@NotNull @NotNull org.bukkit.NamespacedKey key)
    • size

      public int size()