GUI Menu Problem

Discussion in 'Plugin Development' started by dNiym, May 5, 2014.

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


    I am attempting to modify a GUI menu (a chest)

    So far this menu has two teams Humans and Zombies
    We also have different classes for each team, these classes get unlocked based upon the number of kills.

    Currently all classes are displayed and the only way for a player to tell if they have access is to click on the class and the menu then notifies them that they don't have permission.

    This is done via an onOptionClick event. Once the player clicks a class the permissions are checked and the player notified if their class change was successful or not.

    "event" allows me to do getPlayer(); to identify which player clicked it..
    1. public void onOptionClick(IconMenu.OptionClickEvent event) {
    3. final Player player = event.getPlayer();
    5. //Do stuff to check permissions then set the class or tell them they don't have access yet.
    7. } me.plugin;

    directly below the above code is where if nothing was clicked the full list is displayed, here I would like to be able to check player permissions and then change the icon/description to let them know the class is currently locked for them.

    1. int i = 0;
    2. for (InfClass Class : InfClassManager.getClasses(Team.Human))
    3. {
    4. ItemStack item = Class.getIcon();
    5. if(!player.hasPermission("Infected.Classes.Human.Ash")) { //im just checking one here until i'm sure I have it working properly.
    6. item = item.getType(Material.getMaterial(146)); //change the icon to a locked chest
    7. }
    9. StringBuilder desc = new StringBuilder();

    I can't for the life of me figure out how to identify the player here as all the variables from the previous function aren't usable since the player may or may not have clicked yet.

    I feel like in any other programming language there would be some global identifier for what caused the menu to open in the first place and that's what I need to know how to find!

    Thanks in advance!
Thread Status:
Not open for further replies.

Share This Page