Help with Permissions(Yeti) and commands

Discussion in 'Plugin Development' started by lilalulelo, Aug 14, 2011.

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

    lilalulelo

    Hi !

    I'm writing a plugin for my server, but I have some problems with the "hooking into permissions"(the Permissions 3.1.6 plugin, not the bukkit default) thing.

    I've followed this, but when I want to check if a player has the permission node, it seems like it only check the user permissions, not the group permissions.

    So... how should I do ? I'm using the permissionHandler.has method for the test. Is there another way to check it ? Maybe the bukkit permission check ? I'm kinda lost.

    Another problem I have is with the commands.

    Here's my code :
    Code:
    getCommand("signquest").setExecutor(new CommandExecutor(){
                public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){
                    if (sender instanceof Player){
                        Player player = (Player)sender;
                    if(SignQuestPermissions.canDo(player)){
    
                        if(commandLabel.equalsIgnoreCase("info")){
                            QuestInteraction.info(sender);
                            return true;
                        }
                        if(commandLabel.equalsIgnoreCase("drop")){
                            return true;
                        }
                        if(commandLabel.equalsIgnoreCase("stat")){
                            return true;
                        }
                        if(commandLabel.equalsIgnoreCase("reloadquests")){
                            return true;
                        }
                    }else{
                        player.sendMessage(ChatColor.RED+"Vous n'avez pas la permission pour faire ça !");
                        return true;
                    }
                        return false;
                    }
                    sender.sendMessage("[SignQuest]Les commandes ne sont utilisables que par les joueurs.");
                    return false;
                }
            });
    but when I try the command, it's seems to always return false (I always get the usage message).

    I'll be really thankfull for your help !
     
  2. Offline

    Jogy34

    In the yml that you created for this you have to put commands at the bottom in this format.
    commands:
    <name>:
    description: <description> (doesn't actually matter what you put)
    usage: <name>

    so for one of your commands it would be like this.
    commands:
    info:
    description: To relay information to the user.
    usage: info

    hoped that helped
     
  3. Offline

    lilalulelo

    Yeah I've put

    signquest:
    description: General command for signquest, display information about commands labels.
    usage: /<command> [info, drop, stats]
    aliases : [sq, signq]

    Should I add the commands with labels as well ?
     
  4. Offline

    Jogy34

    It couldn't hurt
     
  5. Offline

    lilalulelo

    So I should put it like this :

    signquest info:
    description:
    usage:
    aliases:

    ?
     
  6. Offline

    Jogy34

    you could try it like that but you may have to add each alias individually and if your command in info leave out the signquest part.
     
  7. Offline

    lilalulelo

    Fixed it.

    I use the built-in permission system at the end.
    For the commands I misunderstood commandLabel with arguments.

    Everything's fine now ! Thanks for your help ;)
     
  8. Offline

    Jogy34

    cool but do you think that you might be able to help me with my problem?
     
Thread Status:
Not open for further replies.

Share This Page