mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-15 16:05:28 +00:00
Check player online status, closes #1983
This commit is contained in:
parent
e0fc3784ad
commit
f7e2d31f0a
@ -2137,7 +2137,6 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
||||
|
||||
$this->connected = false;
|
||||
$this->interface->close($this, $reason);
|
||||
$this->server->removePlayer($this);
|
||||
$this->getLevel()->freeAllChunks($this);
|
||||
|
||||
|
||||
@ -2157,6 +2156,8 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
||||
$this->loadQueue = [];
|
||||
unset($this->buffer);
|
||||
}
|
||||
|
||||
$this->server->removePlayer($this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1984,10 +1984,13 @@ class Server{
|
||||
}
|
||||
|
||||
public function doAutoSave(){
|
||||
|
||||
Timings::$worldSaveTimer->startTiming();
|
||||
foreach($this->getOnlinePlayers() as $player){
|
||||
foreach($this->getOnlinePlayers() as $index => $player){
|
||||
if($player->isOnline()){
|
||||
$player->save();
|
||||
}elseif(!$player->isConnected()){
|
||||
unset($this->players[$index]);
|
||||
}
|
||||
}
|
||||
|
||||
foreach($this->getLevels() as $level){
|
||||
|
@ -251,7 +251,7 @@ class Level implements ChunkManager, Metadatable{
|
||||
$this->nextSave = microtime(true) + 90;
|
||||
|
||||
$this->chunkTickRadius = min($this->server->getViewDistance(), max(1, (int) $this->server->getProperty("chunk-ticking.tick-radius", 3)));
|
||||
$this->chunksPerTick = (int) $this->server->getProperty("chunk-ticking.per-tick", 128);
|
||||
$this->chunksPerTick = (int) $this->server->getProperty("chunk-ticking.per-tick", 80);
|
||||
$this->chunkTickList = [];
|
||||
$this->clearChunksOnTick = (bool) $this->server->getProperty("chunk-ticking.clear-tick-list", false);
|
||||
$this->timings = new LevelTimings($this);
|
||||
|
Loading…
x
Reference in New Issue
Block a user