move namefix to monitor

This commit is contained in:
nossr50 2020-03-21 20:24:40 -07:00
parent 8fc3643803
commit e8021e81e6
2 changed files with 15 additions and 13 deletions

View File

@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.gmail.nossr50.mcMMO</groupId>
<artifactId>mcMMO</artifactId>
<version>2.1.125</version>
<version>2.1.126-SNAPSHOT</version>
<name>mcMMO</name>
<url>https://github.com/mcMMO-Dev/mcMMO</url>
<scm>

View File

@ -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) {