23 public const NETWORK_ID = ProtocolInfo::PACKET_VIOLATION_WARNING_PACKET;
25 public const TYPE_MALFORMED = 0;
27 public const SEVERITY_WARNING = 0;
28 public const SEVERITY_FINAL_WARNING = 1;
29 public const SEVERITY_TERMINATING_CONNECTION = 2;
32 private int $severity;
33 private int $packetId;
34 private string $message;
39 public static function create(
int $type,
int $severity,
int $packetId,
string $message) : self{
41 $result->type = $type;
42 $result->severity = $severity;
43 $result->packetId = $packetId;
44 $result->message = $message;
48 public function getType() : int{ return $this->type; }
50 public function getSeverity() : int{ return $this->severity; }
52 public function getPacketId() : int{ return $this->packetId; }
54 public function getMessage() : string{ return $this->message; }
57 $this->type = VarInt::readSignedInt($in);
58 $this->severity = VarInt::readSignedInt($in);
59 $this->packetId = VarInt::readSignedInt($in);
60 $this->message = CommonTypes::getString($in);
64 VarInt::writeSignedInt($out, $this->type);
65 VarInt::writeSignedInt($out, $this->severity);
66 VarInt::writeSignedInt($out, $this->packetId);
67 CommonTypes::putString($out, $this->message);
71 return $handler->handlePacketViolationWarning($this);