Solved Can't use any items in GUI if one item has clickable as false

Discussion in 'Plugin Development' started by yPedx, May 16, 2017.

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

    yPedx

    Basically, I'm trying to make a configurable option if the item in the GUI should be clickable or not. However, if one item is set to false, and the others are true, the false one counts for all items inside the GUI. (can't click any of them). Here's what I use;
    Code:
    if(this.getConfig().getBoolean("GUI.Slot"+(event.getSlot()+1)+".clickable") == false){
                // Hidden message to player
            }
            String category = event.getCurrentItem().getItemMeta().getDisplayName();
                for (Player p : Bukkit.getOnlinePlayers()) {
                    if (p.hasPermission("glamreports.viewreports")) {
                        // Hidden message to player
              }}
                // Hidden message to player
        player.closeInventory();
        }
    Why isn't it working though?

    Paths does exit in config as well as I've double checked the true and false settings for each item.
     
  2. Offline

    Zombie_Striker

    @yPedx
    Can you try printing out whether the path exist? Can you print out what the boolean is equal to? Can you print out what slot is equal to?
     
  3. Offline

    yPedx

    @Zombie_Striker
    Oh my, I really should watch out to get the right amount of spaces to make the paths in config.... Still not working though.
    The path exist now, but it didn't change anything appearently (I double checked all spaces in config on my server..)
    The boolean always returns false, even if the item has been set to true in config.
    The slot is equal to the one clicked, so it is correct.
     
  4. Offline

    timtower Administrator Administrator Moderator

    @yPedx Set a value to the same path using the code, does it end up in the same place?
     
  5. Offline

    yPedx

    @timtower
    Ugh, I don't really get what you said, however; When I set all items to true, it still returns false for all of them...
    Code:
    Removed.
    EDIT: never noticed I set the wrong path in the code.... Fixed
     
  6. Offline

    timtower Administrator Administrator Moderator

    And that is why I mentioned it.
    It is an easy to make mistake.
     
Thread Status:
Not open for further replies.

Share This Page