mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-16 02:38:54 +00:00
More hack-fixes for #1220
Player and network really need to get divorced, and fast.
This commit is contained in:
parent
e8be8550a0
commit
8274f5b3cc
@ -299,12 +299,19 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
/** @var int|null */
|
||||
protected $lineHeight = null;
|
||||
|
||||
/**
|
||||
* @return TranslationContainer|string
|
||||
*/
|
||||
public function getLeaveMessage(){
|
||||
if($this->joined){
|
||||
return new TranslationContainer(TextFormat::YELLOW . "%multiplayer.player.left", [
|
||||
$this->getDisplayName()
|
||||
]);
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* This might disappear in the future.
|
||||
* Please use getUniqueId() instead (IP + clientId + name combo, in the future it'll change to real UUID for online
|
||||
@ -3444,12 +3451,14 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
$this->usedChunks = [];
|
||||
$this->loadQueue = [];
|
||||
|
||||
if($this->loggedIn){
|
||||
foreach($this->server->getOnlinePlayers() as $player){
|
||||
if(!$player->canSee($this)){
|
||||
$player->showPlayer($this);
|
||||
}
|
||||
}
|
||||
$this->hiddenPlayers = [];
|
||||
}
|
||||
|
||||
foreach($this->windowIndex as $window){
|
||||
$this->removeWindow($window);
|
||||
@ -3460,8 +3469,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
parent::close();
|
||||
$this->spawned = false;
|
||||
|
||||
$this->interface->close($this, $notify ? $reason : "");
|
||||
|
||||
if($this->loggedIn){
|
||||
$this->loggedIn = false;
|
||||
$this->server->removeOnlinePlayer($this);
|
||||
@ -3489,6 +3496,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
}catch(\Throwable $e){
|
||||
$this->server->getLogger()->logException($e);
|
||||
}finally{
|
||||
$this->interface->close($this, $notify ? $reason : "");
|
||||
$this->server->removePlayer($this);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user