mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 22:56:45 +01:00
Fix deaths from skeletons showing health bars (#4483)
* Fix deaths from skeletons showing health bars * Ignore human attackers
This commit is contained in:
parent
56f9341f8e
commit
e7978a6ad9
@ -121,8 +121,21 @@ public class PlayerListener implements Listener {
|
|||||||
// we only care about players as this is for fixing player death messages
|
// we only care about players as this is for fixing player death messages
|
||||||
if (!(event.getEntity() instanceof Player))
|
if (!(event.getEntity() instanceof Player))
|
||||||
return;
|
return;
|
||||||
if (!(event.getDamager() instanceof LivingEntity))
|
Player player = (Player) event.getEntity();
|
||||||
|
|
||||||
|
// get the attacker
|
||||||
|
LivingEntity attacker;
|
||||||
|
if (event.getDamager() instanceof LivingEntity)
|
||||||
|
attacker = (LivingEntity) event.getDamager();
|
||||||
|
// attempt to find creator of a projectile
|
||||||
|
else if (event.getDamager() instanceof Projectile && ((Projectile) event.getDamager()).getShooter() instanceof LivingEntity)
|
||||||
|
attacker = (LivingEntity) ((Projectile) event.getDamager()).getShooter();
|
||||||
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (attacker instanceof HumanEntity)
|
||||||
|
return;
|
||||||
|
|
||||||
// world blacklist check
|
// world blacklist check
|
||||||
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
||||||
return;
|
return;
|
||||||
@ -130,9 +143,6 @@ public class PlayerListener implements Listener {
|
|||||||
if (WorldGuardUtils.isWorldGuardLoaded() && !WorldGuardManager.getInstance().hasMainFlag((Player) event.getEntity()))
|
if (WorldGuardUtils.isWorldGuardLoaded() && !WorldGuardManager.getInstance().hasMainFlag((Player) event.getEntity()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Player player = (Player) event.getEntity();
|
|
||||||
LivingEntity attacker = (LivingEntity) event.getDamager();
|
|
||||||
|
|
||||||
// we only want to handle player deaths
|
// we only want to handle player deaths
|
||||||
if ((player.getHealth() - event.getFinalDamage()) > 0)
|
if ((player.getHealth() - event.getFinalDamage()) > 0)
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user