From 1c4e29e72590b85c46f9e623b2938495e7d303e7 Mon Sep 17 00:00:00 2001 From: Kiran Hart Date: Mon, 22 Mar 2021 18:48:50 -0400 Subject: [PATCH] added refresh option on filter change --- .../tweetzy/auctionhouse/guis/GUIAuctionHouse.java | 12 ++++++++++-- .../ca/tweetzy/auctionhouse/settings/Settings.java | 1 + 2 files changed, 11 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 88713e4..501e902 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/guis/GUIAuctionHouse.java +++ b/src/main/java/ca/tweetzy/auctionhouse/guis/GUIAuctionHouse.java @@ -86,11 +86,19 @@ public class GUIAuctionHouse extends Gui { switch (e.clickType) { case LEFT: this.filterCategory = this.filterCategory.next(); - draw(); + if (Settings.REFRESH_GUI_ON_FILTER_CHANGE.getBoolean()) { + e.manager.showGUI(e.player, new GUIAuctionHouse(this.auctionPlayer)); + } else { + draw(); + } break; case RIGHT: this.filterAuctionType = this.filterAuctionType.next(); - draw(); + if (Settings.REFRESH_GUI_ON_FILTER_CHANGE.getBoolean()){ + e.manager.showGUI(e.player, new GUIAuctionHouse(this.auctionPlayer)); + } else { + draw(); + } break; } }); diff --git a/src/main/java/ca/tweetzy/auctionhouse/settings/Settings.java b/src/main/java/ca/tweetzy/auctionhouse/settings/Settings.java index a684393..342e4cc 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/settings/Settings.java +++ b/src/main/java/ca/tweetzy/auctionhouse/settings/Settings.java @@ -37,6 +37,7 @@ public class Settings { public static final ConfigSetting TIME_TO_INCREASE_BY_ON_BID = new ConfigSetting(config, "auction setting.time to increase by on the bid", 20, "How many seconds should be added to the remaining time?"); public static final ConfigSetting TICK_UPDATE_TIME = new ConfigSetting(config, "auction setting.tick auctions every", 1, "How many seconds should pass before the plugin updates all the times on items?"); public static final ConfigSetting REFRESH_GUI_WHEN_BID = new ConfigSetting(config, "auction setting.refresh gui when bid", true, "Should the auction gui be re-opened (not redrawn) when a user places a bid, so they get the latest items?"); + public static final ConfigSetting REFRESH_GUI_ON_FILTER_CHANGE = new ConfigSetting(config, "auction setting.refresh gui when filter changed", false, "Should the gui refresh when the player changes the filter mode?"); public static final ConfigSetting RECORD_TRANSACTIONS = new ConfigSetting(config, "auction setting.record transactions", true, "Should every transaction be recorded (everything an auction is won or an item is bought)"); /* ===============================