diff --git a/BauSystem_API/src/de/steamwar/bausystem/SWUtils.java b/BauSystem_API/src/de/steamwar/bausystem/SWUtils.java index e5b2468..693cd1f 100644 --- a/BauSystem_API/src/de/steamwar/bausystem/SWUtils.java +++ b/BauSystem_API/src/de/steamwar/bausystem/SWUtils.java @@ -29,6 +29,14 @@ import java.util.List; public class SWUtils { public static void giveItemToPlayer(Player player, ItemStack itemStack) { + for (int i = 0; i < player.getInventory().getSize(); i++) { + ItemStack current = player.getInventory().getItem(i); + if (current != null && current.isSimilar(itemStack)) { + player.getInventory().setItem(i, null); + itemStack = current; + break; + } + } ItemStack current = player.getInventory().getItemInMainHand(); player.getInventory().setItemInMainHand(itemStack); if (current.getType() != Material.AIR) {