3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-26 00:00:28 +01:00

Merge pull request #108 from gigosaurus/patch-2

Fix some MalformedJsonExceptions
Dieser Commit ist enthalten in:
Myles 2016-03-03 21:33:57 +00:00
Commit caae4e4cca

Datei anzeigen

@ -115,6 +115,55 @@ public class OutgoingTransformer {
output.writeBytes(input); output.writeBytes(input);
return; return;
} }
if (packet == PacketType.PLAY_PLAYER_LIST_ITEM) {
int action = readVarInt(input);
writeVarInt(action, output);
int players = readVarInt(input);
writeVarInt(players, output);
// loop through players
for (int i = 0; i < players; i++) {
UUID uuid = readUUID(input);
writeUUID(uuid, output);
if (action == 0) { // add player
writeString(readString(input), output); // name
int properties = readVarInt(input);
writeVarInt(properties, output);
// loop through properties
for (int j = 0; j < properties; j++) {
writeString(readString(input), output); // name
writeString(readString(input), output); // value
boolean isSigned = input.readBoolean();
output.writeBoolean(isSigned);
if (isSigned) {
writeString(readString(input), output); // signature
}
}
writeVarInt(readVarInt(input), output); // gamemode
writeVarInt(readVarInt(input), output); // ping
boolean hasDisplayName = input.readBoolean();
output.writeBoolean(hasDisplayName);
if (hasDisplayName) {
writeString(fixJson(readString(input)), output); // display name
}
} else if ((action == 1) || (action == 2)) { // update gamemode || update latency
writeVarInt(readVarInt(input), output);
} else if (action == 3) { // update display name
boolean hasDisplayName = input.readBoolean();
output.writeBoolean(hasDisplayName);
if (hasDisplayName) {
writeString(fixJson(readString(input)), output); // display name
}
} else if (action == 4) { // remove player
// no fields
}
}
return;
}
if (packet == PacketType.PLAY_PLAYER_LIST_HEADER_FOOTER) { if (packet == PacketType.PLAY_PLAYER_LIST_HEADER_FOOTER) {
String header = readString(input); String header = readString(input);
String footer = readString(input); String footer = readString(input);