From 8cb6f1d901c3747dd63e978b9ac21c48f613c950 Mon Sep 17 00:00:00 2001 From: Luca Date: Wed, 24 Nov 2021 20:08:45 +0100 Subject: [PATCH] Update WorldListener.java --- .../tilly/bedwars/listeners/game/WorldListener.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/java/rip/tilly/bedwars/listeners/game/WorldListener.java b/src/main/java/rip/tilly/bedwars/listeners/game/WorldListener.java index 13be7cf..7d4b6bc 100644 --- a/src/main/java/rip/tilly/bedwars/listeners/game/WorldListener.java +++ b/src/main/java/rip/tilly/bedwars/listeners/game/WorldListener.java @@ -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