From 29e88d8592b8637515125a7b6dde370cd7e4b3a0 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 5 Jun 2017 23:39:16 +0100 Subject: [PATCH] Send area broadcasted packets in batches - I don't know why it wasn't done like this to start with - This provides a significant lightening of workload for large servers with lots of players in the same area because packets are only compressed once instead of for each player. - Improves client-sided performance receiving these in batches instead of being spammed with many individual packets. --- src/pocketmine/level/Level.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/pocketmine/level/Level.php b/src/pocketmine/level/Level.php index a573411f5..f1d604515 100644 --- a/src/pocketmine/level/Level.php +++ b/src/pocketmine/level/Level.php @@ -786,9 +786,7 @@ class Level implements ChunkManager, Metadatable{ Level::getXZ($index, $chunkX, $chunkZ); $chunkPlayers = $this->getChunkPlayers($chunkX, $chunkZ); if(count($chunkPlayers) > 0){ - foreach($entries as $pk){ - $this->server->broadcastPacket($chunkPlayers, $pk); - } + $this->server->batchPackets($chunkPlayers, $entries, false, false); } }