From 6ef8ef8f329e0d2eca9e2cb165516eb9120e87f6 Mon Sep 17 00:00:00 2001 From: Soper Date: Sun, 9 May 2021 04:44:51 -0400 Subject: [PATCH] added shell check method --- src/xyz/soper/arty/item/Shell.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/xyz/soper/arty/item/Shell.java b/src/xyz/soper/arty/item/Shell.java index 3ce1dbd..4acc69c 100644 --- a/src/xyz/soper/arty/item/Shell.java +++ b/src/xyz/soper/arty/item/Shell.java @@ -1,5 +1,7 @@ package xyz.soper.arty.item; +import org.bukkit.ChatColor; +import org.bukkit.Material; import org.bukkit.inventory.ItemStack; import java.util.List; @@ -33,4 +35,17 @@ public class Shell { this.failChance = failChance; } + /** + * Checks if the item stack is a shell + * @param item ItemStack to check against + * @return True if item is an arrow with a gray name "Shell" + */ + public static boolean isShell(ItemStack item){ + if(item.getType() == Material.ARROW + && item.hasItemMeta() + && item.getItemMeta().hasDisplayName() + && item.getItemMeta().getDisplayName().equals(ChatColor.GRAY + "Shell")) return true; + return false; + } + }