Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Server crash on kick player

Comments in 'Plugin Development' started by Creeperface, Jul 21, 2015.

  1. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    when i kick player from game server crash :/
    Fatal error: Call to a member function hasPermission() on null in phar://C:/Users/Honza/Documents/PocketMine-MP/PocketMine-MP.phar/src/pocketmine/Player__32bit.php on line 439

    code:
    PHP:
    public function onJoin(PlayerPreLoginEvent $e){
            
    $player $e->getPlayer();
            if(
    strtolower($this->getConfig()->get("enable_whitelist")) == "true"){
                if(
    $player->isOp() || $player->hasPermission("rwl.acces") || $this->isWhitelisted($player)){
                    return;
                }
                else{
                    
    $player->kick(str_replace("&""§"$this->getConfig()->get("reason")), false);
                }
            }
        }
  2. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    Don't use Dev Builds of PocketMine.
  3. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    but this bug is in all last dev builds xD
    and when i report it pocketmine said it is EssentialsPE bug, but i have not EssentialsPE and still crashing :p
  4. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    Use PocketMine-Soft
  5. GreenMCPE
    Offline

    GreenMCPE New Member

    Joined:
    Apr 12, 2015
    Posts:
    27
    Minecraft User:
    Green_Slime
    PocketMine-SOft has the invisible players bug. :/
    Creeperface likes this.
  6. EvolSoft
    Offline

    EvolSoft Notable Member Plugin Developer

    Joined:
    Sep 10, 2014
    Posts:
    821
    Plugins:
    15
    Minecraft User:
    Flavius12
    Try to cancel the event after kick. Then is better to kick player on PlayerLoginEvent
  7. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    i tried on loginevent too but server still crash so i try on prelogin
    and how can i get event after kick?
  8. MCPEPIG
    Offline

    MCPEPIG Notable Member

    Joined:
    Jun 22, 2014
    Posts:
    349
    Minecraft User:
    MCPEPIG
    Try $player->close($reason); then $event->setCancelled()
  9. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    PHP:
    $player->close(""$reason);
    MCPEPIG likes this.
  10. MCPEPIG
    Offline

    MCPEPIG Notable Member

    Joined:
    Jun 22, 2014
    Posts:
    349
    Minecraft User:
    MCPEPIG
    Oops :p
  11. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Don't kick players in PlayerPreLoginEvent. Cancel the event instead, and use $evemt->setKickMessage() for kick message.
    EvolSoft likes this.
  12. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    But i tried in login event too and same
  13. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    I said, cancel the event.
    Vaivez66, EvolSoft, MCPEPIG and 2 others like this.
  14. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace

Share This Page

Advertisement