Multiworld exit-warp and location formatting.

This commit is contained in:
garbagemule 2013-08-14 22:36:12 +02:00
parent b3cb258d0b
commit f98fe0b78f
3 changed files with 13 additions and 10 deletions

View File

@ -40,7 +40,7 @@ public class SetWarpCommand implements Command
if (arg1.equals("spec")) arg1 = "spectator";
if (!WARPS.contains(arg1)) {
Messenger.tellPlayer(sender, "Usage: /ma setwarp arena|lobby|spectator");
Messenger.tellPlayer(sender, "Usage: /ma setwarp arena|lobby|spectator|exit");
return true;
}
@ -48,7 +48,7 @@ public class SetWarpCommand implements Command
Arena arena = am.getSelectedArena();
World aw = arena.getWorld();
World pw = p.getLocation().getWorld();
boolean changeWorld = !aw.getName().equals(pw.getName());
boolean changeWorld = !arg1.equals("exit") && !aw.getName().equals(pw.getName());
// Change worlds to make sure the region check doesn't fail
if (changeWorld) arena.setWorld(pw);

View File

@ -77,9 +77,7 @@ public class ArenaRegion
arenaWarp = coords.getLocation("arena", world);
lobbyWarp = coords.getLocation("lobby", world);
specWarp = coords.getLocation("spectator", world);
exitWarp = coords.getLocation("exit", world);
leaderboard = coords.getLocation("leaderboard", world);
exitWarp = coords.getLocation("exit", null);
}
public void reloadLeaderboards() {

View File

@ -453,8 +453,8 @@ public class Config
result.append(twoPlaces(loc.getX())).append(",");
result.append(twoPlaces(loc.getY())).append(",");
result.append(twoPlaces(loc.getZ())).append(",");
result.append(twoPlaces(loc.getYaw())).append(",");
result.append(twoPlaces(loc.getPitch())).append(",");
result.append(twoPlaces(loc.getYaw(), true)).append(",");
result.append(twoPlaces(loc.getPitch(), true)).append(",");
result.append(loc.getWorld().getName());
return result.toString();
@ -480,8 +480,13 @@ public class Config
}
}
private static String twoPlaces(double value) {
return df.format(value);
private static String twoPlaces(double value, boolean force) {
return force ? DF_FORCE.format(value) : DF_NORMAL.format(value);
}
private static final DecimalFormat df = new DecimalFormat("0.##");
private static String twoPlaces(double value) {
return twoPlaces(value, false);
}
private static final DecimalFormat DF_NORMAL = new DecimalFormat("0.##");
private static final DecimalFormat DF_FORCE = new DecimalFormat("0.0#");
}