mirror of
https://github.com/taoneill/war.git
synced 2024-11-27 12:46:11 +01:00
Closes gh-49. Nether lobbies dont look like chunk errors anymore. Not perfect, but better. The outlines are still weird.
This commit is contained in:
parent
4b9c0d0a1c
commit
e1fa801664
@ -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);
|
||||
|
@ -48,7 +48,7 @@ public class Warzone {
|
||||
private HashMap<String, InventoryStash> inventories = new HashMap<String, InventoryStash>();
|
||||
private HashMap<String, Team> flagThieves = new HashMap<String, Team>();
|
||||
private World world;
|
||||
private final int minSafeDistanceFromWall = 5;
|
||||
private final int minSafeDistanceFromWall = 6;
|
||||
private List<ZoneWallGuard> zoneWallGuards = new ArrayList<ZoneWallGuard>();
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user