mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2025-02-14 17:31:26 +01:00
Merge pull request #553 from Krakenied/strip-price-colors
Add option to strip price colors
This commit is contained in:
commit
6602be68e3
@ -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")
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user