Warps Gui Plugin Help

Discussion in 'Plugin Development' started by nicoxdry, Jun 5, 2017.

Thread Status:
Not open for further replies.
  1. Offline

    nicoxdry

    Ive been trying to make a Warps gui plugin but i haven't been able to make it work

    Code:
    public class WarpGui extends JavaPlugin implements Listener{
       
        public void onEnable(){
            //if the code above is in your main file, use this:
            this.getServer().getPluginManager().registerEvents(this, this);
    
            //if it's in another class, use this:
            this.getServer().getPluginManager().registerEvents(new WarpGui(), this);
        }
       
        public Inventory inv;
        public Inventory inventory;
        public Inventory inventoryd;
    
        public void openGUI(Player p){
            inv = Bukkit.createInventory(null, 27, "&a&lOblivion&2&lMC");
            inv.setItem(10, new ItemStack(Material.ENDER_PORTAL));
            inv.setItem(16, new ItemStack(Material.DIAMOND_SWORD));
            inv.setItem(26, new ItemStack(Material.DIAMOND_PICKAXE));
            inv.setItem(13, new ItemStack(Material.GRASS));
            p.openInventory(inv);
        }
       
        public void openGUI1(Player p){
            inventory = Bukkit.createInventory(null, 36, "&a&m--&r&f&oWarps&r&a&m--");
            inventory.setItem(0, new ItemStack(Material.SLIME_BALL));
            inventory.setItem(1, new ItemStack(Material.SLIME_BALL));
            inventory.setItem(2, new ItemStack(Material.SLIME_BALL));
            inventory.setItem(3, new ItemStack(Material.SLIME_BALL));
            inventory.setItem(4, new ItemStack(Material.SLIME_BALL));
            inventory.setItem(5, new ItemStack(Material.SLIME_BALL));
            inventory.setItem(6, new ItemStack(Material.SLIME_BALL));
            inventory.setItem(7, new ItemStack(Material.SLIME_BALL));
            inventory.setItem(8, new ItemStack(Material.SLIME_BALL));
            inventory.setItem(9, new ItemStack(Material.SLIME_BALL));
            inventory.setItem(10, new ItemStack(Material.SLIME_BALL));
            inventory.setItem(11, new ItemStack(Material.SLIME_BALL));
            inventory.setItem(12, new ItemStack(Material.SLIME_BALL));
            inventory.setItem(13, new ItemStack(Material.SLIME_BALL));
            inventory.setItem(14, new ItemStack(Material.SLIME_BALL));
            inventory.setItem(15, new ItemStack(Material.SLIME_BALL));
            inventory.setItem(16, new ItemStack(Material.SLIME_BALL));
            inventory.setItem(17, new ItemStack(Material.SLIME_BALL));
            inventory.setItem(18, new ItemStack(Material.SLIME_BALL));
            inventory.setItem(19, new ItemStack(Material.SLIME_BALL));
            inventory.setItem(20, new ItemStack(Material.SLIME_BALL));
            inventory.setItem(21, new ItemStack(Material.SLIME_BALL));
            inventory.setItem(22, new ItemStack(Material.SLIME_BALL));
            inventory.setItem(23, new ItemStack(Material.SLIME_BALL));
            inventory.setItem(24, new ItemStack(Material.SLIME_BALL));
            inventory.setItem(25, new ItemStack(Material.SLIME_BALL));
            inventory.setItem(27, new ItemStack(Material.EMERALD));
            inventory.setItem(28, new ItemStack(Material.OBSIDIAN));
            inventory.setItem(36, new ItemStack(Material.DIAMOND));
            p.openInventory(inventory);
        }
       
        public void openGUI2(Player p){
            inventoryd = Bukkit.createInventory(null, 9, "&a&m--&r&f&oDonor&r&a&m--");
            inventoryd.setItem(0, new ItemStack(Material.COAL));
            inventoryd.setItem(1, new ItemStack(Material.IRON_INGOT));
            inventoryd.setItem(2, new ItemStack(Material.GOLD_INGOT));
            inventoryd.setItem(3, new ItemStack(Material.LAPIS_BLOCK));
            inventoryd.setItem(4, new ItemStack(Material.REDSTONE_BLOCK));
            inventoryd.setItem(5, new ItemStack(Material.DIAMOND_BLOCK));
            inventoryd.setItem(6, new ItemStack(Material.EMERALD_BLOCK));
            inventoryd.setItem(7, new ItemStack(Material.OBSIDIAN));
            inventoryd.setItem(8, new ItemStack(Material.BEDROCK));
            p.openInventory(inventory);
        }
       
        public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
            Player p = (Player) sender;
            if(cmd.getName().equalsIgnoreCase("Warps"))
            p.openInventory(inv);
           
            return true;           
        }
       
       
       
        @EventHandler
        public void InventoryClick(InventoryClickEvent e){
            Player p = (Player) e.getWhoClicked(); 
    
            if(e.getInventory().getTitle().contains("&a&lOblivion&2&lMC")){
                //Cancel the event so they can't take items out of the GUI
                e.setCancelled(true);
    
                if(e.getCurrentItem() == null){
                    return;
                }
                //gets called when the current item's type (The item the player clicked) is a diamond
                else if(e.getCurrentItem().getType() == Material.ENDER_PORTAL){
                    ItemStack item = new ItemStack(Material.ENDER_PORTAL);
                    ItemMeta meta = item.getItemMeta();
                    meta.setDisplayName("&b&lDonor");
                    ArrayList<String> Lore = new ArrayList<String>();
                    Lore.add("&8(!) &7Click to go to warp donor &8(!)");
                    meta.setLore(Lore);
                    item.setItemMeta(meta);
                    ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();
                    String command = "warp donate " + p.getName();
                    Bukkit.dispatchCommand(console, command);
    
    
                    p.closeInventory();
                }
                else if(e.getCurrentItem().getType() == Material.GRASS){
                    ItemStack item = new ItemStack(Material.GRASS);
                    ItemMeta meta = item.getItemMeta();
                    meta.setDisplayName("&a&lPlots");
                    ArrayList<String> Lore = new ArrayList<String>();
                    Lore.add("&8(!) &7Click to go to warp plots &8(!)");
                    meta.setLore(Lore);
                    item.setItemMeta(meta);
                    ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();
                    String command = "warp plots " + p.getName();
                    Bukkit.dispatchCommand(console, command);
    
    
                    p.closeInventory();
                }
                else if(e.getCurrentItem().getType() == Material.DIAMOND_SWORD){
                    ItemStack item = new ItemStack(Material.ENDER_PORTAL);
                    ItemMeta meta = item.getItemMeta();
                    meta.setDisplayName("&c&lPvPr");
                    ArrayList<String> Lore = new ArrayList<String>();
                    Lore.add("&8(!) &7Click to go to warp pvp &8(!)");
                    meta.setLore(Lore);
                    item.setItemMeta(meta);
                    ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();
                    String command = "warp pvp " + p.getName();
                    Bukkit.dispatchCommand(console, command);
    
    
                    p.closeInventory();
                }
                else if(e.getCurrentItem().getType() == Material.DIAMOND_PICKAXE){
                    ItemStack item = new ItemStack(Material.DIAMOND_PICKAXE);
                    ItemMeta meta = item.getItemMeta();
                    meta.setDisplayName("&8&lMines");
                    ArrayList<String> Lore = new ArrayList<String>();
                    Lore.add("&8(!) &7Click to go mines &8(!)");
                    meta.setLore(Lore);
                    item.setItemMeta(meta);
                    p.closeInventory();
                    p.openInventory(inventory);
                   
                }
            }
               
            }
            public void InventoryClick1(InventoryClickEvent e){
                Player p = (Player) e.getWhoClicked(); 
    
                if(e.getInventory().getTitle().contains("&a&m--&r&f&oWarps&r&a&m--")){
                    //Cancel the event so they can't take items out of the GUI
                    e.setCancelled(true);
    
                    if(e.getCurrentItem() == null){
                        return;
                    }
                    //gets called when the current item's type (The item the player clicked) is a diamond
                    else if(e.getCurrentItem().getType() == Material.DIAMOND){
                        ItemStack item = new ItemStack(Material.DIAMOND);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&b&lDonor &7Warps");
                        ArrayList<String> Lore = new ArrayList<String>();
                        Lore.add("&8(!) &7Click to go to donor mines &8(!)");
                        meta.setLore(Lore);
                        item.setItemMeta(meta);                   
                        p.closeInventory();
                        p.openInventory(inventoryd);
                    }
                    else if(e.getCurrentItem().getType() == Material.SLIME_BALL){
                        ItemStack item = new ItemStack(Material.SLIME_BALL);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&c&lA");
                        item.setItemMeta(meta);
                        p.performCommand("Warp A");
                        p.closeInventory();
                    }
                    else if(e.getCurrentItem().getType() == Material.SLIME_BALL){
                        ItemStack item = new ItemStack(Material.SLIME_BALL);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&c&lB");
                        p.performCommand("Warp B");
                        item.setItemMeta(meta);
                       
                        p.closeInventory();
                    }
                    else if(e.getCurrentItem().getType() == Material.SLIME_BALL){
                        ItemStack item = new ItemStack(Material.SLIME_BALL);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&c&lC");
                        item.setItemMeta(meta);
                        p.performCommand("Warp C");
                        p.closeInventory();
                      
                    }
                    else if(e.getCurrentItem().getType() == Material.SLIME_BALL){
                        ItemStack item = new ItemStack(Material.SLIME_BALL);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&c&lD");
                        item.setItemMeta(meta);
                        p.performCommand("Warp D");
                        p.closeInventory();
                      
                    }
                    else if(e.getCurrentItem().getType() == Material.SLIME_BALL){
                        ItemStack item = new ItemStack(Material.SLIME_BALL);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&c&lE");
                        item.setItemMeta(meta);
                        p.performCommand("Warp E");
                        p.closeInventory();
                    
                    }
                    else if(e.getCurrentItem().getType() == Material.SLIME_BALL){
                        ItemStack item = new ItemStack(Material.SLIME_BALL);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&c&lF");
                        item.setItemMeta(meta);
                        p.performCommand("Warp F");
                        p.closeInventory();
                    
                    }
                    else if(e.getCurrentItem().getType() == Material.SLIME_BALL){
                        ItemStack item = new ItemStack(Material.SLIME_BALL);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&c&lG");
                        item.setItemMeta(meta);
                        p.performCommand("Warp G");
                        p.closeInventory();
                   
                    }
                    else if(e.getCurrentItem().getType() == Material.SLIME_BALL){
                        ItemStack item = new ItemStack(Material.SLIME_BALL);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&c&lH");
                        item.setItemMeta(meta);
                        p.closeInventory();
                      
                    }
                    else if(e.getCurrentItem().getType() == Material.SLIME_BALL){
                        ItemStack item = new ItemStack(Material.SLIME_BALL);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&c&lI");
                        item.setItemMeta(meta);
                        p.performCommand("Warp I");
                        p.closeInventory();
                     
                    }
                    else if(e.getCurrentItem().getType() == Material.SLIME_BALL){
                        ItemStack item = new ItemStack(Material.SLIME_BALL);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&c&lJ");
                        item.setItemMeta(meta);
                        p.performCommand("Warp J");
                        p.closeInventory();
                       
                    }
                    else if(e.getCurrentItem().getType() == Material.SLIME_BALL){
                        ItemStack item = new ItemStack(Material.SLIME_BALL);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&c&lK");
                        item.setItemMeta(meta);
                        p.performCommand("Warp K");
                        p.closeInventory();
                      
                    }
                    else if(e.getCurrentItem().getType() == Material.SLIME_BALL){
                        ItemStack item = new ItemStack(Material.SLIME_BALL);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&c&lL");
                        item.setItemMeta(meta);
                        p.performCommand("Warp L");
                        p.closeInventory();
                    
                    }
                    else if(e.getCurrentItem().getType() == Material.SLIME_BALL){
                        ItemStack item = new ItemStack(Material.SLIME_BALL);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&c&lM");
                        item.setItemMeta(meta);
                        p.performCommand("Warp M");
                        p.closeInventory();
                      
                    }
                    else if(e.getCurrentItem().getType() == Material.SLIME_BALL){
                        ItemStack item = new ItemStack(Material.SLIME_BALL);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&c&lN");
                        item.setItemMeta(meta);
                        p.performCommand("Warp N");
                        p.closeInventory();
                    
                    }
                    else if(e.getCurrentItem().getType() == Material.SLIME_BALL){
                        ItemStack item = new ItemStack(Material.SLIME_BALL);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&c&lO");
                        item.setItemMeta(meta);
                        p.performCommand("Warp O");
                        p.closeInventory();
                      
                    }
                    else if(e.getCurrentItem().getType() == Material.SLIME_BALL){
                        ItemStack item = new ItemStack(Material.SLIME_BALL);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&c&lP");
                        item.setItemMeta(meta);
                        p.performCommand("Warp P");
                        p.closeInventory();
                      
                    }
                    else if(e.getCurrentItem().getType() == Material.SLIME_BALL){
                        ItemStack item = new ItemStack(Material.SLIME_BALL);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&c&lQ");
                        item.setItemMeta(meta);
                        p.performCommand("Warp Q");
                        p.closeInventory();
                       
                    }
                    else if(e.getCurrentItem().getType() == Material.SLIME_BALL){
                        ItemStack item = new ItemStack(Material.SLIME_BALL);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&c&lR");
                        item.setItemMeta(meta);
                        p.performCommand("Warp R");
                        p.closeInventory();
                    
                    }
                    else if(e.getCurrentItem().getType() == Material.SLIME_BALL){
                        ItemStack item = new ItemStack(Material.SLIME_BALL);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&c&lS");
                        item.setItemMeta(meta);
                        p.performCommand("Warp S");
                        p.closeInventory();
                     
                    }
                    else if(e.getCurrentItem().getType() == Material.SLIME_BALL){
                        ItemStack item = new ItemStack(Material.SLIME_BALL);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&c&lT");
                        item.setItemMeta(meta);
                        p.performCommand("Warp T");
                        p.closeInventory();
                     
                    }
                    else if(e.getCurrentItem().getType() == Material.SLIME_BALL){
                        ItemStack item = new ItemStack(Material.SLIME_BALL);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&c&lU");
                        item.setItemMeta(meta);
                        p.performCommand("Warp U");
                        p.closeInventory();
                      
                    }
                    else if(e.getCurrentItem().getType() == Material.SLIME_BALL){
                        ItemStack item = new ItemStack(Material.SLIME_BALL);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&c&lV");
                        item.setItemMeta(meta);
                        p.performCommand("Warp V");
                        p.closeInventory();
                       
                    }
                    else if(e.getCurrentItem().getType() == Material.SLIME_BALL){
                        ItemStack item = new ItemStack(Material.SLIME_BALL);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&c&lW");
                        item.setItemMeta(meta);
                        p.performCommand("Warp W");
                        p.closeInventory();
                       
                    }
                    else if(e.getCurrentItem().getType() == Material.SLIME_BALL){
                        ItemStack item = new ItemStack(Material.SLIME_BALL);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&c&lX");
                        item.setItemMeta(meta);
                        p.performCommand("Warp X");
                        p.closeInventory();
                   
                    }
                    else if(e.getCurrentItem().getType() == Material.SLIME_BALL){
                        ItemStack item = new ItemStack(Material.SLIME_BALL);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&c&lY");
                        item.setItemMeta(meta);
                        p.performCommand("Warp Y");
                        p.closeInventory();
                      
                    }
                    else if(e.getCurrentItem().getType() == Material.SLIME_BALL){
                        ItemStack item = new ItemStack(Material.SLIME_BALL);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&c&lZ");
                        item.setItemMeta(meta);
                        p.performCommand("Warp Z");
                        p.closeInventory();
                  
                    }               
                    }
                    else if(e.getCurrentItem().getType() == Material.EMERALD){
                        ItemStack item = new ItemStack(Material.EMERALD);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&c&lFree");
                        item.setItemMeta(meta);
                        p.performCommand("Warp Free");
                        p.closeInventory();
                     
                    }
                    else if(e.getCurrentItem().getType() == Material.OBSIDIAN){
                        ItemStack item = new ItemStack(Material.OBSIDIAN);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&c&lPrisonGod");
                        item.setItemMeta(meta);
                        p.performCommand("Warp PrisonGod");
                        p.closeInventory();
                   
                    }
               
        } 
            public void InventoryClick2(InventoryClickEvent e){
                Player p = (Player) e.getWhoClicked(); 
    
                if(e.getInventory().getTitle().contains("&a&m--&r&f&oDonor&r&a&m--")){
                    //Cancel the event so they can't take items out of the GUI
                    e.setCancelled(true);
    
                    if(e.getCurrentItem() == null){
                        return;
                    }
                    //gets called when the current item's type (The item the player clicked) is a diamond
                    else if(e.getCurrentItem().getType() == Material.COAL){
                        ItemStack item = new ItemStack(Material.COAL);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&0&lCOAl &fWarp");
                        item.setItemMeta(meta);        
                        p.performCommand("Warp COAL");         
                        p.closeInventory();
                    }
                    else if(e.getCurrentItem().getType() == Material.IRON_INGOT){
                        ItemStack item = new ItemStack(Material.IRON_INGOT);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&7&lIRON &fWarp");  
                        p.performCommand("Warp IRON");
                        p.closeInventory();
                      
                    }
                    else if(e.getCurrentItem().getType() == Material.GOLD_INGOT){
                        ItemStack item = new ItemStack(Material.GOLD_INGOT);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&6&LGOLD &fWarp");
                        p.performCommand("Warp GOLD");
                        p.closeInventory();
                     
                    }
                    else if(e.getCurrentItem().getType() == Material.LAPIS_BLOCK){
                        ItemStack item = new ItemStack(Material.LAPIS_BLOCK);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&9&LLAPIS &fWarp");
                        item.setItemMeta(meta);   
                        p.performCommand("Warp LAPIS");
                        p.closeInventory();
                       
                    }
                    else if(e.getCurrentItem().getType() == Material.REDSTONE_BLOCK){
                        ItemStack item = new ItemStack(Material.DIAMOND_BLOCK);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&c&lREDSTONE &FWarp");
                        item.setItemMeta(meta);   
                        p.performCommand("Warp REDSTONE");
                        p.closeInventory();
                     
                    }
                    else if(e.getCurrentItem().getType() == Material.DIAMOND_BLOCK){
                        ItemStack item = new ItemStack(Material.DIAMOND_BLOCK);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&b&LDIAMOND &fWarp");
                        item.setItemMeta(meta);       
                        p.performCommand("Warp DIAMOND");
                        p.closeInventory();
                      
                    }
                    else if(e.getCurrentItem().getType() == Material.EMERALD_BLOCK){
                        ItemStack item = new ItemStack(Material.EMERALD_BLOCK);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&2&lEMERALD &FWarp");
                        item.setItemMeta(meta);             
                        p.performCommand("Warp EMERALD");
                        p.closeInventory();
                  
                    }
                    else if(e.getCurrentItem().getType() == Material.OBSIDIAN){
                        ItemStack item = new ItemStack(Material.OBSIDIAN);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&8&LOBSIDIAN &fWarp");
                        item.setItemMeta(meta);         
                        p.performCommand("Warp OBSIDIAN");
                        p.closeInventory();
                    
                    }
                    else if(e.getCurrentItem().getType() == Material.BEDROCK){
                        ItemStack item = new ItemStack(Material.BEDROCK);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&7&lB&f&LE&7&LD&f&LR&7&LO&f&LC&7&LK &fWarp");
                        item.setItemMeta(meta);   
                        p.performCommand("Warp BEDROCK");
                        p.closeInventory();
                      
                    }
           
    }
            }
    }
    
       
    

    this is my plugin.yml

    Code:
    name: WarpsGui
    main: me.nicoxdry.com.WarpGui
    version: '1.10.2'
    commands:
      Warps:
        description: warps gui
        usage: /<command>
        aliases: [Warp, ewarps]
     
  2. Offline

    Side8StarLite

    @nicoxdry Why are you doing
    Code:
      p.openInventory(inv);
    When you already made the methods openGUI1 and openGUI2 to open the inventory for you?
     
  3. Offline

    FabeGabeMC

    Looks like copy-pasted code. Do you know Java? Make sure you learn it before touching Bukkit.
     
    Zombie_Striker likes this.
  4. Offline

    Horsey

    What's the expected output? What's the output you get?
    Why to you register events twice?
    Instead of creating a new slimeball ItemStack every time, why don't you define a variable and use that one?
    You need to check that the player uses the item in the inventory before teleporting them, they could have that item in their inventory.
    You need to use your plugin's version in the plugin.yml, not the Minecraft version.

    All in all, it seems like you don't know Java, I suggest looking up tutorials, and actually learning, instead of copy-pasting.

    Also, would like to address this:

    Learning Bukkit is often the biggest motivation to learn Java.
    It's not necessary for one to learn Java first, I for instance, started learning how to code with Bukkit before learning basic Java.
    Writing out code yourself, is the best way to learn, whether you know Java or not, you will never learn by copy-pasting.
     
  5. Offline

    timtower Moderator Moderator

    @nicoxdry You are missing a couple @Eventhandler s
     
  6. Offline

    nicoxdry

    Thanks for the review, i did copy paste a bit but not all of the code i just did some parts that i didn't know what do.
    I will be able to fix the code now thx.
     
  7. Offline

    Caderape2

    @nicoxdry
    Code:
    else if(e.getCurrentItem().getType() == Material.SLIME_BALL){
                        ItemStack item = new ItemStack(Material.SLIME_BALL);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&c&lA");
                        item.setItemMeta(meta);
                        p.performCommand("Warp A");
                        p.closeInventory();
                    }
                    else if(e.getCurrentItem().getType() == Material.SLIME_BALL){
                        ItemStack item = new ItemStack(Material.SLIME_BALL);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&c&lB");
                        p.performCommand("Warp B");
                        item.setItemMeta(meta);
                      
                        p.closeInventory();
                    }
                    else if(e.getCurrentItem().getType() == Material.SLIME_BALL){
                        ItemStack item = new ItemStack(Material.SLIME_BALL);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&c&lC");
                        item.setItemMeta(meta);
                        p.performCommand("Warp C");
                        p.closeInventory();
                     
                    }
                    else if(e.getCurrentItem().getType() == Material.SLIME_BALL){
                        ItemStack item = new ItemStack(Material.SLIME_BALL);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&c&lD");
                        item.setItemMeta(meta);
                        p.performCommand("Warp D");
                        p.closeInventory();
                     
                    }
                    else if(e.getCurrentItem().getType() == Material.SLIME_BALL){
                        ItemStack item = new ItemStack(Material.SLIME_BALL);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&c&lE");
                        item.setItemMeta(meta);
                        p.performCommand("Warp E");
                        p.closeInventory();
                   
                    }
                    else if(e.getCurrentItem().getType() == Material.SLIME_BALL){
                        ItemStack item = new ItemStack(Material.SLIME_BALL);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&c&lF");
                        item.setItemMeta(meta);
                        p.performCommand("Warp F");
                        p.closeInventory();
                   
                    }
                    else if(e.getCurrentItem().getType() == Material.SLIME_BALL){
                        ItemStack item = new ItemStack(Material.SLIME_BALL);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&c&lG");
                        item.setItemMeta(meta);
                        p.performCommand("Warp G");
                        p.closeInventory();
                  
                    }
                    else if(e.getCurrentItem().getType() == Material.SLIME_BALL){
                        ItemStack item = new ItemStack(Material.SLIME_BALL);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&c&lH");
                        item.setItemMeta(meta);
                        p.closeInventory();
                     
                    }
                    else if(e.getCurrentItem().getType() == Material.SLIME_BALL){
                        ItemStack item = new ItemStack(Material.SLIME_BALL);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&c&lI");
                        item.setItemMeta(meta);
                        p.performCommand("Warp I");
                        p.closeInventory();
                    
                    }
                    else if(e.getCurrentItem().getType() == Material.SLIME_BALL){
                        ItemStack item = new ItemStack(Material.SLIME_BALL);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&c&lJ");
                        item.setItemMeta(meta);
                        p.performCommand("Warp J");
                        p.closeInventory();
                      
                    }
                    else if(e.getCurrentItem().getType() == Material.SLIME_BALL){
                        ItemStack item = new ItemStack(Material.SLIME_BALL);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&c&lK");
                        item.setItemMeta(meta);
                        p.performCommand("Warp K");
                        p.closeInventory();
                     
                    }
                    else if(e.getCurrentItem().getType() == Material.SLIME_BALL){
                        ItemStack item = new ItemStack(Material.SLIME_BALL);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&c&lL");
                        item.setItemMeta(meta);
                        p.performCommand("Warp L");
                        p.closeInventory();
                   
                    }
                    else if(e.getCurrentItem().getType() == Material.SLIME_BALL){
                        ItemStack item = new ItemStack(Material.SLIME_BALL);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&c&lM");
                        item.setItemMeta(meta);
                        p.performCommand("Warp M");
                        p.closeInventory();
                     
                    }
                    else if(e.getCurrentItem().getType() == Material.SLIME_BALL){
                        ItemStack item = new ItemStack(Material.SLIME_BALL);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&c&lN");
                        item.setItemMeta(meta);
                        p.performCommand("Warp N");
                        p.closeInventory();
                   
                    }
                    else if(e.getCurrentItem().getType() == Material.SLIME_BALL){
                        ItemStack item = new ItemStack(Material.SLIME_BALL);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&c&lO");
                        item.setItemMeta(meta);
                        p.performCommand("Warp O");
                        p.closeInventory();
                     
                    }
                    else if(e.getCurrentItem().getType() == Material.SLIME_BALL){
                        ItemStack item = new ItemStack(Material.SLIME_BALL);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&c&lP");
                        item.setItemMeta(meta);
                        p.performCommand("Warp P");
                        p.closeInventory();
                     
                    }
                    else if(e.getCurrentItem().getType() == Material.SLIME_BALL){
                        ItemStack item = new ItemStack(Material.SLIME_BALL);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&c&lQ");
                        item.setItemMeta(meta);
                        p.performCommand("Warp Q");
                        p.closeInventory();
                      
                    }
                    else if(e.getCurrentItem().getType() == Material.SLIME_BALL){
                        ItemStack item = new ItemStack(Material.SLIME_BALL);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&c&lR");
                        item.setItemMeta(meta);
                        p.performCommand("Warp R");
                        p.closeInventory();
                   
                    }
                    else if(e.getCurrentItem().getType() == Material.SLIME_BALL){
                        ItemStack item = new ItemStack(Material.SLIME_BALL);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&c&lS");
                        item.setItemMeta(meta);
                        p.performCommand("Warp S");
                        p.closeInventory();
                    
                    }
                    else if(e.getCurrentItem().getType() == Material.SLIME_BALL){
                        ItemStack item = new ItemStack(Material.SLIME_BALL);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&c&lT");
                        item.setItemMeta(meta);
                        p.performCommand("Warp T");
                        p.closeInventory();
                    
                    }
                    else if(e.getCurrentItem().getType() == Material.SLIME_BALL){
                        ItemStack item = new ItemStack(Material.SLIME_BALL);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&c&lU");
                        item.setItemMeta(meta);
                        p.performCommand("Warp U");
                        p.closeInventory();
                     
                    }
                    else if(e.getCurrentItem().getType() == Material.SLIME_BALL){
                        ItemStack item = new ItemStack(Material.SLIME_BALL);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&c&lV");
                        item.setItemMeta(meta);
                        p.performCommand("Warp V");
                        p.closeInventory();
                      
                    }
                    else if(e.getCurrentItem().getType() == Material.SLIME_BALL){
                        ItemStack item = new ItemStack(Material.SLIME_BALL);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&c&lW");
                        item.setItemMeta(meta);
                        p.performCommand("Warp W");
                        p.closeInventory();
                      
                    }
                    else if(e.getCurrentItem().getType() == Material.SLIME_BALL){
                        ItemStack item = new ItemStack(Material.SLIME_BALL);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&c&lX");
                        item.setItemMeta(meta);
                        p.performCommand("Warp X");
                        p.closeInventory();
                  
                    }
                    else if(e.getCurrentItem().getType() == Material.SLIME_BALL){
                        ItemStack item = new ItemStack(Material.SLIME_BALL);
                        ItemMeta meta = item.getItemMeta();
                        meta.setDisplayName("&c&lY");
                        item.setItemMeta(meta);
                        p.performCommand("Warp Y");
                        p.closeInventory();
                     
                    }
    What is the point of doing that ? it's the same condition, except the first one, the rest of the code will be never called
     
Thread Status:
Not open for further replies.

Share This Page