package mc.hpk.network.ojInventory; import mc.hpk.network.Main; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.block.Action; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.SkullMeta; import java.util.Collections; public class ojMenu implements Listener { private final String menuName2 = ChatColor.YELLOW + "Select the jump " + ChatColor.DARK_GRAY + "[" + ChatColor.GRAY + "Right-Click" + ChatColor.DARK_GRAY + "]"; private final String DisplayName = ChatColor.AQUA + "" + ChatColor.BOLD + "OneJump Menu"; private final String basicName = ChatColor.YELLOW + "" + ChatColor.BOLD + "Basic Jumps"; private final String UbiquitousName = ChatColor.AQUA + "" + ChatColor.BOLD + "Ubiquitous Jumps"; private final String rotateName = ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "Rotation Jumps"; private final String ojlName = ChatColor.GOLD + "" + ChatColor.BOLD + "Squidyerser's OJL"; public Inventory ojMenu1 = Bukkit.createInventory(null, 54, "OneJump Menu"); private final Main plugin; public ojMenu(Main plugin) { this.plugin = plugin; } @EventHandler public void openOJMenu(PlayerInteractEvent event) { Player player = event.getPlayer(); Action action = event.getAction(); if (player.getItemInHand() == null) return; if (player.getItemInHand().getItemMeta() == null) return; if (player.getItemInHand().getItemMeta().getDisplayName() == null) return; if (action.equals(Action.RIGHT_CLICK_BLOCK) || action.equals(Action.RIGHT_CLICK_AIR)) { if (player.getItemInHand().getItemMeta().getDisplayName().equals(menuName2)) { ItemStack blank1 = new ItemStack(Material.STAINED_GLASS_PANE, 1, (byte) 15); ItemMeta blankMeta1 = blank1.getItemMeta(); blankMeta1.setDisplayName(" "); blank1.setItemMeta(blankMeta1); ItemStack blank2 = new ItemStack(Material.STAINED_GLASS_PANE, 1, (byte) 7); ItemMeta blankMeta2 = blank2.getItemMeta(); blankMeta2.setDisplayName(" "); blank2.setItemMeta(blankMeta2); ItemStack nameDisplay = new ItemStack(Material.DIAMOND, 1); ItemMeta displayMeta = nameDisplay.getItemMeta(); displayMeta.setDisplayName(DisplayName); nameDisplay.setItemMeta(displayMeta); ItemStack basicJump = new ItemStack(Material.CHEST, 1); ItemMeta basicMeta = basicJump.getItemMeta(); basicMeta.setDisplayName(basicName); basicMeta.setLore(Collections.singletonList(ChatColor.GRAY + "Includes very historical and original jumps.")); basicJump.setItemMeta(basicMeta); ItemStack UbiquitousJump = new ItemStack(Material.ENDER_CHEST, 1); ItemMeta ubiquitousMeta = UbiquitousJump.getItemMeta(); ubiquitousMeta.setDisplayName(UbiquitousName); ubiquitousMeta.setLore(Collections.singletonList(ChatColor.GRAY + "Includes widely known jumps.")); UbiquitousJump.setItemMeta(ubiquitousMeta); ItemStack rotationJump = new ItemStack(Material.WORKBENCH, 1); ItemMeta rotateMeta = rotationJump.getItemMeta(); rotateMeta.setDisplayName(rotateName); rotateMeta.setLore(Collections.singletonList(ChatColor.GRAY + "Jumps that changes every 2 months.")); rotationJump.setItemMeta(rotateMeta); ItemStack squidOJL = new ItemStack(Material.SKULL_ITEM, 1, (byte) 3); SkullMeta ojlMeta = (SkullMeta) squidOJL.getItemMeta(); ojlMeta.setDisplayName(ojlName); ojlMeta.setLore(Collections.singletonList(ChatColor.GRAY + "Squidyerser's onejump lobby jumps!")); ojlMeta.setOwner("Squidyerser"); squidOJL.setItemMeta(ojlMeta); for (int i = 0; i <= 3; i++) { ojMenu1.setItem(i, blank1); } for (int i = 5; i <= 8; i++) { ojMenu1.setItem(i, blank1); } ojMenu1.setItem(9, blank2); for (int i = 17; i <= 18; i++) { ojMenu1.setItem(i, blank2); } for (int i = 26; i <= 27; i++) { ojMenu1.setItem(i, blank2); } for (int i = 35; i <= 36; i++) { ojMenu1.setItem(i, blank2); } ojMenu1.setItem(44, blank2); for (int i = 45; i <= 53; i++) { ojMenu1.setItem(i, blank1); } ojMenu1.setItem(4, nameDisplay); ojMenu1.setItem(20, basicJump); ojMenu1.setItem(24, UbiquitousJump); ojMenu1.setItem(29, rotationJump); ojMenu1.setItem(33, squidOJL); player.openInventory(ojMenu1); } } } }