mirror of
https://github.com/garbagemule/MobArena.git
synced 2025-02-01 21:21:19 +01:00
Multiworld exit-warp and location formatting.
This commit is contained in:
parent
b3cb258d0b
commit
f98fe0b78f
@ -40,7 +40,7 @@ public class SetWarpCommand implements Command
|
|||||||
if (arg1.equals("spec")) arg1 = "spectator";
|
if (arg1.equals("spec")) arg1 = "spectator";
|
||||||
|
|
||||||
if (!WARPS.contains(arg1)) {
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ public class SetWarpCommand implements Command
|
|||||||
Arena arena = am.getSelectedArena();
|
Arena arena = am.getSelectedArena();
|
||||||
World aw = arena.getWorld();
|
World aw = arena.getWorld();
|
||||||
World pw = p.getLocation().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
|
// Change worlds to make sure the region check doesn't fail
|
||||||
if (changeWorld) arena.setWorld(pw);
|
if (changeWorld) arena.setWorld(pw);
|
||||||
|
@ -77,9 +77,7 @@ public class ArenaRegion
|
|||||||
arenaWarp = coords.getLocation("arena", world);
|
arenaWarp = coords.getLocation("arena", world);
|
||||||
lobbyWarp = coords.getLocation("lobby", world);
|
lobbyWarp = coords.getLocation("lobby", world);
|
||||||
specWarp = coords.getLocation("spectator", world);
|
specWarp = coords.getLocation("spectator", world);
|
||||||
exitWarp = coords.getLocation("exit", world);
|
exitWarp = coords.getLocation("exit", null);
|
||||||
|
|
||||||
leaderboard = coords.getLocation("leaderboard", world);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reloadLeaderboards() {
|
public void reloadLeaderboards() {
|
||||||
|
@ -453,8 +453,8 @@ public class Config
|
|||||||
result.append(twoPlaces(loc.getX())).append(",");
|
result.append(twoPlaces(loc.getX())).append(",");
|
||||||
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(), true)).append(",");
|
||||||
result.append(twoPlaces(loc.getPitch())).append(",");
|
result.append(twoPlaces(loc.getPitch(), true)).append(",");
|
||||||
result.append(loc.getWorld().getName());
|
result.append(loc.getWorld().getName());
|
||||||
|
|
||||||
return result.toString();
|
return result.toString();
|
||||||
@ -480,8 +480,13 @@ public class Config
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String twoPlaces(double value) {
|
private static String twoPlaces(double value, boolean force) {
|
||||||
return df.format(value);
|
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#");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user