diff --git a/build.gradle b/build.gradle index fa4b6d1e..945b3566 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ plugins { } group 'ru.nanit' -version '1.4' +version '1.3.2' repositories { mavenCentral() diff --git a/src/main/java/ru/nanit/limbo/protocol/PacketSnapshot.java b/src/main/java/ru/nanit/limbo/protocol/PacketSnapshot.java index d61c0ed3..7b02ab00 100644 --- a/src/main/java/ru/nanit/limbo/protocol/PacketSnapshot.java +++ b/src/main/java/ru/nanit/limbo/protocol/PacketSnapshot.java @@ -57,6 +57,7 @@ public PacketSnapshot encodePacket() { mappings.put(version, hashed); } else { hashes.put(hash, version); + mappings.put(version, version); versionMessages.put(version, encodedMessage.toByteArray()); } @@ -69,6 +70,10 @@ public PacketSnapshot encodePacket() { @Override public void encode(ByteMessage msg, Version version) { Version mapped = mappings.get(version); + + if (mapped == null) + throw new IllegalArgumentException("No mapped version is for " + version); + byte[] message = versionMessages.get(mapped); if (message != null) diff --git a/src/main/java/ru/nanit/limbo/protocol/packets/status/PacketStatusResponse.java b/src/main/java/ru/nanit/limbo/protocol/packets/status/PacketStatusResponse.java index fb7d5111..3655af17 100644 --- a/src/main/java/ru/nanit/limbo/protocol/packets/status/PacketStatusResponse.java +++ b/src/main/java/ru/nanit/limbo/protocol/packets/status/PacketStatusResponse.java @@ -42,10 +42,10 @@ public void encode(ByteMessage msg, Version version) { String ver = server.getConfig().getPingData().getVersion(); String desc = server.getConfig().getPingData().getDescription(); - String json = getResponseJson(ver, protocol, - server.getConfig().getMaxPlayers(), server.getConnections().getCount(), desc); - msg.writeString(json); + msg.writeString(getResponseJson(ver, protocol, + server.getConfig().getMaxPlayers(), + server.getConnections().getCount(), desc)); } @Override