mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 08:44:01 +00:00
Replace Player->joined with Player->spawned, remove redundant field
spawned serves basically the same purpose as joined does.
This commit is contained in:
parent
adabfe78df
commit
7c2dccd2a6
@ -197,7 +197,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
public $playedBefore;
|
||||
public $spawned = false;
|
||||
public $loggedIn = false;
|
||||
public $joined = false;
|
||||
public $gamemode;
|
||||
public $lastBreak;
|
||||
/** @var bool */
|
||||
@ -303,7 +302,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
* @return TranslationContainer|string
|
||||
*/
|
||||
public function getLeaveMessage(){
|
||||
if($this->joined){
|
||||
if($this->spawned){
|
||||
return new TranslationContainer(TextFormat::YELLOW . "%multiplayer.player.left", [
|
||||
$this->getDisplayName()
|
||||
]);
|
||||
@ -988,8 +987,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
if($this->getHealth() <= 0){
|
||||
$this->sendRespawnPacket($this->getSpawn());
|
||||
}
|
||||
|
||||
$this->joined = true;
|
||||
}
|
||||
|
||||
protected function sendRespawnPacket(Vector3 $pos){
|
||||
@ -3319,7 +3316,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
|
||||
$this->stopSleep();
|
||||
|
||||
if($this->joined){
|
||||
if($this->spawned){
|
||||
$this->server->getPluginManager()->callEvent($ev = new PlayerQuitEvent($this, $message, $reason));
|
||||
if($ev->getQuitMessage() != ""){
|
||||
$this->server->broadcastMessage($ev->getQuitMessage());
|
||||
@ -3332,7 +3329,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
$this->server->getLogger()->logException($e);
|
||||
}
|
||||
}
|
||||
$this->joined = false;
|
||||
|
||||
if($this->isValid()){
|
||||
foreach($this->usedChunks as $index => $d){
|
||||
|
@ -2357,7 +2357,7 @@ class Server{
|
||||
foreach($this->players as $p){
|
||||
if(!$p->loggedIn and ($tickTime - $p->creationTime) >= 10){
|
||||
$p->close("", "Login timeout");
|
||||
}elseif($this->alwaysTickPlayers and $p->joined){
|
||||
}elseif($this->alwaysTickPlayers and $p->spawned){
|
||||
$p->onUpdate($currentTick);
|
||||
}
|
||||
}
|
||||
@ -2402,7 +2402,7 @@ class Server{
|
||||
if($this->getAutoSave()){
|
||||
Timings::$worldSaveTimer->startTiming();
|
||||
foreach($this->players as $index => $player){
|
||||
if($player->joined){
|
||||
if($player->spawned){
|
||||
$player->save(true);
|
||||
}elseif(!$player->isConnected()){
|
||||
$this->removePlayer($player);
|
||||
|
Loading…
x
Reference in New Issue
Block a user