diff --git a/src/main/java/ca/tweetzy/auctionhouse/auction/enums/AuctionItemCategory.java b/src/main/java/ca/tweetzy/auctionhouse/auction/enums/AuctionItemCategory.java index 51bd642..a9a3b2d 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/auction/enums/AuctionItemCategory.java +++ b/src/main/java/ca/tweetzy/auctionhouse/auction/enums/AuctionItemCategory.java @@ -35,6 +35,7 @@ public enum AuctionItemCategory { BLOCKS("Blocks", true, Settings.BLOCKS_FILTER_ENABLED.getBoolean()), TOOLS("Tools", true, Settings.TOOLS_FILTER_ENABLED.getBoolean()), WEAPONS("Weapons", true, Settings.WEAPONS_FILTER_ENABLED.getBoolean()), + POTIONS("Potions", true, Settings.POTIONS_FILTER_ENABLED.getBoolean()), SPAWNERS("Spawners", true, Settings.SPAWNERS_FILTER_ENABLED.getBoolean()), ENCHANTS("Enchants", true, Settings.ENCHANTS_FILTER_ENABLED.getBoolean()), MISC("Misc", true, Settings.MISC_FILTER_ENABLED.getBoolean()), @@ -99,6 +100,8 @@ public enum AuctionItemCategory { return AuctionHouse.getInstance().getLocale().getMessage("auction_filter.categories.weapons").getMessage(); case SELF: return AuctionHouse.getInstance().getLocale().getMessage("auction_filter.categories.self").getMessage(); + case POTIONS: + return AuctionHouse.getInstance().getLocale().getMessage("auction_filter.categories.potions").getMessage(); case SEARCH: return AuctionHouse.getInstance().getLocale().getMessage("auction_filter.categories.search").getMessage(); } diff --git a/src/main/java/ca/tweetzy/auctionhouse/guis/filter/GUIFilterSelection.java b/src/main/java/ca/tweetzy/auctionhouse/guis/filter/GUIFilterSelection.java index 463ad80..b500210 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/guis/filter/GUIFilterSelection.java +++ b/src/main/java/ca/tweetzy/auctionhouse/guis/filter/GUIFilterSelection.java @@ -47,7 +47,7 @@ public class GUIFilterSelection extends AbstractPlaceholderGui { super(auctionPlayer); this.auctionPlayer = auctionPlayer; setTitle(TextUtils.formatText(Settings.GUI_FILTER_TITLE.getString())); - setRows(4); + setRows(5); setAcceptsItems(false); setDefaultItem(ConfigurationItemHelper.createConfigurationItem(this.player, Settings.GUI_FILTER_BG_ITEM.getString())); setUseLockedCells(true); @@ -135,6 +135,13 @@ public class GUIFilterSelection extends AbstractPlaceholderGui { updatePlayerFilter(this.auctionPlayer); e.manager.showGUI(e.player, new GUIAuctionHouse(this.auctionPlayer)); }); + + if (AuctionItemCategory.POTIONS.isEnabled()) + setButton(3, 4, ConfigurationItemHelper.createConfigurationItem(this.player, Settings.GUI_FILTER_ITEMS_POTIONS_ITEM.getString(), Settings.GUI_FILTER_ITEMS_POTIONS_NAME.getString(), Settings.GUI_FILTER_ITEMS_POTIONS_LORE.getStringList(), null), e -> { + this.auctionPlayer.setSelectedFilter(AuctionItemCategory.POTIONS); + updatePlayerFilter(this.auctionPlayer); + e.manager.showGUI(e.player, new GUIAuctionHouse(this.auctionPlayer)); + }); } private void updatePlayerFilter(AuctionPlayer player) { diff --git a/src/main/java/ca/tweetzy/auctionhouse/guis/filter/GUIFilterWhitelist.java b/src/main/java/ca/tweetzy/auctionhouse/guis/filter/GUIFilterWhitelist.java index 3d4c284..3c0288e 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/guis/filter/GUIFilterWhitelist.java +++ b/src/main/java/ca/tweetzy/auctionhouse/guis/filter/GUIFilterWhitelist.java @@ -77,5 +77,10 @@ public class GUIFilterWhitelist extends AbstractPlaceholderGui { setButton(3, 7, ConfigurationItemHelper.createConfigurationItem(this.player, Settings.GUI_FILTER_WHITELIST_ITEMS_MISC_ITEM.getString(), Settings.GUI_FILTER_WHITELIST_ITEMS_MISC_NAME.getString(), Settings.GUI_FILTER_WHITELIST_ITEMS_MISC_LORE.getStringList(), null), e -> { e.manager.showGUI(e.player, new GUIFilterWhitelistList(e.player, AuctionItemCategory.MISC)); }); + + setButton(4, 1, ConfigurationItemHelper.createConfigurationItem(this.player, Settings.GUI_FILTER_WHITELIST_ITEMS_POTIONS_ITEM.getString(), Settings.GUI_FILTER_WHITELIST_ITEMS_POTIONS_NAME.getString(), Settings.GUI_FILTER_WHITELIST_ITEMS_POTIONS_LORE.getStringList(), null), e -> { + e.manager.showGUI(e.player, new GUIFilterWhitelistList(e.player, AuctionItemCategory.POTIONS)); + }); + } } diff --git a/src/main/java/ca/tweetzy/auctionhouse/helpers/MaterialCategorizer.java b/src/main/java/ca/tweetzy/auctionhouse/helpers/MaterialCategorizer.java index 38326ad..471de28 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/helpers/MaterialCategorizer.java +++ b/src/main/java/ca/tweetzy/auctionhouse/helpers/MaterialCategorizer.java @@ -53,6 +53,29 @@ public class MaterialCategorizer { // Tool Filter if (materialName.endsWith("_AXE") || materialName.endsWith("_PICKAXE") || materialName.endsWith("_HOE") || materialName.endsWith("SHOVEL")) return AuctionItemCategory.TOOLS; + + // Potions + if (material == XMaterial.BREWING_STAND.parseMaterial() + || material == XMaterial.CAULDRON.parseMaterial() + || material == XMaterial.BLAZE_POWDER.parseMaterial() + || material == XMaterial.POTION.parseMaterial() + || material == XMaterial.NETHER_WART.parseMaterial() + || material == XMaterial.REDSTONE.parseMaterial() + || material == XMaterial.GLOWSTONE_DUST.parseMaterial() + || material == XMaterial.FERMENTED_SPIDER_EYE.parseMaterial() + || material == XMaterial.GUNPOWDER.parseMaterial() + || material.name().contains("DRAGONS_BREATH") || material.name().contains("DRAGON_BREATH") + || material == XMaterial.GLISTERING_MELON_SLICE.parseMaterial() + || material == XMaterial.MAGMA_CREAM.parseMaterial() + || material == XMaterial.GHAST_TEAR.parseMaterial() + || material == XMaterial.SUGAR.parseMaterial() + || material == XMaterial.GOLDEN_CARROT.parseMaterial() + || material == XMaterial.PUFFERFISH.parseMaterial() + || material == XMaterial.RABBIT_FOOT.parseMaterial() + || material == XMaterial.PHANTOM_MEMBRANE.parseMaterial() + || material == XMaterial.SPIDER_EYE.parseMaterial()) + return AuctionItemCategory.POTIONS; + return AuctionItemCategory.MISC; } } diff --git a/src/main/java/ca/tweetzy/auctionhouse/settings/LocaleSettings.java b/src/main/java/ca/tweetzy/auctionhouse/settings/LocaleSettings.java index 73b6db0..5c64cd5 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/settings/LocaleSettings.java +++ b/src/main/java/ca/tweetzy/auctionhouse/settings/LocaleSettings.java @@ -155,6 +155,7 @@ public class LocaleSettings { languageNodes.put("auction_filter.categories.food", "Food"); languageNodes.put("auction_filter.categories.armor", "Armor"); languageNodes.put("auction_filter.categories.blocks", "Blocks"); + languageNodes.put("auction_filter.categories.potions", "Potions"); languageNodes.put("auction_filter.categories.tools", "Tools"); languageNodes.put("auction_filter.categories.misc", "Misc"); languageNodes.put("auction_filter.categories.spawners", "Spawners"); diff --git a/src/main/java/ca/tweetzy/auctionhouse/settings/Settings.java b/src/main/java/ca/tweetzy/auctionhouse/settings/Settings.java index 6cfb2c5..afc0e84 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/settings/Settings.java +++ b/src/main/java/ca/tweetzy/auctionhouse/settings/Settings.java @@ -191,6 +191,7 @@ public class Settings { public static final ConfigSetting WEAPONS_FILTER_ENABLED = new ConfigSetting(config, "auction setting.enabled filters.weapons", true, "Should this filter be enabled?"); public static final ConfigSetting SPAWNERS_FILTER_ENABLED = new ConfigSetting(config, "auction setting.enabled filters.spawners", true, "Should this filter be enabled?"); public static final ConfigSetting ENCHANTS_FILTER_ENABLED = new ConfigSetting(config, "auction setting.enabled filters.enchants", true, "Should this filter be enabled?"); + public static final ConfigSetting POTIONS_FILTER_ENABLED = new ConfigSetting(config, "auction setting.enabled filters.potions", true, "Should this filter be enabled?"); public static final ConfigSetting MISC_FILTER_ENABLED = new ConfigSetting(config, "auction setting.enabled filters.misc", true, "Should this filter be enabled?"); public static final ConfigSetting SEARCH_FILTER_ENABLED = new ConfigSetting(config, "auction setting.enabled filters.search", true, "Should this filter be enabled?"); public static final ConfigSetting SELF_FILTER_ENABLED = new ConfigSetting(config, "auction setting.enabled filters.self", true, "Should this filter be enabled?"); @@ -858,6 +859,11 @@ public class Settings { public static final ConfigSetting GUI_FILTER_ITEMS_MISC_NAME = new ConfigSetting(config, "gui.filter.items.misc.name", "&e&lMiscellaneous"); public static final ConfigSetting GUI_FILTER_ITEMS_MISC_LORE = new ConfigSetting(config, "gui.filter.items.misc.lore", Collections.singletonList("&7Click to set the filter to&f: &eMiscellaneous")); + public static final ConfigSetting GUI_FILTER_ITEMS_POTIONS_ITEM = new ConfigSetting(config, "gui.filter.items.potions.item", XMaterial.SPLASH_POTION.name()); + public static final ConfigSetting GUI_FILTER_ITEMS_POTIONS_NAME = new ConfigSetting(config, "gui.filter.items.potions.name", "&e&LPotions"); + public static final ConfigSetting GUI_FILTER_ITEMS_POTIONS_LORE = new ConfigSetting(config, "gui.filter.items.potions.lore", Collections.singletonList("&7Click to set the filter to&f: &ePotions")); + + public static final ConfigSetting GUI_FILTER_ITEMS_ENCHANTS_ITEM = new ConfigSetting(config, "gui.filter.items.enchants.item", XMaterial.ENCHANTED_BOOK.name()); public static final ConfigSetting GUI_FILTER_ITEMS_ENCHANTS_NAME = new ConfigSetting(config, "gui.filter.items.enchants.name", "&e&lEnchantments"); public static final ConfigSetting GUI_FILTER_ITEMS_ENCHANTS_LORE = new ConfigSetting(config, "gui.filter.items.enchants.lore", Collections.singletonList("&7Click to set the filter to&f: &eEnchantments")); @@ -916,6 +922,11 @@ public class Settings { public static final ConfigSetting GUI_FILTER_WHITELIST_ITEMS_WEAPONS_NAME = new ConfigSetting(config, "gui.filter whitelist.items.weapons.name", "&e&lWeapon Filters"); public static final ConfigSetting GUI_FILTER_WHITELIST_ITEMS_WEAPONS_LORE = new ConfigSetting(config, "gui.filter whitelist.items.weapons.lore", Collections.singletonList("&7Click to adjust the item whitelist for this filter")); + public static final ConfigSetting GUI_FILTER_WHITELIST_ITEMS_POTIONS_ITEM = new ConfigSetting(config, "gui.filter whitelist.items.potions.item", XMaterial.SPLASH_POTION.name()); + public static final ConfigSetting GUI_FILTER_WHITELIST_ITEMS_POTIONS_NAME = new ConfigSetting(config, "gui.filter whitelist.items.potions.name", "&e&LPotions Filters"); + public static final ConfigSetting GUI_FILTER_WHITELIST_ITEMS_POTIONS_LORE = new ConfigSetting(config, "gui.filter whitelist.items.potions.lore", Collections.singletonList("&7Click to adjust the item whitelist for this filter")); + + public static final ConfigSetting GUI_FILTER_WHITELIST_ITEMS_MISC_ITEM = new ConfigSetting(config, "gui.filter whitelist.items.misc.item", XMaterial.BONE_MEAL.name()); public static final ConfigSetting GUI_FILTER_WHITELIST_ITEMS_MISC_NAME = new ConfigSetting(config, "gui.filter whitelist.items.misc.name", "&e&lMiscellaneous Filters"); public static final ConfigSetting GUI_FILTER_WHITELIST_ITEMS_MISC_LORE = new ConfigSetting(config, "gui.filter whitelist.items.misc.lore", Collections.singletonList("&7Click to adjust the item whitelist for this filter"));