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

Change Groups pureperms

Discussion in 'Development' started by Matrox, May 3, 2019.

  1. Matrox

    Matrox Slime

    Messages:
    92
    GitHub:
    MatroxMC
    How can I change the group player (pureperms) in my plugin ??

    In my Main
     
  2. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
  3. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    No, don't copy code from there, use the methods there.
    setGroup is probably what you need.
    And since that method needs an instance of PPGroup as parameter, you will need to get a group using getGroup.
     
    jasonwynn10 likes this.
  4. Matrox

    Matrox Slime

    Messages:
    92
    GitHub:
    MatroxMC
    Exemple please :/
     
  5. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    PHP:
    $purePerms $this->getServer()->getPluginManager()->getPlugin("PurePerms");
    $group $purePerms->getGroup("groupname");
    $purePerms->setGroup($player$group);
    (assuming $this is a PluginBase instance (or anything with a getServer method) and $player implements the IPlayer interface (for example an instance of Player))
     
  6. Matrox

    Matrox Slime

    Messages:
    92
    GitHub:
    MatroxMC
    Error

    PHP:
    01:30:04] [Server thread/CRITICAL]: ParseError"syntax error, unexpected '$this' (T_VARIABLE)" (EXCEPTIONin "plugins/PermChangeur/src/Matroxplay/PermChangeur/Main" at line 27

    My full code:


    PHP:
    <?php

    namespace Matroxplay\PermChangeur;

    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\command\CommandSender;
    use 
    pocketmine\command\Command;
    use 
    pocketmine\Server;
    use 
    pocketmine\Player;
    use 
    pocketmine\event\Listener;

    class 
    Main extends PluginBase implements Listener{

    public function 
    onEnable(){
    $this->getLogger()->info("Activation...");
    }

    public function 
    onDisable(){
    $this->getLogger()->info("Désactivation...");
    }

    public function 
    onCommand(CommandSender $senderCommand $commandstring $label, array $args) : bool {
    switch(
    $command->getName()){

    case 
    "modo":

       
    $purePerms $this->getServer()->getPluginManager()->getPlugin("PurePerms");  <--- line 27
          $group 
    $purePerms->getGroup("modo");
          
    $purePerms->setGroup($player$group)
     
    return 
    true;
    }
    }
    }
     
  7. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    1. There is a semicolon missing after "$purePerms->setGroup($player, $group)"
    2. $player is not defined

    Also the Syntax error you gave me does not exist, so you either didn't send the right code or left something out.

    You seem to need more practise in php.
     
    jasonwynn10 likes 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.