diff --git a/Server/src/main/java/core/game/node/entity/combat/ImpactHandler.java b/Server/src/main/java/core/game/node/entity/combat/ImpactHandler.java index f173c4ed7..46fe57c21 100644 --- a/Server/src/main/java/core/game/node/entity/combat/ImpactHandler.java +++ b/Server/src/main/java/core/game/node/entity/combat/ImpactHandler.java @@ -19,6 +19,7 @@ import java.util.HashMap; import java.util.LinkedList; import java.util.Map; import java.util.Queue; +import java.util.stream.Collectors; /** * Class used for handling combat impacts. @@ -262,6 +263,15 @@ public final class ImpactHandler { return impactLog; } + /** + * Gets the impact log filtered for Player objects + * @return The impact log of each Player and their damage + */ + public Map getPlayerImpactLog() { + return impactLog.entrySet().stream().filter(entry -> entry.getKey() instanceof Player).collect( + Collectors.toMap(m -> m.getKey().asPlayer(), m -> m.getValue())); + } + /** * Checks if the entity needs a hit update. * @return {@code True} if so. diff --git a/Server/src/main/java/core/game/node/entity/npc/NPC.java b/Server/src/main/java/core/game/node/entity/npc/NPC.java index 6bb1b1add..1ee2fafb5 100644 --- a/Server/src/main/java/core/game/node/entity/npc/NPC.java +++ b/Server/src/main/java/core/game/node/entity/npc/NPC.java @@ -38,6 +38,8 @@ import rs09.game.system.config.ShopParser; import rs09.game.world.GameWorld; import rs09.game.world.repository.Repository; +import java.util.Map; + import static rs09.game.node.entity.player.info.stats.StatAttributeKeysKt.STATS_BASE; import static rs09.game.node.entity.player.info.stats.StatAttributeKeysKt.STATS_ENEMIES_KILLED; @@ -543,7 +545,7 @@ public class NPC extends Entity { if (getAttribute("disable:drop", false)) { return; } - if (killer instanceof Player && p != null && p.getIronmanManager().isIronman() && getImpactHandler().getImpactLog().size() > 1) { + if (killer instanceof Player && p != null && p.getIronmanManager().isIronman() && getImpactHandler().getPlayerImpactLog().size() > 1) { return; } if (definition == null || definition.getDropTables() == null) {