mirror of
https://github.com/hyperdefined/ToolStats.git
synced 2026-01-30 01:01:04 +00:00
better handling of /kill
apparently minecraft:kill runs in multiple entity damage events?
This commit is contained in:
@@ -49,6 +49,7 @@ public class EntityDamage implements Listener {
|
|||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(event.getEntity() instanceof LivingEntity)) {
|
if (!(event.getEntity() instanceof LivingEntity)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -148,6 +149,13 @@ public class EntityDamage implements Listener {
|
|||||||
if (!(event.getEntity() instanceof LivingEntity)) {
|
if (!(event.getEntity() instanceof LivingEntity)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ignore void and /kill damage
|
||||||
|
EntityDamageEvent.DamageCause cause = event.getCause();
|
||||||
|
if (cause == EntityDamageEvent.DamageCause.SUICIDE || cause == EntityDamageEvent.DamageCause.VOID) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
LivingEntity livingEntity = (LivingEntity) event.getEntity();
|
LivingEntity livingEntity = (LivingEntity) event.getEntity();
|
||||||
// player is taken damage but not being killed
|
// player is taken damage but not being killed
|
||||||
if (livingEntity instanceof Player) {
|
if (livingEntity instanceof Player) {
|
||||||
@@ -171,6 +179,13 @@ public class EntityDamage implements Listener {
|
|||||||
if (!(event.getEntity() instanceof LivingEntity)) {
|
if (!(event.getEntity() instanceof LivingEntity)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ignore void and /kill damage
|
||||||
|
EntityDamageEvent.DamageCause cause = event.getCause();
|
||||||
|
if (cause == EntityDamageEvent.DamageCause.SUICIDE || cause == EntityDamageEvent.DamageCause.VOID) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
LivingEntity livingEntity = (LivingEntity) event.getEntity();
|
LivingEntity livingEntity = (LivingEntity) event.getEntity();
|
||||||
// player is taken damage but not being killed
|
// player is taken damage but not being killed
|
||||||
if (livingEntity instanceof Player) {
|
if (livingEntity instanceof Player) {
|
||||||
|
|||||||
Reference in New Issue
Block a user