Make plugin compatible with PEX?

Discussion in 'Plugin Development' started by turkeypenguin, Sep 13, 2015.

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

    turkeypenguin

    Hi, I am currently writing a plugin, and want to make sure that it is compatible with pex. I couldn't find anything on this online, so I am asking here:

    Is there anything special I need to do, or do I only use the default permissions.yml to create nodes and test for the permission in my commandexecuter class and let pex handle the rest, or do I need to do anything special?

    Thanks,
    -turkey
     
  2. Offline

    RoboticPlayer

    If you are just using it to check for permissions, there is no need to use pex. Just check if sender#hasPermission(string)
     
  3. Offline

    teej107

    No.
     
  4. Just like @henderry2019 said, if you are just checking if they have a permission, all you need is the player.hasPermission("") method.

    If you want to implement PermissionsEx and use it's methods, you will need to add it to the build path.
     
  5. Offline

    oceantheskatr

    For this wouldn't it be better to use Vault so that GroupManager/PEx/etc. can use it?
     
  6. I'm not sure why he would need Vault if he's just checking permissions. Either way, he is going to need to add something to his Build Path in order to access the methods from it. Vault is only a help if he is trying to hook into more than one supported plugin, which he is not. @oceantheskatr

    @turkeypenguin , Keep in mind that permission nodes are not 'created' as such, a permission node check is literally just player.hasPermission("your.permission.here") You don't need to add anything to the permissions.yml, just use PEx to set up perms.

    You don't even need to add a permission: line to the command in the plugin.yml. Just use player.hasPermission() to check if that perm has been assigned to that player.
     
  7. Offline

    oceantheskatr

    I know. I was replying to the last part that you state, hooking in to use methods. GroupManager and PermissionsEx are nearly the same, and will hook in to Vault the same way, so unless OP is needing something that is PEx exclusive, it's probably better practice to use Vault.
     
  8. Offline

    teej107

    Yeah. I can see someone smacking themselves on the head in the future for not using Vault. AFAIK, the OP shouldn't hook into anything.
     
  9. Offline

    oceantheskatr

    Course not :p
     
  10. Offline

    Boomer

    vault isn't needed for simple has-permission checks - its frustrating to see so many plugins that require it just for that simple check...
    where vault for permissions is used is for getting lists of rank names, rank orders, and accessing some general info about groups regardless of the permission plugin - which very few do. Checking if someone has permissions - just use the bukkit built in command that is the base, core, bottom line shortest path between plugin and permission system, intead of going through bridges built on top of layers built to interface that require going all the way over and back to get to the same point before going forward...
     
  11. Offline

    oceantheskatr

    @Boomer @teej107 I was referring to what @Sulphate said:
    I was thinking that if you needed to change a player's group/prefix it would be better to use Vault so that anything that hooks in to Vault (GroupManager, PEx, etc.) would be able to use it :) (If you made a plugin that would be public/shared with others)

    Of course with a simple permission check I know that you'd use hasPermission("permission.node.here").
     
Thread Status:
Not open for further replies.

Share This Page