diff --git a/src/main/java/ca/tweetzy/auctionhouse/helpers/input/Input.java b/src/main/java/ca/tweetzy/auctionhouse/helpers/input/Input.java index 03b3ff7..231e702 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/helpers/input/Input.java +++ b/src/main/java/ca/tweetzy/auctionhouse/helpers/input/Input.java @@ -19,10 +19,12 @@ package ca.tweetzy.auctionhouse.helpers.input; import ca.tweetzy.auctionhouse.AuctionHouse; +import ca.tweetzy.auctionhouse.settings.Settings; import ca.tweetzy.flight.comp.ActionBar; import ca.tweetzy.flight.comp.Titles; import lombok.NonNull; import org.bukkit.Bukkit; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -80,6 +82,10 @@ public abstract class Input implements Listener, Runnable { ) public void onChat(AsyncPlayerChatEvent e) { if (e.getPlayer().equals(this.player)) { + if (ChatColor.stripColor(e.getMessage()).equals(Settings.TITLE_INPUT_CANCEL_WORD.getString())) { + e.setCancelled(true); + this.close(false); + } this.onInput(e.getMessage()); e.setCancelled(true); diff --git a/src/main/java/ca/tweetzy/auctionhouse/helpers/input/TitleInput.java b/src/main/java/ca/tweetzy/auctionhouse/helpers/input/TitleInput.java index 2c32d4c..5e7ff6d 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/helpers/input/TitleInput.java +++ b/src/main/java/ca/tweetzy/auctionhouse/helpers/input/TitleInput.java @@ -43,7 +43,7 @@ public abstract class TitleInput extends Input { this.player = player; this.title = title; this.subTitle = subTitle; - this.actionbar = actionbar; + this.actionbar = Common.colorize(actionbar); } public TitleInput(@NonNull final Player player, final String title, final String subTitle) { diff --git a/src/main/java/ca/tweetzy/auctionhouse/settings/Settings.java b/src/main/java/ca/tweetzy/auctionhouse/settings/Settings.java index 83be3d9..32805d8 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/settings/Settings.java +++ b/src/main/java/ca/tweetzy/auctionhouse/settings/Settings.java @@ -148,6 +148,7 @@ public class Settings { public static final ConfigSetting ALLOW_PLAYERS_TO_DEFINE_AUCTION_TIME = new ConfigSetting(config, "auction setting.allow players to set auction time", false, "If true players can use -t 1 day for example to set the listing time for their item"); public static final ConfigSetting MAX_CUSTOM_DEFINED_TIME = new ConfigSetting(config, "auction setting.max custom defined time", 604800, "What should the limit on custom defined listing times be in seconds?"); public static final ConfigSetting SMART_MIN_BUY_PRICE = new ConfigSetting(config, "auction setting.smart min and buy price", false, "Will calculate buy now/min prices on a per item basis. For example, if the user states $100 and the item is in a stack of", "32, the min / buy now price will be $3200. If they provide -s or -stack in the command", "this will be ignored and the entire stack will sell for $100"); + public static final ConfigSetting TITLE_INPUT_CANCEL_WORD = new ConfigSetting(config, "auction setting.title input cancel word", "cancel", "The word to be used to cancel chat inputs (users can also just click any block)"); 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 FILTER_ONLY_USES_WHITELIST = new ConfigSetting(config, "auction setting.filter only uses whitelist", false, "If true, auction house will ignore default filters, and only filter by the items added to the category whitelists");