Permissions compatibility

Discussion in 'Plugin Development' started by Infernus, Mar 12, 2011.

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

    Infernus

    I am trying to hook up my simple plugin with permissions.

    Here I am not understanding a part of the tutorial:

    PHP:
    if (!(MyPlugin).Permissions.has(player"a.custom.node")) {
      return;
    }

    What does this even do? How do I check if players are allowed to use my command? I haven't ever used Permissions, so I do not have very much experience with this.

    I would appreciate some help on this :)
     
  2. Offline

    MadMonkeyCo

    It checks the permission .yml file if the player has that permission.
    Code:
    groups:
      Default:
        <you know what this looks like>
      special:
        permissions:
          - 'a.custom.node'
    
    users:
      player1:
        group: Default
        permissons:
          - 'a.custom.node'
      player2:
        group: Default
        permissions:
          - 'something.else'
      player3:
        group: special
        permissions:
    Your above if would only be true on player2 since his group doesn't have the permission nor does he.
    However player1 does have the permisson and player3's group has the permission.
    I hope this has helped you.
     
  3. Offline

    Infernus

    Ah, I get it now! So can I change "a.custom.node" to anything I like? I would like to change it to "AdminChat", or should it be package.pluginclass? Would appreciate more help! :)
     
  4. Offline

    MadMonkeyCo

    Yes, that's the most common way to use it. It can also just be "AdminChat.use". If you have a plugin that has many features you can have have groups to identify for what it is used like in the plugin mcMMO (just an example) there is a tool to edit your stats ("mcmmo.tools.mmoedit") so it's in the "tools" group when the skills like mining ("mcmmo.skills.mining") are stored in a group called "skills" . But it can be just about anything although it's best not to use any symbols.
     
  5. Offline

    Infernus

    Thanks very much! This was very helpful information!
     
Thread Status:
Not open for further replies.

Share This Page