public void applyInventory(final BattlePlayer p) { Inventory i = p.getInventory(); ItemStack HEALTH_POTION = new ItemStack(Material.POTION, 1, (short) 16373); ItemStack IRON_SWORD = new ItemStack(Material.IRON_SWORD, 1); ItemStack BOW = new ItemStack(Material.BOW, 1); ItemStack IRON_PICKAXE = new ItemStack(Material.IRON_PICKAXE, 1); ItemStack STONE_AXE = new ItemStack(Material.STONE_AXE, 1); ItemStack LEATHER_CHESTPLATE = new ItemStack(Material.LEATHER_CHESTPLATE, 1); ItemStack LEATHER_BOOTS = new ItemStack(Material.LEATHER_BOOTS, 1); ItemStack LEATHER_HELMET = new ItemStack(Material.LEATHER_HELMET, 1); ItemStack LEATHER_PANTS = new ItemStack(Material.LEATHER_LEGGINGS, 1); ItemStack COOKED_PORKCHOP = new ItemStack(Material.COOKED_BEEF, 4); ItemStack BIRCH_LOG = new ItemStack(Material.LOG, 64); ItemStack ARROW = new ItemStack(Material.ARROW, 64); InvUtils.colourArmourAccordingToTeam( p, new ItemStack[] {LEATHER_HELMET, LEATHER_CHESTPLATE, LEATHER_BOOTS, LEATHER_PANTS}); p.getInventory().setBoots(LEATHER_BOOTS); p.getInventory().setLeggings(LEATHER_PANTS); p.getInventory().setChestplate(LEATHER_CHESTPLATE); p.getInventory().setHelmet(LEATHER_HELMET); i.setItem(0, IRON_SWORD); i.setItem(1, BOW); i.setItem(5, HEALTH_POTION); i.setItem(2, IRON_PICKAXE); i.setItem(3, STONE_AXE); i.setItem(5, COOKED_PORKCHOP); i.setItem(6, BIRCH_LOG); i.setItem(11, ARROW); }
public static void renameInventory( final Player player, final Inventory inventory, final String title) { try { final Object iinv = InventoryUtil.iinvField.get(inventory); InventoryUtil.titleField.set(iinv, title); final Object handle = InventoryUtil.handleField.get(player); final Integer containerCounter = (Integer) InventoryUtil.containerCounterField.get(handle); final Object playerConnection = InventoryUtil.playerConnectionField.get(handle); final Object packet = InventoryUtil.openWindowPacketConstructor.newInstance( containerCounter, 0, title, inventory.getSize(), false); InventoryUtil.sendPacket.invoke(playerConnection, packet); } catch (Exception ex) { } }