Strip price colors

This commit is contained in:
Krakenied 2023-05-20 14:56:06 +02:00
parent 05ebe2d054
commit 2fb82a2529
No known key found for this signature in database
GPG Key ID: 40183D852ECBB635
3 changed files with 10 additions and 2 deletions

View File

@ -120,6 +120,9 @@ public class Properties {
@ConfigurationComment("Should the plugin try to use a language file that matches the client's locale setting?")
public static boolean USE_CLIENT_LOCALE = true;
@ConfigurationComment("Should the plugin strip the colors from formatted price?")
public static boolean STRIP_PRICE_COLORS = false;
@PrecededBySpace
@ConfigurationComment("What containers are allowed to hold a shop? (Only blocks with inventories work!)")
@Parser("MaterialSet")

View File

@ -1,5 +1,6 @@
package com.Acrobot.ChestShop.Listeners.Economy.Plugins;
import com.Acrobot.ChestShop.Configuration.Properties;
import com.Acrobot.ChestShop.Events.Economy.AccountCheckEvent;
import com.Acrobot.ChestShop.Events.Economy.CurrencyAddEvent;
import com.Acrobot.ChestShop.Events.Economy.CurrencyAmountEvent;
@ -12,6 +13,7 @@ import com.Acrobot.ChestShop.Listeners.Economy.EconomyAdapter;
import net.tnemc.core.Reserve;
import net.tnemc.core.economy.EconomyAPI;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.event.EventHandler;
import javax.annotation.Nullable;
@ -99,7 +101,8 @@ public class ReserveListener extends EconomyAdapter {
}
if (provided()) {
event.setFormattedAmount(economyAPI.format(event.getAmount()));
String formatted = economyAPI.format(event.getAmount());
event.setFormattedAmount(Properties.STRIP_PRICE_COLORS ? ChatColor.stripColor(formatted) : formatted);
event.setHandled(true);
}
}

View File

@ -5,11 +5,13 @@ import java.util.logging.Level;
import javax.annotation.Nullable;
import com.Acrobot.ChestShop.Configuration.Properties;
import com.Acrobot.ChestShop.Listeners.Economy.EconomyAdapter;
import net.milkbowl.vault.economy.Economy;
import net.milkbowl.vault.economy.EconomyResponse;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;
import org.bukkit.World;
import org.bukkit.event.EventHandler;
@ -172,7 +174,7 @@ public class VaultListener extends EconomyAdapter {
}
String formatted = provider.format(event.getAmount().doubleValue());
event.setFormattedAmount(formatted);
event.setFormattedAmount(Properties.STRIP_PRICE_COLORS ? ChatColor.stripColor(formatted) : formatted);
event.setHandled(true);
}