Solved Items not being set into inventory

Discussion in 'Spigot Plugin Development' started by timmaker, Aug 18, 2017.

  1. @Hex_27 nope it only adds a pattern to the banner. and the banner i clone is working before it goes into the method
     
  2. First items may not show because you set their amount to 0
    Code (Text):
    ItemStack basicBanner = ItemUtil.createBasicBanner(DyeColor.WHITE, 0 /* Here */, "White Banner");
    I've made some tests with your code to finally resolve the problem on my side. Here's the modified code :

    Code (Text):
        public void openEditor(Player player) {
            Inventory editor = Bukkit.createInventory(player, 54, ChatColor.BOLD + "Banner Editor");
            // Moved basicBanner ItemStack into the for loop.

            editor.setItem(42, ItemUtil.addPatternFromTemplate(basicBanner.clone(), EnumBannerLetters.A, DyeColor.BLACK));
            editor.setItem(49, editors.get(player.getUniqueId()));
           
            editor.setItem(53, ItemUtil.createItemStack(Material.CONCRETE, 1, 0, "Color Chooser", ChatColor.RESET.toString() + ChatColor.WHITE + "White"));
            int i = -1;
            for (PatternType type : PatternType.values()) {
                Bukkit.broadcastMessage("HELLLLO");
                ItemStack basicBanner = ItemUtil.createBasicBanner(DyeColor.WHITE, 1, "White Banner");
                if (type != PatternType.BASE) {
                    Bukkit.broadcastMessage("A");
                    if (i < 35) {
                        i++;
                    } else if (i == 35) {
                        i = 38;
                    }
                    Bukkit.broadcastMessage("B");
                    editor.setItem(i, ItemUtil.addBannerPattern(basicBanner, new Pattern(DyeColor.LIGHT_BLUE, type))); // Changed DyeColor to LIGHT_BLUE to see the result, as pattern & base color where both white.
                }
            }
            player.openInventory(editor);
        }
    Hope it'll work for you, if you have any other issues, tag me :)
     
    • Winner Winner x 2
  3. @roro1506 thank you, i feel really stupid now :oops:
    I just don't know why I didn't see that or even wrote it