mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 16:51:42 +00:00
Player: fixed chunks getting spammed like crazy during generation
because of the shitty way that the chunk resending is handled, it causes all kinds of problems with the async system because of potential reversions of the state during the process.
This commit is contained in:
parent
0251359179
commit
35a3522b4e
@ -733,6 +733,13 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
|
||||
if(!$this->isConnected() || !isset($this->usedChunks[$index]) || $world !== $this->getWorld()){
|
||||
return;
|
||||
}
|
||||
if(!$this->usedChunks[$index]->equals(UsedChunkStatus::NEEDED())){
|
||||
//TODO: make this an error
|
||||
//we may have added multiple completion handlers, since the Player keeps re-requesting chunks
|
||||
//it doesn't have yet (a relic from the old system, but also currently relied on for chunk resends).
|
||||
//in this event, make sure we don't try to send the chunk multiple times.
|
||||
return;
|
||||
}
|
||||
unset($this->loadQueue[$index]);
|
||||
$this->usedChunks[$index] = UsedChunkStatus::REQUESTED();
|
||||
|
||||
@ -741,6 +748,13 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
|
||||
$this->logger->debug("Tried to send no-longer-active chunk $X $Z in world " . $world->getFolderName());
|
||||
return;
|
||||
}
|
||||
if(!$this->usedChunks[$index]->equals(UsedChunkStatus::REQUESTED())){
|
||||
//TODO: make this an error
|
||||
//this could be triggered due to the shitty way that chunk resends are handled
|
||||
//right now - not because of the spammy re-requesting, but because the chunk status reverts
|
||||
//to NEEDED if they want to be resent.
|
||||
return;
|
||||
}
|
||||
$this->usedChunks[$index] = UsedChunkStatus::SENT();
|
||||
if($this->spawnChunkLoadCount === -1){
|
||||
$this->spawnEntitiesOnChunk($X, $Z);
|
||||
|
Loading…
x
Reference in New Issue
Block a user