From 073e8a0d891d1060a4c2cfadf4f63696153a6e8f Mon Sep 17 00:00:00 2001 From: Lixfel Date: Fri, 18 Dec 2020 23:08:57 +0100 Subject: [PATCH] Hotfix for forbidden item contents Signed-off-by: Lixfel --- .../fightsystem/listener/PersonalKitCreator_10.java | 7 +++++-- .../fightsystem/listener/PersonalKitCreator_12.java | 7 +++++-- .../fightsystem/listener/PersonalKitCreator_14.java | 7 +++++-- .../fightsystem/listener/PersonalKitCreator_15.java | 7 +++++-- .../fightsystem/listener/PersonalKitCreator_8.java | 7 +++++-- .../fightsystem/listener/PersonalKitCreator_9.java | 7 +++++-- 6 files changed, 30 insertions(+), 12 deletions(-) diff --git a/FightSystem_10/src/de/steamwar/fightsystem/listener/PersonalKitCreator_10.java b/FightSystem_10/src/de/steamwar/fightsystem/listener/PersonalKitCreator_10.java index 291a86a..0bf5938 100644 --- a/FightSystem_10/src/de/steamwar/fightsystem/listener/PersonalKitCreator_10.java +++ b/FightSystem_10/src/de/steamwar/fightsystem/listener/PersonalKitCreator_10.java @@ -22,12 +22,15 @@ package de.steamwar.fightsystem.listener; import org.bukkit.craftbukkit.v1_10_R1.inventory.CraftItemStack; import org.bukkit.inventory.ItemStack; +import java.util.HashSet; import java.util.Set; class PersonalKitCreator_10 { static boolean hasItems(ItemStack stack){ - Set keys = CraftItemStack.asNMSCopy(stack).getTag().c(); - return keys.size() > 1 || !keys.contains("Enchantments"); + Set keys = new HashSet<>(CraftItemStack.asNMSCopy(stack).getTag().c()); + keys.remove("Enchantments"); + keys.remove("Damage"); + return !keys.isEmpty(); } } diff --git a/FightSystem_12/src/de/steamwar/fightsystem/listener/PersonalKitCreator_12.java b/FightSystem_12/src/de/steamwar/fightsystem/listener/PersonalKitCreator_12.java index 74efa4f..ba74cd1 100644 --- a/FightSystem_12/src/de/steamwar/fightsystem/listener/PersonalKitCreator_12.java +++ b/FightSystem_12/src/de/steamwar/fightsystem/listener/PersonalKitCreator_12.java @@ -22,12 +22,15 @@ package de.steamwar.fightsystem.listener; import org.bukkit.craftbukkit.v1_12_R1.inventory.CraftItemStack; import org.bukkit.inventory.ItemStack; +import java.util.HashSet; import java.util.Set; class PersonalKitCreator_12 { static boolean hasItems(ItemStack stack){ - Set keys = CraftItemStack.asNMSCopy(stack).getTag().c(); - return keys.size() > 1 || !keys.contains("Enchantments"); + Set keys = new HashSet<>(CraftItemStack.asNMSCopy(stack).getTag().c()); + keys.remove("Enchantments"); + keys.remove("Damage"); + return !keys.isEmpty(); } } \ No newline at end of file diff --git a/FightSystem_14/src/de/steamwar/fightsystem/listener/PersonalKitCreator_14.java b/FightSystem_14/src/de/steamwar/fightsystem/listener/PersonalKitCreator_14.java index 61803ef..bbf665d 100644 --- a/FightSystem_14/src/de/steamwar/fightsystem/listener/PersonalKitCreator_14.java +++ b/FightSystem_14/src/de/steamwar/fightsystem/listener/PersonalKitCreator_14.java @@ -22,6 +22,7 @@ package de.steamwar.fightsystem.listener; import org.bukkit.craftbukkit.v1_14_R1.inventory.CraftItemStack; import org.bukkit.inventory.ItemStack; +import java.util.HashSet; import java.util.Objects; import java.util.Set; @@ -33,7 +34,9 @@ class PersonalKitCreator_14 { } static boolean hasItems(ItemStack stack){ - Set keys = CraftItemStack.asNMSCopy(stack).getTag().getKeys(); - return keys.size() > 1 || !keys.contains("Enchantments"); + Set keys = new HashSet<>(CraftItemStack.asNMSCopy(stack).getTag().getKeys()); + keys.remove("Enchantments"); + keys.remove("Damage"); + return !keys.isEmpty(); } } diff --git a/FightSystem_15/src/de/steamwar/fightsystem/listener/PersonalKitCreator_15.java b/FightSystem_15/src/de/steamwar/fightsystem/listener/PersonalKitCreator_15.java index ab7ba30..9eb6d42 100644 --- a/FightSystem_15/src/de/steamwar/fightsystem/listener/PersonalKitCreator_15.java +++ b/FightSystem_15/src/de/steamwar/fightsystem/listener/PersonalKitCreator_15.java @@ -22,12 +22,15 @@ package de.steamwar.fightsystem.listener; import org.bukkit.craftbukkit.v1_15_R1.inventory.CraftItemStack; import org.bukkit.inventory.ItemStack; +import java.util.HashSet; import java.util.Set; class PersonalKitCreator_15 { static boolean hasItems(ItemStack stack){ - Set keys = CraftItemStack.asNMSCopy(stack).getTag().getKeys(); - return keys.size() > 1 || !keys.contains("Enchantments"); + Set keys = new HashSet<>(CraftItemStack.asNMSCopy(stack).getTag().getKeys()); + keys.remove("Enchantments"); + keys.remove("Damage"); + return !keys.isEmpty(); } } diff --git a/FightSystem_8/src/de/steamwar/fightsystem/listener/PersonalKitCreator_8.java b/FightSystem_8/src/de/steamwar/fightsystem/listener/PersonalKitCreator_8.java index f1ba1a4..8f42599 100644 --- a/FightSystem_8/src/de/steamwar/fightsystem/listener/PersonalKitCreator_8.java +++ b/FightSystem_8/src/de/steamwar/fightsystem/listener/PersonalKitCreator_8.java @@ -22,12 +22,15 @@ package de.steamwar.fightsystem.listener; import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack; import org.bukkit.inventory.ItemStack; +import java.util.HashSet; import java.util.Set; class PersonalKitCreator_8 { static boolean hasItems(ItemStack stack){ - Set keys = CraftItemStack.asNMSCopy(stack).getTag().c(); - return keys.size() > 1 || !keys.contains("Enchantments"); + Set keys = new HashSet<>(CraftItemStack.asNMSCopy(stack).getTag().c()); + keys.remove("Enchantments"); + keys.remove("Damage"); + return !keys.isEmpty(); } } diff --git a/FightSystem_9/src/de/steamwar/fightsystem/listener/PersonalKitCreator_9.java b/FightSystem_9/src/de/steamwar/fightsystem/listener/PersonalKitCreator_9.java index 6cba31d..77b1002 100644 --- a/FightSystem_9/src/de/steamwar/fightsystem/listener/PersonalKitCreator_9.java +++ b/FightSystem_9/src/de/steamwar/fightsystem/listener/PersonalKitCreator_9.java @@ -22,12 +22,15 @@ package de.steamwar.fightsystem.listener; import org.bukkit.craftbukkit.v1_9_R2.inventory.CraftItemStack; import org.bukkit.inventory.ItemStack; +import java.util.HashSet; import java.util.Set; class PersonalKitCreator_9 { static boolean hasItems(ItemStack stack){ - Set keys = CraftItemStack.asNMSCopy(stack).getTag().c(); - return keys.size() > 1 || !keys.contains("Enchantments"); + Set keys = new HashSet<>(CraftItemStack.asNMSCopy(stack).getTag().c()); + keys.remove("Enchantments"); + keys.remove("Damage"); + return !keys.isEmpty(); } }