Added chunk-sending.compression-level property

This commit is contained in:
Shoghi Cervantes 2014-06-17 14:34:14 +02:00
parent 266b78aa31
commit e8cc52f99e
2 changed files with 4 additions and 1 deletions

View File

@ -1371,6 +1371,8 @@ class Server{
$this->logger->info("Advanced cache enabled"); $this->logger->info("Advanced cache enabled");
} }
Level::$COMPRESSION_LEVEL = $this->getProperty("chunk-sending.compression-level", 7);
if(defined("pocketmine\\DEBUG") and \pocketmine\DEBUG >= 0 and function_exists("cli_set_process_title")){ if(defined("pocketmine\\DEBUG") and \pocketmine\DEBUG >= 0 and function_exists("cli_set_process_title")){
@cli_set_process_title("PocketMine-MP " . $this->getPocketMineVersion()); @cli_set_process_title("PocketMine-MP " . $this->getPocketMineVersion());
} }

View File

@ -67,6 +67,7 @@ use raklib\Binary;
class Level implements ChunkManager, Metadatable{ class Level implements ChunkManager, Metadatable{
private static $levelIdCounter = 1; private static $levelIdCounter = 1;
public static $COMPRESSION_LEVEL = 7;
const BLOCK_UPDATE_NORMAL = 1; const BLOCK_UPDATE_NORMAL = 1;
@ -1261,7 +1262,7 @@ class Level implements ChunkManager, Metadatable{
} }
} }
$ordered = zlib_encode(Binary::writeLInt($X) . Binary::writeLInt($Z) . $orderedIds . $orderedData . $orderedSkyLight . $orderedLight . $biomeIds . $biomeColors, ZLIB_ENCODING_DEFLATE, 8); $ordered = zlib_encode(Binary::writeLInt($X) . Binary::writeLInt($Z) . $orderedIds . $orderedData . $orderedSkyLight . $orderedLight . $biomeIds . $biomeColors, ZLIB_ENCODING_DEFLATE, self::$COMPRESSION_LEVEL);
if(ADVANCED_CACHE == true and $Yndex === 0xff){ if(ADVANCED_CACHE == true and $Yndex === 0xff){
Cache::add($identifier, $ordered, 60); Cache::add($identifier, $ordered, 60);