File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
src/main/java/lol/hyper/toolstats/events Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ public void onDamage(EntityDamageByEntityEvent event) {
4949 if (event .isCancelled ()) {
5050 return ;
5151 }
52+
5253 if (!(event .getEntity () instanceof LivingEntity )) {
5354 return ;
5455 }
@@ -148,6 +149,13 @@ public void onDamage(EntityDamageEvent event) {
148149 if (!(event .getEntity () instanceof LivingEntity )) {
149150 return ;
150151 }
152+
153+ // ignore void and /kill damage
154+ EntityDamageEvent .DamageCause cause = event .getCause ();
155+ if (cause == EntityDamageEvent .DamageCause .SUICIDE || cause == EntityDamageEvent .DamageCause .VOID ) {
156+ return ;
157+ }
158+
151159 LivingEntity livingEntity = (LivingEntity ) event .getEntity ();
152160 // player is taken damage but not being killed
153161 if (livingEntity instanceof Player ) {
@@ -171,6 +179,13 @@ public void onDamage(EntityDamageByBlockEvent event) {
171179 if (!(event .getEntity () instanceof LivingEntity )) {
172180 return ;
173181 }
182+
183+ // ignore void and /kill damage
184+ EntityDamageEvent .DamageCause cause = event .getCause ();
185+ if (cause == EntityDamageEvent .DamageCause .SUICIDE || cause == EntityDamageEvent .DamageCause .VOID ) {
186+ return ;
187+ }
188+
174189 LivingEntity livingEntity = (LivingEntity ) event .getEntity ();
175190 // player is taken damage but not being killed
176191 if (livingEntity instanceof Player ) {
You can’t perform that action at this time.
0 commit comments