6868import java .util .AbstractMap .SimpleEntry ;
6969import java .util .*;
7070import java .util .Map .Entry ;
71- import java .util .concurrent .atomic .AtomicBoolean ;
7271import java .util .concurrent .locks .ReentrantReadWriteLock ;
7372import java .util .logging .Level ;
7473import java .util .stream .Collectors ;
@@ -86,7 +85,7 @@ public class Util {
8685 private static final ThreadLocal <MineDown > mineDown = ThreadLocal .withInitial (() -> new MineDown ("" ));
8786 private static int bypassedCustomStackSize = -1 ;
8887 private static Yaml yaml = null ;
89- private static AtomicBoolean devMode = null ;
88+ private static Boolean devMode = null ;
9089 @ Setter
9190 private static QuickShop plugin ;
9291 private static Object serverInstance ;
@@ -332,10 +331,7 @@ public static void debugLog(@NotNull String... logs) {
332331 if (debugLogs .size () >= 2000 ) {
333332 debugLogs .clear ();
334333 }
335- if (devMode == null ){ //Workaround: Initial it if devMode not set while call this method
336- devMode = new AtomicBoolean (plugin .getConfig ().getBoolean ("dev-mode" ));
337- }
338- if (!devMode .get ()) {
334+ if (!isDevMode ()) {
339335 for (String log : logs ) {
340336 debugLogs .add ("[DEBUG] " + log );
341337 }
@@ -626,7 +622,7 @@ public static void initialize() {
626622 restrictedPrices .clear ();
627623 customStackSize .clear ();
628624 currency2Symbol .clear ();
629- devMode = new AtomicBoolean ( plugin .getConfig ().getBoolean ("dev-mode" ) );
625+ devMode = plugin .getConfig ().getBoolean ("dev-mode" );
630626
631627 for (String s : plugin .getConfig ().getStringList ("shop-blocks" )) {
632628 Material mat = Material .matchMaterial (s .toUpperCase ());
@@ -1293,9 +1289,7 @@ public static List<String> getStartupFlags() {
12931289 * @return under dev-mode
12941290 */
12951291 public static boolean isDevMode () {
1296- if (devMode == null )
1297- return false ;
1298- return devMode .get ();
1292+ return devMode != null ? devMode : (devMode = plugin .getConfig ().getBoolean ("dev-mode" ));
12991293 }
13001294
13011295 /**
0 commit comments