mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-14 09:49:50 +00:00
Workaround for some plugins crashing clients during PlayerLoginEvent
This commit is contained in:
parent
e4e4ef5f2a
commit
087a994393
@ -1840,12 +1840,6 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
|||||||
|
|
||||||
protected function completeLoginSequence(){
|
protected function completeLoginSequence(){
|
||||||
parent::__construct($this->level, $this->namedtag);
|
parent::__construct($this->level, $this->namedtag);
|
||||||
$this->server->getPluginManager()->callEvent($ev = new PlayerLoginEvent($this, "Plugin reason"));
|
|
||||||
if($ev->isCancelled()){
|
|
||||||
$this->close($this->getLeaveMessage(), $ev->getKickMessage());
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!$this->hasValidSpawnPosition() and isset($this->namedtag->SpawnLevel) and ($level = $this->server->getLevelByName($this->namedtag["SpawnLevel"])) instanceof Level){
|
if(!$this->hasValidSpawnPosition() and isset($this->namedtag->SpawnLevel) and ($level = $this->server->getLevelByName($this->namedtag["SpawnLevel"])) instanceof Level){
|
||||||
$this->spawnPosition = new WeakPosition($this->namedtag["SpawnX"], $this->namedtag["SpawnY"], $this->namedtag["SpawnZ"], $level);
|
$this->spawnPosition = new WeakPosition($this->namedtag["SpawnX"], $this->namedtag["SpawnY"], $this->namedtag["SpawnZ"], $level);
|
||||||
@ -1879,6 +1873,13 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
|||||||
$pk->worldName = $this->server->getMotd();
|
$pk->worldName = $this->server->getMotd();
|
||||||
$this->dataPacket($pk);
|
$this->dataPacket($pk);
|
||||||
|
|
||||||
|
$this->server->getPluginManager()->callEvent($ev = new PlayerLoginEvent($this, "Plugin reason"));
|
||||||
|
if($ev->isCancelled()){
|
||||||
|
$this->close($this->getLeaveMessage(), $ev->getKickMessage());
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$this->level->sendTime($this);
|
$this->level->sendTime($this);
|
||||||
|
|
||||||
$this->sendAttributes(true);
|
$this->sendAttributes(true);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user