Skip to content

Commit 260cb22

Browse files
committed
Fix logging issue hiding underlying issue
1 parent c1ceb47 commit 260cb22

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/main/java/com/comphenix/protocol/error/DetailedErrorReporter.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
import java.util.logging.Level;
3131
import java.util.logging.Logger;
3232

33+
import com.comphenix.protocol.ProtocolConfig;
34+
import com.comphenix.protocol.ProtocolLib;
3335
import com.comphenix.protocol.ProtocolLibrary;
3436
import com.comphenix.protocol.ProtocolLogger;
3537
import com.comphenix.protocol.collections.ExpireHashMap;
@@ -391,7 +393,7 @@ public void reportDetailed(Object sender, Report report) {
391393
writer.println(addPrefix(Bukkit.getServer().getVersion(), SECOND_LEVEL_PREFIX));
392394

393395
// Inform of this occurrence
394-
if (ERROR_PERMISSION != null && ProtocolLibrary.getConfig().isChatWarnings()) {
396+
if (isChatWarnings()) {
395397
Bukkit.getServer().broadcast(
396398
String.format("Error %s (%s) occurred in %s.", report.getReportMessage(), report.getException(), sender),
397399
ERROR_PERMISSION
@@ -402,7 +404,15 @@ public void reportDetailed(Object sender, Report report) {
402404
// Make sure it is reported
403405
logger.severe(addPrefix(text.toString(), prefix));
404406
}
405-
407+
408+
private boolean isChatWarnings() {
409+
try {
410+
ProtocolConfig config = ProtocolLibrary.getConfig();
411+
return config != null && config.isChatWarnings();
412+
} catch (Exception ignored) {}
413+
return false;
414+
}
415+
406416
/**
407417
* Print the call stack to the given logger.
408418
* @param logger - the logger.

0 commit comments

Comments
 (0)