diff options
author | Tyler Murphy <tylermurphy534@gmail.com> | 2022-08-18 13:43:57 -0400 |
---|---|---|
committer | Tyler Murphy <tylermurphy534@gmail.com> | 2022-08-18 13:43:57 -0400 |
commit | ed294714ac7c83666e1cc29bf0977f4767ae592c (patch) | |
tree | f4a4b903ee2720be41edcc47a6255e6c0baf8428 /src/main/java/net/tylermurphy/hideAndSeek/configuration/Items.java | |
parent | fix 1.8 generation (diff) | |
download | kenshinshideandseek-ed294714ac7c83666e1cc29bf0977f4767ae592c.tar.gz kenshinshideandseek-ed294714ac7c83666e1cc29bf0977f4767ae592c.tar.bz2 kenshinshideandseek-ed294714ac7c83666e1cc29bf0977f4767ae592c.zip |
Stop Game Items From Dropping
Diffstat (limited to 'src/main/java/net/tylermurphy/hideAndSeek/configuration/Items.java')
-rw-r--r-- | src/main/java/net/tylermurphy/hideAndSeek/configuration/Items.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Items.java b/src/main/java/net/tylermurphy/hideAndSeek/configuration/Items.java index dfdb197..06dbb99 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Items.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/configuration/Items.java @@ -21,6 +21,7 @@ package net.tylermurphy.hideAndSeek.configuration; import com.cryptomorin.xseries.XItemStack; import net.tylermurphy.hideAndSeek.Main; +import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.file.YamlConfiguration; @@ -129,4 +130,23 @@ public class Items { item.getBoolean("particles") ); } + + public static boolean matchItem(ItemStack stack){ + for(ItemStack check : HIDER_ITEMS) + if(equals(stack,check)) return true; + for(ItemStack check : SEEKER_ITEMS) + if(equals(stack,check)) return true; + return false; + } + + private static boolean equals(ItemStack a, ItemStack b) { + if (a == null) { + return false; + } else if (a == b) { + return true; + } else { + return a.getType() == b.getType() && a.hasItemMeta() == b.hasItemMeta() && (!a.hasItemMeta() || Bukkit.getItemFactory().equals(a.getItemMeta(), b.getItemMeta())); + } + } + } |