Archiviert
13
0

Fix a few issues with the registry

Dieser Commit ist enthalten in:
Dan Mulloy 2016-05-18 21:03:14 -04:00
Ursprung a9aa406d29
Commit e5bc602af3
2 geänderte Dateien mit 15 neuen und 7 gelöschten Zeilen

Datei anzeigen

@ -33,7 +33,11 @@ public class ProtocolLogger {
} }
private static boolean isDebugEnabled() { private static boolean isDebugEnabled() {
try {
return ProtocolLibrary.getConfig().isDebug(); 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) { public static void debug(String message, Object... args) {
if (isDebugEnabled()) { if (isDebugEnabled()) {
if (logger != null) {
log("[Debug] " + message, args); log("[Debug] " + message, args);
} else {
System.out.println("[Debug] " + MessageFormat.format(message, args));
}
} }
} }
} }

Datei anzeigen

@ -43,7 +43,7 @@ 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_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"); 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; private static volatile ProtocolRegistry NETTY;
// Cached for Netty // Cached for Netty
@ -51,8 +51,8 @@ public class PacketRegistry {
private static volatile Set<Integer> LEGACY_CLIENT_PACKETS; private static volatile Set<Integer> LEGACY_CLIENT_PACKETS;
private static volatile Map<Integer, Class> LEGACY_PREVIOUS_PACKETS; private static volatile Map<Integer, Class> LEGACY_PREVIOUS_PACKETS;
// Whether or not the registry has // Whether or not the registry has been initialized
private static boolean INITIALIZED; private static volatile boolean INITIALIZED = false;
/** /**
* Initializes the packet registry. * Initializes the packet registry.
@ -65,8 +65,8 @@ public class PacketRegistry {
return; return;
} }
INITIALIZED = true;
NETTY = new NettyProtocolRegistry(); NETTY = new NettyProtocolRegistry();
INITIALIZED = true;
} }
/** /**