From e1fa801664d798e11fcffe52b53dce91fb8b9ed5 Mon Sep 17 00:00:00 2001 From: taoneill Date: Sun, 20 Mar 2011 18:56:51 -0400 Subject: [PATCH] Closes gh-49. Nether lobbies dont look like chunk errors anymore. Not perfect, but better. The outlines are still weird. --- .../main/java/bukkit/tommytony/war/War.java | 4 ++-- .../main/java/com/tommytony/war/Warzone.java | 10 +++++----- .../java/com/tommytony/war/ZoneLobby.java | 20 +++++++++++++------ 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/war/src/main/java/bukkit/tommytony/war/War.java b/war/src/main/java/bukkit/tommytony/war/War.java index ae1ca3e..ad2b54d 100644 --- a/war/src/main/java/bukkit/tommytony/war/War.java +++ b/war/src/main/java/bukkit/tommytony/war/War.java @@ -806,9 +806,9 @@ public class War extends JavaPlugin { } else if(warzone.getSoutheast() == null) { msg(player, msgString + "Still missing southeasternmost point."); } else if (warzone.tooBig()) { - badMsg(player, msgString + "Warzone " + warzone.getName() + " is too Big. Max north-south size: 500. Max east-west size: 500."); + badMsg(player, msgString + "Warzone " + warzone.getName() + " is too Big. Max north-south size: 750. Max east-west size: 750."); } else if (warzone.tooSmall()) { - badMsg(player, msgString + "Warzone " + warzone.getName() + " is too small. Min north-south size: 20. Min east-west size: 20."); + badMsg(player, msgString + "Warzone " + warzone.getName() + " is too small. Min north-south size: 10. Min east-west size: 10."); } else if(!fail && warzone.ready()) { if(!this.warzones.contains(warzone)) { this.addWarzone(warzone); diff --git a/war/src/main/java/com/tommytony/war/Warzone.java b/war/src/main/java/com/tommytony/war/Warzone.java index 967aa3a..38fa33e 100644 --- a/war/src/main/java/com/tommytony/war/Warzone.java +++ b/war/src/main/java/com/tommytony/war/Warzone.java @@ -48,7 +48,7 @@ public class Warzone { private HashMap inventories = new HashMap(); private HashMap flagThieves = new HashMap(); private World world; - private final int minSafeDistanceFromWall = 5; + private final int minSafeDistanceFromWall = 6; private List zoneWallGuards = new ArrayList(); private War war; private ZoneLobby lobby; @@ -86,14 +86,14 @@ public class Warzone { } public boolean tooSmall() { - if((getSoutheast().getBlockX() - getNorthwest().getBlockX() < 20) - || (getNorthwest().getBlockZ() - getSoutheast().getBlockZ() < 20)) return true; + if((getSoutheast().getBlockX() - getNorthwest().getBlockX() < 10) + || (getNorthwest().getBlockZ() - getSoutheast().getBlockZ() < 10)) return true; return false; } public boolean tooBig() { - if((getSoutheast().getBlockX() - getNorthwest().getBlockX() > 500) - || (getNorthwest().getBlockZ() - getSoutheast().getBlockZ() > 500)) return true; + if((getSoutheast().getBlockX() - getNorthwest().getBlockX() > 750) + || (getNorthwest().getBlockZ() - getSoutheast().getBlockZ() > 750)) return true; return false; } diff --git a/war/src/main/java/com/tommytony/war/ZoneLobby.java b/war/src/main/java/com/tommytony/war/ZoneLobby.java index 4e53fbc..0fc20f4 100644 --- a/war/src/main/java/com/tommytony/war/ZoneLobby.java +++ b/war/src/main/java/com/tommytony/war/ZoneLobby.java @@ -109,6 +109,8 @@ public class ZoneLobby { int wallLength = wallEnd - wallStart + 1; int wallCenterPos = wallStart + wallLength / 2; int highestNonAirBlockAtCenter = warzone.getWorld().getHighestBlockYAt(x+1, wallCenterPos); + if(highestNonAirBlockAtCenter < 3 || highestNonAirBlockAtCenter > 125 - lobbyHeight) + highestNonAirBlockAtCenter = warzone.getNorthwest().getBlockY(); lobbyMiddleWallBlock = new BlockInfo(warzone.getWorld().getBlockAt(x, highestNonAirBlockAtCenter, wallCenterPos)); corner1 = warzone.getWorld().getBlockAt(x, highestNonAirBlockAtCenter - 1, wallCenterPos + lobbyHalfSide); corner2 = warzone.getWorld().getBlockAt(x - lobbyDepth, @@ -120,6 +122,8 @@ public class ZoneLobby { int wallLength = wallEnd - wallStart + 1; int wallCenterPos = wallStart + wallLength / 2; int highestNonAirBlockAtCenter = warzone.getWorld().getHighestBlockYAt(wallCenterPos, z+1); + if(highestNonAirBlockAtCenter < 3 || highestNonAirBlockAtCenter > 125 - lobbyHeight) + highestNonAirBlockAtCenter = warzone.getSoutheast().getBlockY(); lobbyMiddleWallBlock = new BlockInfo(warzone.getWorld().getBlockAt(wallCenterPos, highestNonAirBlockAtCenter, z)); corner1 = warzone.getWorld().getBlockAt(wallCenterPos - lobbyHalfSide, highestNonAirBlockAtCenter - 1, z); corner2 = warzone.getWorld().getBlockAt(wallCenterPos + lobbyHalfSide, @@ -131,6 +135,8 @@ public class ZoneLobby { int wallLength = wallEnd - wallStart + 1; int wallCenterPos = wallStart + wallLength / 2; int highestNonAirBlockAtCenter = warzone.getWorld().getHighestBlockYAt(x-1, wallCenterPos); + if(highestNonAirBlockAtCenter < 3 || highestNonAirBlockAtCenter > 125 - lobbyHeight) + highestNonAirBlockAtCenter = warzone.getSoutheast().getBlockY(); lobbyMiddleWallBlock = new BlockInfo(warzone.getWorld().getBlockAt(x, highestNonAirBlockAtCenter, wallCenterPos)); corner1 = warzone.getWorld().getBlockAt(x, highestNonAirBlockAtCenter -1 , wallCenterPos - lobbyHalfSide); corner2 = warzone.getWorld().getBlockAt(x + lobbyDepth, @@ -142,6 +148,8 @@ public class ZoneLobby { int wallLength = wallEnd - wallStart + 1; int wallCenterPos = wallStart + wallLength / 2; int highestNonAirBlockAtCenter = warzone.getWorld().getHighestBlockYAt(wallCenterPos, z-1); + if(highestNonAirBlockAtCenter < 3 || highestNonAirBlockAtCenter > 125 - lobbyHeight) + highestNonAirBlockAtCenter = warzone.getNorthwest().getBlockY(); lobbyMiddleWallBlock = new BlockInfo(warzone.getWorld().getBlockAt(wallCenterPos, highestNonAirBlockAtCenter, z)); corner1 = warzone.getWorld().getBlockAt(wallCenterPos + lobbyHalfSide, highestNonAirBlockAtCenter - 1, z); corner2 = warzone.getWorld().getBlockAt(wallCenterPos - lobbyHalfSide, highestNonAirBlockAtCenter + 1 + lobbyHeight, z + lobbyDepth); @@ -244,12 +252,12 @@ public class ZoneLobby { } else { war.logWarn("Failed to initalize zone lobby for zone " + warzone.getName()); } - World world = warzone.getWorld(); - if(world instanceof CraftWorld && lobbyMiddleWallBlock != null) { - ((CraftWorld)world).refreshChunk(lobbyMiddleWallBlock.getX(), lobbyMiddleWallBlock.getZ()); - ((CraftWorld)world).refreshChunk(volume.getCornerOne().getX(), volume.getCornerOne().getZ()); - ((CraftWorld)world).refreshChunk(volume.getCornerTwo().getX(), volume.getCornerTwo().getZ()); - } +// World world = warzone.getWorld(); +// if(world instanceof CraftWorld && lobbyMiddleWallBlock != null) { +// ((CraftWorld)world).refreshChunk(lobbyMiddleWallBlock.getX(), lobbyMiddleWallBlock.getZ()); +// ((CraftWorld)world).refreshChunk(volume.getCornerOne().getX(), volume.getCornerOne().getZ()); +// ((CraftWorld)world).refreshChunk(volume.getCornerTwo().getX(), volume.getCornerTwo().getZ()); +// } } private void setGatePositions(Block lobbyMiddleWallBlock) {