bug fixes (uuid reading, play info, TextComponent null)

This commit is contained in:
Bixilon 2020-06-25 15:49:49 +02:00
parent 4a561d6a01
commit 2d529dfce7
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
3 changed files with 6 additions and 4 deletions

View File

@ -24,6 +24,10 @@ public class TextComponent {
JSONObject json; JSONObject json;
public TextComponent(String raw) { public TextComponent(String raw) {
if (raw == null) {
this.json = new JSONObject();
return;
}
try { try {
this.json = new JSONObject(raw); this.json = new JSONObject(raw);
} catch (JSONException e) { } catch (JSONException e) {

View File

@ -88,7 +88,7 @@ public class PacketPlayerInfo implements ClientboundPacket {
if (property.isLegacy()) { if (property.isLegacy()) {
Log.game(String.format("[TAB] Player info bulk (uuid=%s, name=%s, ping=%d)", property.getUUID(), property.getName(), property.getPing())); Log.game(String.format("[TAB] Player info bulk (uuid=%s, name=%s, ping=%d)", property.getUUID(), property.getName(), property.getPing()));
} else { } else {
Log.game(String.format("[TAB] Player info bulk (uuid=%s, action=%s, name=%s, gameMode=%s, ping=%d)", property.getUUID(), property.getAction(), property.getName(), ((property.getGameMode() == null) ? "null" : property.getGameMode().name()), property.getPing())); Log.game(String.format("[TAB] Player info bulk (uuid=%s, action=%s, name=%s, gameMode=%s, ping=%d, displayName=%s)", property.getUUID(), property.getAction(), property.getName(), ((property.getGameMode() == null) ? "null" : property.getGameMode().name()), property.getPing(), ((property.getDisplayName() == null) ? "null" : property.getDisplayName().getColoredMessage())));
} }
} }

View File

@ -121,9 +121,7 @@ public class InByteBuffer {
public UUID readUUID() { public UUID readUUID() {
ByteBuffer buffer = ByteBuffer.allocate(16); // UUID.BYTES return new UUID(readLong(), readLong());
buffer.put(readBytes(16));
return new UUID(buffer.getLong(0), buffer.getLong(1));
} }
public int readVarInt() { public int readVarInt() {