Fix chat which is not got proper JSON

This commit is contained in:
Myles 2016-03-01 23:35:16 +00:00
parent 6828425d72
commit 9368347b56
2 changed files with 10 additions and 1 deletions

View File

@ -20,7 +20,7 @@ public enum PacketType {
/* Play serverbound */ /* Play serverbound */
PLAY_TP_CONFIRM(State.PLAY, Direction.INCOMING, -1, 0x00), PLAY_TP_CONFIRM(State.PLAY, Direction.INCOMING, -1, 0x00),
PLAY_TAB_COMPLETE_REQUEST(State.PLAY, Direction.INCOMING, 0x14, 0x01), PLAY_TAB_COMPLETE_REQUEST(State.PLAY, Direction.INCOMING, 0x14, 0x01),
PLAY_CLICHAT_MESSAGE_CLIENT(State.PLAY, Direction.INCOMING, 0x01, 0x02), PLAY_CHAT_MESSAGE_CLIENT(State.PLAY, Direction.INCOMING, 0x01, 0x02),
PLAY_CLIENT_STATUS(State.PLAY, Direction.INCOMING, 0x16, 0x03), PLAY_CLIENT_STATUS(State.PLAY, Direction.INCOMING, 0x16, 0x03),
PLAY_CLIENT_SETTINGS(State.PLAY, Direction.INCOMING, 0x15, 0x04), PLAY_CLIENT_SETTINGS(State.PLAY, Direction.INCOMING, 0x15, 0x04),
PLAY_CONFIRM_TRANS(State.PLAY, Direction.INCOMING, 0x0F, 0x05), PLAY_CONFIRM_TRANS(State.PLAY, Direction.INCOMING, 0x0F, 0x05),

View File

@ -222,6 +222,7 @@ public class OutgoingTransformer {
} }
return; return;
} }
if (packet == PacketType.PLAY_SPAWN_GLOBAL_ENTITY) { if (packet == PacketType.PLAY_SPAWN_GLOBAL_ENTITY) {
int id = PacketUtil.readVarInt(input); int id = PacketUtil.readVarInt(input);
PacketUtil.writeVarInt(id, output); PacketUtil.writeVarInt(id, output);
@ -376,6 +377,14 @@ public class OutgoingTransformer {
PacketUtil.writeString(fixJson(line), output); PacketUtil.writeString(fixJson(line), output);
} }
} }
if(packet == PacketType.PLAY_CHAT_MESSAGE) {
String chat = PacketUtil.readString(input);
PacketUtil.writeString(fixJson(chat), output);
byte pos = input.readByte();
output.writeByte(pos);
return;
}
if (packet == PacketType.PLAY_JOIN_GAME) { if (packet == PacketType.PLAY_JOIN_GAME) {
int id = input.readInt(); int id = input.readInt();
clientEntityTypes.put(id, EntityType.PLAYER); clientEntityTypes.put(id, EntityType.PLAYER);