From 687f47e22e8b648dad7689a32b954576d6327728 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Fri, 9 Oct 2020 11:00:49 +1300 Subject: [PATCH] Messy fix for setEnraged, fixes #506 --- .../disguisetypes/watchers/InsentientWatcher.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/InsentientWatcher.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/InsentientWatcher.java index d5f2d45a..502db190 100644 --- a/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/InsentientWatcher.java +++ b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/InsentientWatcher.java @@ -2,6 +2,7 @@ package me.libraryaddict.disguise.disguisetypes.watchers; import me.libraryaddict.disguise.disguisetypes.Disguise; import me.libraryaddict.disguise.disguisetypes.MetaIndex; +import me.libraryaddict.disguise.utilities.DisguiseUtilities; import me.libraryaddict.disguise.utilities.reflection.NmsAddedIn; import me.libraryaddict.disguise.utilities.reflection.NmsVersion; import org.bukkit.inventory.MainHand; @@ -50,6 +51,15 @@ public class InsentientWatcher extends LivingWatcher { @NmsAddedIn(NmsVersion.v1_14) public void setEnraged(boolean enraged) { + if (hasValue(MetaIndex.INSENTIENT_META) && getInsentientFlag(4) == enraged) { + return; + } + setInsentientFlag(4, enraged); + + // TODO Check if a less hacky fix is possible + if (!enraged) { + DisguiseUtilities.refreshTrackers(getDisguise()); + } } }