Java Code Examples for org.bukkit.Material#WRITABLE_BOOK
The following examples show how to use
org.bukkit.Material#WRITABLE_BOOK .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CommandHandler.java From NyaaUtils with MIT License | 6 votes |
@SubCommand(value = "setbookunsigned", permission = "nu.setbook") public void setbookunsigned(CommandSender sender, Arguments args) { Player p = asPlayer(sender); ItemStack item = p.getInventory().getItemInMainHand(); if (item == null || !item.getType().equals(Material.WRITTEN_BOOK)) { msg(sender, "user.setbook.no_book"); return; } BookMeta meta = (BookMeta) item.getItemMeta(); ItemStack newbook = new ItemStack(Material.WRITABLE_BOOK, 1); BookMeta newbookMeta = (BookMeta) newbook.getItemMeta(); newbookMeta.setPages(meta.getPages()); newbook.setItemMeta(newbookMeta); p.getInventory().setItemInMainHand(newbook); msg(sender, "user.setbook.success"); }
Example 2
Source File: SkyBlockMenu.java From uSkyBlock with GNU General Public License v3.0 | 6 votes |
public Inventory displayLogGUI(final Player player) { List<String> lores = new ArrayList<>(); String title = "\u00a79" + tr("Island Log"); Inventory menu = Bukkit.createInventory(new UltimateHolder(player, title, MenuType.DEFAULT), 9, title); ItemMeta meta4 = sign.getItemMeta(); meta4.setDisplayName("\u00a79\u00a7l" + tr("Island Log")); addLore(lores, tr("\u00a7eClick here to return to\n\u00a7ethe main island screen.")); meta4.setLore(lores); sign.setItemMeta(meta4); menu.addItem(new ItemStack[]{sign}); lores.clear(); ItemStack menuItem = new ItemStack(Material.WRITABLE_BOOK, 1); meta4 = menuItem.getItemMeta(); meta4.setDisplayName(tr("\u00a7e\u00a7lIsland Log")); for (String log : plugin.getIslandInfo(player).getLog()) { lores.add(log); } meta4.setLore(lores); menuItem.setItemMeta(meta4); menu.setItem(8, menuItem); lores.clear(); return menu; }
Example 3
Source File: MainConfigMenu.java From uSkyBlock with GNU General Public License v3.0 | 5 votes |
private ItemStack getCurrentMenu(InventoryClickEvent event) { int index = 0; ItemStack currentMenu = event.getInventory().getItem(index); while (currentMenu != null && currentMenu.getType() != Material.WRITABLE_BOOK) { index += 9; currentMenu = event.getInventory().getItem(index); } return currentMenu; }
Example 4
Source File: SkyBlockMenu.java From uSkyBlock with GNU General Public License v3.0 | 4 votes |
private void onClickMainMenu(InventoryClickEvent event, ItemStack currentItem, Player p, int slotIndex) { event.setCancelled(true); if (slotIndex < 0 || slotIndex > 35) { return; } PlayerInfo playerInfo = plugin.getPlayerInfo(p); IslandInfo islandInfo = plugin.getIslandInfo(playerInfo); if (currentItem.getType() == Material.JUNGLE_SAPLING) { p.closeInventory(); p.performCommand("island biome"); } else if (currentItem.getType() == Material.PLAYER_HEAD) { p.closeInventory(); p.performCommand("island party"); } else if (currentItem.getType() == Material.RED_BED) { p.closeInventory(); p.performCommand("island sethome"); p.performCommand("island"); } else if (currentItem.getType() == Material.GRASS) { p.closeInventory(); p.performCommand("island spawn"); } else if (currentItem.getType() == Material.HOPPER) { p.closeInventory(); p.performCommand("island setwarp"); p.performCommand("island"); } else if (currentItem.getType() == Material.WRITABLE_BOOK) { p.closeInventory(); p.performCommand("island log"); } else if (currentItem.getType() == Material.OAK_DOOR) { p.closeInventory(); p.performCommand("island home"); } else if (currentItem.getType() == Material.EXPERIENCE_BOTTLE) { p.closeInventory(); p.performCommand("island level"); } else if (currentItem.getType() == Material.DIAMOND_ORE) { p.closeInventory(); p.performCommand("c"); } else if (currentItem.getType() == Material.END_STONE || currentItem.getType() == Material.END_PORTAL_FRAME) { p.closeInventory(); p.performCommand("island togglewarp"); p.performCommand("island"); } else if (currentItem.getType() == Material.IRON_BARS && islandInfo.isLocked()) { p.closeInventory(); p.performCommand("island unlock"); p.performCommand("island"); } else if (currentItem.getType() == Material.IRON_BARS && !islandInfo.isLocked()) { p.closeInventory(); p.performCommand("island lock"); p.performCommand("island"); } else if (slotIndex == 17) { if (islandInfo.isLeader(p) && plugin.getConfig().getBoolean("island-schemes-enabled", true)) { p.closeInventory(); p.openInventory(createRestartGUI(p)); } else { if (plugin.getConfirmHandler().millisLeft(p, "/is leave") > 0) { p.closeInventory(); p.performCommand("island leave"); } else { p.performCommand("island leave"); updateLeaveMenuItemTimer(p, event.getInventory(), currentItem); } } } else { if (!isExtraMenuAction(p, currentItem)) { p.closeInventory(); p.performCommand("island"); } } }