-
Notifications
You must be signed in to change notification settings - Fork 18
Icons
Hamza Coşkun edited this page Sep 22, 2022
·
12 revisions
Icons are all item stacks shown on GUI.
Icon icon = new Icon(new ItemStack(Material.STONE));
//or
Icon icon = new Icon(Material.STONE);
icon.setName("");
icon.setLore(stringArrayList);
//or
icon.setLore("1st line", "2nd line");
icon.appendLore("3th line");
icon.insertLore(0, "0th line");
icon.setAmount(64);
icon.hideFlags(ItemFlag.HIDE_ENCHANTS);
//or all flags
icon.hideFlags();
icon.enchant(Enchantment.ARROW_DAMAGE); //supports enchanted book enchantments
//or
icon.enchant(Enchantment.ARROW_DAMAGE, 2);
//or
icon.enchant(enchantmentsMap);
icon.setDurability(10);
icon.onClick(event -> {
player.sendMessage("you clicked to an icon.");
});
icon.onDrag(event -> {
player.sendMessage("you dragged an icon.");
});
Each line has same function. Puts a dysfunctional stone icon to 0. slot of GUI.
addItem(0, Material.STONE);
addItem(0, new ItemStack(Material.STONE));
addItem(0, new Icon(new ItemStack(Material.STONE)));
addItem(0, new Icon(Material.STONE));
Fill Methods
fillGui(new ItemStack(Material.BLACK_STAINED_GLASS_PANE));
fillGui(new Icon(Material.BLACK_STAINED_GLASS_PANE), 10,11,12); // fills all GUI except 10., 11. and 12. slots.
fillColumn(new Icon(Material.BLACK_STAINED_GLASS_PANE), 0); // column numbers are starting from 0.
fillRow(new Icon(Material.BLACK_STAINED_GLASS_PANE), 0); // row numbers are starting from 0.
Icon methods returns the object again. This is means you can make that:
new Icon(Material.STONE).setName("Stone").setLore("it is a special stone").setAmount(10);