Stuck with GUI (1.13)

Discussion in 'Plugin Development' started by bigflori, Nov 18, 2018.

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

    bigflori

    Hey!
    I'm trying to update my plugin to 1.13 but I can't figure out what's the problem and why not fill my GUI with items.
    Here's my code:
    Inventories.java:
    Code:
    String asd = Vars.prefix + Vars.mainMenuHeader;
       
        @SuppressWarnings("static-access")
        public Inventory mainMenu = Bukkit.createInventory(null, 9, asd);
    
        @SuppressWarnings("static-access")
        public void initContents(Player p, Inventory inv) {
            if(inv == null) return;
            @SuppressWarnings("deprecation")
            ItemStack placeHolder = new ItemStack(Material.GRAY_STAINED_GLASS_PANE, 1, DyeColor.GRAY.getWoolData());
            ItemMeta im = placeHolder.getItemMeta();
            im.setDisplayName(" ");
            placeHolder.setItemMeta(im);
            for(int i = 0; i < 8; i++) {
                //inv.setItem(i, placeHolder);
            }
           
            if(inv.getName().equals(asd)) {
                if(p.hasPermission(perms.boosters_admin) || p.isOp()) {
                    inv.setItem(0, new Item(Material.PAPER, "§6Boosters parancs rejtett funckiói", new String[] 
                        {
                            "§7Ezt csak az engedéllyel rendelkező emberek látják!",
                            "",
                            "§c/boosters stop - Egy már futó booster leállítása",
                            "§c/boosters give - 1 darab booster addolása",
                            "§c/boosters list - Jelenleg aktív boosterek"
                        }, 1).getItemStack());
                }
                inv.setItem(3, new Item(Material.GOLDEN_APPLE, "§9Booster aktiváló", new String[]
                    {
                        "§7Itt tudsz boostereket aktiválni!"
                    }, 1).getItemStack());
                inv.setItem(5, new Item(Material.DIAMOND_SWORD, "§9Booster vásárló", new String[]
                    {
                        "§7Itt tudsz boostereket vásárolni!"
                    }, 1).getItemStack());
                inv.setItem(8, new Item(Material.BARRIER, "§4Kilépés", new String[]{}, 1).getItemStack());
            }
        }
    
     
  2. @bigflori

    For debugging, it would be really useful to print all of the contents of the inventory at the end of the initContents method.
     
  3. Offline

    bigflori

    @knokko I figured out, for some reason it doesn't work if I use variables for the inventory name and in the if statement
     
Thread Status:
Not open for further replies.

Share This Page