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 ;
@@ -331,10 +330,7 @@ public static void debugLog(@NotNull String... logs) {
331330 if (debugLogs .size () >= 2000 ) {
332331 debugLogs .clear ();
333332 }
334- if (devMode == null ){ //Workaround: Initial it if devMode not set while call this method
335- devMode = new AtomicBoolean (plugin .getConfig ().getBoolean ("dev-mode" ));
336- }
337- if (!devMode .get ()) {
333+ if (!isDevMode ()) {
338334 for (String log : logs ) {
339335 debugLogs .add ("[DEBUG] " + log );
340336 }
@@ -625,7 +621,7 @@ public static void initialize() {
625621 restrictedPrices .clear ();
626622 customStackSize .clear ();
627623 currency2Symbol .clear ();
628- devMode = new AtomicBoolean ( plugin .getConfig ().getBoolean ("dev-mode" ) );
624+ devMode = plugin .getConfig ().getBoolean ("dev-mode" );
629625
630626 for (String s : plugin .getConfig ().getStringList ("shop-blocks" )) {
631627 Material mat = Material .matchMaterial (s .toUpperCase ());
@@ -1300,9 +1296,7 @@ public static List<String> getStartupFlags() {
13001296 * @return under dev-mode
13011297 */
13021298 public static boolean isDevMode () {
1303- if (devMode == null )
1304- return false ;
1305- return devMode .get ();
1299+ return devMode != null ? devMode : (devMode = plugin .getConfig ().getBoolean ("dev-mode" ));
13061300 }
13071301
13081302 /**
0 commit comments