diff --git a/FightSystem_10/src/de/steamwar/fightsystem/listener/PersonalKitCreator_10.java b/FightSystem_10/src/de/steamwar/fightsystem/listener/PersonalKitCreator_10.java
new file mode 100644
index 0000000..69ed19f
--- /dev/null
+++ b/FightSystem_10/src/de/steamwar/fightsystem/listener/PersonalKitCreator_10.java
@@ -0,0 +1,30 @@
+/*
+ This file is a part of the SteamWar software.
+
+ Copyright (C) 2020 SteamWar.de-Serverteam
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see .
+*/
+
+package de.steamwar.fightsystem.listener;
+
+import org.bukkit.craftbukkit.v1_10_R1.inventory.CraftItemStack;
+import org.bukkit.inventory.ItemStack;
+
+class PersonalKitCreator_10 {
+
+ static boolean hasItems(ItemStack stack){
+ return CraftItemStack.asNMSCopy(stack).getTag().hasKey("Items");
+ }
+}
diff --git a/FightSystem_12/src/de/steamwar/fightsystem/listener/PersonalKitCreator_12.java b/FightSystem_12/src/de/steamwar/fightsystem/listener/PersonalKitCreator_12.java
new file mode 100644
index 0000000..9815305
--- /dev/null
+++ b/FightSystem_12/src/de/steamwar/fightsystem/listener/PersonalKitCreator_12.java
@@ -0,0 +1,30 @@
+/*
+ This file is a part of the SteamWar software.
+
+ Copyright (C) 2020 SteamWar.de-Serverteam
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see .
+*/
+
+package de.steamwar.fightsystem.listener;
+
+import org.bukkit.craftbukkit.v1_12_R1.inventory.CraftItemStack;
+import org.bukkit.inventory.ItemStack;
+
+class PersonalKitCreator_12 {
+
+ static boolean hasItems(ItemStack stack){
+ return CraftItemStack.asNMSCopy(stack).getTag().hasKey("Items");
+ }
+}
\ 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 f635870..1f74777 100644
--- a/FightSystem_14/src/de/steamwar/fightsystem/listener/PersonalKitCreator_14.java
+++ b/FightSystem_14/src/de/steamwar/fightsystem/listener/PersonalKitCreator_14.java
@@ -19,6 +19,7 @@
package de.steamwar.fightsystem.listener;
+import org.bukkit.craftbukkit.v1_14_R1.inventory.CraftItemStack;
import org.bukkit.inventory.ItemStack;
import java.util.Objects;
@@ -29,4 +30,8 @@ class PersonalKitCreator_14 {
static boolean hasAttributeModifier(ItemStack stack){
return stack.hasItemMeta() && Objects.requireNonNull(stack.getItemMeta()).hasAttributeModifiers();
}
+
+ static boolean hasItems(ItemStack stack){
+ return CraftItemStack.asNMSCopy(stack).getTag().hasKey("Items");
+ }
}
diff --git a/FightSystem_15/src/de/steamwar/fightsystem/listener/PersonalKitCreator_15.java b/FightSystem_15/src/de/steamwar/fightsystem/listener/PersonalKitCreator_15.java
new file mode 100644
index 0000000..f4fda19
--- /dev/null
+++ b/FightSystem_15/src/de/steamwar/fightsystem/listener/PersonalKitCreator_15.java
@@ -0,0 +1,30 @@
+/*
+ This file is a part of the SteamWar software.
+
+ Copyright (C) 2020 SteamWar.de-Serverteam
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see .
+*/
+
+package de.steamwar.fightsystem.listener;
+
+import org.bukkit.craftbukkit.v1_15_R1.inventory.CraftItemStack;
+import org.bukkit.inventory.ItemStack;
+
+class PersonalKitCreator_15 {
+
+ static boolean hasItems(ItemStack stack){
+ return CraftItemStack.asNMSCopy(stack).getTag().hasKey("Items");
+ }
+}
diff --git a/FightSystem_8/src/de/steamwar/fightsystem/listener/PersonalKitCreator_8.java b/FightSystem_8/src/de/steamwar/fightsystem/listener/PersonalKitCreator_8.java
new file mode 100644
index 0000000..1a4c82e
--- /dev/null
+++ b/FightSystem_8/src/de/steamwar/fightsystem/listener/PersonalKitCreator_8.java
@@ -0,0 +1,30 @@
+/*
+ This file is a part of the SteamWar software.
+
+ Copyright (C) 2020 SteamWar.de-Serverteam
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see .
+*/
+
+package de.steamwar.fightsystem.listener;
+
+import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack;
+import org.bukkit.inventory.ItemStack;
+
+class PersonalKitCreator_8 {
+
+ static boolean hasItems(ItemStack stack){
+ return CraftItemStack.asNMSCopy(stack).getTag().hasKey("Items");
+ }
+}
diff --git a/FightSystem_9/src/de/steamwar/fightsystem/listener/PersonalKitCreator_9.java b/FightSystem_9/src/de/steamwar/fightsystem/listener/PersonalKitCreator_9.java
new file mode 100644
index 0000000..8bfdf83
--- /dev/null
+++ b/FightSystem_9/src/de/steamwar/fightsystem/listener/PersonalKitCreator_9.java
@@ -0,0 +1,30 @@
+/*
+ This file is a part of the SteamWar software.
+
+ Copyright (C) 2020 SteamWar.de-Serverteam
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see .
+*/
+
+package de.steamwar.fightsystem.listener;
+
+import org.bukkit.craftbukkit.v1_9_R2.inventory.CraftItemStack;
+import org.bukkit.inventory.ItemStack;
+
+class PersonalKitCreator_9 {
+
+ static boolean hasItems(ItemStack stack){
+ return CraftItemStack.asNMSCopy(stack).getTag().hasKey("Items");
+ }
+}
diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/listener/PersonalKitCreator.java b/FightSystem_Main/src/de/steamwar/fightsystem/listener/PersonalKitCreator.java
index 104fa81..c89e924 100644
--- a/FightSystem_Main/src/de/steamwar/fightsystem/listener/PersonalKitCreator.java
+++ b/FightSystem_Main/src/de/steamwar/fightsystem/listener/PersonalKitCreator.java
@@ -42,6 +42,8 @@ import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
+import org.bukkit.inventory.meta.BlockDataMeta;
+import org.bukkit.inventory.meta.ItemMeta;
import java.util.EnumSet;
import java.util.HashMap;
@@ -160,11 +162,38 @@ public class PersonalKitCreator extends BasicListener {
return true;
}
+ if(stack.hasItemMeta()){
+ ItemMeta meta = stack.getItemMeta();
+ if(meta instanceof BlockDataMeta && ((BlockDataMeta)meta).hasBlockData())
+ return true; //Blocks always upwards slabs etc.
+
+ if(hasItems(stack))
+ return true; //Blocks prefilled inventories
+ }
+
Kit normal = KitManager.getKitByName(Config.MemberDefault);
assert normal != null;
return !normal.isEnchantmentInKit(stack) && !stack.getEnchantments().isEmpty();
}
+ private static boolean hasItems(ItemStack stack){
+ switch(Core.getVersion()){
+ case 8:
+ return PersonalKitCreator_8.hasItems(stack);
+ case 9:
+ return PersonalKitCreator_9.hasItems(stack);
+ case 10:
+ return PersonalKitCreator_10.hasItems(stack);
+ case 12:
+ return PersonalKitCreator_12.hasItems(stack);
+ case 14:
+ return PersonalKitCreator_14.hasItems(stack);
+ case 15:
+ default:
+ return PersonalKitCreator_15.hasItems(stack);
+ }
+ }
+
private static class InventoryBackup{
private final Player player;
private final ItemStack[] contents;