🍶 added potions / potion ingredient filter

Took 11 minutes
This commit is contained in:
Kiran Hart 2023-06-06 18:05:51 -04:00
parent 491c8ec4a8
commit 6cb03727d8
No known key found for this signature in database
GPG Key ID: 5F36C7BC79D3EBC3
6 changed files with 51 additions and 1 deletions

View File

@ -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();
}

View File

@ -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) {

View File

@ -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));
});
}
}

View File

@ -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;
}
}

View File

@ -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");

View File

@ -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"));