Skip to content

Commit

Permalink
Improved ItemTag
Browse files Browse the repository at this point in the history
  • Loading branch information
WillFP committed Jul 20, 2024
1 parent 0f11f98 commit 79db597
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions eco-api/src/main/java/com/willfp/eco/core/items/tag/ItemTag.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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.
Expand All @@ -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
Expand Down

0 comments on commit 79db597

Please sign in to comment.