diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2022-08-24 13:48:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-24 13:48:53 +0200 |
commit | c3845685bbb3a2a7fde25476eed0f788e038dc93 (patch) | |
tree | f0569ff00274a3b419e3a5da3742baabce8622be /src/main/java | |
parent | b97dd13100f36dc64560067c707081af5bc8ff0c (diff) | |
download | NotEnoughUpdates-c3845685bbb3a2a7fde25476eed0f788e038dc93.tar.gz NotEnoughUpdates-c3845685bbb3a2a7fde25476eed0f788e038dc93.tar.bz2 NotEnoughUpdates-c3845685bbb3a2a7fde25476eed0f788e038dc93.zip |
Neuah save search (#243)
* saving the last search in neuah
* default enabled
* saving jani's desk
Diffstat (limited to 'src/main/java')
3 files changed, 30 insertions, 3 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java b/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java index f0ef1ec6..7b4542d0 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java @@ -133,6 +133,8 @@ public class CustomAH extends Gui { public int guiLeft = -1; public int guiTop = -1; + private String lastSearch = ""; + private final Category CATEGORY_SWORD = new Category("sword", "Swords", "diamond_sword"); private final Category CATEGORY_ARMOR = new Category("armor", "Armor", "diamond_chestplate"); private final Category CATEGORY_BOWS = new Category("bow", "Bows", "bow"); @@ -275,7 +277,11 @@ public class CustomAH extends Gui { } public void setSearch(String search) { - searchField.setText(search); + if (search == null) { + searchField.setText(lastSearch); + } else { + searchField.setText(search); + } updateSearch(); } @@ -1487,8 +1493,15 @@ public class CustomAH extends Gui { auctionIdsNew.add(entry.getKey()); } } + if (NotEnoughUpdates.INSTANCE.config.neuAuctionHouse.saveLastSearch) { + lastSearch = ""; + } } else { String query = searchField.getText(); + + if (NotEnoughUpdates.INSTANCE.config.neuAuctionHouse.saveLastSearch) { + lastSearch = query; + } Set<String> dontMatch = new HashSet<>(); HashSet<String> allMatch = new HashSet<>(); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/misc/AhCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/misc/AhCommand.java index 1cd6bcce..bd8abf1d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/commands/misc/AhCommand.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/commands/misc/AhCommand.java @@ -50,8 +50,13 @@ public class AhCommand extends ClientCommandBase { NotEnoughUpdates.INSTANCE.manager.auctionManager.customAH.clearSearch(); NotEnoughUpdates.INSTANCE.manager.auctionManager.customAH.updateSearch(); - if (args.length > 0) + if (args.length > 0) { NotEnoughUpdates.INSTANCE.manager.auctionManager.customAH.setSearch(StringUtils.join(args, " ")); + } else { + if (NotEnoughUpdates.INSTANCE.config.neuAuctionHouse.saveLastSearch) { + NotEnoughUpdates.INSTANCE.manager.auctionManager.customAH.setSearch(null); + } + } } } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/NeuAuctionHouse.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/NeuAuctionHouse.java index 44f3454a..6c55fd09 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/NeuAuctionHouse.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/NeuAuctionHouse.java @@ -24,7 +24,8 @@ import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditor import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorSlider; import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigOption; -public class NeuAuctionHouse { +public class +NeuAuctionHouse { @Expose @ConfigOption( name = "Enable NeuAH", @@ -61,4 +62,12 @@ public class NeuAuctionHouse { ) @ConfigEditorBoolean public boolean priceFiltering = false; + + @Expose + @ConfigOption( + name = "Save Last Search", + desc = "Saving the last query when closing the neuah" + ) + @ConfigEditorBoolean + public boolean saveLastSearch = true; } |