From d542bbc7369125922ab65d8369d62c27bbddef75 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Fri, 16 Mar 2018 11:44:57 +0000 Subject: [PATCH] Level: Fixed race condition between direct and batched block updating This happened when a block was set into the world with a direct update, when an entry for that block was already present in the changedBlocks map. This fixes the bug by removing the entry from the changedBlocks map to avoid sending outdated block updates in batches. --- src/pocketmine/level/Level.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pocketmine/level/Level.php b/src/pocketmine/level/Level.php index 5a64b975d..8d7c21a0d 100644 --- a/src/pocketmine/level/Level.php +++ b/src/pocketmine/level/Level.php @@ -1529,7 +1529,7 @@ class Level implements ChunkManager, Metadatable{ if($direct === true){ $this->sendBlocks($this->getChunkPlayers($pos->x >> 4, $pos->z >> 4), [$block], UpdateBlockPacket::FLAG_ALL_PRIORITY); - unset($this->chunkCache[$chunkHash]); + unset($this->chunkCache[$chunkHash], $this->changedBlocks[$chunkHash][$blockHash]); }else{ if(!isset($this->changedBlocks[$chunkHash])){ $this->changedBlocks[$chunkHash] = [];