From a6586e07cc4e0cc216db0bd22a0ea81d35cb5d8e Mon Sep 17 00:00:00 2001 From: nossr50 Date: Mon, 5 Oct 2020 14:13:32 -0700 Subject: [PATCH] final damage values of 0 are only ignored in certain circumstances, fixes a few bugs --- Changelog.txt | 1 + .../com/gmail/nossr50/listeners/EntityListener.java | 3 +-- .../com/gmail/nossr50/util/skills/CombatUtils.java | 12 ++++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index 9f84c51b0..03dbf644e 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,4 +1,5 @@ Version 2.1.148 + Fixed a bug where weakness potions could prevent unarmed skills from activating and thus making unarmed useless Alchemy progression is now more reasonable (delete skillranks.yml or edit it yourself to receive the change) NOTES: diff --git a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java index a462d598b..89339cc8c 100644 --- a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java @@ -411,7 +411,6 @@ public class EntityListener implements Listener { } } - /* * This was put here to solve a plugin conflict with a mod called Project Korra * Project Korra sends out a damage event with exactly 0 damage @@ -421,7 +420,7 @@ public class EntityListener implements Listener { * Surprising this kind of thing * */ - if(damage <= 0) { + if(event.getDamage() <= 0 && !CombatUtils.isDamageLikelyFromNormalCombat(event.getCause())) { return; } diff --git a/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java b/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java index 67ff06589..501d9571c 100644 --- a/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java +++ b/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java @@ -42,6 +42,18 @@ import java.util.Map; public final class CombatUtils { private CombatUtils() {} + //Likely.. because who knows what plugins are throwing around + public static boolean isDamageLikelyFromNormalCombat(DamageCause damageCause) { + switch (damageCause) { + case ENTITY_ATTACK: + case ENTITY_SWEEP_ATTACK: + case PROJECTILE: + return true; + default: + return false; + } + } + private static void processSwordCombat(LivingEntity target, Player player, EntityDamageByEntityEvent event) { if (event.getCause() == DamageCause.THORNS) { return;