hasPermission() Issues / Misunderstanding

Discussion in 'Development' started by NickteeChunky, Nov 7, 2019 at 9:22 PM.

  1. NickteeChunky

    NickteeChunky Spider Jockey

    Messages:
    26
    GitHub:
    nickteechunky
    Code:
    Server thread/CRITICAL InvalidStateException: "Trying to get permissions of closed player" (EXCEPTION) in "src/pocketmine/Player" at line 678
    I am having an issue with hasPermission() and I don't get what closed players are. If anyone can give me further information, it would be much appreciated.

    PHP:
                           $target $this->getServer()->getPlayerExact($this->targettPlayer);
                           if(!
    $target->hasPermission("warn.1") && !$target->hasPermission("warn.2") && !$target->hasPermission("warn.3")){
                               
    $this->getServer()->dispatchCommand(new ConsoleCommandSender(), "setuperm ".$target->getName()." warn.1");
                               
    $this->getServer()->dispatchCommand(new ConsoleCommandSender(), "rca ".$player->getName()." kick ".$target->getName(). " \"┬žaSpamming - Warning 1\"");
                           }
    $this->targettPlayer = $data from another form
     
  2. Levi

    Levi Skeleton

    Messages:
    854
    GitHub:
    captainleviftw
    is $target online?
     

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.