mirror of
https://github.com/EarthMC/QuickShop-Reremake.git
synced 2026-11-15 21:26:04 -05:00
Fail-safe decimal-format
This commit is contained in:
1 parent
1e4858f4b1
commit
73af89cbd2
1 file changed
+10
-2
@@ -81,8 +81,7 @@ public class MsgUtil {
|
||||
|
||||
private static TextComponent errorComponent;
|
||||
|
||||
private static final DecimalFormat decimalFormat =
|
||||
new DecimalFormat(Objects.requireNonNull(plugin.getConfig().getString("decimal-format")));
|
||||
private static final DecimalFormat decimalFormat = processFormat();
|
||||
public static GameLanguage gameLanguage;
|
||||
@Getter
|
||||
private static YamlConfiguration enchi18n;
|
||||
@@ -95,6 +94,15 @@ public class MsgUtil {
|
||||
private static IFile builtInLang;
|
||||
private static BukkitAudiences audiences = plugin.getBukkitAudiences();
|
||||
|
||||
private static DecimalFormat processFormat() {
|
||||
try {
|
||||
return new DecimalFormat(Objects.requireNonNull(QuickShop.getInstance().getConfig().getString("decimal-format")));
|
||||
} catch (Exception e) {
|
||||
QuickShop.getInstance().getLogger().log(Level.WARNING, "Error when processing decimal format, using system default: " + e.getMessage());
|
||||
return new DecimalFormat();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes any messages that are older than a week in the database, to save on space.
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user