mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-13 09:19:42 +00:00
De-spaghettify spawn notification handling
This commit is contained in:
parent
714393820f
commit
3ac0c98199
@ -1001,8 +1001,6 @@ class Player extends Human implements CommandSender, ChunkLoader, ChunkListener,
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function doFirstSpawn(){
|
public function doFirstSpawn(){
|
||||||
$this->networkSession->onSpawn();
|
|
||||||
|
|
||||||
if($this->hasPermission(Server::BROADCAST_CHANNEL_USERS)){
|
if($this->hasPermission(Server::BROADCAST_CHANNEL_USERS)){
|
||||||
PermissionManager::getInstance()->subscribeToPermission(Server::BROADCAST_CHANNEL_USERS, $this);
|
PermissionManager::getInstance()->subscribeToPermission(Server::BROADCAST_CHANNEL_USERS, $this);
|
||||||
}
|
}
|
||||||
|
@ -567,6 +567,7 @@ class NetworkSession{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function onSpawn() : void{
|
public function onSpawn() : void{
|
||||||
|
$this->player->doFirstSpawn();
|
||||||
$this->setHandler(new InGameSessionHandler($this->player, $this));
|
$this->setHandler(new InGameSessionHandler($this->player, $this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ class PreSpawnSessionHandler extends SessionHandler{
|
|||||||
public function handleSetLocalPlayerAsInitialized(SetLocalPlayerAsInitializedPacket $packet) : bool{
|
public function handleSetLocalPlayerAsInitialized(SetLocalPlayerAsInitializedPacket $packet) : bool{
|
||||||
$this->player->setImmobile(false); //HACK: this is set to prevent client-side falling before spawn
|
$this->player->setImmobile(false); //HACK: this is set to prevent client-side falling before spawn
|
||||||
|
|
||||||
$this->player->doFirstSpawn();
|
$this->session->onSpawn();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user