check hub
This commit is contained in:
parent
05dde26aa4
commit
a61716710d
4 changed files with 29 additions and 24 deletions
|
@ -27,7 +27,6 @@ import org.lwjgl.input.Keyboard;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
@Mod(modid = Main.MODID, name = Main.MOD_NAME, version = Main.VERSION, acceptedMinecraftVersions = "[1.8.9]")
|
@Mod(modid = Main.MODID, name = Main.MOD_NAME, version = Main.VERSION, acceptedMinecraftVersions = "[1.8.9]")
|
||||||
public class Main {
|
public class Main {
|
||||||
|
@ -83,11 +82,6 @@ public class Main {
|
||||||
|
|
||||||
if (tickAmount % 20 == 0) {
|
if (tickAmount % 20 == 0) {
|
||||||
Utils.checkForDungeon();
|
Utils.checkForDungeon();
|
||||||
if (!Objects.equals(AHConfig.WEBHOOK, ConfigUtils.getString("main", "Webhook"))) {
|
|
||||||
ConfigUtils.writeStringConfig("main", "Webhook", AHConfig.WEBHOOK);
|
|
||||||
} else if (!Objects.equals(AHConfig.AUCTION_HOUSE_DELAY, ConfigUtils.getInt("main", "AuctionHouseDelay"))) {
|
|
||||||
ConfigUtils.writeIntConfig("main", "AuctionHouseDelay", Math.round(AHConfig.AUCTION_HOUSE_DELAY));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
AuctionHouse.switchStates();
|
AuctionHouse.switchStates();
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,11 +7,14 @@ import cc.polyfrost.oneconfig.config.annotations.Text;
|
||||||
import cc.polyfrost.oneconfig.config.data.Mod;
|
import cc.polyfrost.oneconfig.config.data.Mod;
|
||||||
import cc.polyfrost.oneconfig.config.data.ModType;
|
import cc.polyfrost.oneconfig.config.data.ModType;
|
||||||
import me.night0721.lilase.gui.ConfigGUI;
|
import me.night0721.lilase.gui.ConfigGUI;
|
||||||
|
import me.night0721.lilase.utils.ConfigUtils;
|
||||||
|
|
||||||
public class AHConfig extends Config {
|
public class AHConfig extends Config {
|
||||||
public AHConfig() {
|
public AHConfig() {
|
||||||
super(new Mod("Lilase", ModType.UTIL_QOL), "lilase.json");
|
super(new Mod("Lilase", ModType.UTIL_QOL), "lilase.json");
|
||||||
initialize();
|
initialize();
|
||||||
|
addListener("AUCTION_HOUSE_DELAY", () -> ConfigUtils.writeIntConfig("main", "AuctionHouseDelay", Math.round(AHConfig.AUCTION_HOUSE_DELAY)));
|
||||||
|
addListener("WEBHOOK", () -> ConfigUtils.writeStringConfig("main", "Webhook", AHConfig.WEBHOOK));
|
||||||
}
|
}
|
||||||
|
|
||||||
@HUD(name = "Lilase")
|
@HUD(name = "Lilase")
|
||||||
|
|
|
@ -196,6 +196,7 @@ public class AuctionHouse {
|
||||||
items.clear();
|
items.clear();
|
||||||
open = false;
|
open = false;
|
||||||
} else {
|
} else {
|
||||||
|
if (Utils.checkInHub()) {
|
||||||
Utils.sendMessage("Started Auction House");
|
Utils.sendMessage("Started Auction House");
|
||||||
thread = new Thread(() -> {
|
thread = new Thread(() -> {
|
||||||
while (true) {
|
while (true) {
|
||||||
|
@ -208,6 +209,9 @@ public class AuctionHouse {
|
||||||
});
|
});
|
||||||
thread.start();
|
thread.start();
|
||||||
open = true;
|
open = true;
|
||||||
|
} else {
|
||||||
|
Utils.sendMessage("Detected not in hub, please go to hub to start");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static void switchStates() {
|
public static void switchStates() {
|
||||||
|
|
|
@ -10,7 +10,6 @@ import java.util.List;
|
||||||
public class Utils {
|
public class Utils {
|
||||||
|
|
||||||
public static boolean inDungeon;
|
public static boolean inDungeon;
|
||||||
public static boolean inHub;
|
|
||||||
|
|
||||||
public static String translateAlternateColorCodes(String text) {
|
public static String translateAlternateColorCodes(String text) {
|
||||||
char[] b = text.toCharArray();
|
char[] b = text.toCharArray();
|
||||||
|
@ -43,16 +42,21 @@ public class Utils {
|
||||||
inDungeon = false;
|
inDungeon = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void checkInHub() {
|
public static boolean checkInHub() {
|
||||||
List<String> scoreboard = ScoreboardUtils.getSidebarLines();
|
List<String> scoreboard = ScoreboardUtils.getSidebarLines();
|
||||||
for (String s : scoreboard) {
|
for (String s : scoreboard) {
|
||||||
String sCleaned = ScoreboardUtils.cleanSB(s);
|
String sCleaned = ScoreboardUtils.cleanSB(s);
|
||||||
if (sCleaned.contains("Forest") || sCleaned.contains("Village") || sCleaned.contains("Farm") || sCleaned.contains("Mountain") || sCleaned.contains("Wilderness") || sCleaned.contains("Community Center") || sCleaned.contains("Graveyard")) {
|
return sCleaned.contains("Forest") ||
|
||||||
inHub = true;
|
sCleaned.contains("Village") ||
|
||||||
return;
|
sCleaned.contains("Farm") ||
|
||||||
|
sCleaned.contains("Mountain") ||
|
||||||
|
sCleaned.contains("Wilderness") ||
|
||||||
|
sCleaned.contains("Community") ||
|
||||||
|
sCleaned.contains("Graveyard") ||
|
||||||
|
sCleaned.contains("Bazaar") ||
|
||||||
|
sCleaned.contains("Auction");
|
||||||
}
|
}
|
||||||
}
|
return false;
|
||||||
inDungeon = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendMessage(String message) {
|
public static void sendMessage(String message) {
|
||||||
|
|
Loading…
Reference in a new issue