🟥 vault symbol overrides, currency display name fixes, and hide thank you toggle

Took 7 minutes
This commit is contained in:
Kiran Hart 2024-10-17 13:02:28 -04:00
parent f659b5f1ec
commit 2008b97e06
No known key found for this signature in database
GPG Key ID: 5F36C7BC79D3EBC3
4 changed files with 23 additions and 22 deletions

View File

@ -282,12 +282,14 @@ public class AuctionHouse extends TweetyPlugin {
if (USER.contains(uIDPartOne) && USER.contains(uIDPartTwo)) {
getLogger().severe("Could not detect user ID, are you running a cracked / self-compiled copy of auction house?");
} else {
getConsole().sendMessage(TextUtils.formatText("&e&m--------------------------------------------------------"));
getConsole().sendMessage(TextUtils.formatText(""));
getConsole().sendMessage(TextUtils.formatText("&aThank you for purchasing Auction House, it means a lot"));
getConsole().sendMessage(TextUtils.formatText("&7 - Kiran Hart"));
getConsole().sendMessage(TextUtils.formatText(""));
getConsole().sendMessage(TextUtils.formatText("&e&m--------------------------------------------------------"));
if (!Settings.HIDE_THANKYOU.getBoolean()) {
getConsole().sendMessage(TextUtils.formatText("&e&m--------------------------------------------------------"));
getConsole().sendMessage(TextUtils.formatText(""));
getConsole().sendMessage(TextUtils.formatText("&aThank you for purchasing Auction House, it means a lot"));
getConsole().sendMessage(TextUtils.formatText("&7 - Kiran Hart"));
getConsole().sendMessage(TextUtils.formatText(""));
getConsole().sendMessage(TextUtils.formatText("&e&m--------------------------------------------------------"));
}
}
}, 1L);
}

View File

@ -4,9 +4,7 @@ import ca.tweetzy.auctionhouse.AuctionHouse;
import ca.tweetzy.auctionhouse.api.currency.AbstractCurrency;
import ca.tweetzy.auctionhouse.api.currency.IconableCurrency;
import ca.tweetzy.auctionhouse.guis.AuctionPagedGUI;
import ca.tweetzy.auctionhouse.impl.currency.FundsCurrency;
import ca.tweetzy.auctionhouse.impl.currency.ItemCurrency;
import ca.tweetzy.auctionhouse.impl.currency.UltraEconomyCurrency;
import ca.tweetzy.auctionhouse.settings.Settings;
import ca.tweetzy.core.gui.Gui;
import ca.tweetzy.core.gui.events.GuiClickEvent;
@ -76,15 +74,7 @@ public final class GUICurrencyPicker extends AuctionPagedGUI<AbstractCurrency> {
quickItem = QuickItem.of(iconableCurrency.getIcon());
}
if (currency instanceof FundsCurrency) {
FundsCurrency fundsCurrency = (FundsCurrency) currency;
quickItem.name(fundsCurrency.getDisplayName());
} else if (currency instanceof UltraEconomyCurrency) {
UltraEconomyCurrency ultraEconomyCurrency = (UltraEconomyCurrency) currency;
quickItem.name(ultraEconomyCurrency.getDisplayName());
} else {
quickItem.name(currency.getCurrencyName().equalsIgnoreCase("vault") ? "&a" + Settings.CURRENCY_VAULT_SYMBOL.getString() : "&e" + currency.getCurrencyName());
}
quickItem.name(currency.getCurrencyName().equalsIgnoreCase("vault") ? "&a" + Settings.CURRENCY_VAULT_SYMBOL.getString() : "&e" + currency.getDisplayName());
quickItem.lore(Replacer.replaceVariables(Settings.GUI_CURRENCY_PICKER_ITEMS_CURRENCY_LORE.getStringList(), "currency_owning_plugin", currency.getOwningPlugin()));

View File

@ -53,14 +53,21 @@ public final class AuctionAPI implements AuctionHouseAPI {
.build()
);
if (hideSymbol)
if (currencyFormatter instanceof DecimalFormat) {
DecimalFormat decimalFormat = (DecimalFormat) currencyFormatter;
DecimalFormatSymbols symbols = decimalFormat.getDecimalFormatSymbols();
if (currencyFormatter instanceof DecimalFormat) {
DecimalFormat decimalFormat = (DecimalFormat) currencyFormatter;
DecimalFormatSymbols symbols = decimalFormat.getDecimalFormatSymbols();
if (hideSymbol) {
symbols.setCurrencySymbol(""); // Set the currency symbol to an empty string
decimalFormat.setDecimalFormatSymbols(symbols);
} else {
if (Settings.CURRENCY_VAULT_SYMBOL_OVERRIDES.getBoolean())
symbols.setCurrencySymbol(Settings.CURRENCY_VAULT_SYMBOL.getString());
}
decimalFormat.setDecimalFormatSymbols(symbols);
}
currencyFormatter.setGroupingUsed(Settings.CURRENCY_USE_GROUPING.getBoolean());
String formatted = currencyFormatter.format(number);

View File

@ -41,10 +41,12 @@ public class Settings {
static final Config config = AuctionHouse.getInstance().getCoreConfig();
public static final ConfigSetting LANG = new ConfigSetting(config, "lang", "en_US", "Default language file");
public static final ConfigSetting HIDE_THANKYOU = new ConfigSetting(config, "hide thank you", false, "Hides the purchase thank you message in the console.");
public static final ConfigSetting CURRENCY_ALLOW_PICK = new ConfigSetting(config, "economy.currency.allow pick", true, "If true, players will be able to select which currency they want to use.");
public static final ConfigSetting CURRENCY_DEFAULT_SELECTED = new ConfigSetting(config, "economy.currency.default selection", "Vault/Vault", "The default currency selection, PluginName/CurrencyName -> Ex. Vault/Vault or UltraEconomy/Gems etc");
public static final ConfigSetting CURRENCY_VAULT_SYMBOL = new ConfigSetting(config, "economy.currency.vault symbol", "$", "When using default/vault currency, what symbol should be used.");
public static final ConfigSetting CURRENCY_VAULT_SYMBOL_OVERRIDES = new ConfigSetting(config, "economy.currency.vault symbol overrides", false, "If true, the vault symbol will override the symbol provided by the country/language combination");
public static final ConfigSetting CURRENCY_BLACKLISTED = new ConfigSetting(config, "economy.currency.black listed", Collections.singletonList("UltraEconomy:Test"), "A list of owning plugins & the currency to be blacklisted. Ex. UltraEconomy:Test");
public static final ConfigSetting CURRENCY_FORMAT_LANGUAGE = new ConfigSetting(config, "economy.currency.format.language", "en", "An ISO 639 alpha-2 or alpha-3 language code.");
public static final ConfigSetting CURRENCY_FORMAT_COUNTRY = new ConfigSetting(config, "economy.currency.format.country", "US", "An ISO 3166 alpha-2 country code or a UN M.49 numeric-3 area code.");