mirror of
https://github.com/dmulloy2/ProtocolLib.git
synced 2024-11-24 03:25:29 +01:00
Fix a few issues with the registry
This commit is contained in:
parent
a9aa406d29
commit
e5bc602af3
@ -33,7 +33,11 @@ public class ProtocolLogger {
|
||||
}
|
||||
|
||||
private static boolean isDebugEnabled() {
|
||||
return ProtocolLibrary.getConfig().isDebug();
|
||||
try {
|
||||
return ProtocolLibrary.getConfig().isDebug();
|
||||
} catch (Throwable ex) {
|
||||
return true; // For testing
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -67,7 +71,11 @@ public class ProtocolLogger {
|
||||
|
||||
public static void debug(String message, Object... args) {
|
||||
if (isDebugEnabled()) {
|
||||
log("[Debug] " + message, args);
|
||||
if (logger != null) {
|
||||
log("[Debug] " + message, args);
|
||||
} else {
|
||||
System.out.println("[Debug] " + MessageFormat.format(message, args));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -43,16 +43,16 @@ public class PacketRegistry {
|
||||
public static final ReportType REPORT_INSUFFICIENT_SERVER_PACKETS = new ReportType("Too few server packets detected: %s");
|
||||
public static final ReportType REPORT_INSUFFICIENT_CLIENT_PACKETS = new ReportType("Too few client packets detected: %s");
|
||||
|
||||
// Two different packet registry
|
||||
// The Netty packet registry
|
||||
private static volatile ProtocolRegistry NETTY;
|
||||
|
||||
// Cached for Netty
|
||||
private static volatile Set<Integer> LEGACY_SERVER_PACKETS;
|
||||
private static volatile Set<Integer> LEGACY_CLIENT_PACKETS;
|
||||
private static volatile Map<Integer, Class> LEGACY_PREVIOUS_PACKETS;
|
||||
|
||||
// Whether or not the registry has
|
||||
private static boolean INITIALIZED;
|
||||
|
||||
// Whether or not the registry has been initialized
|
||||
private static volatile boolean INITIALIZED = false;
|
||||
|
||||
/**
|
||||
* Initializes the packet registry.
|
||||
@ -65,8 +65,8 @@ public class PacketRegistry {
|
||||
return;
|
||||
}
|
||||
|
||||
INITIALIZED = true;
|
||||
NETTY = new NettyProtocolRegistry();
|
||||
INITIALIZED = true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user