diff options
author | Tyler Murphy <tylermurphy534@gmail.com> | 2022-08-18 14:59:26 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-18 14:59:26 -0400 |
commit | 87a859a5db050112d38bcdc8eb42f46f681c5f18 (patch) | |
tree | 0c43d08dc6fc6d3c23aca21a330db25e193dd0a9 /src/main/java/net/tylermurphy/hideAndSeek/configuration | |
parent | Merge pull request #76 from tylermurphy534/1.6.1 (diff) | |
parent | fix pom (diff) | |
download | kenshinshideandseek-87a859a5db050112d38bcdc8eb42f46f681c5f18.tar.gz kenshinshideandseek-87a859a5db050112d38bcdc8eb42f46f681c5f18.tar.bz2 kenshinshideandseek-87a859a5db050112d38bcdc8eb42f46f681c5f18.zip |
Merge pull request #81 from tylermurphy534/1.6.2
1.6.2
Diffstat (limited to 'src/main/java/net/tylermurphy/hideAndSeek/configuration')
-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())); + } + } + } |