From 46b4b21feb3657c8ad2906f2d83b95b4072c112f Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Sun, 25 Jul 2021 20:42:10 +1200 Subject: [PATCH] Fix inability to change setEnraged, setAI and setMainHand to false --- .../disguisetypes/watchers/InsentientWatcher.java | 10 +--------- .../packetlisteners/PacketListenerEntityDestroy.java | 2 -- 2 files changed, 1 insertion(+), 11 deletions(-) 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 2c4cd935..5f2c6ba4 100644 --- a/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/InsentientWatcher.java +++ b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/InsentientWatcher.java @@ -2,7 +2,6 @@ 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; @@ -34,7 +33,7 @@ public class InsentientWatcher extends LivingWatcher { if (flag) { setData(MetaIndex.INSENTIENT_META, (byte) (b0 | i)); } else { - setData(MetaIndex.INSENTIENT_META, (byte) (b0 & i)); + setData(MetaIndex.INSENTIENT_META, (byte) (b0 & -(i + 1))); } sendData(MetaIndex.INSENTIENT_META); @@ -56,12 +55,5 @@ public class InsentientWatcher extends LivingWatcher { } setInsentientFlag(4, enraged); - - if (!getDisguise().isDisguiseInUse() || enraged) { - return; - } - - // TODO Check if a less hacky fix is possible - DisguiseUtilities.refreshTrackers(getDisguise()); } } diff --git a/src/main/java/me/libraryaddict/disguise/utilities/packets/packetlisteners/PacketListenerEntityDestroy.java b/src/main/java/me/libraryaddict/disguise/utilities/packets/packetlisteners/PacketListenerEntityDestroy.java index c428b575..ff03b360 100644 --- a/src/main/java/me/libraryaddict/disguise/utilities/packets/packetlisteners/PacketListenerEntityDestroy.java +++ b/src/main/java/me/libraryaddict/disguise/utilities/packets/packetlisteners/PacketListenerEntityDestroy.java @@ -3,7 +3,6 @@ package me.libraryaddict.disguise.utilities.packets.packetlisteners; import com.comphenix.protocol.PacketType; import com.comphenix.protocol.ProtocolLibrary; import com.comphenix.protocol.events.PacketAdapter; -import com.comphenix.protocol.events.PacketContainer; import com.comphenix.protocol.events.PacketEvent; import me.libraryaddict.disguise.DisguiseAPI; import me.libraryaddict.disguise.disguisetypes.Disguise; @@ -13,7 +12,6 @@ import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; import java.lang.reflect.InvocationTargetException; -import java.util.Arrays; import java.util.List; /**