30 public const NETWORK_ID = ProtocolInfo::NETWORK_SETTINGS_PACKET;
32 public const COMPRESS_NOTHING = 0;
33 public const COMPRESS_EVERYTHING = 1;
35 private int $compressionThreshold;
36 private int $compressionAlgorithm;
37 private bool $enableClientThrottling;
38 private int $clientThrottleThreshold;
39 private float $clientThrottleScalar;
44 public static function create(
int $compressionThreshold,
int $compressionAlgorithm,
bool $enableClientThrottling,
int $clientThrottleThreshold,
float $clientThrottleScalar) : self{
46 $result->compressionThreshold = $compressionThreshold;
47 $result->compressionAlgorithm = $compressionAlgorithm;
48 $result->enableClientThrottling = $enableClientThrottling;
49 $result->clientThrottleThreshold = $clientThrottleThreshold;
50 $result->clientThrottleScalar = $clientThrottleScalar;
54 public function canBeSentBeforeLogin() : bool{
58 public function getCompressionThreshold() : int{
59 return $this->compressionThreshold;
67 public function isEnableClientThrottling() : bool{ return $this->enableClientThrottling; }
69 public function getClientThrottleThreshold() : int{ return $this->clientThrottleThreshold; }
71 public function getClientThrottleScalar() : float{ return $this->clientThrottleScalar; }
74 $this->compressionThreshold = LE::readUnsignedShort($in);
75 $this->compressionAlgorithm = LE::readUnsignedShort($in);
76 $this->enableClientThrottling = CommonTypes::getBool($in);
77 $this->clientThrottleThreshold = Byte::readUnsigned($in);
78 $this->clientThrottleScalar = LE::readFloat($in);
82 LE::writeUnsignedShort($out, $this->compressionThreshold);
83 LE::writeUnsignedShort($out, $this->compressionAlgorithm);
84 CommonTypes::putBool($out, $this->enableClientThrottling);
85 Byte::writeUnsigned($out, $this->clientThrottleThreshold);
86 LE::writeFloat($out, $this->clientThrottleScalar);
90 return $handler->handleNetworkSettings($this);