Added PlayerCreationEvent

This commit is contained in:
Shoghi Cervantes
2015-01-03 16:38:00 +01:00
parent 074c8b876d
commit 7ef8edccf4
3 changed files with 134 additions and 2 deletions

View File

@ -24,6 +24,7 @@
*/
namespace pocketmine\network;
use pocketmine\event\player\PlayerCreationEvent;
use pocketmine\network\protocol\AddEntityPacket;
use pocketmine\network\protocol\AddItemEntityPacket;
use pocketmine\network\protocol\AddMobPacket;
@ -167,7 +168,11 @@ class RakLibInterface implements ServerInstance, SourceInterface{
}
public function openSession($identifier, $address, $port, $clientID){
$player = new Player($this, null, $address, $port);
$ev = new PlayerCreationEvent($this, Player::class, Player::class, null, $address, $port);
$this->server->getPluginManager()->callEvent($ev);
$class = $ev->getPlayerClass();
$player = new $class($this, $ev->getClientId(), $ev->getAddress(), $ev->getPort());
$this->players[$identifier] = $player;
$this->identifiersACK[$identifier] = 0;
$this->identifiers->attach($player, $identifier);