mirror of
https://github.com/taoneill/war.git
synced 2025-03-11 14:09:57 +01:00
Closes gh-21. Closes gh-114. Wandless cuboid zones are in. Lobbies now reset properly (their save was getting overwritten). Lobbies now always appear at mid-height of the zone. Can't resize warzones if structures end up outside. Zonemaker can now place blocks in important places (walls, monuments, etc) but these blocks will still get reset. No more warzone-ready message when no warzones to load. No more zone outlines, yay.
This commit is contained in:
parent
e81ba0faae
commit
12109175c0
@ -447,7 +447,7 @@ public class War extends JavaPlugin {
|
|||||||
if(warzone.getLobby() != null) {
|
if(warzone.getLobby() != null) {
|
||||||
warzone.getLobby().getVolume().resetBlocks();
|
warzone.getLobby().getVolume().resetBlocks();
|
||||||
warzone.getVolume().resetWallBlocks(warzone.getLobby().getWall());
|
warzone.getVolume().resetWallBlocks(warzone.getLobby().getWall());
|
||||||
warzone.addZoneOutline(warzone.getLobby().getWall());
|
//warzone.addZoneOutline(warzone.getLobby().getWall());
|
||||||
warzone.getLobby().initialize();
|
warzone.getLobby().initialize();
|
||||||
}
|
}
|
||||||
WarzoneMapper.save(this, warzone, false);
|
WarzoneMapper.save(this, warzone, false);
|
||||||
@ -514,7 +514,7 @@ public class War extends JavaPlugin {
|
|||||||
if(warzone.getLobby() != null) {
|
if(warzone.getLobby() != null) {
|
||||||
warzone.getLobby().getVolume().resetBlocks();
|
warzone.getLobby().getVolume().resetBlocks();
|
||||||
warzone.getVolume().resetWallBlocks(warzone.getLobby().getWall());
|
warzone.getVolume().resetWallBlocks(warzone.getLobby().getWall());
|
||||||
warzone.addZoneOutline(warzone.getLobby().getWall());
|
//warzone.addZoneOutline(warzone.getLobby().getWall());
|
||||||
warzone.getLobby().initialize();
|
warzone.getLobby().initialize();
|
||||||
}
|
}
|
||||||
newTeam.setTeamSpawn(player.getLocation());
|
newTeam.setTeamSpawn(player.getLocation());
|
||||||
@ -707,7 +707,7 @@ public class War extends JavaPlugin {
|
|||||||
if(lobby != null) {
|
if(lobby != null) {
|
||||||
// reset existing lobby
|
// reset existing lobby
|
||||||
lobby.getVolume().resetBlocks();
|
lobby.getVolume().resetBlocks();
|
||||||
lobby.changeWall(wall);
|
lobby.setWall(wall);
|
||||||
lobby.initialize();
|
lobby.initialize();
|
||||||
this.msg(player, "Warzone lobby moved to " + wallStr + " side of zone.");
|
this.msg(player, "Warzone lobby moved to " + wallStr + " side of zone.");
|
||||||
} else {
|
} else {
|
||||||
|
@ -54,8 +54,8 @@ public class WarBlockListener extends BlockListener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
boolean isZoneMaker = war.isZoneMaker(player);
|
||||||
if(zone != null && zone.isImportantBlock(block)){
|
if(zone != null && zone.isImportantBlock(block) && (!isZoneMaker || (isZoneMaker && team != null))) {
|
||||||
war.badMsg(player, "Can't build here.");
|
war.badMsg(player, "Can't build here.");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
@ -97,7 +97,6 @@ public class WarBlockListener extends BlockListener {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isZoneMaker = war.isZoneMaker(player);
|
|
||||||
// unbreakableZoneBlocks
|
// unbreakableZoneBlocks
|
||||||
if(zone != null && zone.isUnbreakableZoneBlocks()
|
if(zone != null && zone.isUnbreakableZoneBlocks()
|
||||||
&& (!isZoneMaker
|
&& (!isZoneMaker
|
||||||
|
@ -75,7 +75,7 @@ public class Warzone {
|
|||||||
this.setDropLootOnDeath(war.isDefaultDropLootOnDeath());
|
this.setDropLootOnDeath(war.isDefaultDropLootOnDeath());
|
||||||
this.setUnbreakableZoneBlocks(war.isDefaultUnbreakableZoneBlocks());
|
this.setUnbreakableZoneBlocks(war.isDefaultUnbreakableZoneBlocks());
|
||||||
this.setNoCreatures(war.getDefaultNoCreatures());
|
this.setNoCreatures(war.getDefaultNoCreatures());
|
||||||
this.volume = new ZoneVolume(name, war, this.getWorld());
|
this.volume = new ZoneVolume(name, war, this.getWorld(), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean ready() {
|
public boolean ready() {
|
||||||
@ -181,12 +181,12 @@ public class Warzone {
|
|||||||
|
|
||||||
private void initZone() {
|
private void initZone() {
|
||||||
// add wall outlines
|
// add wall outlines
|
||||||
if(isDrawZoneOutline()) {
|
// if(isDrawZoneOutline()) {
|
||||||
addZoneOutline(BlockFace.NORTH);
|
// addZoneOutline(BlockFace.NORTH);
|
||||||
addZoneOutline(BlockFace.EAST);
|
// addZoneOutline(BlockFace.EAST);
|
||||||
addZoneOutline(BlockFace.SOUTH);
|
// addZoneOutline(BlockFace.SOUTH);
|
||||||
addZoneOutline(BlockFace.WEST);
|
// addZoneOutline(BlockFace.WEST);
|
||||||
}
|
// }
|
||||||
|
|
||||||
// reset monuments
|
// reset monuments
|
||||||
for(Monument monument : monuments) {
|
for(Monument monument : monuments) {
|
||||||
@ -194,7 +194,7 @@ public class Warzone {
|
|||||||
monument.addMonumentBlocks();
|
monument.addMonumentBlocks();
|
||||||
}
|
}
|
||||||
|
|
||||||
// reset lobby
|
// reset lobby (here be demons)
|
||||||
if(lobby != null) {
|
if(lobby != null) {
|
||||||
lobby.initialize();
|
lobby.initialize();
|
||||||
}
|
}
|
||||||
@ -202,75 +202,75 @@ public class Warzone {
|
|||||||
this.flagThieves.clear();
|
this.flagThieves.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addZoneOutline(BlockFace wall) {
|
// public void addZoneOutline(BlockFace wall) {
|
||||||
int c1maxY = world.getHighestBlockYAt(volume.getMinX(), volume.getMinZ());
|
// int c1maxY = world.getHighestBlockYAt(volume.getMinX(), volume.getMinZ());
|
||||||
int c2maxY = world.getHighestBlockYAt(volume.getMaxX(), volume.getMaxZ());
|
// int c2maxY = world.getHighestBlockYAt(volume.getMaxX(), volume.getMaxZ());
|
||||||
Block ne = world.getBlockAt(volume.getMinX(), c1maxY, volume.getMinZ());
|
// Block ne = world.getBlockAt(volume.getMinX(), c1maxY, volume.getMinZ());
|
||||||
Block nw = world.getBlockAt(volume.getMinX(), c2maxY, volume.getMaxZ());
|
// Block nw = world.getBlockAt(volume.getMinX(), c2maxY, volume.getMaxZ());
|
||||||
Block se = world.getBlockAt(volume.getMaxX(), c2maxY, volume.getMinZ());
|
// Block se = world.getBlockAt(volume.getMaxX(), c2maxY, volume.getMinZ());
|
||||||
Block lastBlock = null;
|
// Block lastBlock = null;
|
||||||
if(BlockFace.NORTH == wall) {
|
// if(BlockFace.NORTH == wall) {
|
||||||
for(int z = volume.getMinZ(); z < volume.getMaxZ(); z++) {
|
// for(int z = volume.getMinZ(); z < volume.getMaxZ(); z++) {
|
||||||
lastBlock = highestBlockToGlass(ne.getX(), z, lastBlock);
|
// lastBlock = highestBlockToGlass(ne.getX(), z, lastBlock);
|
||||||
}
|
// }
|
||||||
} else if (BlockFace.EAST == wall) {
|
// } else if (BlockFace.EAST == wall) {
|
||||||
for(int x = volume.getMinX(); x < volume.getMaxX(); x++) {
|
// for(int x = volume.getMinX(); x < volume.getMaxX(); x++) {
|
||||||
lastBlock = highestBlockToGlass(x, ne.getZ(), lastBlock);
|
// lastBlock = highestBlockToGlass(x, ne.getZ(), lastBlock);
|
||||||
}
|
// }
|
||||||
} else if (BlockFace.SOUTH == wall) {
|
// } else if (BlockFace.SOUTH == wall) {
|
||||||
for(int z = volume.getMinZ(); z < volume.getMaxZ(); z++) {
|
// for(int z = volume.getMinZ(); z < volume.getMaxZ(); z++) {
|
||||||
lastBlock = highestBlockToGlass(se.getX(), z, lastBlock);
|
// lastBlock = highestBlockToGlass(se.getX(), z, lastBlock);
|
||||||
}
|
// }
|
||||||
} else if (BlockFace.WEST == wall) {
|
// } else if (BlockFace.WEST == wall) {
|
||||||
for(int x = volume.getMinX(); x < volume.getMaxX(); x++) {
|
// for(int x = volume.getMinX(); x < volume.getMaxX(); x++) {
|
||||||
lastBlock = highestBlockToGlass(x, nw.getZ(), lastBlock);
|
// lastBlock = highestBlockToGlass(x, nw.getZ(), lastBlock);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
private Block highestBlockToGlass(int x, int z, Block lastBlock) {
|
// private Block highestBlockToGlass(int x, int z, Block lastBlock) {
|
||||||
int highest = world.getHighestBlockYAt(x, z);
|
// int highest = world.getHighestBlockYAt(x, z);
|
||||||
Block block = world.getBlockAt(x, highest -1 , z);
|
// Block block = world.getBlockAt(x, highest -1 , z);
|
||||||
|
//
|
||||||
if(block.getType() == Material.LEAVES) { // top of tree, lets find some dirt/ground
|
// if(block.getType() == Material.LEAVES) { // top of tree, lets find some dirt/ground
|
||||||
Block over = block.getFace(BlockFace.DOWN);
|
// Block over = block.getFace(BlockFace.DOWN);
|
||||||
Block under = over.getFace(BlockFace.DOWN);
|
// Block under = over.getFace(BlockFace.DOWN);
|
||||||
int treeHeight = 0;
|
// int treeHeight = 0;
|
||||||
while(!((over.getType() == Material.AIR && under.getType() != Material.AIR && under.getType() != Material.LEAVES)
|
// while(!((over.getType() == Material.AIR && under.getType() != Material.AIR && under.getType() != Material.LEAVES)
|
||||||
|| (over.getType() == Material.LEAVES && under.getType() != Material.LEAVES && under.getType() != Material.AIR)
|
// || (over.getType() == Material.LEAVES && under.getType() != Material.LEAVES && under.getType() != Material.AIR)
|
||||||
|| (over.getType() == Material.WOOD && under.getType() != Material.WOOD && under.getType() != Material.AIR))
|
// || (over.getType() == Material.WOOD && under.getType() != Material.WOOD && under.getType() != Material.AIR))
|
||||||
&& treeHeight < 40) {
|
// && treeHeight < 40) {
|
||||||
over = under;
|
// over = under;
|
||||||
if(over.getY() <= 0) break; // reached bottom
|
// if(over.getY() <= 0) break; // reached bottom
|
||||||
under = over.getFace(BlockFace.DOWN);
|
// under = over.getFace(BlockFace.DOWN);
|
||||||
treeHeight++;
|
// treeHeight++;
|
||||||
}
|
// }
|
||||||
block = under; // found the ground
|
// block = under; // found the ground
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
block.setType(Material.GLASS);
|
// block.setType(Material.GLASS);
|
||||||
|
//
|
||||||
if(lastBlock != null) {
|
// if(lastBlock != null) {
|
||||||
// link the new block and the old vertically if there's a big drop or rise
|
// // link the new block and the old vertically if there's a big drop or rise
|
||||||
if(block.getY() - lastBlock.getY() > 1) { // new block too high
|
// if(block.getY() - lastBlock.getY() > 1) { // new block too high
|
||||||
Block under = block.getFace(BlockFace.DOWN);
|
// Block under = block.getFace(BlockFace.DOWN);
|
||||||
while(under.getY() != lastBlock.getY() - 1) {
|
// while(under.getY() != lastBlock.getY() - 1) {
|
||||||
under.setType(Material.GLASS);
|
// under.setType(Material.GLASS);
|
||||||
if(under.getY() <= 0) break; // reached bottom
|
// if(under.getY() <= 0) break; // reached bottom
|
||||||
under = under.getFace(BlockFace.DOWN);
|
// under = under.getFace(BlockFace.DOWN);
|
||||||
}
|
// }
|
||||||
} else if (lastBlock.getY() - block.getY() > 1) { // new block too low
|
// } else if (lastBlock.getY() - block.getY() > 1) { // new block too low
|
||||||
Block over = block.getFace(BlockFace.UP);
|
// Block over = block.getFace(BlockFace.UP);
|
||||||
while(over.getY() != lastBlock.getY() + 1) {
|
// while(over.getY() != lastBlock.getY() + 1) {
|
||||||
over.setType(Material.GLASS);
|
// over.setType(Material.GLASS);
|
||||||
if(over.getY() >= 127) break;
|
// if(over.getY() >= 127) break;
|
||||||
over = over.getFace(BlockFace.UP);
|
// over = over.getFace(BlockFace.UP);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
return block;
|
// return block;
|
||||||
}
|
// }
|
||||||
|
|
||||||
public void endRound() {
|
public void endRound() {
|
||||||
|
|
||||||
@ -726,9 +726,9 @@ public class Warzone {
|
|||||||
playerGuards.add(guard);
|
playerGuards.add(guard);
|
||||||
BlockFace guardWall = guard.getWall();
|
BlockFace guardWall = guard.getWall();
|
||||||
getVolume().resetWallBlocks(guardWall);
|
getVolume().resetWallBlocks(guardWall);
|
||||||
if(isDrawZoneOutline()) {
|
// if(isDrawZoneOutline()) {
|
||||||
addZoneOutline(guard.getWall());
|
// addZoneOutline(guard.getWall());
|
||||||
}
|
// }
|
||||||
if(lobby != null) {
|
if(lobby != null) {
|
||||||
lobby.getVolume().resetBlocks(); // always reset the lobby even if the guard is on another wall
|
lobby.getVolume().resetBlocks(); // always reset the lobby even if the guard is on another wall
|
||||||
// because player can go around corner
|
// because player can go around corner
|
||||||
|
@ -31,9 +31,6 @@ public class ZoneLobby {
|
|||||||
BlockInfo warHubLinkGate = null;
|
BlockInfo warHubLinkGate = null;
|
||||||
|
|
||||||
Map<String, BlockInfo> teamGateBlocks = new HashMap<String, BlockInfo>();
|
Map<String, BlockInfo> teamGateBlocks = new HashMap<String, BlockInfo>();
|
||||||
// Block diamondGate = null;
|
|
||||||
// Block ironGate = null;
|
|
||||||
// Block goldGate = null;
|
|
||||||
BlockInfo autoAssignGate = null;
|
BlockInfo autoAssignGate = null;
|
||||||
|
|
||||||
BlockInfo zoneTeleportBlock = null;
|
BlockInfo zoneTeleportBlock = null;
|
||||||
@ -50,7 +47,8 @@ public class ZoneLobby {
|
|||||||
if(lobbyHalfSide < 7) {
|
if(lobbyHalfSide < 7) {
|
||||||
lobbyHalfSide = 7;
|
lobbyHalfSide = 7;
|
||||||
}
|
}
|
||||||
this.changeWall(wall);
|
this.wall = wall;
|
||||||
|
//this.changeWall(wall);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -81,6 +79,10 @@ public class ZoneLobby {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setWall(BlockFace newWall) {
|
||||||
|
this.wall = newWall;
|
||||||
|
}
|
||||||
|
|
||||||
public void changeWall(BlockFace newWall) {
|
public void changeWall(BlockFace newWall) {
|
||||||
if(volume == null) {
|
if(volume == null) {
|
||||||
// no previous wall
|
// no previous wall
|
||||||
@ -106,51 +108,42 @@ public class ZoneLobby {
|
|||||||
int x = zoneVolume.getMinX();
|
int x = zoneVolume.getMinX();
|
||||||
int wallLength = wallEnd - wallStart + 1;
|
int wallLength = wallEnd - wallStart + 1;
|
||||||
int wallCenterPos = wallStart + wallLength / 2;
|
int wallCenterPos = wallStart + wallLength / 2;
|
||||||
int highestNonAirBlockAtCenter = warzone.getWorld().getHighestBlockYAt(x+1, wallCenterPos);
|
int y = zoneVolume.getCenterY();
|
||||||
if(highestNonAirBlockAtCenter < 3 || highestNonAirBlockAtCenter > 125 - lobbyHeight)
|
lobbyMiddleWallBlock = new BlockInfo(warzone.getWorld().getBlockAt(x, y, wallCenterPos));
|
||||||
highestNonAirBlockAtCenter = warzone.getVolume().getCenterY();
|
corner1 = warzone.getWorld().getBlockAt(x, y - 1, wallCenterPos + lobbyHalfSide);
|
||||||
lobbyMiddleWallBlock = new BlockInfo(warzone.getWorld().getBlockAt(x, highestNonAirBlockAtCenter, wallCenterPos));
|
corner2 = warzone.getWorld().getBlockAt(x - lobbyDepth, y + 1 + lobbyHeight, wallCenterPos - lobbyHalfSide);
|
||||||
corner1 = warzone.getWorld().getBlockAt(x, highestNonAirBlockAtCenter - 1, wallCenterPos + lobbyHalfSide);
|
|
||||||
corner2 = warzone.getWorld().getBlockAt(x - lobbyDepth,
|
|
||||||
highestNonAirBlockAtCenter + 1 + lobbyHeight, wallCenterPos - lobbyHalfSide);
|
|
||||||
} else if (wall == BlockFace.EAST){
|
} else if (wall == BlockFace.EAST){
|
||||||
int wallStart = zoneVolume.getMinX();
|
int wallStart = zoneVolume.getMinX();
|
||||||
int wallEnd = zoneVolume.getMaxX();
|
int wallEnd = zoneVolume.getMaxX();
|
||||||
int z = zoneVolume.getMinZ();
|
int z = zoneVolume.getMinZ();
|
||||||
int wallLength = wallEnd - wallStart + 1;
|
int wallLength = wallEnd - wallStart + 1;
|
||||||
int wallCenterPos = wallStart + wallLength / 2;
|
int wallCenterPos = wallStart + wallLength / 2;
|
||||||
int highestNonAirBlockAtCenter = warzone.getWorld().getHighestBlockYAt(wallCenterPos, z+1);
|
int y = zoneVolume.getCenterY();
|
||||||
if(highestNonAirBlockAtCenter < 3 || highestNonAirBlockAtCenter > 125 - lobbyHeight)
|
lobbyMiddleWallBlock = new BlockInfo(warzone.getWorld().getBlockAt(wallCenterPos, y, z));
|
||||||
highestNonAirBlockAtCenter = warzone.getVolume().getCenterY();
|
corner1 = warzone.getWorld().getBlockAt(wallCenterPos - lobbyHalfSide, y - 1, z);
|
||||||
lobbyMiddleWallBlock = new BlockInfo(warzone.getWorld().getBlockAt(wallCenterPos, highestNonAirBlockAtCenter, z));
|
|
||||||
corner1 = warzone.getWorld().getBlockAt(wallCenterPos - lobbyHalfSide, highestNonAirBlockAtCenter - 1, z);
|
|
||||||
corner2 = warzone.getWorld().getBlockAt(wallCenterPos + lobbyHalfSide,
|
corner2 = warzone.getWorld().getBlockAt(wallCenterPos + lobbyHalfSide,
|
||||||
highestNonAirBlockAtCenter + 1 + lobbyHeight, z - lobbyDepth);
|
y + 1 + lobbyHeight, z - lobbyDepth);
|
||||||
} else if (wall == BlockFace.SOUTH){
|
} else if (wall == BlockFace.SOUTH){
|
||||||
int wallStart = zoneVolume.getMinZ();
|
int wallStart = zoneVolume.getMinZ();
|
||||||
int wallEnd = zoneVolume.getMaxZ();
|
int wallEnd = zoneVolume.getMaxZ();
|
||||||
int x = zoneVolume.getMaxX();
|
int x = zoneVolume.getMaxX();
|
||||||
int wallLength = wallEnd - wallStart + 1;
|
int wallLength = wallEnd - wallStart + 1;
|
||||||
int wallCenterPos = wallStart + wallLength / 2;
|
int wallCenterPos = wallStart + wallLength / 2;
|
||||||
int highestNonAirBlockAtCenter = warzone.getWorld().getHighestBlockYAt(x-1, wallCenterPos);
|
int y = zoneVolume.getCenterY();
|
||||||
if(highestNonAirBlockAtCenter < 3 || highestNonAirBlockAtCenter > 125 - lobbyHeight)
|
lobbyMiddleWallBlock = new BlockInfo(warzone.getWorld().getBlockAt(x, y, wallCenterPos));
|
||||||
highestNonAirBlockAtCenter = warzone.getVolume().getCenterY();
|
corner1 = warzone.getWorld().getBlockAt(x, y -1 , wallCenterPos - lobbyHalfSide);
|
||||||
lobbyMiddleWallBlock = new BlockInfo(warzone.getWorld().getBlockAt(x, highestNonAirBlockAtCenter, wallCenterPos));
|
|
||||||
corner1 = warzone.getWorld().getBlockAt(x, highestNonAirBlockAtCenter -1 , wallCenterPos - lobbyHalfSide);
|
|
||||||
corner2 = warzone.getWorld().getBlockAt(x + lobbyDepth,
|
corner2 = warzone.getWorld().getBlockAt(x + lobbyDepth,
|
||||||
highestNonAirBlockAtCenter + 1 + lobbyHeight, wallCenterPos + lobbyHalfSide);
|
y + 1 + lobbyHeight, wallCenterPos + lobbyHalfSide);
|
||||||
} else if (wall == BlockFace.WEST){
|
} else if (wall == BlockFace.WEST){
|
||||||
int wallStart = zoneVolume.getMinX();
|
int wallStart = zoneVolume.getMinX();
|
||||||
int wallEnd = zoneVolume.getMaxX();
|
int wallEnd = zoneVolume.getMaxX();
|
||||||
int z = zoneVolume.getMaxZ();
|
int z = zoneVolume.getMaxZ();
|
||||||
int wallLength = wallEnd - wallStart + 1;
|
int wallLength = wallEnd - wallStart + 1;
|
||||||
int wallCenterPos = wallStart + wallLength / 2;
|
int wallCenterPos = wallStart + wallLength / 2;
|
||||||
int highestNonAirBlockAtCenter = warzone.getWorld().getHighestBlockYAt(wallCenterPos, z-1);
|
int y = zoneVolume.getCenterY();
|
||||||
if(highestNonAirBlockAtCenter < 3 || highestNonAirBlockAtCenter > 125 - lobbyHeight)
|
lobbyMiddleWallBlock = new BlockInfo(warzone.getWorld().getBlockAt(wallCenterPos, y, z));
|
||||||
highestNonAirBlockAtCenter = warzone.getVolume().getCenterY();
|
corner1 = warzone.getWorld().getBlockAt(wallCenterPos + lobbyHalfSide, y - 1, z);
|
||||||
lobbyMiddleWallBlock = new BlockInfo(warzone.getWorld().getBlockAt(wallCenterPos, highestNonAirBlockAtCenter, z));
|
corner2 = warzone.getWorld().getBlockAt(wallCenterPos - lobbyHalfSide, y + 1 + lobbyHeight, z + lobbyDepth);
|
||||||
corner1 = warzone.getWorld().getBlockAt(wallCenterPos + lobbyHalfSide, highestNonAirBlockAtCenter - 1, z);
|
|
||||||
corner2 = warzone.getWorld().getBlockAt(wallCenterPos - lobbyHalfSide, highestNonAirBlockAtCenter + 1 + lobbyHeight, z + lobbyDepth);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(corner1 != null && corner2 != null) {
|
if(corner1 != null && corner2 != null) {
|
||||||
@ -163,7 +156,7 @@ public class ZoneLobby {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
changeWall(wall);
|
changeWall(wall); // watch out! this saves the lobby blocks (you gotta the lobby blocks before)
|
||||||
|
|
||||||
// maybe the number of teams change, now reset the gate positions
|
// maybe the number of teams change, now reset the gate positions
|
||||||
setGatePositions(BlockInfo.getBlock(warzone.getWorld(), lobbyMiddleWallBlock));
|
setGatePositions(BlockInfo.getBlock(warzone.getWorld(), lobbyMiddleWallBlock));
|
||||||
@ -193,9 +186,6 @@ public class ZoneLobby {
|
|||||||
BlockInfo gateInfo = teamGateBlocks.get(teamName);
|
BlockInfo gateInfo = teamGateBlocks.get(teamName);
|
||||||
placeGate(BlockInfo.getBlock(warzone.getWorld(), gateInfo), TeamKinds.teamKindFromString(teamName));
|
placeGate(BlockInfo.getBlock(warzone.getWorld(), gateInfo), TeamKinds.teamKindFromString(teamName));
|
||||||
}
|
}
|
||||||
// placeGate(diamondGate, TeamKinds.TEAMDIAMOND);
|
|
||||||
// placeGate(ironGate, TeamKinds.TEAMIRON);
|
|
||||||
// placeGate(goldGate, TeamKinds.TEAMGOLD);
|
|
||||||
for(Team t : warzone.getTeams()) {
|
for(Team t : warzone.getTeams()) {
|
||||||
resetTeamGateSign(t);
|
resetTeamGateSign(t);
|
||||||
}
|
}
|
||||||
@ -249,12 +239,6 @@ public class ZoneLobby {
|
|||||||
} else {
|
} else {
|
||||||
war.logWarn("Failed to initalize zone lobby for zone " + warzone.getName());
|
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());
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setGatePositions(Block lobbyMiddleWallBlock) {
|
private void setGatePositions(Block lobbyMiddleWallBlock) {
|
||||||
|
@ -163,7 +163,7 @@ public class ZoneSetter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void handleTooSmall() {
|
private void handleTooSmall() {
|
||||||
war.badMsg(player, "That would make the " + zoneName + " warzone too small. Sides must be at least 10 blocks.");
|
war.badMsg(player, "That would make the " + zoneName + " warzone too small. Sides must be at least 10 blocks and all existing structures (spawns, flags, etc) must fit inside.");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleTooBig() {
|
private void handleTooBig() {
|
||||||
@ -191,13 +191,20 @@ public class ZoneSetter {
|
|||||||
war.getWarHub().initialize();
|
war.getWarHub().initialize();
|
||||||
}
|
}
|
||||||
war.msg(player, "Default lobby created on south side of zone. Use /setzonelobby <n/s/e/w> to change its position.");
|
war.msg(player, "Default lobby created on south side of zone. Use /setzonelobby <n/s/e/w> to change its position.");
|
||||||
} else {
|
} //else {
|
||||||
// gotta move the lobby
|
// gotta move the lobby (or dont because zone.initzon does it for you)
|
||||||
warzone.getLobby().changeWall(warzone.getLobby().getWall());
|
//warzone.getLobby().changeWall(warzone.getLobby().getWall());
|
||||||
}
|
//}
|
||||||
warzone.initializeZone();
|
warzone.initializeZone();
|
||||||
WarzoneMapper.save(war, warzone, true);
|
WarzoneMapper.save(war, warzone, true);
|
||||||
war.msg(player, "Warzone saved. Use /setteam, /setmonument and /savezone to configure the zone.");
|
war.msg(player, "Warzone saved. Use /setteam, /setmonument and /savezone to configure the zone.");
|
||||||
|
} else {
|
||||||
|
if(warzone.getVolume().getCornerOne() == null) {
|
||||||
|
msgString.append("Still missing corner 1.");
|
||||||
|
} else if (warzone.getVolume().getCornerTwo() == null) {
|
||||||
|
msgString.append("Still missing corner 2.");
|
||||||
|
}
|
||||||
|
war.msg(player, msgString.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,9 @@ public class RestoreWarzonesJob implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(war.getWarzones().size() > 0) {
|
||||||
war.logInfo("Warzones ready.");
|
war.logInfo("Warzones ready.");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ import org.bukkit.material.MaterialData;
|
|||||||
|
|
||||||
import bukkit.tommytony.war.War;
|
import bukkit.tommytony.war.War;
|
||||||
|
|
||||||
|
import com.tommytony.war.Warzone;
|
||||||
import com.tommytony.war.volumes.Volume;
|
import com.tommytony.war.volumes.Volume;
|
||||||
import com.tommytony.war.volumes.ZoneVolume;
|
import com.tommytony.war.volumes.ZoneVolume;
|
||||||
|
|
||||||
@ -34,8 +35,8 @@ public class VolumeMapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static ZoneVolume loadZoneVolume(String volumeName, String zoneName,
|
public static ZoneVolume loadZoneVolume(String volumeName, String zoneName,
|
||||||
War war, World world) {
|
War war, World world, Warzone zone) {
|
||||||
ZoneVolume volume = new ZoneVolume(volumeName, war, world);
|
ZoneVolume volume = new ZoneVolume(volumeName, war, world, zone);
|
||||||
load(volume, zoneName, war, world);
|
load(volume, zoneName, war, world);
|
||||||
return volume;
|
return volume;
|
||||||
}
|
}
|
||||||
|
@ -242,7 +242,7 @@ public class WarzoneMapper {
|
|||||||
if(loadBlocks) {
|
if(loadBlocks) {
|
||||||
|
|
||||||
// zone blocks
|
// zone blocks
|
||||||
ZoneVolume zoneVolume = VolumeMapper.loadZoneVolume(warzone.getName(), warzone.getName(), war, warzone.getWorld());
|
ZoneVolume zoneVolume = VolumeMapper.loadZoneVolume(warzone.getName(), warzone.getName(), war, warzone.getWorld(), warzone);
|
||||||
warzone.setVolume(zoneVolume);
|
warzone.setVolume(zoneVolume);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,10 @@ import org.bukkit.World;
|
|||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
|
|
||||||
|
import com.tommytony.war.Warzone;
|
||||||
|
import com.tommytony.war.Team;
|
||||||
|
import com.tommytony.war.Monument;
|
||||||
|
|
||||||
import bukkit.tommytony.war.War;
|
import bukkit.tommytony.war.War;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -14,8 +18,11 @@ import bukkit.tommytony.war.War;
|
|||||||
*/
|
*/
|
||||||
public class ZoneVolume extends Volume {
|
public class ZoneVolume extends Volume {
|
||||||
|
|
||||||
public ZoneVolume(String name, War war, World world) {
|
private Warzone zone;
|
||||||
|
|
||||||
|
public ZoneVolume(String name, War war, World world, Warzone zone) {
|
||||||
super(name, war, world);
|
super(name, war, world);
|
||||||
|
this.zone = zone;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNorthwest(Block block) throws NotNorthwestException, TooSmallException, TooBigException {
|
public void setNorthwest(Block block) throws NotNorthwestException, TooSmallException, TooBigException {
|
||||||
@ -50,7 +57,7 @@ public class ZoneVolume extends Volume {
|
|||||||
BlockInfo maxZBlock = getMaxZBlock(); // west means max Z
|
BlockInfo maxZBlock = getMaxZBlock(); // west means max Z
|
||||||
maxZBlock.setZ(block.getZ());
|
maxZBlock.setZ(block.getZ());
|
||||||
}
|
}
|
||||||
if(tooSmall()) {
|
if(tooSmall() || zoneStructuresAreOutside()) {
|
||||||
super.setCornerOne(oldCornerOne);
|
super.setCornerOne(oldCornerOne);
|
||||||
super.setCornerTwo(oldCornerTwo);
|
super.setCornerTwo(oldCornerTwo);
|
||||||
throw new TooSmallException();
|
throw new TooSmallException();
|
||||||
@ -107,7 +114,7 @@ public class ZoneVolume extends Volume {
|
|||||||
BlockInfo minZBlock = getMinZBlock(); // east means min Z
|
BlockInfo minZBlock = getMinZBlock(); // east means min Z
|
||||||
minZBlock.setZ(block.getZ());
|
minZBlock.setZ(block.getZ());
|
||||||
}
|
}
|
||||||
if(tooSmall()) {
|
if(tooSmall() || zoneStructuresAreOutside()) {
|
||||||
super.setCornerOne(oldCornerOne);
|
super.setCornerOne(oldCornerOne);
|
||||||
super.setCornerTwo(oldCornerTwo);
|
super.setCornerTwo(oldCornerTwo);
|
||||||
throw new TooSmallException();
|
throw new TooSmallException();
|
||||||
@ -137,14 +144,13 @@ public class ZoneVolume extends Volume {
|
|||||||
if(!hasTwoCorners())
|
if(!hasTwoCorners())
|
||||||
return 0;
|
return 0;
|
||||||
else
|
else
|
||||||
return (getMaxY() - getMinY())/2;
|
return getMinY() + (getMaxY() - getMinY())/2;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setZoneCornerOne(Block block) throws TooSmallException, TooBigException {
|
public void setZoneCornerOne(Block block) throws TooSmallException, TooBigException {
|
||||||
BlockInfo oldCornerOne = getCornerOne();
|
BlockInfo oldCornerOne = getCornerOne();
|
||||||
super.setCornerOne(block);
|
super.setCornerOne(block);
|
||||||
if(tooSmall()) {
|
if(tooSmall() || zoneStructuresAreOutside()) {
|
||||||
super.setCornerOne(oldCornerOne);
|
super.setCornerOne(oldCornerOne);
|
||||||
throw new TooSmallException();
|
throw new TooSmallException();
|
||||||
} else if (tooBig()) {
|
} else if (tooBig()) {
|
||||||
@ -156,7 +162,7 @@ public class ZoneVolume extends Volume {
|
|||||||
public void setZoneCornerTwo(Block block) throws TooSmallException, TooBigException {
|
public void setZoneCornerTwo(Block block) throws TooSmallException, TooBigException {
|
||||||
BlockInfo oldCornerTwo = getCornerTwo();
|
BlockInfo oldCornerTwo = getCornerTwo();
|
||||||
super.setCornerTwo(block);
|
super.setCornerTwo(block);
|
||||||
if(tooSmall()) {
|
if(tooSmall() || zoneStructuresAreOutside()) {
|
||||||
super.setCornerTwo(oldCornerTwo);
|
super.setCornerTwo(oldCornerTwo);
|
||||||
throw new TooSmallException();
|
throw new TooSmallException();
|
||||||
} else if (tooBig()) {
|
} else if (tooBig()) {
|
||||||
@ -179,6 +185,42 @@ public class ZoneVolume extends Volume {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean zoneStructuresAreOutside() {
|
||||||
|
// check team spawns & flags
|
||||||
|
for(Team team : zone.getTeams()) {
|
||||||
|
if(team.getTeamSpawn() != null) {
|
||||||
|
if(!isInside(team.getSpawnVolume().getCornerOne())
|
||||||
|
|| !isInside(team.getSpawnVolume().getCornerTwo())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(team.getTeamFlag() != null) {
|
||||||
|
if(!isInside(team.getFlagVolume().getCornerOne())
|
||||||
|
|| !isInside(team.getFlagVolume().getCornerTwo())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// check monuments
|
||||||
|
for(Monument monument : zone.getMonuments()) {
|
||||||
|
if(monument.getVolume() != null) {
|
||||||
|
if(!isInside(monument.getVolume().getCornerOne())
|
||||||
|
|| !isInside(monument.getVolume().getCornerTwo())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isInside(BlockInfo info) {
|
||||||
|
if(info.getX() <= getMaxX() && info.getX() >= getMinX() &&
|
||||||
|
info.getY() <= getMaxY() && info.getY() >= getMinY() &&
|
||||||
|
info.getZ() <= getMaxZ() && info.getZ() >= getMinZ())
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isWallBlock(Block block){
|
public boolean isWallBlock(Block block){
|
||||||
return isEastWallBlock(block) || isNorthWallBlock(block)
|
return isEastWallBlock(block) || isNorthWallBlock(block)
|
||||||
|| isSouthWallBlock(block) || isWestWallBlock(block)
|
|| isSouthWallBlock(block) || isWestWallBlock(block)
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
package com.tommytony.war.spec.volumes;
|
package com.tommytony.war.spec.volumes;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@ -9,6 +12,9 @@ import static org.mockito.Mockito.*;
|
|||||||
|
|
||||||
import bukkit.tommytony.war.War;
|
import bukkit.tommytony.war.War;
|
||||||
|
|
||||||
|
import com.tommytony.war.Monument;
|
||||||
|
import com.tommytony.war.Team;
|
||||||
|
import com.tommytony.war.Warzone;
|
||||||
import com.tommytony.war.volumes.BlockInfo;
|
import com.tommytony.war.volumes.BlockInfo;
|
||||||
import com.tommytony.war.volumes.NotNorthwestException;
|
import com.tommytony.war.volumes.NotNorthwestException;
|
||||||
import com.tommytony.war.volumes.NotSoutheastException;
|
import com.tommytony.war.volumes.NotSoutheastException;
|
||||||
@ -25,7 +31,10 @@ public class ZoneVolumeSpec {
|
|||||||
// Arrange
|
// Arrange
|
||||||
War warMock = mock(War.class);
|
War warMock = mock(War.class);
|
||||||
World worldMock = mock(World.class);
|
World worldMock = mock(World.class);
|
||||||
ZoneVolume volume = new ZoneVolume("test", warMock, worldMock);
|
Warzone zoneMock = mock(Warzone.class);
|
||||||
|
when(zoneMock.getTeams()).thenReturn(new ArrayList<Team>());
|
||||||
|
when(zoneMock.getMonuments()).thenReturn(new ArrayList<Monument>());
|
||||||
|
ZoneVolume volume = new ZoneVolume("test", warMock, worldMock, zoneMock);
|
||||||
Block blockMock = mock(Block.class);
|
Block blockMock = mock(Block.class);
|
||||||
when(blockMock.getX()).thenReturn(0);
|
when(blockMock.getX()).thenReturn(0);
|
||||||
when(blockMock.getY()).thenReturn(64); // at sea level
|
when(blockMock.getY()).thenReturn(64); // at sea level
|
||||||
@ -50,7 +59,10 @@ public class ZoneVolumeSpec {
|
|||||||
// Arrange
|
// Arrange
|
||||||
War warMock = mock(War.class);
|
War warMock = mock(War.class);
|
||||||
World worldMock = mock(World.class);
|
World worldMock = mock(World.class);
|
||||||
ZoneVolume volume = new ZoneVolume("test", warMock, worldMock);
|
Warzone zoneMock = mock(Warzone.class);
|
||||||
|
when(zoneMock.getTeams()).thenReturn(new ArrayList<Team>());
|
||||||
|
when(zoneMock.getMonuments()).thenReturn(new ArrayList<Monument>());
|
||||||
|
ZoneVolume volume = new ZoneVolume("test", warMock, worldMock, zoneMock);
|
||||||
Block blockMock = mock(Block.class);
|
Block blockMock = mock(Block.class);
|
||||||
when(blockMock.getX()).thenReturn(-64); // further north
|
when(blockMock.getX()).thenReturn(-64); // further north
|
||||||
when(blockMock.getY()).thenReturn(64); // at sea level
|
when(blockMock.getY()).thenReturn(64); // at sea level
|
||||||
@ -81,7 +93,10 @@ public class ZoneVolumeSpec {
|
|||||||
// Arrange
|
// Arrange
|
||||||
War warMock = mock(War.class);
|
War warMock = mock(War.class);
|
||||||
World worldMock = mock(World.class);
|
World worldMock = mock(World.class);
|
||||||
ZoneVolume volume = new ZoneVolume("test", warMock, worldMock);
|
Warzone zoneMock = mock(Warzone.class);
|
||||||
|
when(zoneMock.getTeams()).thenReturn(new ArrayList<Team>());
|
||||||
|
when(zoneMock.getMonuments()).thenReturn(new ArrayList<Monument>());
|
||||||
|
ZoneVolume volume = new ZoneVolume("test", warMock, worldMock, zoneMock);
|
||||||
Block blockMock = mock(Block.class);
|
Block blockMock = mock(Block.class);
|
||||||
when(blockMock.getX()).thenReturn(64); // further south
|
when(blockMock.getX()).thenReturn(64); // further south
|
||||||
when(blockMock.getY()).thenReturn(64); // at sea level
|
when(blockMock.getY()).thenReturn(64); // at sea level
|
||||||
@ -112,7 +127,10 @@ public class ZoneVolumeSpec {
|
|||||||
// Arrange
|
// Arrange
|
||||||
War warMock = mock(War.class);
|
War warMock = mock(War.class);
|
||||||
World worldMock = mock(World.class);
|
World worldMock = mock(World.class);
|
||||||
ZoneVolume volume = new ZoneVolume("test", warMock, worldMock);
|
Warzone zoneMock = mock(Warzone.class);
|
||||||
|
when(zoneMock.getTeams()).thenReturn(new ArrayList<Team>());
|
||||||
|
when(zoneMock.getMonuments()).thenReturn(new ArrayList<Monument>());
|
||||||
|
ZoneVolume volume = new ZoneVolume("test", warMock, worldMock, zoneMock);
|
||||||
Block blockMock = mock(Block.class);
|
Block blockMock = mock(Block.class);
|
||||||
when(blockMock.getX()).thenReturn(-5); // further south
|
when(blockMock.getX()).thenReturn(-5); // further south
|
||||||
when(blockMock.getY()).thenReturn(64); // at sea level
|
when(blockMock.getY()).thenReturn(64); // at sea level
|
||||||
@ -143,7 +161,10 @@ public class ZoneVolumeSpec {
|
|||||||
// Arrange
|
// Arrange
|
||||||
War warMock = mock(War.class);
|
War warMock = mock(War.class);
|
||||||
World worldMock = mock(World.class);
|
World worldMock = mock(World.class);
|
||||||
ZoneVolume volume = new ZoneVolume("test", warMock, worldMock);
|
Warzone zoneMock = mock(Warzone.class);
|
||||||
|
when(zoneMock.getTeams()).thenReturn(new ArrayList<Team>());
|
||||||
|
when(zoneMock.getMonuments()).thenReturn(new ArrayList<Monument>());
|
||||||
|
ZoneVolume volume = new ZoneVolume("test", warMock, worldMock, zoneMock);
|
||||||
Block blockMock = mock(Block.class);
|
Block blockMock = mock(Block.class);
|
||||||
when(blockMock.getX()).thenReturn(-1000); // further south
|
when(blockMock.getX()).thenReturn(-1000); // further south
|
||||||
when(blockMock.getY()).thenReturn(64); // at sea level
|
when(blockMock.getY()).thenReturn(64); // at sea level
|
||||||
@ -174,7 +195,10 @@ public class ZoneVolumeSpec {
|
|||||||
// Arrange
|
// Arrange
|
||||||
War warMock = mock(War.class);
|
War warMock = mock(War.class);
|
||||||
World worldMock = mock(World.class);
|
World worldMock = mock(World.class);
|
||||||
ZoneVolume volume = new ZoneVolume("test", warMock, worldMock);
|
Warzone zoneMock = mock(Warzone.class);
|
||||||
|
when(zoneMock.getTeams()).thenReturn(new ArrayList<Team>());
|
||||||
|
when(zoneMock.getMonuments()).thenReturn(new ArrayList<Monument>());
|
||||||
|
ZoneVolume volume = new ZoneVolume("test", warMock, worldMock, zoneMock);
|
||||||
Block blockMock = mock(Block.class);
|
Block blockMock = mock(Block.class);
|
||||||
when(blockMock.getX()).thenReturn(-64); // further north
|
when(blockMock.getX()).thenReturn(-64); // further north
|
||||||
when(blockMock.getY()).thenReturn(64); // at sea level
|
when(blockMock.getY()).thenReturn(64); // at sea level
|
||||||
@ -207,7 +231,10 @@ public class ZoneVolumeSpec {
|
|||||||
// Arrange
|
// Arrange
|
||||||
War warMock = mock(War.class);
|
War warMock = mock(War.class);
|
||||||
World worldMock = mock(World.class);
|
World worldMock = mock(World.class);
|
||||||
ZoneVolume volume = new ZoneVolume("test", warMock, worldMock);
|
Warzone zoneMock = mock(Warzone.class);
|
||||||
|
when(zoneMock.getTeams()).thenReturn(new ArrayList<Team>());
|
||||||
|
when(zoneMock.getMonuments()).thenReturn(new ArrayList<Monument>());
|
||||||
|
ZoneVolume volume = new ZoneVolume("test", warMock, worldMock, zoneMock);
|
||||||
Block blockMock = mock(Block.class);
|
Block blockMock = mock(Block.class);
|
||||||
when(blockMock.getX()).thenReturn(-64); // further north
|
when(blockMock.getX()).thenReturn(-64); // further north
|
||||||
when(blockMock.getY()).thenReturn(64); // at sea level
|
when(blockMock.getY()).thenReturn(64); // at sea level
|
||||||
@ -238,7 +265,10 @@ public class ZoneVolumeSpec {
|
|||||||
// Arrange
|
// Arrange
|
||||||
War warMock = mock(War.class);
|
War warMock = mock(War.class);
|
||||||
World worldMock = mock(World.class);
|
World worldMock = mock(World.class);
|
||||||
ZoneVolume volume = new ZoneVolume("test", warMock, worldMock);
|
Warzone zoneMock = mock(Warzone.class);
|
||||||
|
when(zoneMock.getTeams()).thenReturn(new ArrayList<Team>());
|
||||||
|
when(zoneMock.getMonuments()).thenReturn(new ArrayList<Monument>());
|
||||||
|
ZoneVolume volume = new ZoneVolume("test", warMock, worldMock, zoneMock);
|
||||||
Block blockMock = mock(Block.class);
|
Block blockMock = mock(Block.class);
|
||||||
when(blockMock.getX()).thenReturn(64); // further south
|
when(blockMock.getX()).thenReturn(64); // further south
|
||||||
when(blockMock.getY()).thenReturn(64); // at sea level
|
when(blockMock.getY()).thenReturn(64); // at sea level
|
||||||
@ -269,7 +299,10 @@ public class ZoneVolumeSpec {
|
|||||||
// Arrange
|
// Arrange
|
||||||
War warMock = mock(War.class);
|
War warMock = mock(War.class);
|
||||||
World worldMock = mock(World.class);
|
World worldMock = mock(World.class);
|
||||||
ZoneVolume volume = new ZoneVolume("test", warMock, worldMock);
|
Warzone zoneMock = mock(Warzone.class);
|
||||||
|
when(zoneMock.getTeams()).thenReturn(new ArrayList<Team>());
|
||||||
|
when(zoneMock.getMonuments()).thenReturn(new ArrayList<Monument>());
|
||||||
|
ZoneVolume volume = new ZoneVolume("test", warMock, worldMock, zoneMock);
|
||||||
Block blockMock = mock(Block.class);
|
Block blockMock = mock(Block.class);
|
||||||
when(blockMock.getX()).thenReturn(-64); // further north
|
when(blockMock.getX()).thenReturn(-64); // further north
|
||||||
when(blockMock.getY()).thenReturn(64); // at sea level
|
when(blockMock.getY()).thenReturn(64); // at sea level
|
||||||
@ -305,7 +338,10 @@ public class ZoneVolumeSpec {
|
|||||||
// Arrange
|
// Arrange
|
||||||
War warMock = mock(War.class);
|
War warMock = mock(War.class);
|
||||||
World worldMock = mock(World.class);
|
World worldMock = mock(World.class);
|
||||||
ZoneVolume volume = new ZoneVolume("test", warMock, worldMock);
|
Warzone zoneMock = mock(Warzone.class);
|
||||||
|
when(zoneMock.getTeams()).thenReturn(new ArrayList<Team>());
|
||||||
|
when(zoneMock.getMonuments()).thenReturn(new ArrayList<Monument>());
|
||||||
|
ZoneVolume volume = new ZoneVolume("test", warMock, worldMock, zoneMock);
|
||||||
Block blockMock = mock(Block.class);
|
Block blockMock = mock(Block.class);
|
||||||
when(blockMock.getX()).thenReturn(-64); // further north
|
when(blockMock.getX()).thenReturn(-64); // further north
|
||||||
when(blockMock.getY()).thenReturn(64); // at sea level
|
when(blockMock.getY()).thenReturn(64); // at sea level
|
||||||
@ -341,7 +377,10 @@ public class ZoneVolumeSpec {
|
|||||||
// Arrange
|
// Arrange
|
||||||
War warMock = mock(War.class);
|
War warMock = mock(War.class);
|
||||||
World worldMock = mock(World.class);
|
World worldMock = mock(World.class);
|
||||||
ZoneVolume volume = new ZoneVolume("test", warMock, worldMock);
|
Warzone zoneMock = mock(Warzone.class);
|
||||||
|
when(zoneMock.getTeams()).thenReturn(new ArrayList<Team>());
|
||||||
|
when(zoneMock.getMonuments()).thenReturn(new ArrayList<Monument>());
|
||||||
|
ZoneVolume volume = new ZoneVolume("test", warMock, worldMock, zoneMock);
|
||||||
Block blockMock = mock(Block.class);
|
Block blockMock = mock(Block.class);
|
||||||
when(blockMock.getX()).thenReturn(-64); // further north
|
when(blockMock.getX()).thenReturn(-64); // further north
|
||||||
when(blockMock.getY()).thenReturn(64); // at sea level
|
when(blockMock.getY()).thenReturn(64); // at sea level
|
||||||
@ -377,7 +416,10 @@ public class ZoneVolumeSpec {
|
|||||||
// Arrange
|
// Arrange
|
||||||
War warMock = mock(War.class);
|
War warMock = mock(War.class);
|
||||||
World worldMock = mock(World.class);
|
World worldMock = mock(World.class);
|
||||||
ZoneVolume volume = new ZoneVolume("test", warMock, worldMock);
|
Warzone zoneMock = mock(Warzone.class);
|
||||||
|
when(zoneMock.getTeams()).thenReturn(new ArrayList<Team>());
|
||||||
|
when(zoneMock.getMonuments()).thenReturn(new ArrayList<Monument>());
|
||||||
|
ZoneVolume volume = new ZoneVolume("test", warMock, worldMock, zoneMock);
|
||||||
Block blockMock = mock(Block.class);
|
Block blockMock = mock(Block.class);
|
||||||
when(blockMock.getX()).thenReturn(-64); // further north
|
when(blockMock.getX()).thenReturn(-64); // further north
|
||||||
when(blockMock.getY()).thenReturn(64); // at sea level
|
when(blockMock.getY()).thenReturn(64); // at sea level
|
||||||
@ -419,7 +461,10 @@ public class ZoneVolumeSpec {
|
|||||||
// Arrange
|
// Arrange
|
||||||
War warMock = mock(War.class);
|
War warMock = mock(War.class);
|
||||||
World worldMock = mock(World.class);
|
World worldMock = mock(World.class);
|
||||||
ZoneVolume volume = new ZoneVolume("test", warMock, worldMock);
|
Warzone zoneMock = mock(Warzone.class);
|
||||||
|
when(zoneMock.getTeams()).thenReturn(new ArrayList<Team>());
|
||||||
|
when(zoneMock.getMonuments()).thenReturn(new ArrayList<Monument>());
|
||||||
|
ZoneVolume volume = new ZoneVolume("test", warMock, worldMock, zoneMock);
|
||||||
Block blockMock = mock(Block.class);
|
Block blockMock = mock(Block.class);
|
||||||
when(blockMock.getX()).thenReturn(0);
|
when(blockMock.getX()).thenReturn(0);
|
||||||
when(blockMock.getY()).thenReturn(64); // at sea level
|
when(blockMock.getY()).thenReturn(64); // at sea level
|
||||||
@ -444,7 +489,10 @@ public class ZoneVolumeSpec {
|
|||||||
// Arrange
|
// Arrange
|
||||||
War warMock = mock(War.class);
|
War warMock = mock(War.class);
|
||||||
World worldMock = mock(World.class);
|
World worldMock = mock(World.class);
|
||||||
ZoneVolume volume = new ZoneVolume("test", warMock, worldMock);
|
Warzone zoneMock = mock(Warzone.class);
|
||||||
|
when(zoneMock.getTeams()).thenReturn(new ArrayList<Team>());
|
||||||
|
when(zoneMock.getMonuments()).thenReturn(new ArrayList<Monument>());
|
||||||
|
ZoneVolume volume = new ZoneVolume("test", warMock, worldMock, zoneMock);
|
||||||
Block blockMock = mock(Block.class);
|
Block blockMock = mock(Block.class);
|
||||||
when(blockMock.getX()).thenReturn(64); // further south
|
when(blockMock.getX()).thenReturn(64); // further south
|
||||||
when(blockMock.getY()).thenReturn(64); // at sea level
|
when(blockMock.getY()).thenReturn(64); // at sea level
|
||||||
@ -475,7 +523,10 @@ public class ZoneVolumeSpec {
|
|||||||
// Arrange
|
// Arrange
|
||||||
War warMock = mock(War.class);
|
War warMock = mock(War.class);
|
||||||
World worldMock = mock(World.class);
|
World worldMock = mock(World.class);
|
||||||
ZoneVolume volume = new ZoneVolume("test", warMock, worldMock);
|
Warzone zoneMock = mock(Warzone.class);
|
||||||
|
when(zoneMock.getTeams()).thenReturn(new ArrayList<Team>());
|
||||||
|
when(zoneMock.getMonuments()).thenReturn(new ArrayList<Monument>());
|
||||||
|
ZoneVolume volume = new ZoneVolume("test", warMock, worldMock, zoneMock);
|
||||||
Block blockMock = mock(Block.class);
|
Block blockMock = mock(Block.class);
|
||||||
when(blockMock.getX()).thenReturn(-64); // further north
|
when(blockMock.getX()).thenReturn(-64); // further north
|
||||||
when(blockMock.getY()).thenReturn(64); // at sea level
|
when(blockMock.getY()).thenReturn(64); // at sea level
|
||||||
@ -506,7 +557,10 @@ public class ZoneVolumeSpec {
|
|||||||
// Arrange
|
// Arrange
|
||||||
War warMock = mock(War.class);
|
War warMock = mock(War.class);
|
||||||
World worldMock = mock(World.class);
|
World worldMock = mock(World.class);
|
||||||
ZoneVolume volume = new ZoneVolume("test", warMock, worldMock);
|
Warzone zoneMock = mock(Warzone.class);
|
||||||
|
when(zoneMock.getTeams()).thenReturn(new ArrayList<Team>());
|
||||||
|
when(zoneMock.getMonuments()).thenReturn(new ArrayList<Monument>());
|
||||||
|
ZoneVolume volume = new ZoneVolume("test", warMock, worldMock, zoneMock);
|
||||||
Block blockMock = mock(Block.class);
|
Block blockMock = mock(Block.class);
|
||||||
when(blockMock.getX()).thenReturn(64); // further south
|
when(blockMock.getX()).thenReturn(64); // further south
|
||||||
when(blockMock.getY()).thenReturn(64); // at sea level
|
when(blockMock.getY()).thenReturn(64); // at sea level
|
||||||
@ -539,7 +593,10 @@ public class ZoneVolumeSpec {
|
|||||||
// Arrange
|
// Arrange
|
||||||
War warMock = mock(War.class);
|
War warMock = mock(War.class);
|
||||||
World worldMock = mock(World.class);
|
World worldMock = mock(World.class);
|
||||||
ZoneVolume volume = new ZoneVolume("test", warMock, worldMock);
|
Warzone zoneMock = mock(Warzone.class);
|
||||||
|
when(zoneMock.getTeams()).thenReturn(new ArrayList<Team>());
|
||||||
|
when(zoneMock.getMonuments()).thenReturn(new ArrayList<Monument>());
|
||||||
|
ZoneVolume volume = new ZoneVolume("test", warMock, worldMock, zoneMock);
|
||||||
Block blockMock = mock(Block.class);
|
Block blockMock = mock(Block.class);
|
||||||
when(blockMock.getX()).thenReturn(64); // further south
|
when(blockMock.getX()).thenReturn(64); // further south
|
||||||
when(blockMock.getY()).thenReturn(64); // at sea level
|
when(blockMock.getY()).thenReturn(64); // at sea level
|
||||||
@ -570,7 +627,10 @@ public class ZoneVolumeSpec {
|
|||||||
// Arrange
|
// Arrange
|
||||||
War warMock = mock(War.class);
|
War warMock = mock(War.class);
|
||||||
World worldMock = mock(World.class);
|
World worldMock = mock(World.class);
|
||||||
ZoneVolume volume = new ZoneVolume("test", warMock, worldMock);
|
Warzone zoneMock = mock(Warzone.class);
|
||||||
|
when(zoneMock.getTeams()).thenReturn(new ArrayList<Team>());
|
||||||
|
when(zoneMock.getMonuments()).thenReturn(new ArrayList<Monument>());
|
||||||
|
ZoneVolume volume = new ZoneVolume("test", warMock, worldMock, zoneMock);
|
||||||
Block blockMock = mock(Block.class);
|
Block blockMock = mock(Block.class);
|
||||||
when(blockMock.getX()).thenReturn(-64); // further north
|
when(blockMock.getX()).thenReturn(-64); // further north
|
||||||
when(blockMock.getY()).thenReturn(64); // at sea level
|
when(blockMock.getY()).thenReturn(64); // at sea level
|
||||||
@ -601,7 +661,10 @@ public class ZoneVolumeSpec {
|
|||||||
// Arrange
|
// Arrange
|
||||||
War warMock = mock(War.class);
|
War warMock = mock(War.class);
|
||||||
World worldMock = mock(World.class);
|
World worldMock = mock(World.class);
|
||||||
ZoneVolume volume = new ZoneVolume("test", warMock, worldMock);
|
Warzone zoneMock = mock(Warzone.class);
|
||||||
|
when(zoneMock.getTeams()).thenReturn(new ArrayList<Team>());
|
||||||
|
when(zoneMock.getMonuments()).thenReturn(new ArrayList<Monument>());
|
||||||
|
ZoneVolume volume = new ZoneVolume("test", warMock, worldMock, zoneMock);
|
||||||
Block blockMock = mock(Block.class);
|
Block blockMock = mock(Block.class);
|
||||||
when(blockMock.getX()).thenReturn(64); // further south
|
when(blockMock.getX()).thenReturn(64); // further south
|
||||||
when(blockMock.getY()).thenReturn(64); // at sea level
|
when(blockMock.getY()).thenReturn(64); // at sea level
|
||||||
@ -637,7 +700,10 @@ public class ZoneVolumeSpec {
|
|||||||
// Arrange
|
// Arrange
|
||||||
War warMock = mock(War.class);
|
War warMock = mock(War.class);
|
||||||
World worldMock = mock(World.class);
|
World worldMock = mock(World.class);
|
||||||
ZoneVolume volume = new ZoneVolume("test", warMock, worldMock);
|
Warzone zoneMock = mock(Warzone.class);
|
||||||
|
when(zoneMock.getTeams()).thenReturn(new ArrayList<Team>());
|
||||||
|
when(zoneMock.getMonuments()).thenReturn(new ArrayList<Monument>());
|
||||||
|
ZoneVolume volume = new ZoneVolume("test", warMock, worldMock, zoneMock);
|
||||||
Block blockMock = mock(Block.class);
|
Block blockMock = mock(Block.class);
|
||||||
when(blockMock.getX()).thenReturn(64); // further south
|
when(blockMock.getX()).thenReturn(64); // further south
|
||||||
when(blockMock.getY()).thenReturn(64); // at sea level
|
when(blockMock.getY()).thenReturn(64); // at sea level
|
||||||
@ -673,7 +739,10 @@ public class ZoneVolumeSpec {
|
|||||||
// Arrange
|
// Arrange
|
||||||
War warMock = mock(War.class);
|
War warMock = mock(War.class);
|
||||||
World worldMock = mock(World.class);
|
World worldMock = mock(World.class);
|
||||||
ZoneVolume volume = new ZoneVolume("test", warMock, worldMock);
|
Warzone zoneMock = mock(Warzone.class);
|
||||||
|
when(zoneMock.getTeams()).thenReturn(new ArrayList<Team>());
|
||||||
|
when(zoneMock.getMonuments()).thenReturn(new ArrayList<Monument>());
|
||||||
|
ZoneVolume volume = new ZoneVolume("test", warMock, worldMock, zoneMock);
|
||||||
Block blockMock = mock(Block.class);
|
Block blockMock = mock(Block.class);
|
||||||
when(blockMock.getX()).thenReturn(64); // further south
|
when(blockMock.getX()).thenReturn(64); // further south
|
||||||
when(blockMock.getY()).thenReturn(64); // at sea level
|
when(blockMock.getY()).thenReturn(64); // at sea level
|
||||||
@ -709,7 +778,10 @@ public class ZoneVolumeSpec {
|
|||||||
// Arrange
|
// Arrange
|
||||||
War warMock = mock(War.class);
|
War warMock = mock(War.class);
|
||||||
World worldMock = mock(World.class);
|
World worldMock = mock(World.class);
|
||||||
ZoneVolume volume = new ZoneVolume("test", warMock, worldMock);
|
Warzone zoneMock = mock(Warzone.class);
|
||||||
|
when(zoneMock.getTeams()).thenReturn(new ArrayList<Team>());
|
||||||
|
when(zoneMock.getMonuments()).thenReturn(new ArrayList<Monument>());
|
||||||
|
ZoneVolume volume = new ZoneVolume("test", warMock, worldMock, zoneMock);
|
||||||
Block blockMock = mock(Block.class);
|
Block blockMock = mock(Block.class);
|
||||||
when(blockMock.getX()).thenReturn(64); // further south
|
when(blockMock.getX()).thenReturn(64); // further south
|
||||||
when(blockMock.getY()).thenReturn(64); // at sea level
|
when(blockMock.getY()).thenReturn(64); // at sea level
|
||||||
|
Loading…
Reference in New Issue
Block a user