Fixed array size exception with armor slot

This commit is contained in:
libraryaddict 2013-11-27 11:40:38 +13:00
parent 16c9fca4d9
commit be3712ccd0

View File

@ -868,7 +868,7 @@ public class PacketsManager {
int slot = event.getPacket().getIntegers().read(0); int slot = event.getPacket().getIntegers().read(0);
if (slot >= 5 && slot <= 8) { if (slot >= 5 && slot <= 8) {
if (disguise.isHidingArmorFromSelf()) { if (disguise.isHidingArmorFromSelf()) {
int armorSlot = Math.abs(slot - 9); int armorSlot = Math.abs((slot - 5) - 3);
org.bukkit.inventory.ItemStack item = event.getPlayer().getInventory().getArmorContents()[armorSlot]; org.bukkit.inventory.ItemStack item = event.getPlayer().getInventory().getArmorContents()[armorSlot];
if (item != null && item.getType() != Material.AIR) { if (item != null && item.getType() != Material.AIR) {
PacketContainer packet = new PacketContainer(Packets.Server.SET_SLOT); PacketContainer packet = new PacketContainer(Packets.Server.SET_SLOT);