Help me through how to fix this and why it doesnt work

Discussion in 'Plugin Development' started by dbaum102, Dec 13, 2015.

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

    dbaum102

    Code:
    private void openGUI(Player player) {
            Inventory inv = Bukkit.createInventory(null, InventoryType.CHEST, ChatColor.GREEN + "Server Selector");
            for (int i = 1; i <= this.getConfig().getInt("Items"); i++) {
                String servername = this.getConfig().getString("Item" + i);
                int serverMaterial = this.getConfig().getInt(servername + "Material");
                Material m = Material.getMaterial(serverMaterial);
                ItemStack items = new ItemStack(m);
                ItemMeta deeze = items.getItemMeta();
                deeze.setDisplayName(servername);
                items.setItemMeta(deeze);
                inv.setItem(i, items);
               
            }
            player.openInventory(inv);
        }

    deeze.setDisplayName(servername);
    items.setItemsMeta(deeze);
    Why doesnt that work?

    Thanks
     
  2. Offline

    Zombie_Striker

    Are you sure this is equal to something? What is this in the config? More importantly, what would this line print out? (System.out.println(servername);)
     
    Lightspeed likes this.
  3. Offline

    dbaum102

    The for loop starts at one I

    "Item"+i should be item1
    Therefore finding

    In the Config
    Item1: Factions
     
    Last edited: Dec 13, 2015
  4. Offline

    Zombie_Striker

    @dbaum102
     
  5. Offline

    mcdorli

    Is this bungeecoord BTW?
     
    Zombie_Striker likes this.
  6. Offline

    dbaum102

  7. Offline

    Zombie_Striker

  8. Offline

    dbaum102

    In my current configuration file i have
    Item1: Factions
    Which should be found when:
    Code:
     String servername = this.getConfig().getString("Item" + i);
    Unfortunatly the OpenGUI does not open the gui. Any help with my problem
    would be great, Thanks.

    Found Solution!!!!!!!!!!
    I had to add the Strings to the defaults and it works perfectly now!
    Thanks for the help it was a small error.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Dec 14, 2015
  9. Offline

    Zombie_Striker

    @dbaum102
    Has your problem been solved? If so, mark this thread as solved.
     
  10. Offline

    timtower Administrator Administrator Moderator

    Locked.
    Bungeecord requires offline mode.
    Offline mode is not supported.
     
Thread Status:
Not open for further replies.

Share This Page