From 023107b8983789be75c417ce6451ac8eeecd6df4 Mon Sep 17 00:00:00 2001 From: Kiran Hart Date: Mon, 3 Oct 2022 20:58:37 -0400 Subject: [PATCH] add FILTER_WHITELIST_USES_DURABILITY Took 3 minutes --- .../ca/tweetzy/auctionhouse/guis/GUIAuctionHouse.java | 8 ++++++-- .../java/ca/tweetzy/auctionhouse/settings/Settings.java | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/ca/tweetzy/auctionhouse/guis/GUIAuctionHouse.java b/src/main/java/ca/tweetzy/auctionhouse/guis/GUIAuctionHouse.java index 4a057ec..400d5f9 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/guis/GUIAuctionHouse.java +++ b/src/main/java/ca/tweetzy/auctionhouse/guis/GUIAuctionHouse.java @@ -160,8 +160,12 @@ public class GUIAuctionHouse extends AbstractPlaceholderGui { private boolean checkFilterCriteria(AuctionedItem auctionItem, AuctionItemCategory category) { // option for only whitelisted shit - if (Settings.FILTER_ONLY_USES_WHITELIST.getBoolean()) - return AuctionHouse.getInstance().getFilterManager().getFilterWhitelist(category).stream().anyMatch(item -> item.isSimilar(auctionItem.getItem())); + if (Settings.FILTER_ONLY_USES_WHITELIST.getBoolean()) { + if (!Settings.FILTER_WHITELIST_USES_DURABILITY.getBoolean()) + return AuctionHouse.getInstance().getFilterManager().getFilterWhitelist(category).stream().anyMatch(item -> item.isSimilar(auctionItem.getItem())); + else + return AuctionHouse.getInstance().getFilterManager().getFilterWhitelist(category).stream().anyMatch(item -> item.getType() == auctionItem.getItem().getType() && item.getDurability() == auctionItem.getItem().getDurability()); + } return auctionItem.getCategory() == category || AuctionHouse.getInstance().getFilterManager().getFilterWhitelist(category).stream().anyMatch(item -> item.isSimilar(auctionItem.getItem())); diff --git a/src/main/java/ca/tweetzy/auctionhouse/settings/Settings.java b/src/main/java/ca/tweetzy/auctionhouse/settings/Settings.java index cc123ce..c7060d2 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/settings/Settings.java +++ b/src/main/java/ca/tweetzy/auctionhouse/settings/Settings.java @@ -129,6 +129,7 @@ public class Settings { public static final ConfigSetting USE_SEPARATE_FILTER_MENU = new ConfigSetting(config, "auction setting.use separate filter menu", false, "If true, rather than using a single filter item inside the auction menu", "it will open an entirely new menu to select the filter"); public static final ConfigSetting FILTER_ONLY_USES_WHITELIST = new ConfigSetting(config, "auction setting.filter only uses whitelist", false, "If true, auction house will ignore default filters, and only filter by the items added to the category whitelists"); + public static final ConfigSetting FILTER_WHITELIST_USES_DURABILITY = new ConfigSetting(config, "auction setting.filter whitelist uses durability", false, "If true, the filter will look at material names and durability values for comparisons only"); public static final ConfigSetting SELL_MENU_REQUIRES_USER_TO_HOLD_ITEM = new ConfigSetting(config, "auction setting.require user to hold item when using sell menu", false, "If enabled, when running just /ah sell, the user will need to hold the item in their hand, otherwise they just add it in the gui."); public static final ConfigSetting OPEN_MAIN_AUCTION_HOUSE_AFTER_MENU_LIST = new ConfigSetting(config, "auction setting.open main auction house after listing using menu", true, "Should the main auction house be opened after the user lists an item using the sell menu?"); public static final ConfigSetting SELL_MENU_CLOSE_SENDS_TO_LISTING = new ConfigSetting(config, "auction setting.sell menu close sends to listings", true, "If true, when the player clicks the close button within the sell menu, it will send them to the main auction house");