From 9aa7b49d224bfde055e12bc84f6908ba0a50090d Mon Sep 17 00:00:00 2001 From: BuildTools Date: Thu, 6 May 2021 08:03:15 +0800 Subject: fine ironman --- .../notenoughupdates/miscgui/TradeWindow.java | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'src/main/java/io/github/moulberry/notenoughupdates/miscgui/TradeWindow.java') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/TradeWindow.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/TradeWindow.java index 91d3b981..165cb494 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/TradeWindow.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/TradeWindow.java @@ -56,23 +56,15 @@ public class TradeWindow { private static int lastBackpackY; - public static boolean hypixelTradeWindowActive() { - if(!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) return false; - GuiScreen guiScreen = Minecraft.getMinecraft().currentScreen; - if(guiScreen instanceof GuiChest) { - GuiChest eventGui = (GuiChest) guiScreen; - ContainerChest cc = (ContainerChest) eventGui.inventorySlots; - String containerName = cc.getLowerChestInventory().getDisplayName().getUnformattedText(); - return containerName.trim().startsWith("You "); - } - return false; + public static boolean hypixelTradeWindowActive(String containerName) { + return containerName != null && containerName.trim().startsWith("You "); } - public static boolean tradeWindowActive() { - if(!NotEnoughUpdates.INSTANCE.isOnSkyblock()) return false; + public static boolean tradeWindowActive(String containerName) { + if(!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) return false; if(!NotEnoughUpdates.INSTANCE.config.tradeMenu.enableCustomTrade) return false; - if(hypixelTradeWindowActive()) { + if(hypixelTradeWindowActive(containerName)) { return true; } -- cgit