diff --git a/src/main/java/ca/tweetzy/auctionhouse/auction/AuctionPlayer.java b/src/main/java/ca/tweetzy/auctionhouse/auction/AuctionPlayer.java index 4d5df2f..128b03f 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/auction/AuctionPlayer.java +++ b/src/main/java/ca/tweetzy/auctionhouse/auction/AuctionPlayer.java @@ -69,7 +69,23 @@ public class AuctionPlayer { private long endAllRequestTime; public AuctionPlayer(UUID uuid) { - this(uuid, Bukkit.getPlayer(uuid), AuctionSaleType.BOTH, AuctionItemCategory.ALL, AuctionSortType.RECENT, "", AuctionSaleType.BOTH, AuctionItemCategory.ALL, AuctionSortType.RECENT, TransactionViewFilter.ALL, true, -1, null, -1, -1); + this( + uuid, + Bukkit.getPlayer(uuid), + Enum.valueOf(AuctionSaleType.class, Settings.DEFAULT_FILTER_SALE_TYPE.getString()), + Enum.valueOf(AuctionItemCategory.class, Settings.DEFAULT_FILTER_CATEGORY.getString()), + Enum.valueOf(AuctionSortType.class, Settings.DEFAULT_FILTER_SORT.getString()), + "", + Enum.valueOf(AuctionSaleType.class, Settings.DEFAULT_FILTER_SALE_TYPE.getString()), + Enum.valueOf(AuctionItemCategory.class, Settings.DEFAULT_FILTER_CATEGORY.getString()), + Enum.valueOf(AuctionSortType.class, Settings.DEFAULT_FILTER_SORT.getString()), + TransactionViewFilter.ALL, + true, + -1, + null, + -1, + -1 + ); } public AuctionPlayer(Player player) { @@ -131,16 +147,16 @@ public class AuctionPlayer { } public void resetFilter() { - this.selectedFilter = AuctionItemCategory.ALL; - this.auctionSortType = AuctionSortType.RECENT; - this.selectedSaleType = AuctionSaleType.BOTH; + this.selectedFilter = Enum.valueOf(AuctionItemCategory.class, Settings.DEFAULT_FILTER_CATEGORY.getString()); + this.auctionSortType = Enum.valueOf(AuctionSortType.class, Settings.DEFAULT_FILTER_SORT.getString()); + this.selectedSaleType = Enum.valueOf(AuctionSaleType.class, Settings.DEFAULT_FILTER_SALE_TYPE.getString()); this.currentSearchPhrase = ""; } public void resetTransactionFilter() { - this.selectedTransactionFilter = AuctionItemCategory.ALL; - this.transactionSortType = AuctionSortType.RECENT; - this.selectedTransactionSaleType = AuctionSaleType.BOTH; + this.selectedTransactionFilter = Enum.valueOf(AuctionItemCategory.class, Settings.DEFAULT_FILTER_CATEGORY.getString()); + this.transactionSortType = Enum.valueOf(AuctionSortType.class, Settings.DEFAULT_FILTER_SORT.getString()); + this.selectedTransactionSaleType = Enum.valueOf(AuctionSaleType.class, Settings.DEFAULT_FILTER_SALE_TYPE.getString()); } diff --git a/src/main/java/ca/tweetzy/auctionhouse/settings/Settings.java b/src/main/java/ca/tweetzy/auctionhouse/settings/Settings.java index a970eee..0a3bec8 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/settings/Settings.java +++ b/src/main/java/ca/tweetzy/auctionhouse/settings/Settings.java @@ -64,6 +64,12 @@ public class Settings { public static final ConfigSetting DEFAULT_BIN_LISTING_TIME = new ConfigSetting(config, "auction setting.listings times.bin item", 86400, "The default listing time for bin items (buy only items) before they expire"); public static final ConfigSetting DEFAULT_AUCTION_LISTING_TIME = new ConfigSetting(config, "auction setting.listings times.auction item", 604800, "The default listing time for auction items before they expire"); + + public static final ConfigSetting DEFAULT_FILTER_CATEGORY = new ConfigSetting(config, "auction setting.default filters.auction category", "ALL", "Valid Options: ALL, FOOD, ARMOR, BLOCKS, TOOLS, WEAPONS, POTIONS, SPAWNERS, ENCHANTS, MISC, SEARCH, SELF"); + public static final ConfigSetting DEFAULT_FILTER_SORT = new ConfigSetting(config, "auction setting.default filters.auction sort", "RECENT", "Valid Options: RECENT, OLDEST, PRICE"); + public static final ConfigSetting DEFAULT_FILTER_SALE_TYPE = new ConfigSetting(config, "auction setting.default filters.sale type", "BOTH", "Valid Options: USED_BIDDING_SYSTEM, WITHOUT_BIDDING_SYSTEM, BOTH"); + + public static final ConfigSetting INTERNAL_CREATE_DELAY = new ConfigSetting(config, "auction setting.internal create delay", 2, "How many ticks should auction house wait before actually creating the item."); public static final ConfigSetting MAX_AUCTION_PRICE = new ConfigSetting(config, "auction setting.pricing.max auction price", 1000000000, "The max price for buy only / buy now items"); public static final ConfigSetting MAX_AUCTION_START_PRICE = new ConfigSetting(config, "auction setting.pricing.max auction start price", 1000000000, "The max price starting a bidding auction");