7373import java .util .AbstractMap .SimpleEntry ;
7474import java .util .*;
7575import java .util .Map .Entry ;
76+ import java .util .concurrent .atomic .AtomicBoolean ;
7677import java .util .concurrent .locks .ReentrantReadWriteLock ;
7778import java .util .logging .Level ;
7879import java .util .stream .Collectors ;
@@ -90,7 +91,7 @@ public class Util {
9091 private static final ThreadLocal <MineDown > mineDown = ThreadLocal .withInitial (() -> new MineDown ("" ));
9192 private static int bypassedCustomStackSize = -1 ;
9293 private static Yaml yaml = null ;
93- private static boolean devMode = false ;
94+ private static AtomicBoolean devMode = null ;
9495 @ Setter
9596 private static QuickShop plugin ;
9697 private static Object serverInstance ;
@@ -335,7 +336,10 @@ public static void debugLog(@NotNull String... logs) {
335336 if (debugLogs .size () >= 2000 ) {
336337 debugLogs .clear ();
337338 }
338- if (!devMode ) {
339+ if (devMode == null ){ //Workaround: Initial it if devMode not set while call this method
340+ devMode = new AtomicBoolean (plugin .getConfig ().getBoolean ("dev-mode" ));
341+ }
342+ if (!devMode .get ()) {
339343 for (String log : logs ) {
340344 debugLogs .add ("[DEBUG] " + log );
341345 }
@@ -626,7 +630,7 @@ public static void initialize() {
626630 restrictedPrices .clear ();
627631 customStackSize .clear ();
628632 currency2Symbol .clear ();
629- devMode = plugin .getConfig ().getBoolean ("dev-mode" );
633+ devMode = new AtomicBoolean ( plugin .getConfig ().getBoolean ("dev-mode" ) );
630634
631635 for (String s : plugin .getConfig ().getStringList ("shop-blocks" )) {
632636 Material mat = Material .matchMaterial (s .toUpperCase ());
@@ -1302,7 +1306,9 @@ public static List<String> getStartupFlags() {
13021306 * @return under dev-mode
13031307 */
13041308 public static boolean isDevMode () {
1305- return devMode ;
1309+ if (devMode == null )
1310+ return false ;
1311+ return devMode .get ();
13061312 }
13071313
13081314 /**
0 commit comments