aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWyvest <45589059+Wyvest@users.noreply.github.com>2022-07-21 18:18:18 +0900
committerGitHub <noreply@github.com>2022-07-21 10:18:18 +0100
commit6fd6138f40f5ae1d0f924a7de382d889e277ee59 (patch)
tree6e801de3490c0bebf6976bd04af3de1b5d32c1ac
parentf06946c01b2c8f210b398a16610c260eca093a8b (diff)
downloadOneConfig-6fd6138f40f5ae1d0f924a7de382d889e277ee59.tar.gz
OneConfig-6fd6138f40f5ae1d0f924a7de382d889e277ee59.tar.bz2
OneConfig-6fd6138f40f5ae1d0f924a7de382d889e277ee59.zip
fix: fix locraw cancelling all locraw messages (#61)
* fix: fix locraw cancelling all locraw messages * fix: use a separate variable for cancelling locraw messages
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/utils/hypixel/HypixelUtils.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/utils/hypixel/HypixelUtils.java b/src/main/java/cc/polyfrost/oneconfig/utils/hypixel/HypixelUtils.java
index 3e719de..dcef472 100644
--- a/src/main/java/cc/polyfrost/oneconfig/utils/hypixel/HypixelUtils.java
+++ b/src/main/java/cc/polyfrost/oneconfig/utils/hypixel/HypixelUtils.java
@@ -29,6 +29,7 @@ public class HypixelUtils {
private int limboLoop = 0;
private boolean sentCommand = false;
+ private boolean cancel = false;
private boolean sendPermitted = false;
private boolean inGame;
@@ -72,6 +73,7 @@ public class HypixelUtils {
sendPermitted = true;
Multithreading.schedule(() -> {
if (sendPermitted) {
+ cancel = true;
UChat.say("/locraw");
}
}, interval, TimeUnit.MILLISECONDS);
@@ -96,6 +98,7 @@ public class HypixelUtils {
private void onWorldLoad(WorldLoadEvent event) {
locraw = null;
sendPermitted = false;
+ cancel = false;
sentCommand = false;
limboLoop = 0;
}
@@ -103,6 +106,7 @@ public class HypixelUtils {
@Subscribe
private void onMessageReceived(ChatReceiveEvent event) {
try {
+ final boolean didSendCommand = sentCommand;
final String msg = event.getFullyUnformattedMessage();
// Checking for rate limitation.
if (!(msg.startsWith("{") && msg.endsWith("}"))) {
@@ -131,7 +135,10 @@ public class HypixelUtils {
inGame = true; // If your gamemode does not return "lobby", boolean inGame is true.
}
EventManager.INSTANCE.post(new LocrawEvent(locraw));
- event.isCancelled = true;
+ if (cancel && didSendCommand) {
+ cancel = false;
+ event.isCancelled = true;
+ }
}
} catch (Exception ex) {
ex.printStackTrace();