diff options
author | Aaron <51387595+AzureAaron@users.noreply.github.com> | 2023-09-16 21:09:10 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-16 21:09:10 -0400 |
commit | 8c88eb79c83b2ab33eb4b53759e41fc6d8170e8f (patch) | |
tree | 4d69c2c788ce81d9d9294237591dc4f3cec74486 /src/main/java | |
parent | 458074e83ce27b14fa65ad9adc3d918a66a7bc62 (diff) | |
download | Skyblocker-8c88eb79c83b2ab33eb4b53759e41fc6d8170e8f.tar.gz Skyblocker-8c88eb79c83b2ab33eb4b53759e41fc6d8170e8f.tar.bz2 Skyblocker-8c88eb79c83b2ab33eb4b53759e41fc6d8170e8f.zip |
Locraw filter fix (#314)
* Fixed locraw being filtered wrongly in some situations
* Fix locraw filter
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/me/xmrvizzy/skyblocker/utils/Utils.java | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/main/java/me/xmrvizzy/skyblocker/utils/Utils.java b/src/main/java/me/xmrvizzy/skyblocker/utils/Utils.java index 149004c4..755e191d 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/utils/Utils.java +++ b/src/main/java/me/xmrvizzy/skyblocker/utils/Utils.java @@ -49,7 +49,7 @@ public class Utils { private static String map = ""; private static long clientWorldJoinTime = 0; private static boolean sentLocRaw = false; - private static long lastLocRaw = 0; + private static boolean canSendLocRaw = false; public static boolean isOnHypixel() { return isOnHypixel; @@ -293,10 +293,10 @@ public class Utils { private static void updateLocRaw() { if (isOnSkyblock) { long currentTime = System.currentTimeMillis(); - if (!sentLocRaw && currentTime > clientWorldJoinTime + 1000 && currentTime > lastLocRaw + 15000) { + if (!sentLocRaw && canSendLocRaw && currentTime > clientWorldJoinTime + 1000) { MessageScheduler.INSTANCE.sendMessageAfterCooldown("/locraw"); sentLocRaw = true; - lastLocRaw = currentTime; + canSendLocRaw = false; } } else { resetLocRawInfo(); @@ -323,7 +323,11 @@ public class Utils { if (locRaw.has("map")) { map = locRaw.get("map").getAsString(); } - return !sentLocRaw; + + boolean shouldFilter = !sentLocRaw; + sentLocRaw = false; + + return shouldFilter; } } return true; @@ -331,6 +335,7 @@ public class Utils { private static void resetLocRawInfo() { sentLocRaw = false; + canSendLocRaw = true; server = ""; gameType = ""; locationRaw = ""; |