From e61fee630cfc5268aeb29c70c6acf956b354dd16 Mon Sep 17 00:00:00 2001 From: Adam Matthew Date: Sat, 4 Jul 2020 19:57:03 +0800 Subject: [PATCH] Removed redundant AtomicBoolean variable. --- src/main/java/com/larryTheCoder/ASkyBlock.java | 4 ++-- src/main/java/com/larryTheCoder/cache/FastCache.java | 9 --------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/larryTheCoder/ASkyBlock.java b/src/main/java/com/larryTheCoder/ASkyBlock.java index 637b2d6..9ad8df7 100644 --- a/src/main/java/com/larryTheCoder/ASkyBlock.java +++ b/src/main/java/com/larryTheCoder/ASkyBlock.java @@ -47,6 +47,7 @@ import com.larryTheCoder.island.GridManager; import com.larryTheCoder.island.IslandManager; import com.larryTheCoder.island.TeleportLogic; +import com.larryTheCoder.island.TopTen; import com.larryTheCoder.listener.ChatHandler; import com.larryTheCoder.listener.IslandListener; import com.larryTheCoder.listener.LavaCheck; @@ -158,12 +159,11 @@ public void onDisable() { Utils.send("&7Saving all island framework..."); saveLevel(true); - getFastCache().shutdownCache(); getDatabase().shutdownDB(); getMessages().saveMessages(); LavaCheck.clearStats(); getLevelCalcThread().shutdown(); - //TopTen.topTenSave(); + TopTen.topTenSave(); } Utils.send("&cASkyBlock has been successfully disabled. Goodbye!"); diff --git a/src/main/java/com/larryTheCoder/cache/FastCache.java b/src/main/java/com/larryTheCoder/cache/FastCache.java index f0c5758..2f95fcb 100644 --- a/src/main/java/com/larryTheCoder/cache/FastCache.java +++ b/src/main/java/com/larryTheCoder/cache/FastCache.java @@ -44,7 +44,6 @@ import java.sql.Timestamp; import java.time.Instant; import java.util.*; -import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.Consumer; import static com.larryTheCoder.database.TableSet.*; @@ -60,18 +59,12 @@ public class FastCache { private final List dataCache = new ArrayList<>(); private final List uniqueId = new ArrayList<>(); - private final AtomicBoolean isRunning = new AtomicBoolean(false); - public FastCache(ASkyBlock plugin) { this.plugin = plugin; this.loadFastCache(); } - public void shutdownCache() { - isRunning.compareAndSet(true, false); - } - private void addAllCacheData(List list) { dataCache.addAll(list); } @@ -146,8 +139,6 @@ public void onCompletion(Exception err) { Utils.sendDebug(String.format("Loaded %s cache data.", dataCache.size())); ASkyBlock.get().getFastCache().addAllCacheData(dataCache); - - isRunning.compareAndSet(false, true); } }); }