Enforce English locale for decimal formatting in config-file.

This commit is contained in:
garbagemule 2014-03-01 13:58:24 +01:00
parent 8a17c72b4b
commit 3e025ef8be
2 changed files with 10 additions and 8 deletions

View File

@ -1,7 +1,7 @@
name: MobArena name: MobArena
author: garbagemule author: garbagemule
main: com.garbagemule.MobArena.MobArena main: com.garbagemule.MobArena.MobArena
version: 0.96.2.13 version: 0.96.2.14
softdepend: [Multiverse-Core,Towny,Heroes,MagicSpells,Vault] softdepend: [Multiverse-Core,Towny,Heroes,MagicSpells,Vault]
commands: commands:
ma: ma:

View File

@ -9,8 +9,9 @@ import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import java.io.File; import java.io.File;
import java.io.InputStream;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.Locale;
import java.util.Set; import java.util.Set;
public class ConfigUtils public class ConfigUtils
@ -111,12 +112,8 @@ public class ConfigUtils
String world = location.getWorld().getName(); String world = location.getWorld().getName();
StringBuilder buffy = new StringBuilder(); String value = x + "," + y + "," + z + "," + yaw + "," + pit + "," + world;
buffy.append(x).append(",").append(y).append(",").append(z); config.set(path, value);
buffy.append(",").append(yaw).append(",").append(pit);
buffy.append(",").append(world);
config.set(path, buffy.toString());
} }
private static String twoPlaces(double value, boolean force) { private static String twoPlaces(double value, boolean force) {
@ -126,6 +123,11 @@ public class ConfigUtils
private static String twoPlaces(double value) { private static String twoPlaces(double value) {
return twoPlaces(value, false); return twoPlaces(value, false);
} }
private static final DecimalFormat DF_NORMAL = new DecimalFormat("0.##"); private static final DecimalFormat DF_NORMAL = new DecimalFormat("0.##");
private static final DecimalFormat DF_FORCE = new DecimalFormat("0.0#"); private static final DecimalFormat DF_FORCE = new DecimalFormat("0.0#");
static {
DF_FORCE.setDecimalFormatSymbols(DecimalFormatSymbols.getInstance(Locale.ENGLISH));
DF_NORMAL.setDecimalFormatSymbols(DecimalFormatSymbols.getInstance(Locale.ENGLISH));
}
} }