/** * @see Server#createInventory(InventoryHolder owner, int size, String * title) */ public static Inventory createInventory(InventoryHolder owner, int size, String title) throws IllegalArgumentException { return server.createInventory(owner, size, title); }
/** * @see Server#createInventory(InventoryHolder owner, InventoryType type) */ public static Inventory createInventory(InventoryHolder owner, InventoryType type) { return server.createInventory(owner, type); }
/** * @see Server#createInventory(InventoryHolder owner, InventoryType type, String title) */ public static Inventory createInventory(InventoryHolder owner, InventoryType type, String title) { return server.createInventory(owner, type, title); }
/** * @see Server#createInventory(InventoryHolder owner, int size) */ public static Inventory createInventory(InventoryHolder owner, int size) throws IllegalArgumentException { return server.createInventory(owner, size); }
/** * @see Server#createInventory(InventoryHolder owner, InventoryType type, String title) */ public static Inventory createInventory(InventoryHolder owner, InventoryType type, String title) { return server.createInventory(owner, type, title); }
/** * @see Server#createInventory(InventoryHolder owner, int size, String * title) */ public static Inventory createInventory(InventoryHolder owner, int size, String title) throws IllegalArgumentException { return server.createInventory(owner, size, title); }
/** * @see Server#createInventory(InventoryHolder owner, int size) */ public static Inventory createInventory(InventoryHolder owner, int size) throws IllegalArgumentException { return server.createInventory(owner, size); }
/** * @see Server#createInventory(InventoryHolder owner, InventoryType type) */ public static Inventory createInventory(InventoryHolder owner, InventoryType type) { return server.createInventory(owner, type); }
public static Inventory decodeInventory(byte[] buf, String title) { try (ByteArrayInputStream inputStream = new ByteArrayInputStream(buf)) { try (BukkitObjectInputStream dataInput = new BukkitObjectInputStream(inputStream)) { Inventory inventory = Bukkit.getServer().createInventory(null, dataInput.readInt(), title); for (int i = 0; i < inventory.getSize(); i++) { inventory.setItem(i, (ItemStack) dataInput.readObject()); } return inventory; } } catch (ClassNotFoundException | IOException e) { throw new RuntimeException(e); } }
public static Inventory decodeInventory(byte[] buf, String title) { try (ByteArrayInputStream inputStream = new ByteArrayInputStream(buf)) { try (BukkitObjectInputStream dataInput = new BukkitObjectInputStream(inputStream)) { Inventory inventory = Bukkit.getServer().createInventory(null, dataInput.readInt(), title); for (int i = 0; i < inventory.getSize(); i++) { inventory.setItem(i, (ItemStack) dataInput.readObject()); } return inventory; } } catch (ClassNotFoundException | IOException e) { throw new RuntimeException(e); } }
private void openActivate(Player p) { ItemStack[] items = new TARDISSonicActivatorInventory(plugin).getActivator(); Inventory sgc = plugin.getServer().createInventory(p, 9, ChatColor.DARK_RED + "Sonic Activator"); sgc.setContents(items); p.openInventory(sgc); }
public static Inventory fromBase64(String data) { try { ByteArrayInputStream inputStream = new ByteArrayInputStream(Base64Coder.decodeLines(data)); BukkitObjectInputStream dataInput = new BukkitObjectInputStream(inputStream); Inventory inventory = Bukkit.getServer().createInventory(null, dataInput.readInt()); // Read the serialized inventory for (int i = 0; i < inventory.getSize(); i++) { inventory.setItem(i, (ItemStack) dataInput.readObject()); } dataInput.close(); return inventory; } catch (Exception e) { } return null; }
private void list(Player player) { ResultSetTardisCompanions rs = new ResultSetTardisCompanions(plugin); if (rs.fromUUID(player.getUniqueId().toString())) { String comps = rs.getCompanions(); close(player); plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () -> { ItemStack[] items = new TARDISCompanionInventory(plugin, comps.split(":")).getSkulls(); Inventory cominv = plugin.getServer().createInventory(player, 54, ChatColor.DARK_RED + "Companions"); cominv.setContents(items); player.openInventory(cominv); }, 2L); } }
boolean doAddGUI(Player player) { if (player.hasPermission("tardis.add")) { ItemStack[] items = new TARDISCompanionAddInventory(plugin, player.getUniqueId()).getPlayers(); Inventory presetinv = plugin.getServer().createInventory(player, 54, ChatColor.DARK_RED + "Add Companion"); presetinv.setContents(items); player.openInventory(presetinv); } else { TARDISMessage.send(player, "NO_PERMS"); } return true; }
@Override public void run() { TARDISRegulatorInventory reg = new TARDISRegulatorInventory(); ItemStack[] items = reg.getRegulator(); Inventory inv = plugin.getServer().createInventory(player, 54, "Helmic Regulator"); inv.setContents(items); player.openInventory(inv); // play inflight sound if (!plugin.getTrackerKeeper().getDestinationVortex().containsKey(id)) { plugin.getServer().getScheduler().runTask(plugin, new TARDISLoopingFlightSound(plugin, player.getLocation(), id)); } } }
/** * Closes the inventory and opens the Wall block selector menu. * * @param p the player using the GUI */ private void floor(Player p) { plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () -> { p.closeInventory(); ItemStack[] wall_blocks = new TARDISWallsInventory(plugin).getMenu(); Inventory wall = plugin.getServer().createInventory(p, 54, ChatColor.DARK_RED + "TARDIS Floor Menu"); wall.setContents(wall_blocks); p.openInventory(wall); }, 1L); }
/** * Closes the inventory and opens the archive consoles menu. * * @param p the player using the GUI */ private void archive(Player p) { plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () -> { p.closeInventory(); ItemStack[] archive = new TARDISArchiveInventory(plugin, p).getArchives(); Inventory menu = plugin.getServer().createInventory(p, 27, ChatColor.DARK_RED + "TARDIS Archive"); menu.setContents(archive); p.openInventory(menu); }, 1L); }
/** * Goes back to the seeds menu. * * @param p the player using the GUI */ private void back(Player p) { close(p); plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () -> { ItemStack[] seeds = new TARDISSeedsInventory(p).getMenu(); Inventory gui = plugin.getServer().createInventory(p, 27, ChatColor.DARK_RED + "TARDIS Seeds Menu"); gui.setContents(seeds); p.openInventory(gui); }, 2L); }
/** * Closes the inventory and opens the Wall block selector menu. * * @param p the player using the GUI */ private void wall(Player p) { plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () -> { p.closeInventory(); ItemStack[] wall_blocks = new TARDISWallsInventory(plugin).getMenu(); Inventory wall = plugin.getServer().createInventory(p, 54, ChatColor.DARK_RED + "TARDIS Wall Menu"); wall.setContents(wall_blocks); p.openInventory(wall); }, 1L); }
/** * Goes back to the seeds menu. * * @param p the player using the GUI */ private void back(Player p) { close(p); plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () -> { ItemStack[] seeds = new TARDISSeedsInventory(p).getMenu(); Inventory gui = plugin.getServer().createInventory(p, 27, ChatColor.DARK_RED + "TARDIS Seeds Menu"); gui.setContents(seeds); p.openInventory(gui); }, 2L); }