Skip to content

Commit 5a5e29c

Browse files
committed
ignore CUSTOM damage causes
1 parent 05200f0 commit 5a5e29c

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
<groupId>lol.hyper</groupId>
2525
<artifactId>toolstats</artifactId>
26-
<version>1.4.4</version>
26+
<version>1.4.5</version>
2727
<packaging>jar</packaging>
2828

2929
<name>ToolStats</name>

src/main/java/lol/hyper/toolstats/events/EntityDamage.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public class EntityDamage implements Listener {
3939

4040
private final ToolStats toolStats;
4141
public final Set<UUID> trackedMobs = new HashSet<>();
42+
private final List<EntityDamageEvent.DamageCause> ignoredCauses = Arrays.asList(EntityDamageEvent.DamageCause.SUICIDE, EntityDamageEvent.DamageCause.VOID, EntityDamageEvent.DamageCause.CUSTOM);
4243

4344
public EntityDamage(ToolStats toolStats) {
4445
this.toolStats = toolStats;
@@ -57,7 +58,7 @@ public void onDamage(EntityDamageByEntityEvent event) {
5758

5859
// ignore void and /kill damage
5960
EntityDamageEvent.DamageCause cause = event.getCause();
60-
if (cause == EntityDamageEvent.DamageCause.SUICIDE || cause == EntityDamageEvent.DamageCause.VOID) {
61+
if (ignoredCauses.contains(cause)) {
6162
return;
6263
}
6364

@@ -152,7 +153,7 @@ public void onDamage(EntityDamageEvent event) {
152153

153154
// ignore void and /kill damage
154155
EntityDamageEvent.DamageCause cause = event.getCause();
155-
if (cause == EntityDamageEvent.DamageCause.SUICIDE || cause == EntityDamageEvent.DamageCause.VOID) {
156+
if (ignoredCauses.contains(cause)) {
156157
return;
157158
}
158159

@@ -182,7 +183,7 @@ public void onDamage(EntityDamageByBlockEvent event) {
182183

183184
// ignore void and /kill damage
184185
EntityDamageEvent.DamageCause cause = event.getCause();
185-
if (cause == EntityDamageEvent.DamageCause.SUICIDE || cause == EntityDamageEvent.DamageCause.VOID) {
186+
if (ignoredCauses.contains(cause)) {
186187
return;
187188
}
188189

0 commit comments

Comments
 (0)