diff --git a/BauSystem_Main/src/de/steamwar/bausystem/world/ItemFrameListener.java b/BauSystem_Main/src/de/steamwar/bausystem/world/ItemFrameListener.java index eefcd23..a8c9618 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/world/ItemFrameListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/world/ItemFrameListener.java @@ -20,11 +20,13 @@ package de.steamwar.bausystem.world; import de.steamwar.bausystem.SWUtils; +import org.bukkit.Material; import org.bukkit.entity.ItemFrame; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.inventory.ItemStack; public class ItemFrameListener implements Listener { @@ -38,8 +40,13 @@ public class ItemFrameListener implements Listener { } event.setCancelled(true); ItemFrame itemFrame = (ItemFrame) event.getEntity(); - SWUtils.giveItemToPlayer((Player) event.getDamager(), itemFrame.getItem()); - itemFrame.remove(); + ItemStack itemStack = itemFrame.getItem(); + if (itemStack.getType() != Material.AIR) { + SWUtils.giveItemToPlayer((Player) event.getDamager(), itemFrame.getItem()); + itemFrame.setItem(null); + } else { + itemFrame.remove(); + } } }