minecraft plugin make inventory code example
Example 1: spigot how to make an inventory
Inventory inv = Bukkit.createInventory(player, yourSize, "My Inventory Name");
Example 2: bukkit creating an inventory window
IconMenu menu = new IconMenu("My Fancy Menu", 9, new IconMenu.OptionClickEventHandler() {
@Override
public void onOptionClick(IconMenu.OptionClickEvent event) {
event.getPlayer().sendMessage("You have chosen " + event.getName());
event.setWillClose(true);
}
}, plugin)
.setOption(3, new ItemStack(Material.APPLE, 1), "Food", "The food is delicious")
.setOption(4, new ItemStack(Material.IRON_SWORD, 1), "Weapon", "Weapons are for awesome people")
.setOption(5, new ItemStack(Material.EMERALD, 1), "Money", "Money brings happiness");