Join to Skyblock if found lobby
's messages
This commit is contained in:
parent
3f7ecbce43
commit
be5df8f037
2 changed files with 23 additions and 3 deletions
|
@ -26,6 +26,7 @@ import static me.night0721.lilase.features.flipper.Flipper.*;
|
|||
|
||||
public class ChatReceivedEvent {
|
||||
private final Pattern AUCTION_SOLD_PATTERN = Pattern.compile("^(.*?) bought (.*?) for ([\\d,]+) coins CLICK$");
|
||||
private final LockWithTimeReset lockForJoiningSkyblock = new LockWithTimeReset();
|
||||
|
||||
@SubscribeEvent
|
||||
public void onChat(ClientChatReceivedEvent event) {
|
||||
|
@ -96,10 +97,12 @@ public class ChatReceivedEvent {
|
|||
Flipper.state = FlipperState.NONE;
|
||||
Lilase.cofl.toggleAuction();
|
||||
}
|
||||
if (message.contains("You were spawned in Limbo")) {
|
||||
if (message.contains("You were spawned in Limbo") || message.contains("joined the lobby!")) {
|
||||
try {
|
||||
Utils.debugLog("Detected in Limbo, stopping everything for 5 minutes");
|
||||
Utils.addTitle("You got sent to Limbo!");
|
||||
if (this.lockForJoiningSkyblock.isLocked) return
|
||||
this.lockForJoiningSkyblock.lock()
|
||||
Utils.debugLog("Detected in Limbo or Lobby, stopping everything for 5 minutes");
|
||||
Utils.addTitle("You got sent to Limbo or Lobby!");
|
||||
Flipper.state = FlipperState.NONE;
|
||||
if (Lilase.cofl.isOpen()) Lilase.cofl.toggleAuction();
|
||||
Thread.sleep(5000);
|
||||
|
|
17
src/main/java/me/night0721/lilase/utils/Lock.java
Normal file
17
src/main/java/me/night0721/lilase/utils/Lock.java
Normal file
|
@ -0,0 +1,17 @@
|
|||
package me.night0721.lilase.utils;
|
||||
|
||||
|
||||
public class LockWithTimeReset {
|
||||
public boolean isLocked = false;
|
||||
|
||||
public static void lock() {
|
||||
this.isLocked = true;
|
||||
new Thread(() -> {
|
||||
try {
|
||||
Thread.sleep(10000);
|
||||
this.isLocked = false;
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue