contents[last] = null;
}
// Check the remaining three of the four last slots for armor
for (int i = contents.length-1; i > contents.length-5; i--) {
if (contents[i] == null) continue;
ArmorType type = ArmorType.getType(contents[i]);
if (type == null || type == ArmorType.HELMET) continue;
switch (type) {
case CHESTPLATE: inv.setChestplate(contents[i]); break;
case LEGGINGS: inv.setLeggings(contents[i]); break;