From cdc495e62b25bc4366e0d8777cc3d9d6ebd6056b Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Mon, 21 Sep 2020 13:09:45 +0200 Subject: [PATCH] Fixes #2325 --- CHANGELOG.md | 1 + .../listeners/TalismanListener.java | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e4c7aa28..f30ddf444 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,7 @@ * Fixed Cheat Sheet Slimefun Guide being unable to open the settings menu via shift + right click * Fixed #2320 * Fixed some issues with ChestTerminal +* Fixed #2325 ## Release Candidate 16 (07 Sep 2020) https://thebusybiscuit.github.io/builds/TheBusyBiscuit/Slimefun4/stable/#16 diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java index e757d2872..df17d39e0 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java @@ -133,11 +133,19 @@ public class TalismanListener implements Listener { LivingEntity entity = e.getEntity(); - if (!(entity instanceof Player) && !(entity instanceof ArmorStand) && Talisman.checkFor(e, SlimefunItems.TALISMAN_HUNTER)) { + if (entity instanceof Player || entity instanceof ArmorStand) { + // We absolutely don't want to double the + // drops from players or ArmorStands + return; + } + + // We are also excluding entities which can pickup items, this is not perfect + // but it at least prevents dupes by tossing items to zombies + if (!entity.getCanPickupItems() && Talisman.checkFor(e, SlimefunItems.TALISMAN_HUNTER)) { Collection extraDrops = getExtraDrops(e.getEntity(), e.getDrops()); for (ItemStack drop : extraDrops) { - if (drop != null) { + if (drop != null && drop.getType() != Material.AIR) { e.getDrops().add(drop.clone()); } } @@ -163,7 +171,10 @@ public class TalismanListener implements Listener { } } - // Prevent duplication of handheld items or armor + // WARNING: This check is broken as entities now set their + // equipment to NULL before calling the event! + + // Prevents duplication of handheld items or armor EntityEquipment equipment = entity.getEquipment(); if (equipment != null) { for (ItemStack item : equipment.getArmorContents()) {