From 4e02ab15caadec0134e090f60210c5f330c49e2f Mon Sep 17 00:00:00 2001 From: Lulonaut Date: Fri, 20 Oct 2023 22:35:00 +0200 Subject: Fix enchanted books not working with bz keybind (#886) * Fix enchanted books not working with bz keybind Extracts the book name from the lore of the item. Then searches directly with /bz since enchanted books can't be in the auction house * Change method for detecting books to displayname --- .../io/github/moulberry/notenoughupdates/NEUOverlay.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java index 54d85fc3..e7486dba 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java @@ -1212,8 +1212,16 @@ public class NEUOverlay extends Gui { NotEnoughUpdates.INSTANCE.openGui = new GuiPriceGraph(internalname.get()); return true; } else if (keyPressed == NotEnoughUpdates.INSTANCE.config.misc.openAHKeybind) { - String cleanName = Utils.cleanColour(item.get("displayname").getAsString()).replace("[Lvl {LVL}]", "").trim(); - if (NotEnoughUpdates.INSTANCE.manager.auctionManager.getBazaarInfo(internalname.get()) == null) { + String displayname = item.get("displayname").getAsString(); + + String cleanName = Utils.cleanColour(displayname).replace("[Lvl {LVL}]", "").trim(); + + if (displayname.equals("§fEnchanted Book")) { + String loreName = Utils.cleanColour(item.getAsJsonArray("lore").get(0).getAsString()); + + String bookName = loreName.substring(0, loreName.lastIndexOf(' ')); + NotEnoughUpdates.INSTANCE.trySendCommand("/bz " + bookName); + } else if (NotEnoughUpdates.INSTANCE.manager.auctionManager.getBazaarInfo(internalname.get()) == null) { NotEnoughUpdates.INSTANCE.trySendCommand("/ahs " + cleanName); } else { NotEnoughUpdates.INSTANCE.trySendCommand("/bz " + cleanName); -- cgit