diff --git a/src/main/java/ru/nanit/limbo/protocol/registry/State.java b/src/main/java/ru/nanit/limbo/protocol/registry/State.java index 4b377d47..24aec919 100644 --- a/src/main/java/ru/nanit/limbo/protocol/registry/State.java +++ b/src/main/java/ru/nanit/limbo/protocol/registry/State.java @@ -89,7 +89,7 @@ public enum State { clientBound.register(PacketPluginMessage::new, map(0x19, V1_13, V1_13_2), map(0x18, V1_14, V1_14_4), - map(0x19, V1_15,V1_15_2), + map(0x19, V1_15, V1_15_2), map(0x18, V1_16, V1_16_1), map(0x17, V1_16_2, V1_16_4), map(0x18, V1_17, V1_18) diff --git a/src/main/java/ru/nanit/limbo/protocol/registry/Version.java b/src/main/java/ru/nanit/limbo/protocol/registry/Version.java index bd283d99..bb4d19cc 100644 --- a/src/main/java/ru/nanit/limbo/protocol/registry/Version.java +++ b/src/main/java/ru/nanit/limbo/protocol/registry/Version.java @@ -40,13 +40,19 @@ public enum Version { V1_17(755), V1_17_1(756), V1_18(757); + // 1.18.1 has same protocol number private static final Map VERSION_MAP; + private static final Version MAX; static { + Version[] values = values(); + VERSION_MAP = new HashMap<>(); + MAX = values[values.length - 1]; + Version last = null; - for (Version version : values()) { + for (Version version : values) { version.prev = last; last = version; VERSION_MAP.put(version.getProtocolNumber(), version); @@ -97,8 +103,7 @@ public static Version getMin() { } public static Version getMax() { - Version[] values = Version.values(); - return values[values.length - 1]; + return MAX; } public static Version of(int protocolNumber) { diff --git a/src/main/java/ru/nanit/limbo/util/Logger.java b/src/main/java/ru/nanit/limbo/util/Logger.java index c3278519..2f3edbbe 100644 --- a/src/main/java/ru/nanit/limbo/util/Logger.java +++ b/src/main/java/ru/nanit/limbo/util/Logger.java @@ -44,7 +44,7 @@ public static void error(Object msg, Throwable t, Object... args) { public static void print(Level level, Object msg, Throwable t, Object... args) { if (debugLevel >= level.getIndex()) { - System.out.println(String.format("%s: %s", getPrefix(level), String.format(msg.toString(), args))); + System.out.printf("%s: %s%n", getPrefix(level), String.format(msg.toString(), args)); if (t != null) t.printStackTrace(); } }