103 $this->type = Byte::readUnsigned($in);
104 $this->needsTranslation = CommonTypes::getBool($in);
106 case self::TYPE_CHAT:
107 case self::TYPE_WHISPER:
109 case self::TYPE_ANNOUNCEMENT:
110 $this->sourceName = CommonTypes::getString($in);
113 case self::TYPE_SYSTEM:
114 case self::TYPE_JSON_WHISPER:
115 case self::TYPE_JSON:
116 case self::TYPE_JSON_ANNOUNCEMENT:
117 $this->message = CommonTypes::getString($in);
120 case self::TYPE_TRANSLATION:
121 case self::TYPE_POPUP:
122 case self::TYPE_JUKEBOX_POPUP:
123 $this->message = CommonTypes::getString($in);
124 $count = VarInt::readUnsignedInt($in);
125 for($i = 0; $i < $count; ++$i){
126 $this->parameters[] = CommonTypes::getString($in);
131 $this->xboxUserId = CommonTypes::getString($in);
132 $this->platformChatId = CommonTypes::getString($in);
133 $this->filteredMessage = CommonTypes::getString($in);
137 Byte::writeUnsigned($out, $this->type);
138 CommonTypes::putBool($out, $this->needsTranslation);
140 case self::TYPE_CHAT:
141 case self::TYPE_WHISPER:
143 case self::TYPE_ANNOUNCEMENT:
144 CommonTypes::putString($out, $this->sourceName);
147 case self::TYPE_SYSTEM:
148 case self::TYPE_JSON_WHISPER:
149 case self::TYPE_JSON:
150 case self::TYPE_JSON_ANNOUNCEMENT:
151 CommonTypes::putString($out, $this->message);
154 case self::TYPE_TRANSLATION:
155 case self::TYPE_POPUP:
156 case self::TYPE_JUKEBOX_POPUP:
157 CommonTypes::putString($out, $this->message);
158 VarInt::writeUnsignedInt($out, count($this->parameters));
159 foreach($this->parameters as $p){
160 CommonTypes::putString($out, $p);
165 CommonTypes::putString($out, $this->xboxUserId);
166 CommonTypes::putString($out, $this->platformChatId);
167 CommonTypes::putString($out, $this->filteredMessage);