30
30
import java .util .logging .Level ;
31
31
import java .util .logging .Logger ;
32
32
33
+ import com .comphenix .protocol .ProtocolConfig ;
34
+ import com .comphenix .protocol .ProtocolLib ;
33
35
import com .comphenix .protocol .ProtocolLibrary ;
34
36
import com .comphenix .protocol .ProtocolLogger ;
35
37
import com .comphenix .protocol .collections .ExpireHashMap ;
@@ -391,7 +393,7 @@ public void reportDetailed(Object sender, Report report) {
391
393
writer .println (addPrefix (Bukkit .getServer ().getVersion (), SECOND_LEVEL_PREFIX ));
392
394
393
395
// Inform of this occurrence
394
- if (ERROR_PERMISSION != null && ProtocolLibrary . getConfig (). isChatWarnings ()) {
396
+ if (isChatWarnings ()) {
395
397
Bukkit .getServer ().broadcast (
396
398
String .format ("Error %s (%s) occurred in %s." , report .getReportMessage (), report .getException (), sender ),
397
399
ERROR_PERMISSION
@@ -402,7 +404,15 @@ public void reportDetailed(Object sender, Report report) {
402
404
// Make sure it is reported
403
405
logger .severe (addPrefix (text .toString (), prefix ));
404
406
}
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
+
406
416
/**
407
417
* Print the call stack to the given logger.
408
418
* @param logger - the logger.
0 commit comments