diff options
author | Rime <81419447+Emirlol@users.noreply.github.com> | 2024-05-17 01:06:17 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-16 18:06:17 -0400 |
commit | 6886f2d89416bf56d0255f6aac3036141ce41caf (patch) | |
tree | dca11bc2126d1b25841d35d5d5898d77483923f2 /src/main/java/de/hysky/skyblocker/utils | |
parent | 62125a9c16e725e8505f0284d356088602636119 (diff) | |
download | Skyblocker-6886f2d89416bf56d0255f6aac3036141ce41caf.tar.gz Skyblocker-6886f2d89416bf56d0255f6aac3036141ce41caf.tar.bz2 Skyblocker-6886f2d89416bf56d0255f6aac3036141ce41caf.zip |
Add LOCATION_CHANGE event, fired upon parsing /locraw (#716)
Diffstat (limited to 'src/main/java/de/hysky/skyblocker/utils')
-rw-r--r-- | src/main/java/de/hysky/skyblocker/utils/Utils.java | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main/java/de/hysky/skyblocker/utils/Utils.java b/src/main/java/de/hysky/skyblocker/utils/Utils.java index 00028011..62a3b897 100644 --- a/src/main/java/de/hysky/skyblocker/utils/Utils.java +++ b/src/main/java/de/hysky/skyblocker/utils/Utils.java @@ -74,6 +74,8 @@ public class Utils { private static long clientWorldJoinTime = 0; private static boolean sentLocRaw = false; private static boolean canSendLocRaw = false; + //This is required to prevent the location change event from being fired twice. + private static boolean locationChanged = true; private static String mayor = ""; @@ -383,6 +385,7 @@ public class Utils { MessageScheduler.INSTANCE.sendMessageAfterCooldown("/locraw"); sentLocRaw = true; canSendLocRaw = false; + locationChanged = true; } } else { resetLocRawInfo(); @@ -413,6 +416,11 @@ public class Utils { if (locRaw.has("map")) { map = locRaw.get("map").getAsString(); } + + if (locationChanged) { + SkyblockEvents.LOCATION_CHANGE.invoker().onSkyblockLocationChange(location); + locationChanged = false; + } } /** |