diff options
author | Lulonaut <lulonaut@lulonaut.tech> | 2023-10-20 22:35:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-20 22:35:00 +0200 |
commit | 4e02ab15caadec0134e090f60210c5f330c49e2f (patch) | |
tree | 71719a3b89fd0dd0e2c4dc3c76d20dd279facf2d /src/main/java/io | |
parent | 5e3a573493a47f9a6208093925a8c4b5d1f324ce (diff) | |
download | NotEnoughUpdates-4e02ab15caadec0134e090f60210c5f330c49e2f.tar.gz NotEnoughUpdates-4e02ab15caadec0134e090f60210c5f330c49e2f.tar.bz2 NotEnoughUpdates-4e02ab15caadec0134e090f60210c5f330c49e2f.zip |
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
Diffstat (limited to 'src/main/java/io')
-rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java | 12 |
1 files 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); |