Fix inability to change setEnraged, setAI and setMainHand to false

This commit is contained in:
libraryaddict 2021-07-25 20:42:10 +12:00
parent 8007cdd706
commit 46b4b21feb
2 changed files with 1 additions and 11 deletions

View File

@ -2,7 +2,6 @@ package me.libraryaddict.disguise.disguisetypes.watchers;
import me.libraryaddict.disguise.disguisetypes.Disguise; import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.MetaIndex; 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.NmsAddedIn;
import me.libraryaddict.disguise.utilities.reflection.NmsVersion; import me.libraryaddict.disguise.utilities.reflection.NmsVersion;
import org.bukkit.inventory.MainHand; import org.bukkit.inventory.MainHand;
@ -34,7 +33,7 @@ public class InsentientWatcher extends LivingWatcher {
if (flag) { if (flag) {
setData(MetaIndex.INSENTIENT_META, (byte) (b0 | i)); setData(MetaIndex.INSENTIENT_META, (byte) (b0 | i));
} else { } else {
setData(MetaIndex.INSENTIENT_META, (byte) (b0 & i)); setData(MetaIndex.INSENTIENT_META, (byte) (b0 & -(i + 1)));
} }
sendData(MetaIndex.INSENTIENT_META); sendData(MetaIndex.INSENTIENT_META);
@ -56,12 +55,5 @@ public class InsentientWatcher extends LivingWatcher {
} }
setInsentientFlag(4, enraged); setInsentientFlag(4, enraged);
if (!getDisguise().isDisguiseInUse() || enraged) {
return;
}
// TODO Check if a less hacky fix is possible
DisguiseUtilities.refreshTrackers(getDisguise());
} }
} }

View File

@ -3,7 +3,6 @@ package me.libraryaddict.disguise.utilities.packets.packetlisteners;
import com.comphenix.protocol.PacketType; import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.ProtocolLibrary; import com.comphenix.protocol.ProtocolLibrary;
import com.comphenix.protocol.events.PacketAdapter; import com.comphenix.protocol.events.PacketAdapter;
import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.events.PacketEvent; import com.comphenix.protocol.events.PacketEvent;
import me.libraryaddict.disguise.DisguiseAPI; import me.libraryaddict.disguise.DisguiseAPI;
import me.libraryaddict.disguise.disguisetypes.Disguise; import me.libraryaddict.disguise.disguisetypes.Disguise;
@ -13,7 +12,6 @@ import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;
import java.util.List; import java.util.List;
/** /**