mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-15 02:09:42 +00:00
Added login timeout for players that do not complete the login process in time
This commit is contained in:
parent
b1edfd7631
commit
e61db8ad06
@ -1495,7 +1495,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
||||
|
||||
switch($packet->pid()){
|
||||
case ProtocolInfo::LOGIN_PACKET:
|
||||
if($this->loggedIn === true){
|
||||
if($this->loggedIn){
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -2207,15 +2207,18 @@ class Server{
|
||||
$this->identifiers[spl_object_hash($player)] = $identifier;
|
||||
}
|
||||
|
||||
private function checkTickUpdates($currentTick){
|
||||
private function checkTickUpdates($currentTick, $tickTime){
|
||||
foreach($this->players as $p){
|
||||
if(!$p->loggedIn and ($tickTime - $p->creationTime) >= 10){
|
||||
$p->close("", "Login timeout");
|
||||
}elseif($this->alwaysTickPlayers){
|
||||
$p->onUpdate($currentTick);
|
||||
}
|
||||
}
|
||||
|
||||
//Do level ticks
|
||||
foreach($this->getLevels() as $level){
|
||||
if($level->getTickRate() > $this->baseTickRate and --$level->tickRateCounter > 0){
|
||||
if($this->alwaysTickPlayers){
|
||||
foreach($level->getPlayers() as $p){
|
||||
$p->onUpdate($currentTick);
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
try{
|
||||
@ -2405,7 +2408,7 @@ class Server{
|
||||
$this->scheduler->mainThreadHeartbeat($this->tickCounter);
|
||||
Timings::$schedulerTimer->stopTiming();
|
||||
|
||||
$this->checkTickUpdates($this->tickCounter);
|
||||
$this->checkTickUpdates($this->tickCounter, $tickTime);
|
||||
|
||||
if(($this->tickCounter & 0b1111) === 0){
|
||||
$this->titleTick();
|
||||
|
Loading…
x
Reference in New Issue
Block a user