mirror of
https://github.com/filoghost/HolographicDisplays.git
synced 2024-12-25 02:07:36 +01:00
Use Locale.ROOT for decimal format
This commit is contained in:
parent
8f81052370
commit
ca3c1f8c9e
@ -16,6 +16,7 @@ package com.gmail.filoghost.holographicdisplays.disk;
|
|||||||
|
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.text.DecimalFormatSymbols;
|
import java.text.DecimalFormatSymbols;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -26,14 +27,7 @@ import com.gmail.filoghost.holographicdisplays.exception.WorldNotFoundException;
|
|||||||
|
|
||||||
public class LocationSerializer {
|
public class LocationSerializer {
|
||||||
|
|
||||||
private static DecimalFormat decimalFormat;
|
private static DecimalFormat numberFormat = new DecimalFormat("0.000", DecimalFormatSymbols.getInstance(Locale.ROOT));
|
||||||
static {
|
|
||||||
// More precision is not needed at all.
|
|
||||||
decimalFormat = new DecimalFormat("0.000");
|
|
||||||
DecimalFormatSymbols formatSymbols = decimalFormat.getDecimalFormatSymbols();
|
|
||||||
formatSymbols.setDecimalSeparator('.');
|
|
||||||
decimalFormat.setDecimalFormatSymbols(formatSymbols);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Location locationFromString(String input) throws WorldNotFoundException, InvalidFormatException {
|
public static Location locationFromString(String input) throws WorldNotFoundException, InvalidFormatException {
|
||||||
if (input == null) {
|
if (input == null) {
|
||||||
@ -64,6 +58,6 @@ public class LocationSerializer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String locationToString(Location loc) {
|
public static String locationToString(Location loc) {
|
||||||
return (loc.getWorld().getName() + ", " + decimalFormat.format(loc.getX()) + ", " + decimalFormat.format(loc.getY()) + ", " + decimalFormat.format(loc.getZ()));
|
return (loc.getWorld().getName() + ", " + numberFormat.format(loc.getX()) + ", " + numberFormat.format(loc.getY()) + ", " + numberFormat.format(loc.getZ()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user