mirror of
https://github.com/Nan1t/NanoLimbo.git
synced 2025-07-18 06:50:17 +02:00
Minor code optimizations
This commit is contained in:
parent
1d75272c83
commit
4bdf856363
@ -89,7 +89,7 @@ public enum State {
|
|||||||
clientBound.register(PacketPluginMessage::new,
|
clientBound.register(PacketPluginMessage::new,
|
||||||
map(0x19, V1_13, V1_13_2),
|
map(0x19, V1_13, V1_13_2),
|
||||||
map(0x18, V1_14, V1_14_4),
|
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(0x18, V1_16, V1_16_1),
|
||||||
map(0x17, V1_16_2, V1_16_4),
|
map(0x17, V1_16_2, V1_16_4),
|
||||||
map(0x18, V1_17, V1_18)
|
map(0x18, V1_17, V1_18)
|
||||||
|
@ -40,13 +40,19 @@ public enum Version {
|
|||||||
V1_17(755),
|
V1_17(755),
|
||||||
V1_17_1(756),
|
V1_17_1(756),
|
||||||
V1_18(757);
|
V1_18(757);
|
||||||
|
// 1.18.1 has same protocol number
|
||||||
|
|
||||||
private static final Map<Integer, Version> VERSION_MAP;
|
private static final Map<Integer, Version> VERSION_MAP;
|
||||||
|
private static final Version MAX;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
Version[] values = values();
|
||||||
|
|
||||||
VERSION_MAP = new HashMap<>();
|
VERSION_MAP = new HashMap<>();
|
||||||
|
MAX = values[values.length - 1];
|
||||||
|
|
||||||
Version last = null;
|
Version last = null;
|
||||||
for (Version version : values()) {
|
for (Version version : values) {
|
||||||
version.prev = last;
|
version.prev = last;
|
||||||
last = version;
|
last = version;
|
||||||
VERSION_MAP.put(version.getProtocolNumber(), version);
|
VERSION_MAP.put(version.getProtocolNumber(), version);
|
||||||
@ -97,8 +103,7 @@ public enum Version {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Version getMax() {
|
public static Version getMax() {
|
||||||
Version[] values = Version.values();
|
return MAX;
|
||||||
return values[values.length - 1];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Version of(int protocolNumber) {
|
public static Version of(int protocolNumber) {
|
||||||
|
@ -44,7 +44,7 @@ public final class Logger {
|
|||||||
|
|
||||||
public static void print(Level level, Object msg, Throwable t, Object... args) {
|
public static void print(Level level, Object msg, Throwable t, Object... args) {
|
||||||
if (debugLevel >= level.getIndex()) {
|
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();
|
if (t != null) t.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user