diff --git a/src/player/Player.php b/src/player/Player.php index d0003d4b2a..762187b240 100644 --- a/src/player/Player.php +++ b/src/player/Player.php @@ -342,7 +342,7 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{ $this->spawnThreshold = (int) (($this->server->getConfigGroup()->getPropertyInt(YmlServerProperties::CHUNK_SENDING_SPAWN_RADIUS, 4) ** 2) * M_PI); $this->chunkSelector = new ChunkSelector(); - $this->chunkLoader = new class implements ChunkLoader{}; + $this->chunkLoader = new ChunkLoader(); $this->chunkTicker = new ChunkTicker(); $world = $spawnLocation->getWorld(); //load the spawn chunk so we can see the terrain diff --git a/src/world/ChunkLoader.php b/src/world/ChunkLoader.php index 9e909e928f..c81c8e3eaa 100644 --- a/src/world/ChunkLoader.php +++ b/src/world/ChunkLoader.php @@ -32,6 +32,6 @@ namespace pocketmine\world; * WARNING: When moving this object around in the world or destroying it, * be sure to unregister the loader from chunks you're not using, otherwise you'll leak memory. */ -interface ChunkLoader{ +final class ChunkLoader{ } diff --git a/src/world/World.php b/src/world/World.php index 44c8d3cd71..7264b90e2a 100644 --- a/src/world/World.php +++ b/src/world/World.php @@ -3321,7 +3321,7 @@ class World implements ChunkManager{ /** @phpstan-var PromiseResolver $resolver */ $resolver = $this->chunkPopulationRequestMap[$chunkHash] = new PromiseResolver(); if($associatedChunkLoader === null){ - $temporaryLoader = new class implements ChunkLoader{}; + $temporaryLoader = new ChunkLoader(); $this->registerChunkLoader($temporaryLoader, $chunkX, $chunkZ); $resolver->getPromise()->onCompletion( fn() => $this->unregisterChunkLoader($temporaryLoader, $chunkX, $chunkZ), @@ -3368,7 +3368,7 @@ class World implements ChunkManager{ return [$resolver, false]; } - $temporaryChunkLoader = new class implements ChunkLoader{}; + $temporaryChunkLoader = new ChunkLoader(); $this->registerChunkLoader($temporaryChunkLoader, $chunkX, $chunkZ); $chunk = $this->loadChunk($chunkX, $chunkZ); $this->unregisterChunkLoader($temporaryChunkLoader, $chunkX, $chunkZ); @@ -3453,8 +3453,7 @@ class World implements ChunkManager{ $chunkPopulationLockId = new ChunkLockId(); - $temporaryChunkLoader = new class implements ChunkLoader{ - }; + $temporaryChunkLoader = new ChunkLoader(); for($xx = -1; $xx <= 1; ++$xx){ for($zz = -1; $zz <= 1; ++$zz){ $this->lockChunk($chunkX + $xx, $chunkZ + $zz, $chunkPopulationLockId);