From 79db5978bd96943f3da51c2de24009b315cb163c Mon Sep 17 00:00:00 2001 From: Auxilor Date: Sat, 20 Jul 2024 15:14:32 +0100 Subject: [PATCH] Improved ItemTag --- .../java/com/willfp/eco/core/items/tag/ItemTag.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/eco-api/src/main/java/com/willfp/eco/core/items/tag/ItemTag.java b/eco-api/src/main/java/com/willfp/eco/core/items/tag/ItemTag.java index be86a050..66f72d20 100644 --- a/eco-api/src/main/java/com/willfp/eco/core/items/tag/ItemTag.java +++ b/eco-api/src/main/java/com/willfp/eco/core/items/tag/ItemTag.java @@ -1,6 +1,7 @@ package com.willfp.eco.core.items.tag; import com.willfp.eco.core.items.TestableItem; +import org.bukkit.Material; import org.bukkit.inventory.ItemStack; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -30,8 +31,10 @@ public interface ItemTag { * * @return The example item. */ - @NotNull - ItemStack getExampleItem(); + @Nullable + default ItemStack getExampleItem() { + return null; + } /** * Convert this tag to a testable item. @@ -48,7 +51,8 @@ public boolean matches(@Nullable final ItemStack itemStack) { @Override public @NotNull ItemStack getItem() { - return ItemTag.this.getExampleItem(); + ItemStack example = ItemTag.this.getExampleItem(); + return example == null ? new ItemStack(Material.STONE) : example; } @Override