Fix logging issue hiding underlying issue
This commit is contained in:
parent
c1ceb472f1
commit
260cb22f53
|
@ -30,6 +30,8 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import com.comphenix.protocol.ProtocolConfig;
|
||||||
|
import com.comphenix.protocol.ProtocolLib;
|
||||||
import com.comphenix.protocol.ProtocolLibrary;
|
import com.comphenix.protocol.ProtocolLibrary;
|
||||||
import com.comphenix.protocol.ProtocolLogger;
|
import com.comphenix.protocol.ProtocolLogger;
|
||||||
import com.comphenix.protocol.collections.ExpireHashMap;
|
import com.comphenix.protocol.collections.ExpireHashMap;
|
||||||
|
@ -391,7 +393,7 @@ public class DetailedErrorReporter implements ErrorReporter {
|
||||||
writer.println(addPrefix(Bukkit.getServer().getVersion(), SECOND_LEVEL_PREFIX));
|
writer.println(addPrefix(Bukkit.getServer().getVersion(), SECOND_LEVEL_PREFIX));
|
||||||
|
|
||||||
// Inform of this occurrence
|
// Inform of this occurrence
|
||||||
if (ERROR_PERMISSION != null && ProtocolLibrary.getConfig().isChatWarnings()) {
|
if (isChatWarnings()) {
|
||||||
Bukkit.getServer().broadcast(
|
Bukkit.getServer().broadcast(
|
||||||
String.format("Error %s (%s) occurred in %s.", report.getReportMessage(), report.getException(), sender),
|
String.format("Error %s (%s) occurred in %s.", report.getReportMessage(), report.getException(), sender),
|
||||||
ERROR_PERMISSION
|
ERROR_PERMISSION
|
||||||
|
@ -403,6 +405,14 @@ public class DetailedErrorReporter implements ErrorReporter {
|
||||||
logger.severe(addPrefix(text.toString(), prefix));
|
logger.severe(addPrefix(text.toString(), prefix));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isChatWarnings() {
|
||||||
|
try {
|
||||||
|
ProtocolConfig config = ProtocolLibrary.getConfig();
|
||||||
|
return config != null && config.isChatWarnings();
|
||||||
|
} catch (Exception ignored) {}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print the call stack to the given logger.
|
* Print the call stack to the given logger.
|
||||||
* @param logger - the logger.
|
* @param logger - the logger.
|
||||||
|
|
Loading…
Reference in New Issue