improvements

This commit is contained in:
NK 2023-02-20 13:45:37 +00:00
parent 5d7f53ce68
commit 32992a720e
4 changed files with 15 additions and 9 deletions

View file

@ -2,6 +2,7 @@ package me.night0721.lilase;
import com.mojang.realmsclient.gui.ChatFormatting;
import me.night0721.lilase.events.PacketReceivedEvent;
import me.night0721.lilase.features.ah.States;
import me.night0721.lilase.utils.AuctionHouse;
import me.night0721.lilase.utils.ConfigUtils;
import me.night0721.lilase.utils.Utils;
@ -76,7 +77,11 @@ public class Main {
String message = event.message.getUnformattedText();
if (!message.contains(":")) {
if (message.equals("You didn't participate in this auction!")) {
System.out.println("Failed to buy item, closing the menu");
System.out.println("Failed to buy item, not fast enough. Closing the menu");
mc.playerController.windowClick(mc.thePlayer.openContainer.windowId, 49, 0, 0, mc.thePlayer); // Close the window as could not buy
} 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");
AuctionHouse.clickState = States.STOP;
mc.playerController.windowClick(mc.thePlayer.openContainer.windowId, 49, 0, 0, mc.thePlayer); // Close the window as could not buy
}
}

View file

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

View file

@ -1,5 +1,6 @@
package me.night0721.lilase.utils;
import me.night0721.lilase.features.ah.States;
import net.minecraft.client.Minecraft;
import org.json.JSONArray;
import org.json.JSONException;
@ -24,7 +25,7 @@ public class AuctionHouse {
private static String uuid;
private static String message_toSend;
private static long lastAction;
private Thread thread;
private static Thread thread;
private Boolean open = false;
private final DiscordWebhook webhook;
private final List<Item> items = new ArrayList<>();
@ -117,8 +118,6 @@ public class AuctionHouse {
Pattern pattern = Pattern.compile("§[0-9a-z]", Pattern.MULTILINE);
Matcher matcher = pattern.matcher(auction.getString("item_lore"));
String updated = matcher.replaceAll("");
System.out.println(updated);
webhook.addEmbed(
new DiscordWebhook.EmbedObject()
.setTitle("Item Is On Low Price")
@ -205,7 +204,6 @@ public class AuctionHouse {
open = true;
}
}
public static void switchStates() {
switch (clickState) {
case CLICK:
@ -223,15 +221,14 @@ public class AuctionHouse {
AuctionHouse.sendAuction();
lastAction = System.currentTimeMillis();
clickState = States.CLICK;
case STOP:
thread = null;
case NONE:
break;
}
}
}
enum States {
OPEN, NONE, CLICK, CONFIRM
}
enum ItemTier {
ANY, COMMON, UNCOMMON, RARE, EPIC, LEGENDARY, MYTHIC, DIVINE, SPECIAL, VERY_SPECIAL,

View file

@ -143,7 +143,6 @@ public class DiscordWebhook {
connection.addRequestProperty("User-Agent", "Mozilla/5.0 (X11; U; Linux i686) Gecko/20071127 Firefox/2.0.0.11");
connection.setDoOutput(true);
connection.setRequestMethod("POST");
System.out.println(json);
OutputStream stream = connection.getOutputStream();
stream.write(json.toString().getBytes(StandardCharsets.UTF_8));
stream.flush();