mirror of
https://github.com/garbagemule/MobArena.git
synced 2024-11-30 06:33:55 +01:00
Add world name to coords.
This commit is contained in:
parent
a3cef8339e
commit
80f091acaa
@ -8,6 +8,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.apache.commons.lang.Validate;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
@ -273,9 +274,8 @@ public class Config
|
|||||||
if (string == null)
|
if (string == null)
|
||||||
return def;
|
return def;
|
||||||
|
|
||||||
//TODO: Figure out if this would work
|
if (world == null && string.split(",").length == 6)
|
||||||
//if (string.split(",").length == 6)
|
return parseLocation(string);
|
||||||
// return parseLocation(string);
|
|
||||||
|
|
||||||
return parseLocation(world, string);
|
return parseLocation(world, string);
|
||||||
}
|
}
|
||||||
@ -404,8 +404,12 @@ public class Config
|
|||||||
Float pitch = parseFloat(parts[4]);
|
Float pitch = parseFloat(parts[4]);
|
||||||
World world = Bukkit.getServer().getWorld(parts[5]);
|
World world = Bukkit.getServer().getWorld(parts[5]);
|
||||||
|
|
||||||
if (x == null || y == null || z == null || yaw == null || pitch == null)
|
Validate.notNull(x, "x value is null");
|
||||||
throw new NullPointerException("Some of the parsed values are null!");
|
Validate.notNull(y, "y value is null");
|
||||||
|
Validate.notNull(z, "z value is null");
|
||||||
|
Validate.notNull(yaw, "yaw value is null");
|
||||||
|
Validate.notNull(pitch, "pitch value is null");
|
||||||
|
Validate.notNull(world, "pitch value is null");
|
||||||
|
|
||||||
return new Location(world, x, y, z, yaw, pitch);
|
return new Location(world, x, y, z, yaw, pitch);
|
||||||
}
|
}
|
||||||
@ -429,8 +433,11 @@ public class Config
|
|||||||
Float yaw = parseFloat(parts[3]);
|
Float yaw = parseFloat(parts[3]);
|
||||||
Float pitch = parseFloat(parts[4]);
|
Float pitch = parseFloat(parts[4]);
|
||||||
|
|
||||||
if (x == null || y == null || z == null || yaw == null || pitch == null)
|
Validate.notNull(x, "x value is null");
|
||||||
throw new NullPointerException("Some of the parsed values are null!");
|
Validate.notNull(y, "y value is null");
|
||||||
|
Validate.notNull(z, "z value is null");
|
||||||
|
Validate.notNull(yaw, "yaw value is null");
|
||||||
|
Validate.notNull(pitch, "pitch value is null");
|
||||||
|
|
||||||
return new Location(world, x, y, z, yaw, pitch);
|
return new Location(world, x, y, z, yaw, pitch);
|
||||||
}
|
}
|
||||||
@ -447,7 +454,8 @@ public class Config
|
|||||||
result.append(twoPlaces(loc.getY())).append(",");
|
result.append(twoPlaces(loc.getY())).append(",");
|
||||||
result.append(twoPlaces(loc.getZ())).append(",");
|
result.append(twoPlaces(loc.getZ())).append(",");
|
||||||
result.append(twoPlaces(loc.getYaw())).append(",");
|
result.append(twoPlaces(loc.getYaw())).append(",");
|
||||||
result.append(twoPlaces(loc.getPitch()));
|
result.append(twoPlaces(loc.getPitch())).append(",");
|
||||||
|
result.append(loc.getWorld().getName());
|
||||||
|
|
||||||
return result.toString();
|
return result.toString();
|
||||||
}
|
}
|
||||||
@ -475,5 +483,5 @@ public class Config
|
|||||||
private static String twoPlaces(double value) {
|
private static String twoPlaces(double value) {
|
||||||
return df.format(value);
|
return df.format(value);
|
||||||
}
|
}
|
||||||
private static final DecimalFormat df = new DecimalFormat("#.00");
|
private static final DecimalFormat df = new DecimalFormat("0.##");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user