Don't hide Elytra Wings in self disguises

This commit is contained in:
libraryaddict 2019-03-05 18:01:43 +13:00
parent 09d4a3b90f
commit 3ae785fb35

View File

@ -62,7 +62,7 @@ public class PacketListenerInventory extends PacketAdapter {
org.bukkit.inventory.ItemStack item = player.getInventory().getArmorContents()[armorSlot]; org.bukkit.inventory.ItemStack item = player.getInventory().getArmorContents()[armorSlot];
if (item != null && item.getType() != Material.AIR) { if (item != null && item.getType() != Material.AIR && item.getType() != Material.ELYTRA) {
PacketContainer packet = new PacketContainer(Server.SET_SLOT); PacketContainer packet = new PacketContainer(Server.SET_SLOT);
StructureModifier<Object> mods = packet.getModifier(); StructureModifier<Object> mods = packet.getModifier();
@ -185,7 +185,7 @@ public class PacketListenerInventory extends PacketAdapter {
clickedItem = player.getItemOnCursor(); clickedItem = player.getItemOnCursor();
} }
if (clickedItem != null && clickedItem.getType() != Material.AIR) { if (clickedItem != null && clickedItem.getType() != Material.AIR && clickedItem.getType() != Material.ELYTRA) {
// If the slot is a armor slot // If the slot is a armor slot
if (slot >= 5 && slot <= 8) { if (slot >= 5 && slot <= 8) {
if (disguise.isHidingArmorFromSelf()) { if (disguise.isHidingArmorFromSelf()) {
@ -272,7 +272,7 @@ public class PacketListenerInventory extends PacketAdapter {
org.bukkit.inventory.ItemStack item = player.getInventory().getArmorContents()[armorSlot]; org.bukkit.inventory.ItemStack item = player.getInventory().getArmorContents()[armorSlot];
if (item != null && item.getType() != Material.AIR) { if (item != null && item.getType() != Material.AIR && item.getType() != Material.ELYTRA) {
event.setPacket(event.getPacket().shallowClone()); event.setPacket(event.getPacket().shallowClone());
event.getPacket().getModifier().write(2, event.getPacket().getModifier().write(2,
@ -312,7 +312,7 @@ public class PacketListenerInventory extends PacketAdapter {
ItemStack item = player.getInventory().getArmorContents()[armorSlot]; ItemStack item = player.getInventory().getArmorContents()[armorSlot];
if (item != null && item.getType() != Material.AIR) { if (item != null && item.getType() != Material.AIR && item.getType() != Material.ELYTRA) {
items.set(slot, new ItemStack(Material.AIR)); items.set(slot, new ItemStack(Material.AIR));
} }
} }