diff --git a/Essentials/src/com/earth2me/essentials/Settings.java b/Essentials/src/com/earth2me/essentials/Settings.java
index 276e785ef..8d1322ea5 100644
--- a/Essentials/src/com/earth2me/essentials/Settings.java
+++ b/Essentials/src/com/earth2me/essentials/Settings.java
@@ -17,8 +17,6 @@ import org.bukkit.event.EventPriority;
import org.bukkit.inventory.ItemStack;
import java.io.File;
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat;
@@ -1352,24 +1350,8 @@ public class Settings implements net.ess3.api.ISettings {
DecimalFormat currencyFormat = new DecimalFormat(currencyFormatString, decimalFormatSymbols);
currencyFormat.setRoundingMode(RoundingMode.FLOOR);
- // Updates NumberUtil#PRETTY_FORMAT field so that all of Essentials
- // can follow a single format.
- try {
- Field field = NumberUtil.class.getDeclaredField("PRETTY_FORMAT");
- field.setAccessible(true);
- Field modifiersField = Field.class.getDeclaredField("modifiers");
- modifiersField.setAccessible(true);
- modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
- field.set(null, currencyFormat);
- modifiersField.setAccessible(false);
- field.setAccessible(false);
- } catch (NoSuchFieldException | IllegalAccessException e) {
- ess.getLogger().severe("Failed to apply custom currency format: " + e.getMessage());
- if (isDebug()) {
- e.printStackTrace();
- }
- }
-
+ // Updates NumberUtil#PRETTY_FORMAT field so that all of Essentials can follow a single format.
+ NumberUtil.internalSetPrettyFormat(currencyFormat);
return currencyFormat;
}
diff --git a/Essentials/src/com/earth2me/essentials/utils/NumberUtil.java b/Essentials/src/com/earth2me/essentials/utils/NumberUtil.java
index c4459f34c..f554ed6b3 100644
--- a/Essentials/src/com/earth2me/essentials/utils/NumberUtil.java
+++ b/Essentials/src/com/earth2me/essentials/utils/NumberUtil.java
@@ -11,14 +11,14 @@ import java.util.Locale;
import static com.earth2me.essentials.I18n.tl;
-
public class NumberUtil {
- static DecimalFormat twoDPlaces = new DecimalFormat("#,###.##");
- static DecimalFormat currencyFormat = new DecimalFormat("#0.00", DecimalFormatSymbols.getInstance(Locale.US));
+
+ private static DecimalFormat twoDPlaces = new DecimalFormat("#,###.##");
+ private static DecimalFormat currencyFormat = new DecimalFormat("#0.00", DecimalFormatSymbols.getInstance(Locale.US));
// This field is likely to be modified in com.earth2me.essentials.Settings when loading currency format.
// This ensures that we can supply a constant formatting.
- static final NumberFormat PRETTY_FORMAT = NumberFormat.getInstance(Locale.US);
+ private static NumberFormat PRETTY_FORMAT = NumberFormat.getInstance(Locale.US);
static {
twoDPlaces.setRoundingMode(RoundingMode.HALF_UP);
@@ -30,6 +30,11 @@ public class NumberUtil {
PRETTY_FORMAT.setMaximumFractionDigits(2);
}
+ // this method should only be called by Essentials
+ public static void internalSetPrettyFormat(NumberFormat prettyFormat) {
+ PRETTY_FORMAT = prettyFormat;
+ }
+
public static String shortCurrency(final BigDecimal value, final IEssentials ess) {
return ess.getSettings().getCurrencySymbol() + formatAsCurrency(value);
}
diff --git a/pom.xml b/pom.xml
index f6b67fb0b..c50ff8c03 100644
--- a/pom.xml
+++ b/pom.xml
@@ -84,29 +84,6 @@
1.8
-
- org.apache.maven.plugins
- maven-antrun-plugin
- 1.7
-
-
- validate
-
- run
-
-
-
-
-
- com.sun
- tools
- 1.5.0
- system
- ${java.home}/../lib/tools.jar
-
-
- false
-
org.apache.maven.plugins
maven-dependency-plugin