diff --git a/pom.xml b/pom.xml
index 2ae8bd2..232a668 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
4.0.0
ca.tweetzy
auctionhouse
- 2.15.1
+ 2.16.0
UTF-8
diff --git a/src/main/java/ca/tweetzy/auctionhouse/AuctionHouse.java b/src/main/java/ca/tweetzy/auctionhouse/AuctionHouse.java
index 0d01562..139e027 100644
--- a/src/main/java/ca/tweetzy/auctionhouse/AuctionHouse.java
+++ b/src/main/java/ca/tweetzy/auctionhouse/AuctionHouse.java
@@ -195,6 +195,7 @@ public class AuctionHouse extends TweetyPlugin {
public void onConfigReload() {
Settings.setup();
setLocale(Settings.LANG.getString());
+ LocaleSettings.setup();
this.commandManager.setSyntaxErrorMessage(TextUtils.formatText(getLocale().getMessage("commands.invalid_syntax").getMessage().split("\n")));
this.commandManager.setNoPermsMessage(TextUtils.formatText(getLocale().getMessage("commands.no_permission").getMessage()));
}
diff --git a/src/main/java/ca/tweetzy/auctionhouse/api/AuctionAPI.java b/src/main/java/ca/tweetzy/auctionhouse/api/AuctionAPI.java
index d31c42d..4f3b7be 100644
--- a/src/main/java/ca/tweetzy/auctionhouse/api/AuctionAPI.java
+++ b/src/main/java/ca/tweetzy/auctionhouse/api/AuctionAPI.java
@@ -1,18 +1,16 @@
package ca.tweetzy.auctionhouse.api;
import ca.tweetzy.auctionhouse.AuctionHouse;
-import ca.tweetzy.auctionhouse.api.events.AuctionEndEvent;
import ca.tweetzy.auctionhouse.auction.AuctionItem;
import ca.tweetzy.auctionhouse.auction.AuctionSaleType;
import ca.tweetzy.auctionhouse.helpers.ConfigurationItemHelper;
import ca.tweetzy.auctionhouse.settings.Settings;
import ca.tweetzy.core.compatibility.XMaterial;
-import ca.tweetzy.core.utils.PlayerUtils;
import ca.tweetzy.core.utils.TextUtils;
import ca.tweetzy.core.utils.items.ItemUtils;
import ca.tweetzy.core.utils.nms.NBTEditor;
import org.apache.commons.lang.WordUtils;
-import org.bukkit.Bukkit;
+import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@@ -280,9 +278,9 @@ public class AuctionAPI {
* @return whether the keyword is found
*/
public boolean match(String pattern, String sentence) {
- Pattern patt = Pattern.compile(pattern, Pattern.CASE_INSENSITIVE);
+ Pattern patt = Pattern.compile(ChatColor.stripColor(pattern), Pattern.CASE_INSENSITIVE);
Matcher matcher = patt.matcher(sentence);
- return matcher.matches();
+ return matcher.find();
}
/**
diff --git a/src/main/java/ca/tweetzy/auctionhouse/auction/AuctionFilterItem.java b/src/main/java/ca/tweetzy/auctionhouse/auction/AuctionFilterItem.java
index 66bc409..6f2d416 100644
--- a/src/main/java/ca/tweetzy/auctionhouse/auction/AuctionFilterItem.java
+++ b/src/main/java/ca/tweetzy/auctionhouse/auction/AuctionFilterItem.java
@@ -1,6 +1,5 @@
package ca.tweetzy.auctionhouse.auction;
-import ca.tweetzy.auctionhouse.AuctionHouse;
import ca.tweetzy.auctionhouse.api.AuctionAPI;
import lombok.Getter;
import lombok.Setter;
diff --git a/src/main/java/ca/tweetzy/auctionhouse/auction/AuctionItem.java b/src/main/java/ca/tweetzy/auctionhouse/auction/AuctionItem.java
index 27c831e..5bcc85b 100644
--- a/src/main/java/ca/tweetzy/auctionhouse/auction/AuctionItem.java
+++ b/src/main/java/ca/tweetzy/auctionhouse/auction/AuctionItem.java
@@ -3,7 +3,6 @@ package ca.tweetzy.auctionhouse.auction;
import ca.tweetzy.auctionhouse.api.AuctionAPI;
import ca.tweetzy.auctionhouse.settings.Settings;
import ca.tweetzy.core.compatibility.ServerVersion;
-import ca.tweetzy.core.compatibility.XMaterial;
import ca.tweetzy.core.utils.TextUtils;
import ca.tweetzy.core.utils.nms.NBTEditor;
import lombok.Getter;
diff --git a/src/main/java/ca/tweetzy/auctionhouse/auction/AuctionItemCategory.java b/src/main/java/ca/tweetzy/auctionhouse/auction/AuctionItemCategory.java
index e142158..5c400ad 100644
--- a/src/main/java/ca/tweetzy/auctionhouse/auction/AuctionItemCategory.java
+++ b/src/main/java/ca/tweetzy/auctionhouse/auction/AuctionItemCategory.java
@@ -1,6 +1,7 @@
package ca.tweetzy.auctionhouse.auction;
import ca.tweetzy.auctionhouse.AuctionHouse;
+import ca.tweetzy.auctionhouse.settings.Settings;
/**
* The current file has been created by Kiran Hart
@@ -10,25 +11,27 @@ import ca.tweetzy.auctionhouse.AuctionHouse;
*/
public enum AuctionItemCategory {
- ALL("All", false),
- FOOD("Food", true),
- ARMOR("Armor", true),
- BLOCKS("Blocks", true),
- TOOLS("Tools", true),
- WEAPONS("Weapons", true),
- SPAWNERS("Spawners", true),
- ENCHANTS("Enchants", true),
- MISC("Misc", true),
- SEARCH("Search", false),
- SELF("Self", false);
+ ALL("All", false, Settings.ALL_FILTER_ENABLED.getBoolean()),
+ FOOD("Food", true, Settings.FOOD_FILTER_ENABLED.getBoolean()),
+ ARMOR("Armor", true, Settings.ARMOR_FILTER_ENABLED.getBoolean()),
+ BLOCKS("Blocks", true, Settings.BLOCKS_FILTER_ENABLED.getBoolean()),
+ TOOLS("Tools", true, Settings.TOOLS_FILTER_ENABLED.getBoolean()),
+ WEAPONS("Weapons", true, Settings.WEAPONS_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()),
+ SEARCH("Search", false, Settings.SEARCH_FILTER_ENABLED.getBoolean()),
+ SELF("Self", false, Settings.SELF_FILTER_ENABLED.getBoolean());
private final String type;
private final boolean whitelistAllowed;
+ private final boolean enabled;
- AuctionItemCategory(String type, boolean whitelistAllowed) {
+ AuctionItemCategory(String type, boolean whitelistAllowed, boolean enabled) {
this.type = type;
this.whitelistAllowed = whitelistAllowed;
+ this.enabled = enabled;
}
public String getType() {
@@ -39,6 +42,10 @@ public enum AuctionItemCategory {
return whitelistAllowed;
}
+ public boolean isEnabled() {
+ return enabled;
+ }
+
public String getTranslatedType() {
switch (this) {
case ALL:
@@ -68,6 +75,12 @@ public enum AuctionItemCategory {
}
public AuctionItemCategory next() {
- return values()[(this.ordinal() + 1) % values().length];
+ int currentIndex = this.ordinal();
+ int nextIndex = currentIndex + 1;
+ while (!values()[nextIndex %= values().length].isEnabled()) {
+ nextIndex++;
+ }
+
+ return values()[nextIndex];
}
}
diff --git a/src/main/java/ca/tweetzy/auctionhouse/commands/CommandAdmin.java b/src/main/java/ca/tweetzy/auctionhouse/commands/CommandAdmin.java
index 4264d3f..5cf1869 100644
--- a/src/main/java/ca/tweetzy/auctionhouse/commands/CommandAdmin.java
+++ b/src/main/java/ca/tweetzy/auctionhouse/commands/CommandAdmin.java
@@ -5,7 +5,6 @@ import ca.tweetzy.auctionhouse.auction.AuctionItem;
import ca.tweetzy.auctionhouse.helpers.PlayerHelper;
import ca.tweetzy.auctionhouse.settings.Settings;
import ca.tweetzy.core.commands.AbstractCommand;
-import ca.tweetzy.core.utils.PlayerUtils;
import ca.tweetzy.core.utils.items.ItemUtils;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
diff --git a/src/main/java/ca/tweetzy/auctionhouse/guis/GUIActiveAuctions.java b/src/main/java/ca/tweetzy/auctionhouse/guis/GUIActiveAuctions.java
index d4087d1..241c573 100644
--- a/src/main/java/ca/tweetzy/auctionhouse/guis/GUIActiveAuctions.java
+++ b/src/main/java/ca/tweetzy/auctionhouse/guis/GUIActiveAuctions.java
@@ -1,7 +1,6 @@
package ca.tweetzy.auctionhouse.guis;
import ca.tweetzy.auctionhouse.AuctionHouse;
-import ca.tweetzy.auctionhouse.api.AuctionAPI;
import ca.tweetzy.auctionhouse.auction.AuctionItem;
import ca.tweetzy.auctionhouse.auction.AuctionPlayer;
import ca.tweetzy.auctionhouse.auction.AuctionStackType;
diff --git a/src/main/java/ca/tweetzy/auctionhouse/guis/GUIAuctionHouse.java b/src/main/java/ca/tweetzy/auctionhouse/guis/GUIAuctionHouse.java
index badfed4..2eef0c1 100644
--- a/src/main/java/ca/tweetzy/auctionhouse/guis/GUIAuctionHouse.java
+++ b/src/main/java/ca/tweetzy/auctionhouse/guis/GUIAuctionHouse.java
@@ -110,11 +110,13 @@ public class GUIAuctionHouse extends Gui {
}
private boolean checkSearchCriteria(String phrase, AuctionItem item) {
- return AuctionAPI.getInstance().match(phrase, item.getItemName()) ||
+ ItemStack stack = AuctionAPI.getInstance().deserializeItem(item.getRawItem());
+ return AuctionAPI.getInstance().match(phrase, AuctionAPI.getInstance().getItemName(stack)) ||
AuctionAPI.getInstance().match(phrase, item.getCategory().getTranslatedType()) ||
+ AuctionAPI.getInstance().match(phrase, stack.getType().name()) ||
AuctionAPI.getInstance().match(phrase, Bukkit.getOfflinePlayer(item.getOwner()).getName()) ||
- AuctionAPI.getInstance().match(phrase, AuctionAPI.getInstance().getItemLore(AuctionAPI.getInstance().deserializeItem(item.getRawItem()))) ||
- AuctionAPI.getInstance().match(phrase, AuctionAPI.getInstance().getItemEnchantments(AuctionAPI.getInstance().deserializeItem(item.getRawItem())));
+ AuctionAPI.getInstance().match(phrase, AuctionAPI.getInstance().getItemLore(stack)) ||
+ AuctionAPI.getInstance().match(phrase, AuctionAPI.getInstance().getItemEnchantments(stack));
}
/*
diff --git a/src/main/java/ca/tweetzy/auctionhouse/guis/filter/GUIFilterWhitelistList.java b/src/main/java/ca/tweetzy/auctionhouse/guis/filter/GUIFilterWhitelistList.java
index d4ee1cd..5255b12 100644
--- a/src/main/java/ca/tweetzy/auctionhouse/guis/filter/GUIFilterWhitelistList.java
+++ b/src/main/java/ca/tweetzy/auctionhouse/guis/filter/GUIFilterWhitelistList.java
@@ -4,7 +4,6 @@ import ca.tweetzy.auctionhouse.AuctionHouse;
import ca.tweetzy.auctionhouse.auction.AuctionFilterItem;
import ca.tweetzy.auctionhouse.auction.AuctionItemCategory;
import ca.tweetzy.auctionhouse.settings.Settings;
-import ca.tweetzy.core.compatibility.XSound;
import ca.tweetzy.core.gui.Gui;
import ca.tweetzy.core.utils.TextUtils;
import ca.tweetzy.core.utils.items.TItemBuilder;
diff --git a/src/main/java/ca/tweetzy/auctionhouse/listeners/PlayerListeners.java b/src/main/java/ca/tweetzy/auctionhouse/listeners/PlayerListeners.java
index 035f5eb..e0951f0 100644
--- a/src/main/java/ca/tweetzy/auctionhouse/listeners/PlayerListeners.java
+++ b/src/main/java/ca/tweetzy/auctionhouse/listeners/PlayerListeners.java
@@ -5,7 +5,6 @@ import ca.tweetzy.auctionhouse.api.AuctionAPI;
import ca.tweetzy.auctionhouse.api.UpdateChecker;
import ca.tweetzy.auctionhouse.auction.AuctionPlayer;
import ca.tweetzy.auctionhouse.helpers.PlayerHelper;
-import ca.tweetzy.core.compatibility.CompatibleHand;
import ca.tweetzy.core.compatibility.ServerVersion;
import ca.tweetzy.core.compatibility.XMaterial;
import ca.tweetzy.core.utils.PlayerUtils;
diff --git a/src/main/java/ca/tweetzy/auctionhouse/managers/AuctionItemManager.java b/src/main/java/ca/tweetzy/auctionhouse/managers/AuctionItemManager.java
index 38bd542..24d82e1 100644
--- a/src/main/java/ca/tweetzy/auctionhouse/managers/AuctionItemManager.java
+++ b/src/main/java/ca/tweetzy/auctionhouse/managers/AuctionItemManager.java
@@ -2,7 +2,6 @@ package ca.tweetzy.auctionhouse.managers;
import ca.tweetzy.auctionhouse.AuctionHouse;
import ca.tweetzy.auctionhouse.api.AuctionAPI;
-import ca.tweetzy.auctionhouse.auction.AuctionFilterItem;
import ca.tweetzy.auctionhouse.auction.AuctionItem;
import ca.tweetzy.core.utils.TextUtils;
import org.bukkit.Bukkit;
diff --git a/src/main/java/ca/tweetzy/auctionhouse/settings/Settings.java b/src/main/java/ca/tweetzy/auctionhouse/settings/Settings.java
index 776232f..5f970d1 100644
--- a/src/main/java/ca/tweetzy/auctionhouse/settings/Settings.java
+++ b/src/main/java/ca/tweetzy/auctionhouse/settings/Settings.java
@@ -65,6 +65,18 @@ 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 ALL_FILTER_ENABLED = new ConfigSetting(config, "auction setting.enabled filters.all", true, "Should this filter be enabled?");
+ public static final ConfigSetting FOOD_FILTER_ENABLED = new ConfigSetting(config, "auction setting.enabled filters.food", true, "Should this filter be enabled?");
+ public static final ConfigSetting ARMOR_FILTER_ENABLED = new ConfigSetting(config, "auction setting.enabled filters.armor", true, "Should this filter be enabled?");
+ public static final ConfigSetting BLOCKS_FILTER_ENABLED = new ConfigSetting(config, "auction setting.enabled filters.blocks", true, "Should this filter be enabled?");
+ public static final ConfigSetting TOOLS_FILTER_ENABLED = new ConfigSetting(config, "auction setting.enabled filters.tools", true, "Should this filter be enabled?");
+ 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 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?");
+
public static final ConfigSetting ALLOW_ITEM_BUNDLES = new ConfigSetting(config, "auction setting.bundles.enabled", true, "If true, players can use -b in the sell command to bundle all similar items into a single item.");
public static final ConfigSetting ITEM_BUNDLE_ITEM = new ConfigSetting(config, "auction setting.bundles.item", XMaterial.GOLD_BLOCK.name());
public static final ConfigSetting ITEM_BUNDLE_NAME = new ConfigSetting(config, "auction setting.bundles.name", "%item_name% &7Bundle");