PlayerInventory.getSize should not count armor slots.

By: Erik Broes <erikbroes@grum.nl>
This commit is contained in:
CraftBukkit/Spigot 2011-01-10 00:41:22 +01:00
parent 87747a1304
commit 76cc515db3

View File

@ -25,39 +25,43 @@ public class CraftInventoryPlayer extends CraftInventory implements PlayerInvent
return items; return items;
} }
public int getSize() {
return super.getSize() - 4;
}
public CraftItemStack getItemInHand() { public CraftItemStack getItemInHand() {
return new CraftItemStack( getInventory().e() ); return new CraftItemStack( getInventory().e() );
} }
public CraftItemStack getHelmet() { public CraftItemStack getHelmet() {
return getItem( getSize() - 4 ); return getItem( getSize() + 0 );
} }
public CraftItemStack getChestplate() { public CraftItemStack getChestplate() {
return getItem( getSize() - 3 ); return getItem( getSize() + 1 );
} }
public CraftItemStack getLeggings() { public CraftItemStack getLeggings() {
return getItem( getSize() - 2 ); return getItem( getSize() + 2 );
} }
public CraftItemStack getBoots() { public CraftItemStack getBoots() {
return getItem( getSize() - 1 ); return getItem( getSize() + 3 );
} }
public void setHelmet(ItemStack helmet) { public void setHelmet(ItemStack helmet) {
setItem( getSize() - 4, helmet ); setItem( getSize() + 0, helmet );
} }
public void setChestplate(ItemStack chestplate) { public void setChestplate(ItemStack chestplate) {
setItem( getSize() - 3, chestplate ); setItem( getSize() + 1, chestplate );
} }
public void setLeggings(ItemStack leggings) { public void setLeggings(ItemStack leggings) {
setItem( getSize() - 2, leggings ); setItem( getSize() + 2, leggings );
} }
public void setBoots(ItemStack boots) { public void setBoots(ItemStack boots) {
setItem( getSize() - 1, boots ); setItem( getSize() + 3, boots );
} }
} }