mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
Reset mob healthbars on death to avoid conflicting with loot plugins
This commit is contained in:
parent
0ea07d4bc7
commit
3f7b17961f
@ -323,6 +323,30 @@ public class EntityListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Monitor EntityDeath events.
|
||||||
|
*
|
||||||
|
* @param event The event to watch
|
||||||
|
*/
|
||||||
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
|
public void onEntityDeathLowest(EntityDeathEvent event) {
|
||||||
|
LivingEntity entity = event.getEntity();
|
||||||
|
|
||||||
|
if (Misc.isNPCEntity(entity)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (entity.hasMetadata(mcMMO.customNameKey)) {
|
||||||
|
entity.setCustomName(entity.getMetadata(mcMMO.customNameKey).get(0).asString());
|
||||||
|
entity.removeMetadata(mcMMO.customNameKey, mcMMO.p);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (entity.hasMetadata(mcMMO.customVisibleKey)) {
|
||||||
|
entity.setCustomNameVisible(entity.getMetadata(mcMMO.customVisibleKey).get(0).asBoolean());
|
||||||
|
entity.removeMetadata(mcMMO.customVisibleKey, mcMMO.p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Monitor EntityDeath events.
|
* Monitor EntityDeath events.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user