diff options
author | Aaron <51387595+AzureAaron@users.noreply.github.com> | 2024-02-21 00:07:32 -0500 |
---|---|---|
committer | Aaron <51387595+AzureAaron@users.noreply.github.com> | 2024-02-21 00:07:32 -0500 |
commit | 4a1026b088dbd0f6c4621999ac94a55de97d16ac (patch) | |
tree | e6ba4237247da72d3a7331d98a6d49085089078d /src/main/java/de/hysky | |
parent | 980e91c202c7e015e959f30752b69d7818afd715 (diff) | |
download | Skyblocker-4a1026b088dbd0f6c4621999ac94a55de97d16ac.tar.gz Skyblocker-4a1026b088dbd0f6c4621999ac94a55de97d16ac.tar.bz2 Skyblocker-4a1026b088dbd0f6c4621999ac94a55de97d16ac.zip |
Multithread the rules and locations loading
Avoids blocking the main thread
Diffstat (limited to 'src/main/java/de/hysky')
-rw-r--r-- | src/main/java/de/hysky/skyblocker/skyblock/chat/ChatRulesHandler.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/chat/ChatRulesHandler.java b/src/main/java/de/hysky/skyblocker/skyblock/chat/ChatRulesHandler.java index ef44e670..791f3a3a 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/chat/ChatRulesHandler.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/chat/ChatRulesHandler.java @@ -25,6 +25,7 @@ import java.nio.file.Files; import java.nio.file.NoSuchFileException; import java.nio.file.Path; import java.util.*; +import java.util.concurrent.CompletableFuture; public class ChatRulesHandler { private static final MinecraftClient CLIENT = MinecraftClient.getInstance(); @@ -42,8 +43,8 @@ public class ChatRulesHandler { protected static final List<ChatRule> chatRuleList = new ArrayList<>(); public static void init() { - loadChatRules(); - loadLocations(); + CompletableFuture.runAsync(ChatRulesHandler::loadChatRules); + CompletableFuture.runAsync(ChatRulesHandler::loadLocations); ClientReceiveMessageEvents.ALLOW_GAME.register(ChatRulesHandler::checkMessage); } |