All fixed, testing TextRenderer

This commit is contained in:
NK 2023-02-21 20:12:22 +00:00
parent d80acf088c
commit 0dec3da74a
8 changed files with 151 additions and 51 deletions

View file

@ -23,7 +23,7 @@ import net.minecraftforge.fml.common.gameevent.TickEvent;
public class Lilase { public class Lilase {
public static final String MOD_NAME = "Lilase"; public static final String MOD_NAME = "Lilase";
public static final String MODID = "Lilase"; public static final String MODID = "Lilase";
public static final String VERSION = "1.0.0"; public static final String VERSION = "1.0.1-beta";
static int tickAmount; static int tickAmount;
public static AuctionHouse auctionHouse; public static AuctionHouse auctionHouse;
public static AHConfig config; public static AHConfig config;
@ -39,6 +39,7 @@ public class Lilase {
ConfigUtils.register(); ConfigUtils.register();
auctionHouse = new AuctionHouse(); auctionHouse = new AuctionHouse();
KeyBindingManager.registerKeyBindings(); KeyBindingManager.registerKeyBindings();
ConfigUtils.checkWebhookAndAPI();
} }
@Subscribe @Subscribe

View file

@ -29,7 +29,7 @@ public class AuctionHouse {
private static long lastAction; private static long lastAction;
private static Thread thread; private static Thread thread;
private Boolean open = false; private Boolean open = false;
private final DiscordWebhook webhook; private static final DiscordWebhook webhook = new DiscordWebhook(ConfigUtils.getString("main", "Webhook"));
private final List<Item> items = new ArrayList<>(); private final List<Item> items = new ArrayList<>();
private final List<Item> temp_items = new ArrayList<>(); private final List<Item> temp_items = new ArrayList<>();
private final List<String> posted = new ArrayList<>(); private final List<String> posted = new ArrayList<>();
@ -40,14 +40,14 @@ public class AuctionHouse {
// items.add(new Item("Aspect of the Void", ItemType.WEAPON, 8000000, ItemTier.EPIC)); // items.add(new Item("Aspect of the Void", ItemType.WEAPON, 8000000, ItemTier.EPIC));
// items.add(new Item("Bal", ItemType.MISC, 10000000, ItemTier.EPIC)); // items.add(new Item("Bal", ItemType.MISC, 10000000, ItemTier.EPIC));
// items.add(new Item(" ", ItemType.ANY, 1000, ItemTier.ANY)); // items.add(new Item(" ", ItemType.ANY, 1000, ItemTier.ANY));
if (ConfigUtils.getString("item1", "Name") != "")
if (!ConfigUtils.getString("item1", "Name").equals("") && !ConfigUtils.getString("item1", "Type").equals("") && !ConfigUtils.getString("item1", "Tier").equals("") && ConfigUtils.getInt("item1", "Price") != 0)
items.add(new Item(ConfigUtils.getString("item1", "Name"), ItemType.valueOf(ConfigUtils.getString("item1", "Type")), ConfigUtils.getInt("item1", "Price"), ItemTier.valueOf(ConfigUtils.getString("item1", "Tier")))); items.add(new Item(ConfigUtils.getString("item1", "Name"), ItemType.valueOf(ConfigUtils.getString("item1", "Type")), ConfigUtils.getInt("item1", "Price"), ItemTier.valueOf(ConfigUtils.getString("item1", "Tier"))));
if (ConfigUtils.getString("item2", "Name") != "") if (!ConfigUtils.getString("item2", "Name").equals("") && !ConfigUtils.getString("item2", "Type").equals("") && !ConfigUtils.getString("item2", "Tier").equals("") && ConfigUtils.getInt("item2", "Price") != 0)
items.add(new Item(ConfigUtils.getString("item2", "Name"), ItemType.valueOf(ConfigUtils.getString("item2", "Type")), ConfigUtils.getInt("item2", "Price"), ItemTier.valueOf(ConfigUtils.getString("item2", "Tier")))); items.add(new Item(ConfigUtils.getString("item2", "Name"), ItemType.valueOf(ConfigUtils.getString("item2", "Type")), ConfigUtils.getInt("item2", "Price"), ItemTier.valueOf(ConfigUtils.getString("item2", "Tier"))));
if (ConfigUtils.getString("item3", "Name") != "") if (!ConfigUtils.getString("item3", "Name").equals("") && !ConfigUtils.getString("item3", "Type").equals("") && !ConfigUtils.getString("item3", "Tier").equals("") && ConfigUtils.getInt("item3", "Price") != 0)
items.add(new Item(ConfigUtils.getString("item3", "Name"), ItemType.valueOf(ConfigUtils.getString("item3", "Type")), ConfigUtils.getInt("item3", "Price"), ItemTier.valueOf(ConfigUtils.getString("item3", "Tier")))); items.add(new Item(ConfigUtils.getString("item3", "Name"), ItemType.valueOf(ConfigUtils.getString("item3", "Type")), ConfigUtils.getInt("item3", "Price"), ItemTier.valueOf(ConfigUtils.getString("item3", "Tier"))));
webhook = new DiscordWebhook(ConfigUtils.getString("main", "Webhook"));
webhook.setUsername("Lilase - Auction House"); webhook.setUsername("Lilase - Auction House");
webhook.setAvatarUrl("https://wallpapercave.com/wp/wp2412537.jpg"); webhook.setAvatarUrl("https://wallpapercave.com/wp/wp2412537.jpg");
} }
@ -71,7 +71,17 @@ public class AuctionHouse {
} }
private void getItem() throws IOException, JSONException { private void getItem() throws IOException, JSONException {
if (items.size() == 0) return; if (ConfigUtils.getString("main", "APIKey").equals("") || ConfigUtils.getString("main", "Webhook").equals("")) {
Utils.sendMessage("Missing APIKey or Webhook, stopping");
toggleAuction();
return;
}
if (items.size() == 0 && open == false) return;
if (items.size() == 0) {
Utils.sendMessage("No Item queued, stopping");
toggleAuction();
return;
}
URL url = new URL("https://api.hypixel.net/skyblock/auctions"); URL url = new URL("https://api.hypixel.net/skyblock/auctions");
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection(); HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
connection.setRequestProperty("Content-Type", "application/json"); connection.setRequestProperty("Content-Type", "application/json");
@ -130,15 +140,9 @@ public class AuctionHouse {
Pattern pattern = Pattern.compile("§[0-9a-z]", Pattern.MULTILINE); Pattern pattern = Pattern.compile("§[0-9a-z]", Pattern.MULTILINE);
Matcher matcher = pattern.matcher(auction.getString("item_lore")); Matcher matcher = pattern.matcher(auction.getString("item_lore"));
String updated = matcher.replaceAll(""); String updated = matcher.replaceAll("");
webhook.addEmbed(new DiscordWebhook.EmbedObject().setTitle("Item Is On Low Price").setAuthor("night0721", "https://github.com/night0721", "https://avatars.githubusercontent.com/u/77528305?v=4").setDescription(updated.replace("\n", "\\n")).addField("Item", auction.getString("item_name"), true).addField("Price", format.format(auction.getInt("starting_bid")) + " coins", true).addField("Seller", profile.getJSONObject("player").getString("displayname"), true).addField("Started for", toDuration(System.currentTimeMillis() - auction.getLong("start")), true).addField("Ends in", getTimeSinceDate(auction.getLong("end") - System.currentTimeMillis()), true).setUrl("https://www.brandonfowler.me/skyblockah/?uuid=" + auction.getString("uuid")).setColor(Color.decode("#003153"))); webhook.addEmbed(new DiscordWebhook.EmbedObject().setTitle("Bought an item on low price").setUrl("https://sky.coflnet.com/auction/" + auction.getString("uuid")).setAuthor("night0721", "https://github.com/night0721", "https://avatars.githubusercontent.com/u/77528305?v=4").setDescription(updated.replace("\n", "\\n")).addField("Item", auction.getString("item_name"), true).addField("Price", format.format(auction.getInt("starting_bid")) + " coins", true).addField("Seller", profile.getJSONObject("player").getString("displayname"), true).addField("Started for", toDuration(System.currentTimeMillis() - auction.getLong("start")), true).addField("Ends in", getTimeSinceDate(auction.getLong("end") - System.currentTimeMillis()), true).setColor(Color.decode("#003153")));
webhook.setContent(auction.getString("item_name") + " is sale at " + format.format(auction.getInt("starting_bid")) + "! `" + "/viewauction " + auction.getString("uuid") + "`"); webhook.setContent(auction.getString("item_name") + " is sale at " + format.format(auction.getInt("starting_bid")) + "! `" + "/viewauction " + auction.getString("uuid") + "`");
new Thread(() -> {
try {
webhook.execute();
} catch (IOException e) {
e.printStackTrace();
}
}).start();
uuid = auction.getString("uuid"); uuid = auction.getString("uuid");
message_toSend = "Auction House: " + auction.getString("item_name") + " is sale for " + format.format(auction.getInt("starting_bid")) + "!"; message_toSend = "Auction House: " + auction.getString("item_name") + " is sale for " + format.format(auction.getInt("starting_bid")) + "!";
clickState = States.OPEN; clickState = States.OPEN;
@ -187,12 +191,13 @@ public class AuctionHouse {
public void toggleAuction() { public void toggleAuction() {
if (open) { if (open) {
Utils.sendMessage("Stopped Auction House"); Utils.sendMessage("Stopped Auction House");
items.forEach(item -> temp_items.add(item)); temp_items.addAll(items);
items.clear(); items.clear();
open = false; open = false;
} else { } else {
if (Utils.checkInHub()) { if (Utils.checkInHub()) {
Utils.sendMessage("Started Auction House"); Utils.sendMessage("Started Auction House");
items.addAll(temp_items);
thread = new Thread(() -> { thread = new Thread(() -> {
while (true) { while (true) {
try { try {
@ -204,9 +209,7 @@ public class AuctionHouse {
}); });
thread.start(); thread.start();
open = true; open = true;
} else { } else Utils.sendMessage("Detected not in hub, please go to hub to start");
Utils.sendMessage("Detected not in hub, please go to hub to start");
}
} }
} }
@ -221,14 +224,24 @@ public class AuctionHouse {
case CONFIRM: case CONFIRM:
if (System.currentTimeMillis() - lastAction < 500) return; if (System.currentTimeMillis() - lastAction < 500) return;
PlayerUtils.mc.playerController.windowClick(PlayerUtils.mc.thePlayer.openContainer.windowId, 11, 0, 0, PlayerUtils.mc.thePlayer); PlayerUtils.mc.playerController.windowClick(PlayerUtils.mc.thePlayer.openContainer.windowId, 11, 0, 0, PlayerUtils.mc.thePlayer);
lastAction = System.currentTimeMillis();
clickState = States.NONE; clickState = States.NONE;
break; break;
case OPEN: case OPEN:
AuctionHouse.sendAuction(); AuctionHouse.sendAuction();
lastAction = System.currentTimeMillis(); lastAction = System.currentTimeMillis();
clickState = States.CLICK; clickState = States.CLICK;
case STOP: break;
thread = null; case EXECUTE:
new Thread(() -> {
try {
webhook.execute();
} catch (IOException e) {
e.printStackTrace();
}
}).start();
clickState = States.NONE;
break;
case NONE: case NONE:
break; break;
} }
@ -237,12 +250,12 @@ public class AuctionHouse {
enum ItemTier { enum ItemTier {
ANY, COMMON, UNCOMMON, RARE, EPIC, LEGENDARY, MYTHIC, DIVINE, SPECIAL, VERY_SPECIAL, ANY, COMMON, UNCOMMON, RARE, EPIC, LEGENDARY, MYTHIC, DIVINE, SPECIAL, VERY_SPECIAL
} }
enum ItemType { enum ItemType {
ANY("any"), WEAPON("weapon"), ARMOR("armor"), ACCESSORIES("accessories"), CONSUMABLES("consumables"), BLOCKS("blocks"), MISC("misc"), ANY("any"), WEAPON("weapon"), ARMOR("armor"), ACCESSORIES("accessories"), CONSUMABLES("consumables"), BLOCKS("blocks"), MISC("misc");
;
public final String lowercase; public final String lowercase;
public String getLowercase() { public String getLowercase() {

View file

@ -1,5 +1,5 @@
package me.night0721.lilase.features.ah; package me.night0721.lilase.features.ah;
public enum States { public enum States {
OPEN, NONE, CLICK, CONFIRM, STOP OPEN, NONE, CLICK, CONFIRM, EXECUTE
} }

View file

@ -0,0 +1,65 @@
package me.night0721.lilase.gui;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import org.lwjgl.opengl.GL11;
import java.awt.*;
public class TextRenderer {
public TextRenderer(Minecraft mc, String text, int x, int y, double scale) {
double scaleReset = Math.pow(scale, -1);
GL11.glScaled(scale, scale, scale);
y -= mc.fontRendererObj.FONT_HEIGHT;
for (String line : text.split("\n")) {
y += mc.fontRendererObj.FONT_HEIGHT * scale;
/*if (ToggleCommand.outlineTextToggled) {
String noColorLine = StringUtils.stripControlCodes(line);
mc.fontRendererObj.drawString(noColorLine, (int) Math.round(x / scale) - 1, (int) Math.round(y / scale), 0x000000, false);
mc.fontRendererObj.drawString(noColorLine, (int) Math.round(x / scale) + 1, (int) Math.round(y / scale), 0x000000, false);
mc.fontRendererObj.drawString(noColorLine, (int) Math.round(x / scale), (int) Math.round(y / scale) - 1, 0x000000, false);
mc.fontRendererObj.drawString(noColorLine, (int) Math.round(x / scale), (int) Math.round(y / scale) + 1, 0x000000, false);
mc.fontRendererObj.drawString(line, (int) Math.round(x / scale), (int) Math.round(y / scale), 0xFFFFFF, false);
} else {*/
mc.fontRendererObj.drawString(line, (int) Math.round(x / scale), (int) Math.round(y / scale), 0xFFFFFF, true);
//}
}
GL11.glScaled(scaleReset, scaleReset, scaleReset);
GlStateManager.color(1, 1, 1, 1);
}
public TextRenderer(Minecraft mc, String text, int x, int y, double scale, Color color) {
double scaleReset = Math.pow(scale, -1);
GL11.glScaled(scale, scale, scale);
y -= mc.fontRendererObj.FONT_HEIGHT;
for (String line : text.split("\n")) {
y += mc.fontRendererObj.FONT_HEIGHT * scale;
/*if (ToggleCommand.outlineTextToggled) {
String noColorLine = StringUtils.stripControlCodes(line);
mc.fontRendererObj.drawString(noColorLine, (int) Math.round(x / scale) - 1, (int) Math.round(y / scale), 0x000000, false);
mc.fontRendererObj.drawString(noColorLine, (int) Math.round(x / scale) + 1, (int) Math.round(y / scale), 0x000000, false);
mc.fontRendererObj.drawString(noColorLine, (int) Math.round(x / scale), (int) Math.round(y / scale) - 1, 0x000000, false);
mc.fontRendererObj.drawString(noColorLine, (int) Math.round(x / scale), (int) Math.round(y / scale) + 1, 0x000000, false);
mc.fontRendererObj.drawString(line, (int) Math.round(x / scale), (int) Math.round(y / scale), 0xFFFFFF, false);
} else {*/
mc.fontRendererObj.drawString(line, (int) Math.round(x / scale), (int) Math.round(y / scale), color.getRGB(), true);
//}
}
GL11.glScaled(scaleReset, scaleReset, scaleReset);
GlStateManager.color(1, 1, 1, 1);
}
public static void drawString(String text, int x, int y, double scale) {
new TextRenderer(Minecraft.getMinecraft(), text, x, y, scale);
}
public static void drawString(String text, int x, int y, double scale, Color color) {
new TextRenderer(Minecraft.getMinecraft(), text, x, y, scale, color);
}
public void drawCenteredString(String text, int x, int y, double scale) {
drawString(text, x - Minecraft.getMinecraft().fontRendererObj.getStringWidth(text) / 2, y - Minecraft.getMinecraft().fontRendererObj.FONT_HEIGHT / 2, 1);
}
}

View file

@ -18,13 +18,17 @@ public class EventManager {
PlayerUtils.mc.playerController.windowClick(PlayerUtils.mc.thePlayer.openContainer.windowId, 49, 0, 0, PlayerUtils.mc.thePlayer); // Close the window as could not buy PlayerUtils.mc.playerController.windowClick(PlayerUtils.mc.thePlayer.openContainer.windowId, 49, 0, 0, PlayerUtils.mc.thePlayer); // Close the window as could not buy
} else if (message.equals("You don't have enough coins to afford this bid!")) { } else if (message.equals("You don't have enough coins to afford this bid!")) {
System.out.println("Failed to buy item, not enough money. Closing the menu"); System.out.println("Failed to buy item, not enough money. Closing the menu");
AuctionHouse.clickState = States.STOP; AuctionHouse.clickState = States.NONE;
PlayerUtils.mc.playerController.windowClick(PlayerUtils.mc.thePlayer.openContainer.windowId, 49, 0, 0, PlayerUtils.mc.thePlayer); // Close the window as could not buy PlayerUtils.mc.playerController.windowClick(PlayerUtils.mc.thePlayer.openContainer.windowId, 49, 0, 0, PlayerUtils.mc.thePlayer); // Close the window as could not buy
} else if (message.contains("Your new API key is")) { } else if (message.contains("Your new API key is")) {
System.out.println("Detected new API key, saving it to config"); System.out.println("Detected new API key, saving it to config");
Utils.sendMessage("Saved new API key to config"); Utils.sendMessage("Saved new API key to config");
String apiKey = message.replace("Your new API key is ", ""); String apiKey = message.replace("Your new API key is ", "");
ConfigUtils.writeStringConfig("main", "APIKey", apiKey); ConfigUtils.writeStringConfig("main", "APIKey", apiKey);
} else if (message.equals("Claiming BIN auction...")) {
AuctionHouse.clickState = States.EXECUTE;
} else if (message.equals("This BIN sale is still in its grace period!")) {
AuctionHouse.clickState = States.CLICK;
} }
} }
} }

View file

@ -1,27 +1,20 @@
package me.night0721.lilase.managers; package me.night0721.lilase.managers;
import me.night0721.lilase.Lilase; import me.night0721.lilase.Lilase;
import me.night0721.lilase.utils.PlayerUtils;
import net.minecraft.block.Block;
import net.minecraft.client.settings.KeyBinding; import net.minecraft.client.settings.KeyBinding;
import net.minecraft.init.Blocks;
import net.minecraftforge.fml.client.registry.ClientRegistry; import net.minecraftforge.fml.client.registry.ClientRegistry;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.InputEvent; import net.minecraftforge.fml.common.gameevent.InputEvent;
import org.lwjgl.input.Keyboard; import org.lwjgl.input.Keyboard;
import java.util.ArrayList;
import java.util.Arrays;
public class KeyBindingManager { public class KeyBindingManager {
private static final KeyBinding[] keyBindings = new KeyBinding[4]; private static final KeyBinding[] keyBindings = new KeyBinding[4];
private static final ArrayList<Block> interactables = new ArrayList<>(Arrays.asList(Blocks.acacia_door, Blocks.anvil, Blocks.beacon, Blocks.bed, Blocks.birch_door, Blocks.brewing_stand, Blocks.command_block, Blocks.crafting_table, Blocks.chest, Blocks.dark_oak_door, Blocks.daylight_detector, Blocks.daylight_detector_inverted, Blocks.dispenser, Blocks.dropper, Blocks.enchanting_table, Blocks.ender_chest, Blocks.furnace, Blocks.hopper, Blocks.jungle_door, Blocks.lever, Blocks.noteblock, Blocks.powered_comparator, Blocks.unpowered_comparator, Blocks.powered_repeater, Blocks.unpowered_repeater, Blocks.standing_sign, Blocks.wall_sign, Blocks.trapdoor, Blocks.trapped_chest, Blocks.wooden_button, Blocks.stone_button, Blocks.oak_door, Blocks.skull)); // private static final ArrayList<Block> interactables = new ArrayList<>(Arrays.asList(Blocks.acacia_door, Blocks.anvil, Blocks.beacon, Blocks.bed, Blocks.birch_door, Blocks.brewing_stand, Blocks.command_block, Blocks.crafting_table, Blocks.chest, Blocks.dark_oak_door, Blocks.daylight_detector, Blocks.daylight_detector_inverted, Blocks.dispenser, Blocks.dropper, Blocks.enchanting_table, Blocks.ender_chest, Blocks.furnace, Blocks.hopper, Blocks.jungle_door, Blocks.lever, Blocks.noteblock, Blocks.powered_comparator, Blocks.unpowered_comparator, Blocks.powered_repeater, Blocks.unpowered_repeater, Blocks.standing_sign, Blocks.wall_sign, Blocks.trapdoor, Blocks.trapped_chest, Blocks.wooden_button, Blocks.stone_button, Blocks.oak_door, Blocks.skull));
public static void registerKeyBindings() { public static void registerKeyBindings() {
keyBindings[0] = new KeyBinding("Ghost Block Bind", Keyboard.KEY_G, Lilase.MOD_NAME); //keyBindings[0] = new KeyBinding("Ghost Block Bind", Keyboard.KEY_G, Lilase.MOD_NAME);
keyBindings[1] = new KeyBinding("Hub", Keyboard.KEY_DIVIDE, Lilase.MOD_NAME); keyBindings[0] = new KeyBinding("Auction House", Keyboard.KEY_END, Lilase.MOD_NAME);
keyBindings[2] = new KeyBinding("Auction House", Keyboard.KEY_END, Lilase.MOD_NAME); keyBindings[1] = new KeyBinding("Config", Keyboard.KEY_MULTIPLY, Lilase.MOD_NAME);
keyBindings[3] = new KeyBinding("Config", Keyboard.KEY_MULTIPLY, Lilase.MOD_NAME);
for (KeyBinding keyBinding : keyBindings) { for (KeyBinding keyBinding : keyBindings) {
ClientRegistry.registerKeyBinding(keyBinding); ClientRegistry.registerKeyBinding(keyBinding);
} }
@ -29,21 +22,28 @@ public class KeyBindingManager {
@SubscribeEvent @SubscribeEvent
public void onKeyPress(InputEvent.KeyInputEvent event) { public void onKeyPress(InputEvent.KeyInputEvent event) {
if (keyBindings[0].isKeyDown()) { // if (keyBindings[0].isKeyDown()) {
if (PlayerUtils.mc.objectMouseOver.getBlockPos() == null) return; // if (PlayerUtils.mc.objectMouseOver.getBlockPos() == null) return;
Block block = PlayerUtils.mc.theWorld.getBlockState(PlayerUtils.mc.objectMouseOver.getBlockPos()).getBlock(); // Block block = PlayerUtils.mc.theWorld.getBlockState(PlayerUtils.mc.objectMouseOver.getBlockPos()).getBlock();
if (!interactables.contains(block)) { // if (!interactables.contains(block)) {
PlayerUtils.mc.theWorld.setBlockToAir(PlayerUtils.mc.objectMouseOver.getBlockPos()); // PlayerUtils.mc.theWorld.setBlockToAir(PlayerUtils.mc.objectMouseOver.getBlockPos());
} // }
} // }
if (keyBindings[1].isKeyDown()) { // if (keyBindings[1].isKeyDown()) {
PlayerUtils.mc.thePlayer.sendChatMessage("/hub"); // List<String> lines = new ArrayList<>();
} // lines.add("X: " + Math.round(PlayerUtils.mc.thePlayer.posX));
if (keyBindings[2].isPressed()) { // lines.add("Y: " + Math.round(PlayerUtils.mc.thePlayer.posY));
// lines.add("Z: " + Math.round(PlayerUtils.mc.thePlayer.posZ));
// for (String line : lines) {
// TextRenderer.drawString(line, 0, 0, 1);
// }
// }
if (keyBindings[0].isPressed()) {
Lilase.auctionHouse.toggleAuction(); Lilase.auctionHouse.toggleAuction();
} }
if (keyBindings[3].isPressed()) { if (keyBindings[1].isPressed()) {
Lilase.config.openGui(); Lilase.config.openGui();
} }
} }
} }

View file

@ -14,6 +14,21 @@ public class ConfigUtils {
reloadConfig(); reloadConfig();
} }
public static void checkWebhookAndAPI() {
new Thread(() -> {
while (true) {
try {
Thread.sleep(120000);
} catch (InterruptedException e) {
e.printStackTrace();
}
if (getString("main", "APIKey").equals("") || getString("main", "Webhook").equals("")) {
Utils.sendMessage("API Key or Webhook is not set, please set it in the menu (Press *)");
}
}
}).start();
}
public static void reloadConfig() { public static void reloadConfig() {
if (!hasKey("main", "APIKey")) writeStringConfig("main", "APIKey", ""); if (!hasKey("main", "APIKey")) writeStringConfig("main", "APIKey", "");
if (!hasKey("main", "Webhook")) writeStringConfig("main", "Webhook", ""); if (!hasKey("main", "Webhook")) writeStringConfig("main", "Webhook", "");

View file

@ -9,6 +9,7 @@ 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();
@ -44,9 +45,10 @@ public class Utils {
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);
return sCleaned.contains("Forest") || sCleaned.contains("Village") || sCleaned.contains("Farm") || sCleaned.contains("Mountain") || sCleaned.contains("Wilderness") || sCleaned.contains("Community") || sCleaned.contains("Graveyard") || sCleaned.contains("Bazaar") || sCleaned.contains("Auction"); if (sCleaned.contains("Forest") || sCleaned.contains("Village") || sCleaned.contains("Farm") || sCleaned.contains("Mountain") || sCleaned.contains("Wilderness") || sCleaned.contains("Community") || sCleaned.contains("Graveyard") || sCleaned.contains("Bazaar") || sCleaned.contains("Auction"))
inHub = true;
} }
return false; return inHub;
} }
public static void sendMessage(String message) { public static void sendMessage(String message) {