Class CustomItemRegistry
java.lang.Object
net.mathias2246.buildmc.api.item.CustomItemRegistry
- All Implemented Interfaces:
Iterable<AbstractCustomItem>,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 -
Method Summary
Modifier and TypeMethodDescriptionbooleancontains(@NotNull org.bukkit.NamespacedKey key) @Nullable AbstractCustomItemget(@Nullable org.bukkit.NamespacedKey namespacedKey) @Nullable AbstractCustomItemgetFromItemStack(@Nullable org.bukkit.inventory.ItemStack item) Helper method for getting AbstractCustomItem Instance from ItemStack.@NotNull AbstractCustomItemgetOrThrow(@NotNull org.bukkit.NamespacedKey namespacedKey) Tries to get a registry entry by key or throws an IllegalArgumentException.@NotNull Iterator<AbstractCustomItem> iterator()voidregister(@NotNull AbstractCustomItem item) Registers a AbstractCustomItem Instance inside this registry.intsize()@NotNull Stream<AbstractCustomItem> stream()voidtryRegister(@NotNull AbstractCustomItem item) Registers a AbstractCustomItem Instance inside this registry.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface org.bukkit.Registry
match
-
Constructor Details
-
CustomItemRegistry
public CustomItemRegistry()
-
-
Method Details
-
register
Registers a AbstractCustomItem Instance inside this registry.- Throws:
IllegalArgumentException- When this key already exists inside this registry
-
tryRegister
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:
getin interfaceorg.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:
getOrThrowin interfaceorg.bukkit.Registry<AbstractCustomItem>- Throws:
IllegalArgumentException- When the given key does not exist inside the registry
-
stream
- Specified by:
streamin interfaceorg.bukkit.Registry<AbstractCustomItem>
-
iterator
- Specified by:
iteratorin interfaceIterable<AbstractCustomItem>
-
contains
public boolean contains(@NotNull @NotNull org.bukkit.NamespacedKey key) -
size
public int size()
-