Solved How can I complement PurePerms with my Plugin?

Discussion in 'Development' started by Minetron26, Sep 13, 2018.

  1. Minetron26

    Minetron26 Spider Jockey

    Messages:
    25
    GitHub:
    minetron-26
    Hello !, I need to know if there is any way to use PurePerms for the code of my Plugin, how to make that when executing a command it is added to a certain group to the user that executed it.
     
  2. RyanShaw

    RyanShaw Witch

    Messages:
    69
    PHP:
            $pp Server::getInstance()->getPluginManager()->getPlugin('PurePerms');//get the plugin
            
    $pp->setGroup($player,$pp->getGroup("Guest")); //use its api
     
    Last edited: Sep 14, 2018
    Aericio and Minetron26 like this.
  3. Minetron26

    Minetron26 Spider Jockey

    Messages:
    25
    GitHub:
    minetron-26
    Okey, thanks
     
  4. Emirhan Akpınar

    Emirhan Akpınar Spider

    Messages:
    7
    GitHub:
    EmirhanWSD
    You can use this too,

    PHP:
    /** @var Server $server */
    $server->dispatchCommand(new ConsoleCommandSender(), "setgroup ".$player->getName()." Guest");
     
  5. Thunder33345

    Thunder33345 Moderator Staff Member Verified

    Messages:
    2,099
    GitHub:
    Thunder33345
    using commands isnt encouraged

    if the plugin/function have an api you should always use it
    for example what if your player name have a space
    now the whole command fall apart and potentially allowing dangerous exploits
     
    HimbeersaftLP and Muqsit like this.
  6. Minetron26

    Minetron26 Spider Jockey

    Messages:
    25
    GitHub:
    minetron-26
    Yes, thanks for that, but now I need to know how I can add a permission to the Player?
     
  7. HimbeersaftLP

    HimbeersaftLP Wither Skeleton

    Messages:
    1,407
    GitHub:
    HimbeersaftLP
    See how PurePerms itself does it

    PHP:
    $pp>getUserDataMgr()->setPermission($player$permission);
    Edit: Used permalink, added code example.
     
  8. Minetron26

    Minetron26 Spider Jockey

    Messages:
    25
    GitHub:
    minetron-26
    Thank you
     

Share This Page

  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.