mirror of
https://github.com/Nan1t/NanoLimbo.git
synced 2025-07-09 11:30:13 +02:00
Fixed packet snapshot for minimal version
This commit is contained in:
parent
04a18a5386
commit
970d5cfcd2
@ -4,7 +4,7 @@ plugins {
|
||||
}
|
||||
|
||||
group 'ru.nanit'
|
||||
version '1.4'
|
||||
version '1.3.2'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
@ -57,6 +57,7 @@ public class PacketSnapshot implements PacketOut {
|
||||
mappings.put(version, hashed);
|
||||
} else {
|
||||
hashes.put(hash, version);
|
||||
mappings.put(version, version);
|
||||
versionMessages.put(version, encodedMessage.toByteArray());
|
||||
}
|
||||
|
||||
@ -69,6 +70,10 @@ public class PacketSnapshot implements PacketOut {
|
||||
@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)
|
||||
|
@ -42,10 +42,10 @@ public class PacketStatusResponse implements PacketOut {
|
||||
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user