Fix ItemFrameListener with Item in ItemFrame
Dieser Commit ist enthalten in:
Ursprung
ca13e3236c
Commit
7eb8a4b53b
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren