Added resource bar color options

This commit is contained in:
ASangarin 2019-09-03 01:02:48 +01:00
parent 33781c97cc
commit 6728f689ba
2 changed files with 28 additions and 0 deletions

View File

@ -29,6 +29,7 @@ public class ConfigManager {
public boolean overrideVanillaExp, hotbarSwap;
public double expPartyBuff, regenPartyBuff;
public String partyChatPrefix;
public ChatColor manaFull, manaHalf, manaEmpty, staminaFull, staminaHalf, staminaEmpty;
private final DecimalFormatSymbols formatSymbols = new DecimalFormatSymbols();
public final DecimalFormat decimal = new DecimalFormat("0.#", formatSymbols), decimals = new DecimalFormat("0.##", formatSymbols);
@ -99,6 +100,13 @@ public class ConfigManager {
partyChatPrefix = MMOCore.plugin.getConfig().getString("party.chat-prefix");
formatSymbols.setDecimalSeparator(getFirstChar(MMOCore.plugin.getConfig().getString("number-format.decimal-separator"), ','));
manaFull = getColorOrDefault("mana-whole", ChatColor.BLUE);
manaHalf = getColorOrDefault("mana-half", ChatColor.AQUA);
manaEmpty = getColorOrDefault("mana-empty", ChatColor.WHITE);
staminaFull = getColorOrDefault("stamina-whole", ChatColor.BLUE);
staminaHalf = getColorOrDefault("stamina-half", ChatColor.AQUA);
staminaEmpty = getColorOrDefault("stamina-empty", ChatColor.WHITE);
neededExp.clear();
int line = 0;
try {
@ -115,6 +123,16 @@ public class ConfigManager {
}
}
private ChatColor getColorOrDefault(String configKey, ChatColor defaultColor) {
ChatColor newColor = ChatColor.valueOf(MMOCore.plugin.getConfig().getString("resource-bar-colors." + configKey).toUpperCase());
if(newColor != null)
return newColor;
MMOCore.log(Level.WARNING, "Resource Bar color config '" + configKey + "' is invalid... Using default color!");
return defaultColor;
}
public DecimalFormat newFormat(String pattern) {
return new DecimalFormat(pattern, formatSymbols);
}

View File

@ -78,3 +78,13 @@ hotbar-swap: true
# Use this option if you're having issue with Anvil GUIs.
# This replaces anvil inputs by chat inputs.
use-chat-input: true
# Change this to the name of the color you want for
# the different resource bar placeholders
resource-bar-colors:
mana-whole: 'BLUE'
mana-half: 'AQUA'
mana-empty: 'WHITE'
stamina-whole: 'LIME'
stamina-half: 'GREEN'
stamina-empty: 'WHITE'