Skip to content

Commit 428acd2

Browse files
committed
Fixes for empty strings in TextPacket
1 parent e90058d commit 428acd2

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/TextPacket.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,20 +202,20 @@ protected function encodePayload(ByteBufferWriter $out) : void{
202202
case self::TYPE_WHISPER:
203203
/** @noinspection PhpMissingBreakStatementInspection */
204204
case self::TYPE_ANNOUNCEMENT:
205-
CommonTypes::putString($out, $this->sourceName);
205+
CommonTypes::putString($out, $this->sourceName === '' ? ' ' : $this->sourceName);
206206
case self::TYPE_RAW:
207207
case self::TYPE_TIP:
208208
case self::TYPE_SYSTEM:
209209
case self::TYPE_JSON_WHISPER:
210210
case self::TYPE_JSON:
211211
case self::TYPE_JSON_ANNOUNCEMENT:
212-
CommonTypes::putString($out, $this->message);
212+
CommonTypes::putString($out, $this->message === '' ? ' ' : $this->message);
213213
break;
214214

215215
case self::TYPE_TRANSLATION:
216216
case self::TYPE_POPUP:
217217
case self::TYPE_JUKEBOX_POPUP:
218-
CommonTypes::putString($out, $this->message);
218+
CommonTypes::putString($out, $this->message === '' ? ' ' : $this->message);
219219
VarInt::writeUnsignedInt($out, count($this->parameters));
220220
foreach($this->parameters as $p){
221221
CommonTypes::putString($out, $p);

0 commit comments

Comments
 (0)