diff options
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/miscgui/TradeWindow.java')
| -rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/miscgui/TradeWindow.java | 18 |
1 files changed, 5 insertions, 13 deletions
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; } |
