From e8021e81e65c376a49bacb2e2234d5d9f3a1c6c7 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Sat, 21 Mar 2020 20:24:40 -0700 Subject: [PATCH] move namefix to monitor --- pom.xml | 2 +- .../nossr50/listeners/EntityListener.java | 26 ++++++++++--------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/pom.xml b/pom.xml index 76358cb19..dc4eb55bf 100755 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.gmail.nossr50.mcMMO mcMMO - 2.1.125 + 2.1.126-SNAPSHOT mcMMO https://github.com/mcMMO-Dev/mcMMO diff --git a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java index b49e4c91b..5b79227ba 100644 --- a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java @@ -410,6 +410,7 @@ public class EntityListener implements Listener { } } + /* * This was put here to solve a plugin conflict with a mod called Project Korra * Project Korra sends out a damage event with exactly 0 damage @@ -425,20 +426,21 @@ public class EntityListener implements Listener { CombatUtils.processCombatAttack(event, attacker, target); CombatUtils.handleHealthbars(attacker, target, event.getFinalDamage(), plugin); + } - /** - * This sets entity names back to whatever they are supposed to be - */ - if(event.getFinalDamage() >= target.getHealth()) - { - if(attacker instanceof LivingEntity) - { - CombatUtils.fixNames((LivingEntity) attacker); + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = false) + public void onEntityDamageMonitor(EntityDamageByEntityEvent entityDamageEvent) { + if(entityDamageEvent.getEntity() instanceof LivingEntity) { + LivingEntity livingEntity = (LivingEntity) entityDamageEvent.getEntity(); + + if(entityDamageEvent.getFinalDamage() >= livingEntity.getHealth()) { + + /* + * This sets entity names back to whatever they are supposed to be + */ + CombatUtils.fixNames(livingEntity); + } } - - CombatUtils.fixNames(target); - } - } public boolean checkParties(Cancellable event, Player defendingPlayer, Player attackingPlayer) {