Fix a new error for 1.17

This commit is contained in:
libraryaddict 2021-07-01 07:44:13 +12:00
parent cffa7591d9
commit afe4022920

View File

@ -16,6 +16,7 @@ import me.libraryaddict.disguise.disguisetypes.TargetedDisguise;
import me.libraryaddict.disguise.disguisetypes.watchers.*; import me.libraryaddict.disguise.disguisetypes.watchers.*;
import me.libraryaddict.disguise.events.DisguiseInteractEvent; import me.libraryaddict.disguise.events.DisguiseInteractEvent;
import me.libraryaddict.disguise.utilities.DisguiseUtilities; import me.libraryaddict.disguise.utilities.DisguiseUtilities;
import me.libraryaddict.disguise.utilities.reflection.NmsVersion;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Axolotl; import org.bukkit.entity.Axolotl;
@ -81,7 +82,14 @@ public class PacketListenerClientInteract extends PacketAdapter {
// The type of interact, we don't care the difference with "Interact_At" however as it's not // The type of interact, we don't care the difference with "Interact_At" however as it's not
// useful // useful
// for self disguises // for self disguises
EnumWrappers.EntityUseAction interactType = packet.getEntityUseActions().read(0); EnumWrappers.EntityUseAction interactType;
if (NmsVersion.v1_17.isSupported()) {
interactType = packet.getEnumEntityUseActions().read(0).getAction();
} else {
interactType = packet.getEntityUseActions().read(0);
}
final EquipmentSlot handUsed; final EquipmentSlot handUsed;
// Attack has a null hand, which throws an error if you attempt to fetch // Attack has a null hand, which throws an error if you attempt to fetch