diff --git a/build.gradle b/build.gradle index beedce2..2ae6d07 100644 --- a/build.gradle +++ b/build.gradle @@ -21,7 +21,7 @@ apply plugin: "net.minecraftforge.gradle.forge" apply plugin: "com.github.johnrengelman.shadow" apply plugin: "org.spongepowered.mixin" -version = "1.0.21" +version = "1.0.22" group = "me.night0721.lilase" archivesBaseName = "Lilase" sourceCompatibility = 1.8 diff --git a/src/main/java/me/night0721/lilase/Lilase.java b/src/main/java/me/night0721/lilase/Lilase.java index 825d178..4643d81 100644 --- a/src/main/java/me/night0721/lilase/Lilase.java +++ b/src/main/java/me/night0721/lilase/Lilase.java @@ -3,21 +3,17 @@ package me.night0721.lilase; import cc.polyfrost.oneconfig.events.EventManager; import cc.polyfrost.oneconfig.events.event.InitializationEvent; import cc.polyfrost.oneconfig.libs.eventbus.Subscribe; -import com.mojang.realmsclient.gui.ChatFormatting; -import me.night0721.lilase.events.PacketReceivedEvent; import me.night0721.lilase.events.SniperFlipperEvents; import me.night0721.lilase.features.ah.AHConfig; import me.night0721.lilase.features.ah.AuctionHouse; +import me.night0721.lilase.utils.Clock; import me.night0721.lilase.utils.ConfigUtils; import me.night0721.lilase.utils.KeyBindingManager; -import me.night0721.lilase.utils.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiDisconnected; import net.minecraft.client.gui.GuiMainMenu; import net.minecraft.client.gui.GuiMultiplayer; import net.minecraft.client.multiplayer.ServerData; -import net.minecraft.network.play.client.C0DPacketCloseWindow; -import net.minecraft.network.play.server.S2DPacketOpenWindow; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.common.Mod; @@ -34,12 +30,13 @@ import static me.night0721.lilase.features.ah.AHConfig.RECONNECT_DELAY; public class Lilase { public static final String MOD_NAME = "Lilase"; public static final String MODID = "Lilase"; - public static final String VERSION = "1.0.21"; - static int tickAmount; - int waitTime; + public static final String VERSION = "1.0.22"; + public static final Minecraft mc = Minecraft.getMinecraft(); public static AuctionHouse auctionHouse; public static AHConfig config; - static final Minecraft mc = Minecraft.getMinecraft(); + private int tickAmount; + private final Clock clock = new Clock(); + @Mod.EventHandler public void init(FMLInitializationEvent event) { @@ -62,25 +59,15 @@ public class Lilase { public void onTick(TickEvent.ClientTickEvent event) throws IOException { if (mc.thePlayer == null || event.phase != TickEvent.Phase.START) return; tickAmount++; - if (tickAmount % 20 == 0) Utils.checkForDungeon(); if (tickAmount % (20 * AUCTION_HOUSE_DELAY) == 0) auctionHouse.getItem(); if (tickAmount % 2400 == 0) ConfigUtils.checkWebhookAndAPI(); if (AuctionHouse.flipper != null) AuctionHouse.flipper.switchStates(); if (mc.currentScreen instanceof GuiDisconnected) { - if (waitTime >= (RECONNECT_DELAY * 20)) { - waitTime = 0; + if (clock.passed()) { + clock.schedule(RECONNECT_DELAY * 1000L); FMLClientHandler.instance().connectToServer(new GuiMultiplayer(new GuiMainMenu()), new ServerData(" ", "mc.hypixel.net", false)); - } else { - waitTime++; - } - } - } - @SubscribeEvent - public void onPacket(PacketReceivedEvent event) { - if (Utils.inDungeon && event.packet instanceof S2DPacketOpenWindow && ChatFormatting.stripFormatting(((S2DPacketOpenWindow) event.packet).getWindowTitle().getFormattedText()).equals("Chest")) { - event.setCanceled(true); - mc.getNetHandler().getNetworkManager().sendPacket(new C0DPacketCloseWindow(((S2DPacketOpenWindow) event.packet).getWindowId())); + } } } /* diff --git a/src/main/java/me/night0721/lilase/events/SniperFlipperEvents.java b/src/main/java/me/night0721/lilase/events/SniperFlipperEvents.java index 9d061a9..1d9959c 100644 --- a/src/main/java/me/night0721/lilase/events/SniperFlipperEvents.java +++ b/src/main/java/me/night0721/lilase/events/SniperFlipperEvents.java @@ -58,12 +58,12 @@ public class SniperFlipperEvents { flipper.sellItem(); } else if (message.equals("Your starting bid must be at least 10 coins!")) { InventoryUtils.clickOpenContainerSlot(13); - PlayerUtils.mc.thePlayer.closeScreen(); + Lilase.mc.thePlayer.closeScreen(); Utils.debugLog("[Flipper] Cannot post item as the cost is too low, stopping fliiper and starting sniper"); Lilase.auctionHouse.toggleAuction(); Flipper.state = FlipperState.NONE; } else if (message.contains("Can't create a BIN auction for this item for a PRICE this LOW!")) { - PlayerUtils.mc.thePlayer.closeScreen(); + Lilase.mc.thePlayer.closeScreen(); Utils.debugLog("[Flipper] Cannot post item as the cost is too low, stopping fliiper and starting sniper"); Lilase.auctionHouse.toggleAuction(); Flipper.state = FlipperState.NONE; @@ -110,12 +110,12 @@ public class SniperFlipperEvents { Thread.sleep(3000); InventoryUtils.clickOpenContainerSlot(10); Thread.sleep(3000); - PlayerUtils.mc.thePlayer.closeScreen(); + Lilase.mc.thePlayer.closeScreen(); } } else { Thread.sleep(1000 * 60 * 5); } - PlayerUtils.mc.thePlayer.sendChatMessage("/hub"); + Lilase.mc.thePlayer.sendChatMessage("/hub"); Thread.sleep(6000); Lilase.auctionHouse.toggleAuction(); } catch (Exception ignore) { @@ -138,7 +138,7 @@ public class SniperFlipperEvents { try { Utils.debugLog("[Flipper] Interrupting Flipper selling"); Thread.sleep(500); - PlayerUtils.mc.thePlayer.closeScreen(); + Lilase.mc.thePlayer.closeScreen(); Flipper.state = FlipperState.NONE; Lilase.auctionHouse.toggleAuction(); } catch (InterruptedException e) { @@ -159,9 +159,9 @@ public class SniperFlipperEvents { int hour = cal.get(Calendar.HOUR_OF_DAY); int minute = cal.get(Calendar.MINUTE); String time = String.format("%02d:%02d", hour, minute); - String lines = "X: " + Math.round(PlayerUtils.mc.thePlayer.posX) + "\n" + - "Y: " + Math.round(PlayerUtils.mc.thePlayer.posY) + "\n" + - "Z: " + Math.round(PlayerUtils.mc.thePlayer.posZ) + "\n" + + String lines = "X: " + Math.round(Lilase.mc.thePlayer.posX) + "\n" + + "Y: " + Math.round(Lilase.mc.thePlayer.posY) + "\n" + + "Z: " + Math.round(Lilase.mc.thePlayer.posZ) + "\n" + time + "\n" + "FPS: " + Minecraft.getDebugFPS() + "\n" + "Auctions Sniped: " + Lilase.auctionHouse.getAuctionsSniped(); @@ -177,16 +177,16 @@ public class SniperFlipperEvents { ItemStack is = InventoryUtils.getStackInOpenContainerSlot(31); if (is != null && (is.getItem() == Items.gold_nugget || (AHConfig.BED_SPAM && is.getItem() == Items.bed))) { buying = true; - windowId = PlayerUtils.mc.thePlayer.openContainer.windowId; - PlayerUtils.mc.playerController.windowClick(windowId, 31, 0, 0, PlayerUtils.mc.thePlayer); + windowId = Lilase.mc.thePlayer.openContainer.windowId; + Lilase.mc.playerController.windowClick(windowId, 31, 0, 0, Lilase.mc.thePlayer); } else if (is != null && is.getItem() == Items.potato) { buying = false; - PlayerUtils.mc.thePlayer.closeScreen(); + Lilase.mc.thePlayer.closeScreen(); } } if (AHConfig.BED_SPAM) { if (buying && "Confirm Purchase".equals(windowName)) { - PlayerUtils.mc.playerController.windowClick(windowId + 1, 11, 0, 0, PlayerUtils.mc.thePlayer); + Lilase.mc.playerController.windowClick(windowId + 1, 11, 0, 0, Lilase.mc.thePlayer); buying = false; } } diff --git a/src/main/java/me/night0721/lilase/features/ah/AuctionHouse.java b/src/main/java/me/night0721/lilase/features/ah/AuctionHouse.java index 585b501..89a3c1c 100644 --- a/src/main/java/me/night0721/lilase/features/ah/AuctionHouse.java +++ b/src/main/java/me/night0721/lilase/features/ah/AuctionHouse.java @@ -1,5 +1,6 @@ package me.night0721.lilase.features.ah; +import me.night0721.lilase.Lilase; import me.night0721.lilase.features.flip.Flipper; import me.night0721.lilase.utils.*; import org.json.JSONArray; @@ -140,7 +141,7 @@ public class AuctionHouse { flipper = new Flipper(auction.getString("item_name"), auction.getString("item_bytes"), auction.getInt("starting_bid")); NumberFormat format = NumberFormat.getInstance(Locale.US); JSONObject profile = getHypixelData(auction.getString("auctioneer")); - if (profile.getJSONObject("player").getString("displayname").toLowerCase() == PlayerUtils.mc.thePlayer.getName().toLowerCase()) + if (profile.getJSONObject("player").getString("displayname").toLowerCase() == Lilase.mc.thePlayer.getName().toLowerCase()) break; Pattern pattern = Pattern.compile("§[0-9a-z]", Pattern.MULTILINE); Matcher matcher = pattern.matcher(auction.getString("item_lore")); diff --git a/src/main/java/me/night0721/lilase/features/flip/Flipper.java b/src/main/java/me/night0721/lilase/features/flip/Flipper.java index 2a992d2..fbd0f07 100644 --- a/src/main/java/me/night0721/lilase/features/flip/Flipper.java +++ b/src/main/java/me/night0721/lilase/features/flip/Flipper.java @@ -17,7 +17,7 @@ import java.nio.charset.StandardCharsets; public class Flipper { - private static String itemname = null; + private final String itemname; private final String bytedata; private final int itemprice; public static FlipperState state = FlipperState.NONE; @@ -51,8 +51,8 @@ public class Flipper { public void switchStates() { switch (state) { case WALKING_TO_FIRST_POINT: - if (PlayerUtils.mc.currentScreen != null) { - PlayerUtils.mc.thePlayer.closeScreen(); + if (Lilase.mc.currentScreen != null) { + Lilase.mc.thePlayer.closeScreen(); } else if (distanceToFirstPoint() < 0.7f) { Utils.debugLog("[Flipper] Moving to auction house"); KeyBindingManager.updateKeys(false, false, false, false, false); @@ -65,11 +65,11 @@ public class Flipper { } break; case WALKING_INTO_AUCTION_HOUSE: - if (PlayerUtils.mc.currentScreen != null) { - PlayerUtils.mc.thePlayer.closeScreen(); + if (Lilase.mc.currentScreen != null) { + Lilase.mc.thePlayer.closeScreen(); } else if (AngleUtils.smallestAngleDifference(AngleUtils.get360RotationYaw(), 88f) > 1.2) { Utils.debugLog("[Flipper] Rotating to Auction Master"); - rotation.easeTo(88f, PlayerUtils.mc.thePlayer.rotationPitch, 500); + rotation.easeTo(88f, Lilase.mc.thePlayer.rotationPitch, 500); } else if (distanceToAuctionMaster() < 0.7f) { Utils.debugLog("[Flipper] At Auction Master, opening shop"); KeyBindingManager.updateKeys(false, false, false, false, false); @@ -82,13 +82,13 @@ public class Flipper { } break; case BUYING: - if (PlayerUtils.mc.currentScreen == null && buyWait.passed()) { + if (Lilase.mc.currentScreen == null && buyWait.passed()) { final Entity auctionMaster = getAuctionMaster(); if (auctionMaster == null) { Utils.debugLog("[Flipper] Cannot find shop NPC, retrying"); buyWait.schedule(500); } else { - PlayerUtils.mc.playerController.interactWithEntitySendPacket(PlayerUtils.mc.thePlayer, auctionMaster); + Lilase.mc.playerController.interactWithEntitySendPacket(Lilase.mc.thePlayer, auctionMaster); buyWait.schedule(1500); } } else if (InventoryUtils.inventoryNameContains("Auction House") && buyWait.passed()) { @@ -127,7 +127,7 @@ public class Flipper { InventoryUtils.clickOpenContainerSlot(49); Lilase.auctionHouse.incrementAuctionsSniped(); buyWait.schedule(500); - PlayerUtils.mc.thePlayer.closeScreen(); + Lilase.mc.thePlayer.closeScreen(); buyWait.schedule(500); Utils.sendMessage("Posted item on Auction House, continue sniping now"); state = FlipperState.NONE; @@ -162,15 +162,15 @@ public class Flipper { } private float distanceToFirstPoint() { - return (float) Math.sqrt(Math.pow(PlayerUtils.mc.thePlayer.posX - (-2.5), 2) + Math.pow(PlayerUtils.mc.thePlayer.posZ - (-91.5), 2)); + return (float) Math.sqrt(Math.pow(Lilase.mc.thePlayer.posX - (-2.5), 2) + Math.pow(Lilase.mc.thePlayer.posZ - (-91.5), 2)); } private float distanceToAuctionMaster() { - return (float) Math.sqrt(Math.pow(PlayerUtils.mc.thePlayer.posX - (-45), 2) + Math.pow(PlayerUtils.mc.thePlayer.posZ - (-90), 2)); + return (float) Math.sqrt(Math.pow(Lilase.mc.thePlayer.posX - (-45), 2) + Math.pow(Lilase.mc.thePlayer.posZ - (-90), 2)); } private Entity getAuctionMaster() { - for (final Entity e : PlayerUtils.mc.theWorld.loadedEntityList) { + for (final Entity e : Lilase.mc.theWorld.loadedEntityList) { if (e instanceof EntityArmorStand) { final String name = StringUtils.stripControlCodes(e.getDisplayName().getUnformattedText()); if (name.startsWith("Auction Master")) { diff --git a/src/main/java/me/night0721/lilase/gui/TextRenderer.java b/src/main/java/me/night0721/lilase/gui/TextRenderer.java index acc7e4b..abd9844 100644 --- a/src/main/java/me/night0721/lilase/gui/TextRenderer.java +++ b/src/main/java/me/night0721/lilase/gui/TextRenderer.java @@ -1,6 +1,6 @@ package me.night0721.lilase.gui; -import me.night0721.lilase.utils.PlayerUtils; +import me.night0721.lilase.Lilase; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; import org.lwjgl.opengl.GL11; @@ -9,10 +9,10 @@ public class TextRenderer { public static void drawString(String text, int x, int y, double scale) { double scaleReset = Math.pow(scale, -1); GL11.glScaled(scale, scale, scale); - y -= PlayerUtils.mc.fontRendererObj.FONT_HEIGHT * scale; + y -= Lilase.mc.fontRendererObj.FONT_HEIGHT * scale; for (String line : text.split("\n")) { - y += PlayerUtils.mc.fontRendererObj.FONT_HEIGHT * scale; - PlayerUtils.mc.fontRendererObj.drawString(line, (int) Math.round(x / scale), (int) Math.round(y / scale), 0xFFFFFF, true); + y += Lilase.mc.fontRendererObj.FONT_HEIGHT * scale; + Lilase.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); @@ -22,10 +22,10 @@ public class TextRenderer { double scaleReset = Math.pow(scale, -1); GL11.glScaled(scale, scale, scale); - y -= PlayerUtils.mc.fontRendererObj.FONT_HEIGHT * scale; + y -= Lilase.mc.fontRendererObj.FONT_HEIGHT * scale; for (String line : text.split("\n")) { - y += PlayerUtils.mc.fontRendererObj.FONT_HEIGHT * scale; - PlayerUtils.mc.fontRendererObj.drawString(line, (int) Math.round(x / scale), (int) Math.round(y / scale), color, false); + y += Lilase.mc.fontRendererObj.FONT_HEIGHT * scale; + Lilase.mc.fontRendererObj.drawString(line, (int) Math.round(x / scale), (int) Math.round(y / scale), color, false); } GL11.glScaled(scaleReset, scaleReset, scaleReset); GlStateManager.color(1, 1, 1, 1); diff --git a/src/main/java/me/night0721/lilase/utils/KeyBindingManager.java b/src/main/java/me/night0721/lilase/utils/KeyBindingManager.java index 998550c..b2b80c8 100644 --- a/src/main/java/me/night0721/lilase/utils/KeyBindingManager.java +++ b/src/main/java/me/night0721/lilase/utils/KeyBindingManager.java @@ -29,14 +29,14 @@ public class KeyBindingManager { } public static void rightClick() { - if (!ReflectionUtils.invoke(PlayerUtils.mc, "func_147121_ag")) { - ReflectionUtils.invoke(PlayerUtils.mc, "rightClickMouse"); + if (!ReflectionUtils.invoke(Lilase.mc, "func_147121_ag")) { + ReflectionUtils.invoke(Lilase.mc, "rightClickMouse"); } } public static void leftClick() { - if (!ReflectionUtils.invoke(PlayerUtils.mc, "func_147116_af")) { - ReflectionUtils.invoke(PlayerUtils.mc, "clickMouse"); + if (!ReflectionUtils.invoke(Lilase.mc, "func_147116_af")) { + ReflectionUtils.invoke(Lilase.mc, "clickMouse"); } } @@ -46,27 +46,27 @@ public class KeyBindingManager { } public static void updateKeys(boolean forward, boolean back, boolean right, boolean left, boolean attack, boolean crouch, boolean space) { - if (PlayerUtils.mc.currentScreen != null) { + if (Lilase.mc.currentScreen != null) { stopMovement(); return; } - KeyBinding.setKeyBindState(PlayerUtils.mc.gameSettings.keyBindForward.getKeyCode(), forward); - KeyBinding.setKeyBindState(PlayerUtils.mc.gameSettings.keyBindBack.getKeyCode(), back); - KeyBinding.setKeyBindState(PlayerUtils.mc.gameSettings.keyBindRight.getKeyCode(), right); - KeyBinding.setKeyBindState(PlayerUtils.mc.gameSettings.keyBindLeft.getKeyCode(), left); - KeyBinding.setKeyBindState(PlayerUtils.mc.gameSettings.keyBindAttack.getKeyCode(), attack); - KeyBinding.setKeyBindState(PlayerUtils.mc.gameSettings.keyBindSneak.getKeyCode(), crouch); - KeyBinding.setKeyBindState(PlayerUtils.mc.gameSettings.keyBindJump.getKeyCode(), space); + KeyBinding.setKeyBindState(Lilase.mc.gameSettings.keyBindForward.getKeyCode(), forward); + KeyBinding.setKeyBindState(Lilase.mc.gameSettings.keyBindBack.getKeyCode(), back); + KeyBinding.setKeyBindState(Lilase.mc.gameSettings.keyBindRight.getKeyCode(), right); + KeyBinding.setKeyBindState(Lilase.mc.gameSettings.keyBindLeft.getKeyCode(), left); + KeyBinding.setKeyBindState(Lilase.mc.gameSettings.keyBindAttack.getKeyCode(), attack); + KeyBinding.setKeyBindState(Lilase.mc.gameSettings.keyBindSneak.getKeyCode(), crouch); + KeyBinding.setKeyBindState(Lilase.mc.gameSettings.keyBindJump.getKeyCode(), space); } public static void stopMovement() { - KeyBinding.setKeyBindState(PlayerUtils.mc.gameSettings.keyBindForward.getKeyCode(), false); - KeyBinding.setKeyBindState(PlayerUtils.mc.gameSettings.keyBindBack.getKeyCode(), false); - KeyBinding.setKeyBindState(PlayerUtils.mc.gameSettings.keyBindRight.getKeyCode(), false); - KeyBinding.setKeyBindState(PlayerUtils.mc.gameSettings.keyBindLeft.getKeyCode(), false); - KeyBinding.setKeyBindState(PlayerUtils.mc.gameSettings.keyBindAttack.getKeyCode(), false); - KeyBinding.setKeyBindState(PlayerUtils.mc.gameSettings.keyBindSneak.getKeyCode(), false); - KeyBinding.setKeyBindState(PlayerUtils.mc.gameSettings.keyBindJump.getKeyCode(), false); + KeyBinding.setKeyBindState(Lilase.mc.gameSettings.keyBindForward.getKeyCode(), false); + KeyBinding.setKeyBindState(Lilase.mc.gameSettings.keyBindBack.getKeyCode(), false); + KeyBinding.setKeyBindState(Lilase.mc.gameSettings.keyBindRight.getKeyCode(), false); + KeyBinding.setKeyBindState(Lilase.mc.gameSettings.keyBindLeft.getKeyCode(), false); + KeyBinding.setKeyBindState(Lilase.mc.gameSettings.keyBindAttack.getKeyCode(), false); + KeyBinding.setKeyBindState(Lilase.mc.gameSettings.keyBindSneak.getKeyCode(), false); + KeyBinding.setKeyBindState(Lilase.mc.gameSettings.keyBindJump.getKeyCode(), false); } } diff --git a/src/main/java/me/night0721/lilase/utils/PlayerUtils.java b/src/main/java/me/night0721/lilase/utils/PlayerUtils.java index 348b483..cb38112 100644 --- a/src/main/java/me/night0721/lilase/utils/PlayerUtils.java +++ b/src/main/java/me/night0721/lilase/utils/PlayerUtils.java @@ -1,18 +1,15 @@ package me.night0721.lilase.utils; -import net.minecraft.client.Minecraft; +import me.night0721.lilase.Lilase; import net.minecraft.network.Packet; import java.util.ArrayList; public class PlayerUtils { - public static final Minecraft mc = Minecraft.getMinecraft(); - public static final ArrayList> packets = new ArrayList<>(); public static void sendPacketWithoutEvent(Packet packet) { packets.add(packet); - mc.getNetHandler().getNetworkManager().sendPacket(packet); - + Lilase.mc.getNetHandler().getNetworkManager().sendPacket(packet); } } diff --git a/src/main/java/me/night0721/lilase/utils/ScoreboardUtils.java b/src/main/java/me/night0721/lilase/utils/ScoreboardUtils.java index f280da3..86e6df1 100644 --- a/src/main/java/me/night0721/lilase/utils/ScoreboardUtils.java +++ b/src/main/java/me/night0721/lilase/utils/ScoreboardUtils.java @@ -2,6 +2,7 @@ package me.night0721.lilase.utils; import com.google.common.collect.Iterables; import com.google.common.collect.Lists; +import me.night0721.lilase.Lilase; import net.minecraft.scoreboard.Score; import net.minecraft.scoreboard.ScoreObjective; import net.minecraft.scoreboard.ScorePlayerTeam; @@ -37,8 +38,8 @@ public class ScoreboardUtils { public static List getSidebarLines() { List lines = new ArrayList<>(); - if (PlayerUtils.mc.theWorld == null) return lines; - Scoreboard scoreboard = PlayerUtils.mc.theWorld.getScoreboard(); + if (Lilase.mc.theWorld == null) return lines; + Scoreboard scoreboard = Lilase.mc.theWorld.getScoreboard(); if (scoreboard == null) return lines; ScoreObjective objective = scoreboard.getObjectiveInDisplaySlot(1); diff --git a/src/main/java/me/night0721/lilase/utils/Utils.java b/src/main/java/me/night0721/lilase/utils/Utils.java index 00101d7..30e18fe 100644 --- a/src/main/java/me/night0721/lilase/utils/Utils.java +++ b/src/main/java/me/night0721/lilase/utils/Utils.java @@ -1,5 +1,6 @@ package me.night0721.lilase.utils; +import me.night0721.lilase.Lilase; import net.minecraft.network.play.server.S45PacketTitle; import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting; @@ -7,8 +8,6 @@ import net.minecraft.util.EnumChatFormatting; import java.util.List; public class Utils { - - public static boolean inDungeon; public static boolean inHub = false; public static String translateAlternateColorCodes(String text) { @@ -25,20 +24,8 @@ public class Utils { public static void addTitle(String title) { S45PacketTitle p1 = new S45PacketTitle(0, 20, 0); S45PacketTitle p2 = new S45PacketTitle(S45PacketTitle.Type.TITLE, new ChatComponentText(Utils.translateAlternateColorCodes(title))); - PlayerUtils.mc.thePlayer.sendQueue.handleTitle(p1); - PlayerUtils.mc.thePlayer.sendQueue.handleTitle(p2); - } - - public static void checkForDungeon() { - List scoreboard = ScoreboardUtils.getSidebarLines(); - for (String s : scoreboard) { - String sCleaned = ScoreboardUtils.cleanSB(s); - if (sCleaned.contains("The Catacombs") || (sCleaned.contains("Cleared:") && sCleaned.contains("% ("))) { - inDungeon = true; - return; - } - } - inDungeon = false; + Lilase.mc.thePlayer.sendQueue.handleTitle(p1); + Lilase.mc.thePlayer.sendQueue.handleTitle(p2); } public static boolean checkInHub() { @@ -52,14 +39,14 @@ public class Utils { } public static void sendMessage(String message) { - PlayerUtils.mc.thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.LIGHT_PURPLE + "" + EnumChatFormatting.BOLD + "Liliase" + EnumChatFormatting.RESET + EnumChatFormatting.DARK_GRAY + " » " + EnumChatFormatting.RESET + EnumChatFormatting.GREEN + EnumChatFormatting.BOLD + message)); + Lilase.mc.thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.LIGHT_PURPLE + "" + EnumChatFormatting.BOLD + "Liliase" + EnumChatFormatting.RESET + EnumChatFormatting.DARK_GRAY + " » " + EnumChatFormatting.RESET + EnumChatFormatting.GREEN + EnumChatFormatting.BOLD + message)); } public static void debugLog(String message) { - PlayerUtils.mc.thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.LIGHT_PURPLE + "" + "Liliase" + EnumChatFormatting.RESET + EnumChatFormatting.DARK_GRAY + " » " + EnumChatFormatting.RESET + EnumChatFormatting.WHITE + message)); + Lilase.mc.thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.LIGHT_PURPLE + "" + "Liliase" + EnumChatFormatting.RESET + EnumChatFormatting.DARK_GRAY + " » " + EnumChatFormatting.RESET + EnumChatFormatting.WHITE + message)); } public static void sendServerMessage(String message) { - PlayerUtils.mc.thePlayer.sendChatMessage(message); + Lilase.mc.thePlayer.sendChatMessage(message); } }