diff --git a/build.gradle.kts b/build.gradle.kts index b07a5cf..75c3103 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -67,8 +67,9 @@ dependencies { compileOnly("org.projectlombok:lombok:1.18.26") annotationProcessor("org.projectlombok:lombok:1.18.26") shade("net.dv8tion:JDA:5.0.0-beta.9") { - exclude (module = "opus-java") + exclude(module = "opus-java") } + implementation("me.djtheredstoner:DevAuth-forge-legacy:1.1.0") } } diff --git a/settings.gradle.kts b/settings.gradle.kts index 4c20c07..47ae97a 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -4,6 +4,8 @@ pluginManagement { mavenCentral() maven("https://repo.polyfrost.cc/releases") maven("https://maven.architectury.dev/") + maven("https://pkgs.dev.azure.com/djtheredstoner/DevAuth/_packaging/public/maven/v1") + } plugins { val egtVersion = "0.1.18" diff --git a/src/main/java/me/night0721/lilase/events/SniperFlipperEvents.java b/src/main/java/me/night0721/lilase/events/SniperFlipperEvents.java index 0673782..3e8787a 100644 --- a/src/main/java/me/night0721/lilase/events/SniperFlipperEvents.java +++ b/src/main/java/me/night0721/lilase/events/SniperFlipperEvents.java @@ -32,7 +32,7 @@ public class SniperFlipperEvents { public void onTick(TickEvent.ClientTickEvent event) { if (Lilase.mc.thePlayer == null || event.phase != TickEvent.Phase.START) return; try { - if (selling_queue.get(0) != null) selling_queue.forEach(Flipper::switchStates); + if (selling_queue.get(0) != null) selling_queue.forEach(Flipper::onTick); } catch (Exception ignored) { } } diff --git a/src/main/java/me/night0721/lilase/features/flipper/Flipper.java b/src/main/java/me/night0721/lilase/features/flipper/Flipper.java index 1625856..6d23672 100644 --- a/src/main/java/me/night0721/lilase/features/flipper/Flipper.java +++ b/src/main/java/me/night0721/lilase/features/flipper/Flipper.java @@ -75,7 +75,7 @@ public class Flipper { } } - public void switchStates() { + public void onTick() { switch (state) { case WALKING_TO_FIRST_POINT: if (Lilase.mc.currentScreen != null) { @@ -155,33 +155,28 @@ public class Flipper { if (InventoryUtils.inventoryNameContains("Manage Auctions") && buyWait.passed()) { ItemStack slot24 = InventoryUtils.getStackInOpenContainerSlot(24); ItemStack slot33 = InventoryUtils.getStackInOpenContainerSlot(33); - + ItemStack slot42 = InventoryUtils.getStackInOpenContainerSlot(42); if (slot24 != null && slot24.getItem() == Items.golden_horse_armor) { InventoryUtils.clickOpenContainerSlot(24); buyWait.schedule(1000); } else if (slot33 != null) { if (slot33.getSubCompound("display", false).getString("Name").startsWith("§c")) { - ah_full = true; - Utils.debugLog("Auction slots full, stopping sniper for a while"); - selling_queue.remove(0); - if (SEND_MESSAGE) { - try { - webhook.addEmbed(embed("Auction slots are full!", "Could not create more auctions as slots are full already, sending you here so you could create it manually", "#ff0000")); - webhook.execute(); - Utils.debugLog("Notified Webhook"); - } catch (Exception e) { - e.printStackTrace(); - Utils.debugLog("Failed to send webhook"); - } - } - Lilase.mc.thePlayer.closeScreen(); - state = FlipperState.NONE; + sendSlotsFull(); // Lilase.cofl.toggleAuction(); return; } else if (slot33.getItem() == Items.golden_horse_armor) { InventoryUtils.clickOpenContainerSlot(33); buyWait.schedule(1000); } + } else if (slot42 != null) { + if (slot42.getSubCompound("display", false).getString("Name").startsWith("§c")) { + sendSlotsFull(); +// Lilase.cofl.toggleAuction(); + return; + } else if (slot42.getItem() == Items.golden_horse_armor) { + InventoryUtils.clickOpenContainerSlot(33); + buyWait.schedule(1000); + } } else { Utils.debugLog("Can't find create auction button, stopping flipper"); selling_queue.remove(0); @@ -203,16 +198,14 @@ public class Flipper { } case PRICE: if (Lilase.mc.currentScreen instanceof GuiEditSign && buyWait.passed()) { - GuiEditSign guiEditSign = (GuiEditSign) Lilase.mc.currentScreen; TileEntitySign tileSign; try { - tileSign = (TileEntitySign) ReflectionUtils.field(guiEditSign, "tileSign"); + tileSign = (TileEntitySign) ReflectionUtils.field(Lilase.mc.currentScreen, "tileSign"); } catch (Exception e) { - e.printStackTrace(); - tileSign = (TileEntitySign) ReflectionUtils.field(guiEditSign, "field_146848_f"); + tileSign = (TileEntitySign) ReflectionUtils.field(Lilase.mc.currentScreen, "field_146848_f"); } - Utils.debugLog("Sign(normal): " + ReflectionUtils.field(guiEditSign, "tileSign")); - Utils.debugLog("Sign(obfuscated): " + ReflectionUtils.field(guiEditSign, "field_146848_f")); + Utils.debugLog("Sign(normal): " + ReflectionUtils.field(Lilase.mc.currentScreen, "tileSign")); + Utils.debugLog("Sign(obfuscated): " + ReflectionUtils.field(Lilase.mc.currentScreen, "field_146848_f")); if (tileSign == null) { Utils.debugLog("TileEntitySign is null, stopping flipper"); selling_queue.remove(0); @@ -324,6 +317,24 @@ public class Flipper { } } + public void sendSlotsFull() { + ah_full = true; + Utils.debugLog("Auction slots full, stopping sniper for a while"); + selling_queue.remove(0); + if (SEND_MESSAGE) { + try { + webhook.addEmbed(embed("Auction slots are full!", "Could not create more auctions as slots are full already, sending you here so you could create it manually", "#ff0000")); + webhook.execute(); + Utils.debugLog("Notified Webhook"); + } catch (Exception e) { + e.printStackTrace(); + Utils.debugLog("Failed to send webhook"); + } + } + Lilase.mc.thePlayer.closeScreen(); + state = FlipperState.NONE; + } + public static float distanceToFirstPoint() { return (float) Math.sqrt(Math.pow(Lilase.mc.thePlayer.posX - (-2.5), 2) + Math.pow(Lilase.mc.thePlayer.posZ - (-91.5), 2)); }