Fix all issues related to the lobby region.

This commit is contained in:
garbagemule
2013-08-19 04:56:38 +02:00
parent d3187fd2de
commit 957545dfe1
@@ -230,31 +230,31 @@ public class ArenaRegion
// Region expand // Region expand
public void expandUp(int amount) { public void expandUp(int amount) {
Location l = new Location(p2.getWorld(), p2.getX(), Math.min(p2.getWorld().getMaxHeight(), p2.getY() + amount), p2.getZ()); int x = p2.getBlockX();
setLocation(coords, "p2", l); int y = Math.min(p2.getWorld().getMaxHeight(), p2.getBlockY() + amount);
save(); int z = p2.getBlockZ();
reloadRegion(); setSaveReload(coords, "p2", p2.getWorld(), x ,y ,z);
} }
public void expandDown(int amount) { public void expandDown(int amount) {
Location l = new Location(p1.getWorld(), p1.getX(), Math.max(0D, p1.getY() - amount), p1.getZ()); int x = p1.getBlockX();
setLocation(coords, "p1", l); int y = Math.max(0, p1.getBlockY() - amount);
save(); int z = p1.getBlockZ();
reloadRegion(); setSaveReload(coords, "p1", p1.getWorld(), x ,y ,z);
} }
public void expandP1(int x, int z) { public void expandP1(int dx, int dz) {
Location l = new Location(p1.getWorld(), p1.getX() - x, p1.getY(), p1.getZ() - z); int x = p1.getBlockX() - dx;
setLocation(coords, "p1", l); int y = p1.getBlockY();
save(); int z = p1.getBlockZ() - dz;
reloadRegion(); setSaveReload(coords, "p1", p1.getWorld(), x ,y ,z);
} }
public void expandP2(int x, int z) { public void expandP2(int dx, int dz) {
Location l = new Location(p2.getWorld(), p2.getX() + x, p2.getY(), p2.getZ() + z); int x = p2.getBlockX() + dx;
setLocation(coords, "p2", l); int y = p2.getBlockY();
save(); int z = p2.getBlockZ() + dz;
reloadRegion(); setSaveReload(coords, "p2", p2.getWorld(), x ,y ,z);
} }
public void expandOut(int amount) { public void expandOut(int amount) {
@@ -264,25 +264,31 @@ public class ArenaRegion
// Lobby expand // Lobby expand
public void expandLobbyUp(int amount) { public void expandLobbyUp(int amount) {
l2.setY(Math.min(arena.getWorld().getMaxHeight(), l2.getY() + amount)); int x = l2.getBlockX();
set(RegionPoint.L2, l2); int y = Math.min(l2.getWorld().getMaxHeight(), l2.getBlockY() + amount);
int z = l2.getBlockZ();
setSaveReload(coords, "l2", l2.getWorld(), x ,y ,z);
} }
public void expandLobbyDown(int amount) { public void expandLobbyDown(int amount) {
l1.setY(Math.max(0D, l1.getY() + amount)); int x = l1.getBlockX();
set(RegionPoint.L1, l1); int y = Math.max(0, l1.getBlockY() - amount);
int z = l1.getBlockZ();
setSaveReload(coords, "l1", l1.getWorld(), x ,y ,z);
} }
public void expandL1(int x, int z) { public void expandL1(int dx, int dz) {
l1.setX(l1.getX() - x); int x = l1.getBlockX() - dx;
l1.setZ(l1.getZ() - z); int y = l1.getBlockY();
set(RegionPoint.L1, l1); int z = l1.getBlockZ() - dz;
setSaveReload(coords, "l1", l1.getWorld(), x ,y ,z);
} }
public void expandL2(int x, int z) { public void expandL2(int dx, int dz) {
l2.setX(l2.getX() + x); int x = l2.getBlockX() + dx;
l2.setZ(l2.getZ() + z); int y = l2.getBlockY();
set(RegionPoint.L2, l2); int z = l2.getBlockZ() + dz;
setSaveReload(coords, "l2", l2.getWorld(), x ,y ,z);
} }
public void expandLobbyOut(int amount) { public void expandLobbyOut(int amount) {
@@ -290,6 +296,13 @@ public class ArenaRegion
expandL2(amount, amount); expandL2(amount, amount);
} }
private void setSaveReload(ConfigurationSection section, String key, World w, double x, double y, double z) {
Location loc = new Location(w, x, y, z);
setLocation(section, key, loc);
save();
reloadRegion();
}
public void fixRegion() { public void fixRegion() {
fix("p1", "p2"); fix("p1", "p2");
} }