EvolSoft / ServerAuth

An advanced authentication plugin for PocketMine-MP
MIT License
56 stars 39 forks source link

ServerAuthAuthenticateEvent #103

Closed Nivek-C94 closed 8 years ago

Nivek-C94 commented 8 years ago

Event` is not fired when player is automatically logged in from last ip.

public function onAuthenticate(ServerAuthAuthenticateEvent $ev) { //doesn't run when player is automatically logged in. echo 'Player has logged in.'; }

Flavius12 commented 8 years ago

The event is fired correctly. Maybe you don't display the message on your MCPE client because that event is fired on PlayerPreLogin. Then don't use echo or print when you want to log something on PocketMine console, use the PocketMine internal logger instead

Nivek-C94 commented 8 years ago

I just used that to test and make sure the code was being ran..

/* * * @param ServerAuthAuthenticateEvent $ev / public function onAuthenticate(ServerAuthAuthenticateEvent $ev) { $player = $ev->getPlayer(); if($this->getPlugin()->clientExist($player->getName())) { $client = $this->getPlugin()->getClient($player->getName()); }else if($this->getPlugin()->getClientFromId($player->getClientId()) !== false) { $client = $this->getPlugin()->getClientFromId($player->getClientId()); }else{ $client = $this->getPlugin()->registerNewClient($player); } $this->getPlugin()->initClient($client, $player); }

Nivek-C94 commented 8 years ago

From what i saw it would only run when the command is entered..i never tried to send a message to the client just used var_dumps and echos.