From 51ead6884bf0174d996c61ed42848f8145cde6d8 Mon Sep 17 00:00:00 2001 From: Indyuce Date: Sun, 1 Sep 2019 18:59:05 +0200 Subject: [PATCH] fix stat decimal format --- .../java/net/Indyuce/mmocore/api/player/stats/StatType.java | 2 +- src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/Indyuce/mmocore/api/player/stats/StatType.java b/src/main/java/net/Indyuce/mmocore/api/player/stats/StatType.java index 22808bee..fc9d7ce2 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/stats/StatType.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/stats/StatType.java @@ -121,7 +121,7 @@ public enum StatType { FileConfiguration config = new ConfigFile("stats").getConfig(); for (StatType stat : values()) { stat.defaultInfo = config.contains("default." + stat.name()) ? new LinearValue(config.getConfigurationSection("default." + stat.name())) : new LinearValue(0, 0); - stat.format = new DecimalFormat(config.contains("decimal-format." + stat.name()) ? config.getString("decimal-format." + stat.name()) : "0.#"); + stat.format = MMOCore.plugin.configManager.newFormat(config.contains("decimal-format." + stat.name()) ? config.getString("decimal-format." + stat.name()) : "0.#"); } } } diff --git a/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java b/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java index 56264410..536390ee 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java +++ b/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java @@ -115,6 +115,10 @@ public class ConfigManager { } } + public DecimalFormat newFormat(String pattern) { + return new DecimalFormat(pattern, formatSymbols); + } + private char getFirstChar(String str, char defaultChar) { return str == null || str.isEmpty() ? defaultChar : str.charAt(0); }