Solved Permissions

Discussion in 'Plugin Development' started by RoboticPlayer, Aug 12, 2015.

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

    RoboticPlayer

    This might sound kind of dumb, but I am still somewhat new to plugin development. I am wondering how I can create a permission node that will give access to all permissions in the plugin. I know that you can check for a permission node in the plugin code using
    Code:
    if (!sender.hasPermission("troll.zap")) {
                    sender.sendMessage(ChatColor.WHITE + "Unknown command. Type /help for help.");
                    return true;
                }
    but what if I want to create the permission node troll.* and give that node access to all commands in the plugin. How would I do this?
     
  2. Offline

    cfil360

  3. Offline

    RoboticPlayer

    I have that. I want to create 1 permission node for all of the commands as well as the individual nodes.
    Code:
    permissions:
         troll.zap:
            description: /zap
            default: op   
    Above is in my plugin.yml file.
    EDIT: Wait, do you mean add a 2nd check for the permission troll.* in front of each command?
     
  4. Offline

    Zombie_Striker

    Code:
    if (!sender.hasPermission("troll.zap"&&sender.hasPermission("troll.*")) {
    The '*' in the permission node means nothing by itself. It is the same as any other character. What you need to do is tread Troll.* as though it was it's own permission (like troll.zap)
     
  5. Offline

    RoboticPlayer

    Ok, but in that code that you just gave me, does that not essentials say that you have to have both the troll.zap node AND the troll.* node? Or does it treat && as or?
     
  6. Offline

    cfil360

    @henderry2019 if you read the link I sent it tells u about permissions and using children to make parent permissions.
     
  7. Offline

    RoboticPlayer

    Thank you, it works!
     
Thread Status:
Not open for further replies.

Share This Page