From 48ee7819c67dac4c691a4ad42d8700afd2a06f9c Mon Sep 17 00:00:00 2001 From: Lixfel Date: Fri, 18 Dec 2020 22:36:27 +0100 Subject: [PATCH] Hotfix for forbidden item contents Signed-off-by: Lixfel --- .../steamwar/fightsystem/listener/PersonalKitCreator_10.java | 5 ++++- .../steamwar/fightsystem/listener/PersonalKitCreator_12.java | 5 ++++- .../steamwar/fightsystem/listener/PersonalKitCreator_14.java | 4 +++- .../steamwar/fightsystem/listener/PersonalKitCreator_15.java | 5 ++++- .../steamwar/fightsystem/listener/PersonalKitCreator_8.java | 5 ++++- .../steamwar/fightsystem/listener/PersonalKitCreator_9.java | 5 ++++- 6 files changed, 23 insertions(+), 6 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 69ed19f..291a86a 100644 --- a/FightSystem_10/src/de/steamwar/fightsystem/listener/PersonalKitCreator_10.java +++ b/FightSystem_10/src/de/steamwar/fightsystem/listener/PersonalKitCreator_10.java @@ -22,9 +22,12 @@ package de.steamwar.fightsystem.listener; import org.bukkit.craftbukkit.v1_10_R1.inventory.CraftItemStack; import org.bukkit.inventory.ItemStack; +import java.util.Set; + class PersonalKitCreator_10 { static boolean hasItems(ItemStack stack){ - return CraftItemStack.asNMSCopy(stack).getTag().hasKey("Items"); + Set keys = CraftItemStack.asNMSCopy(stack).getTag().c(); + return keys.size() > 1 || !keys.contains("Enchantments"); } } 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 9815305..74efa4f 100644 --- a/FightSystem_12/src/de/steamwar/fightsystem/listener/PersonalKitCreator_12.java +++ b/FightSystem_12/src/de/steamwar/fightsystem/listener/PersonalKitCreator_12.java @@ -22,9 +22,12 @@ package de.steamwar.fightsystem.listener; import org.bukkit.craftbukkit.v1_12_R1.inventory.CraftItemStack; import org.bukkit.inventory.ItemStack; +import java.util.Set; + class PersonalKitCreator_12 { static boolean hasItems(ItemStack stack){ - return CraftItemStack.asNMSCopy(stack).getTag().hasKey("Items"); + Set keys = CraftItemStack.asNMSCopy(stack).getTag().c(); + return keys.size() > 1 || !keys.contains("Enchantments"); } } \ 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 1f74777..61803ef 100644 --- a/FightSystem_14/src/de/steamwar/fightsystem/listener/PersonalKitCreator_14.java +++ b/FightSystem_14/src/de/steamwar/fightsystem/listener/PersonalKitCreator_14.java @@ -23,6 +23,7 @@ import org.bukkit.craftbukkit.v1_14_R1.inventory.CraftItemStack; import org.bukkit.inventory.ItemStack; import java.util.Objects; +import java.util.Set; class PersonalKitCreator_14 { private PersonalKitCreator_14(){} @@ -32,6 +33,7 @@ class PersonalKitCreator_14 { } static boolean hasItems(ItemStack stack){ - return CraftItemStack.asNMSCopy(stack).getTag().hasKey("Items"); + Set keys = CraftItemStack.asNMSCopy(stack).getTag().getKeys(); + return keys.size() > 1 || !keys.contains("Enchantments"); } } 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 f4fda19..ab7ba30 100644 --- a/FightSystem_15/src/de/steamwar/fightsystem/listener/PersonalKitCreator_15.java +++ b/FightSystem_15/src/de/steamwar/fightsystem/listener/PersonalKitCreator_15.java @@ -22,9 +22,12 @@ package de.steamwar.fightsystem.listener; import org.bukkit.craftbukkit.v1_15_R1.inventory.CraftItemStack; import org.bukkit.inventory.ItemStack; +import java.util.Set; + class PersonalKitCreator_15 { static boolean hasItems(ItemStack stack){ - return CraftItemStack.asNMSCopy(stack).getTag().hasKey("Items"); + Set keys = CraftItemStack.asNMSCopy(stack).getTag().getKeys(); + return keys.size() > 1 || !keys.contains("Enchantments"); } } 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 1a4c82e..f1ba1a4 100644 --- a/FightSystem_8/src/de/steamwar/fightsystem/listener/PersonalKitCreator_8.java +++ b/FightSystem_8/src/de/steamwar/fightsystem/listener/PersonalKitCreator_8.java @@ -22,9 +22,12 @@ package de.steamwar.fightsystem.listener; import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack; import org.bukkit.inventory.ItemStack; +import java.util.Set; + class PersonalKitCreator_8 { static boolean hasItems(ItemStack stack){ - return CraftItemStack.asNMSCopy(stack).getTag().hasKey("Items"); + Set keys = CraftItemStack.asNMSCopy(stack).getTag().c(); + return keys.size() > 1 || !keys.contains("Enchantments"); } } 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 8bfdf83..6cba31d 100644 --- a/FightSystem_9/src/de/steamwar/fightsystem/listener/PersonalKitCreator_9.java +++ b/FightSystem_9/src/de/steamwar/fightsystem/listener/PersonalKitCreator_9.java @@ -22,9 +22,12 @@ package de.steamwar.fightsystem.listener; import org.bukkit.craftbukkit.v1_9_R2.inventory.CraftItemStack; import org.bukkit.inventory.ItemStack; +import java.util.Set; + class PersonalKitCreator_9 { static boolean hasItems(ItemStack stack){ - return CraftItemStack.asNMSCopy(stack).getTag().hasKey("Items"); + Set keys = CraftItemStack.asNMSCopy(stack).getTag().c(); + return keys.size() > 1 || !keys.contains("Enchantments"); } }