mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-07 12:18:46 +00:00
Fixed precondition on double chunk send being useless
this is messy, but necessary for now.
This commit is contained in:
parent
d19c21e2e1
commit
09a2402f01
@ -102,6 +102,7 @@ use pocketmine\permission\DefaultPermissions;
|
|||||||
use pocketmine\player\GameMode;
|
use pocketmine\player\GameMode;
|
||||||
use pocketmine\player\Player;
|
use pocketmine\player\Player;
|
||||||
use pocketmine\player\PlayerInfo;
|
use pocketmine\player\PlayerInfo;
|
||||||
|
use pocketmine\player\UsedChunkStatus;
|
||||||
use pocketmine\player\XboxLivePlayerInfo;
|
use pocketmine\player\XboxLivePlayerInfo;
|
||||||
use pocketmine\Server;
|
use pocketmine\Server;
|
||||||
use pocketmine\timings\Timings;
|
use pocketmine\timings\Timings;
|
||||||
@ -919,10 +920,17 @@ class NetworkSession{
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$currentWorld = $this->player->getLocation()->getWorld();
|
$currentWorld = $this->player->getLocation()->getWorld();
|
||||||
if($world !== $currentWorld or !$this->player->isUsingChunk($chunkX, $chunkZ)){
|
if($world !== $currentWorld or ($status = $this->player->getUsedChunkStatus($chunkX, $chunkZ)) === null){
|
||||||
$this->logger->debug("Tried to send no-longer-active chunk $chunkX $chunkZ in world " . $world->getFolderName());
|
$this->logger->debug("Tried to send no-longer-active chunk $chunkX $chunkZ in world " . $world->getFolderName());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(!$status->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;
|
||||||
|
}
|
||||||
$world->timings->syncChunkSend->startTiming();
|
$world->timings->syncChunkSend->startTiming();
|
||||||
try{
|
try{
|
||||||
$this->queueCompressed($promise);
|
$this->queueCompressed($promise);
|
||||||
|
@ -744,13 +744,6 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
|
|||||||
$this->usedChunks[$index] = UsedChunkStatus::REQUESTED();
|
$this->usedChunks[$index] = UsedChunkStatus::REQUESTED();
|
||||||
|
|
||||||
$this->getNetworkSession()->startUsingChunk($X, $Z, function() use ($X, $Z, $index) : void{
|
$this->getNetworkSession()->startUsingChunk($X, $Z, function() use ($X, $Z, $index) : void{
|
||||||
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();
|
$this->usedChunks[$index] = UsedChunkStatus::SENT();
|
||||||
if($this->spawnChunkLoadCount === -1){
|
if($this->spawnChunkLoadCount === -1){
|
||||||
$this->spawnEntitiesOnChunk($X, $Z);
|
$this->spawnEntitiesOnChunk($X, $Z);
|
||||||
@ -876,6 +869,13 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
|
|||||||
return $this->usedChunks;
|
return $this->usedChunks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a usage status of the given chunk, or null if the player is not using the given chunk.
|
||||||
|
*/
|
||||||
|
public function getUsedChunkStatus(int $chunkX, int $chunkZ) : ?UsedChunkStatus{
|
||||||
|
return $this->usedChunks[World::chunkHash($chunkX, $chunkZ)] ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the target chunk has been sent to this player.
|
* Returns whether the target chunk has been sent to this player.
|
||||||
*/
|
*/
|
||||||
|
@ -101,12 +101,12 @@ parameters:
|
|||||||
path: ../../../src/network/mcpe/NetworkSession.php
|
path: ../../../src/network/mcpe/NetworkSession.php
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Cannot call method getWorld\\(\\) on pocketmine\\\\player\\\\Player\\|null\\.$#"
|
message: "#^Cannot call method getUsedChunkStatus\\(\\) on pocketmine\\\\player\\\\Player\\|null\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
path: ../../../src/network/mcpe/NetworkSession.php
|
path: ../../../src/network/mcpe/NetworkSession.php
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Cannot call method isUsingChunk\\(\\) on pocketmine\\\\player\\\\Player\\|null\\.$#"
|
message: "#^Cannot call method getWorld\\(\\) on pocketmine\\\\player\\\\Player\\|null\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
path: ../../../src/network/mcpe/NetworkSession.php
|
path: ../../../src/network/mcpe/NetworkSession.php
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user