1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

PurePerms API?

Discussion in 'Development' started by Junkdude, Nov 21, 2016.

  1. Junkdude

    Junkdude Zombie

    Messages:
    346
    GitHub:
    JunkDaCoder
    I've been looking on how to use it, but I couldnt find it :p I want to know how to set a players group and check a players group, Thank you!
     
  2. Daltontastic

    Daltontastic Spider Jockey

    Messages:
    28
  3. Junkdude

    Junkdude Zombie

    Messages:
    346
    GitHub:
    JunkDaCoder
  4. Daltontastic

    Daltontastic Spider Jockey

    Messages:
    28
    Ah I'm out then.
     
  5. falk

    falk Slime Poggit Reviewer

    Messages:
    75
    GitHub:
    falkirks
    Maybe have a look at https://github.com/Falkirks/RankUp/blob/master/src/rankup/permission/PurePerms.php.

    Assume $this is a PluginBase object and $player is a Player object.

    Getting the API
    PHP:
    $api $this->getServer()->getPluginManager()->getPlugin("PurePerms")
    Adding a player to a group
    PHP:
    $ppGroup $api->getGroup("groupName");
    $api->setGroup($player$ppGroup);
    Checking a player's group
    PHP:
    $api->getUserDataMgr()->getGroup($player)->getName(); // Returns the group name of a player
     
    HimbeersaftLP and SOFe like this.
  6. Junkdude

    Junkdude Zombie

    Messages:
    346
    GitHub:
    JunkDaCoder
    Thank you!
     
  7. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    Finally someone is specifying this.
     
  8. Bamuel

    Bamuel Silverfish

    Messages:
    16
    GitHub:
    bamuel
    :p got you @falk


    also you must include this in your code
    PHP:
    use _64FF00\PurePerms\PPGroup;
     
    Last edited: Nov 23, 2016
  9. falk

    falk Slime Poggit Reviewer

    Messages:
    75
    GitHub:
    falkirks
    You don't need that though...your not constructing anything of that type. If it's a return type you don't need a use comment, because once it's been returned by another function the interpreter knows what type to use.

    I use that in my code because I have

    PHP:
    $ppGroup instanceof PPGroup
    The interpreter can't guess which PPGroup I am referring to, so I need a use statement for it.
     
    Last edited: Nov 23, 2016
    Bamuel and Awzaw like this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.