fix for older MC versions

fixes #81
This commit is contained in:
hyperdefined
2024-10-05 18:37:51 -04:00
parent 6385814b52
commit 7fe0234785
2 changed files with 9 additions and 10 deletions

View File

@@ -39,7 +39,7 @@ public class EntityDamage implements Listener {
private final ToolStats toolStats; private final ToolStats toolStats;
public final Set<UUID> trackedMobs = new HashSet<>(); public final Set<UUID> trackedMobs = new HashSet<>();
private final List<EntityDamageEvent.DamageCause> ignoredCauses = Arrays.asList(EntityDamageEvent.DamageCause.SUICIDE, EntityDamageEvent.DamageCause.VOID, EntityDamageEvent.DamageCause.CUSTOM, EntityDamageEvent.DamageCause.KILL); private final List<String> ignoredDamageCauses = Arrays.asList("SUICIDE", "VOID", "CUSTOM", "KILL");
public EntityDamage(ToolStats toolStats) { public EntityDamage(ToolStats toolStats) {
this.toolStats = toolStats; this.toolStats = toolStats;
@@ -57,8 +57,8 @@ public class EntityDamage implements Listener {
LivingEntity mobBeingAttacked = (LivingEntity) event.getEntity(); LivingEntity mobBeingAttacked = (LivingEntity) event.getEntity();
// ignore void and /kill damage // ignore void and /kill damage
EntityDamageEvent.DamageCause cause = event.getCause(); String cause = event.getCause().toString().toUpperCase();
if (ignoredCauses.contains(cause)) { if (ignoredDamageCauses.contains(cause)) {
return; return;
} }
@@ -166,8 +166,8 @@ public class EntityDamage implements Listener {
} }
// ignore void and /kill damage // ignore void and /kill damage
EntityDamageEvent.DamageCause cause = event.getCause(); String cause = event.getCause().toString().toUpperCase();
if (ignoredCauses.contains(cause)) { if (ignoredDamageCauses.contains(cause)) {
return; return;
} }
@@ -196,8 +196,8 @@ public class EntityDamage implements Listener {
} }
// ignore void and /kill damage // ignore void and /kill damage
EntityDamageEvent.DamageCause cause = event.getCause(); String cause = event.getCause().toString().toUpperCase();
if (ignoredCauses.contains(cause)) { if (ignoredDamageCauses.contains(cause)) {
return; return;
} }

View File

@@ -64,15 +64,14 @@ public class SheepShear implements Listener {
return; return;
} }
Sheep sheep = (Sheep) entity;
// make sure the sheep is not sheared // make sure the sheep is not sheared
Sheep sheep = (Sheep) entity;
if (sheep.isSheared()) { if (sheep.isSheared()) {
return; return;
} }
// update the stats // update the stats
ItemStack finalShears = shears; addLore(shears);
addLore(finalShears);
} }
private static @Nullable ItemStack getShears(Player player) { private static @Nullable ItemStack getShears(Player player) {