Using Permissions (Help Please!)

Discussion in 'Plugin Development' started by RazorFlint, May 24, 2011.

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

    RazorFlint

  2. Offline

    ChrizC

  3. Offline

    RazorFlint

    I Have looked at them i just dont know how to do these...
    Code:
      if (!(MyPlugin).permissionHandler.has(player, "a.custom.node")) {
           return;   }
    
    And The Plugin.yml
     
  4. Offline

    flatd

  5. Offline

    dreadiscool

    The way that TheYeti wrote that line must put off a lot of new Java plugin developers. Allow me to elaborate

    Suppose you only have a default class inside your package - suppose it is myPlugin.java:

    How Permission Nodes Work (open)

    groups:
    Regular:
    permissions:
    - 'myPlugin.command1'
    - 'myPlugin.command2'
    inheritance:
    Admin:
    permissions:
    - 'myPlugin.admin'
    inheritance:
    - 'Regular'
    users:
    harm3112:
    group: Regular
    dreadiscool:
    group: Admin

    harm3112 has the permission to execute the command associated with myPlugin.command1 and myPlugin.command2, but does not have permission to execute myPlugin.admin, because he is not part of the admin group. Although the admin does not have the command 1 and command 2 listed, since his inheritance node points to Regular, he gets all of the regular commands in addition to admin commands.

    Code:
    if (myPlugin.permissionHandler.has(Player, "myPlugin.admin") == true) {
        //this player has the node 'myPlugin.admin' listed under it, so execute your code
    }
    else {
        //this player doesn't have permission, don't execute code
    }
    
    as for declaring the static variable permissionHandler, look into TheYeti's wiki.
    Ask me if you need anymore help.
     
Thread Status:
Not open for further replies.

Share This Page