Update WorldListener.java

This commit is contained in:
Luca 2021-11-24 20:08:45 +01:00
parent bb2bba9a30
commit 8cb6f1d901

View File

@ -215,9 +215,16 @@ public class WorldListener implements Listener {
return;
}
ItemStack itemStack = event.getItemDrop().getItemStack();
Item item = event.getItemDrop();
ItemStack itemStack = item.getItemStack();
String name = itemStack.getType().name();
if (name.endsWith("_SWORD") || name.endsWith("_AXE") || name.endsWith("_PICKAXE") || name.contains("SHEARS")) {
event.setCancelled(true);
return;
}
game.getDroppedItems().add(itemStack);
game.addEntityToRemove(event.getItemDrop());
game.addEntityToRemove(item);
}
@EventHandler