mirror of
https://github.com/taoneill/war.git
synced 2024-11-23 18:55:28 +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) {
|
||||
warzone.getLobby().getVolume().resetBlocks();
|
||||
warzone.getVolume().resetWallBlocks(warzone.getLobby().getWall());
|
||||
warzone.addZoneOutline(warzone.getLobby().getWall());
|
||||
//warzone.addZoneOutline(warzone.getLobby().getWall());
|
||||
warzone.getLobby().initialize();
|
||||
}
|
||||
WarzoneMapper.save(this, warzone, false);
|
||||
@ -514,7 +514,7 @@ public class War extends JavaPlugin {
|
||||
if(warzone.getLobby() != null) {
|
||||
warzone.getLobby().getVolume().resetBlocks();
|
||||
warzone.getVolume().resetWallBlocks(warzone.getLobby().getWall());
|
||||
warzone.addZoneOutline(warzone.getLobby().getWall());
|
||||
//warzone.addZoneOutline(warzone.getLobby().getWall());
|
||||
warzone.getLobby().initialize();
|
||||
}
|
||||
newTeam.setTeamSpawn(player.getLocation());
|
||||
@ -707,7 +707,7 @@ public class War extends JavaPlugin {
|
||||
if(lobby != null) {
|
||||
// reset existing lobby
|
||||
lobby.getVolume().resetBlocks();
|
||||
lobby.changeWall(wall);
|
||||
lobby.setWall(wall);
|
||||
lobby.initialize();
|
||||
this.msg(player, "Warzone lobby moved to " + wallStr + " side of zone.");
|
||||
} else {
|
||||
|
@ -54,8 +54,8 @@ public class WarBlockListener extends BlockListener {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(zone != null && zone.isImportantBlock(block)){
|
||||
boolean isZoneMaker = war.isZoneMaker(player);
|
||||
if(zone != null && zone.isImportantBlock(block) && (!isZoneMaker || (isZoneMaker && team != null))) {
|
||||
war.badMsg(player, "Can't build here.");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
@ -96,8 +96,7 @@ public class WarBlockListener extends BlockListener {
|
||||
event.setCancelled(true);
|
||||
|
||||
}
|
||||
|
||||
boolean isZoneMaker = war.isZoneMaker(player);
|
||||
|
||||
// unbreakableZoneBlocks
|
||||
if(zone != null && zone.isUnbreakableZoneBlocks()
|
||||
&& (!isZoneMaker
|
||||
|
@ -75,7 +75,7 @@ public class Warzone {
|
||||
this.setDropLootOnDeath(war.isDefaultDropLootOnDeath());
|
||||
this.setUnbreakableZoneBlocks(war.isDefaultUnbreakableZoneBlocks());
|
||||
this.setNoCreatures(war.getDefaultNoCreatures());
|
||||
this.volume = new ZoneVolume(name, war, this.getWorld());
|
||||
this.volume = new ZoneVolume(name, war, this.getWorld(), this);
|
||||
}
|
||||
|
||||
public boolean ready() {
|
||||
@ -181,12 +181,12 @@ public class Warzone {
|
||||
|
||||
private void initZone() {
|
||||
// add wall outlines
|
||||
if(isDrawZoneOutline()) {
|
||||
addZoneOutline(BlockFace.NORTH);
|
||||
addZoneOutline(BlockFace.EAST);
|
||||
addZoneOutline(BlockFace.SOUTH);
|
||||
addZoneOutline(BlockFace.WEST);
|
||||
}
|
||||
// if(isDrawZoneOutline()) {
|
||||
// addZoneOutline(BlockFace.NORTH);
|
||||
// addZoneOutline(BlockFace.EAST);
|
||||
// addZoneOutline(BlockFace.SOUTH);
|
||||
// addZoneOutline(BlockFace.WEST);
|
||||
// }
|
||||
|
||||
// reset monuments
|
||||
for(Monument monument : monuments) {
|
||||
@ -194,7 +194,7 @@ public class Warzone {
|
||||
monument.addMonumentBlocks();
|
||||
}
|
||||
|
||||
// reset lobby
|
||||
// reset lobby (here be demons)
|
||||
if(lobby != null) {
|
||||
lobby.initialize();
|
||||
}
|
||||
@ -202,75 +202,75 @@ public class Warzone {
|
||||
this.flagThieves.clear();
|
||||
}
|
||||
|
||||
public void addZoneOutline(BlockFace wall) {
|
||||
int c1maxY = world.getHighestBlockYAt(volume.getMinX(), volume.getMinZ());
|
||||
int c2maxY = world.getHighestBlockYAt(volume.getMaxX(), volume.getMaxZ());
|
||||
Block ne = world.getBlockAt(volume.getMinX(), c1maxY, volume.getMinZ());
|
||||
Block nw = world.getBlockAt(volume.getMinX(), c2maxY, volume.getMaxZ());
|
||||
Block se = world.getBlockAt(volume.getMaxX(), c2maxY, volume.getMinZ());
|
||||
Block lastBlock = null;
|
||||
if(BlockFace.NORTH == wall) {
|
||||
for(int z = volume.getMinZ(); z < volume.getMaxZ(); z++) {
|
||||
lastBlock = highestBlockToGlass(ne.getX(), z, lastBlock);
|
||||
}
|
||||
} else if (BlockFace.EAST == wall) {
|
||||
for(int x = volume.getMinX(); x < volume.getMaxX(); x++) {
|
||||
lastBlock = highestBlockToGlass(x, ne.getZ(), lastBlock);
|
||||
}
|
||||
} else if (BlockFace.SOUTH == wall) {
|
||||
for(int z = volume.getMinZ(); z < volume.getMaxZ(); z++) {
|
||||
lastBlock = highestBlockToGlass(se.getX(), z, lastBlock);
|
||||
}
|
||||
} else if (BlockFace.WEST == wall) {
|
||||
for(int x = volume.getMinX(); x < volume.getMaxX(); x++) {
|
||||
lastBlock = highestBlockToGlass(x, nw.getZ(), lastBlock);
|
||||
}
|
||||
}
|
||||
}
|
||||
// public void addZoneOutline(BlockFace wall) {
|
||||
// int c1maxY = world.getHighestBlockYAt(volume.getMinX(), volume.getMinZ());
|
||||
// int c2maxY = world.getHighestBlockYAt(volume.getMaxX(), volume.getMaxZ());
|
||||
// Block ne = world.getBlockAt(volume.getMinX(), c1maxY, volume.getMinZ());
|
||||
// Block nw = world.getBlockAt(volume.getMinX(), c2maxY, volume.getMaxZ());
|
||||
// Block se = world.getBlockAt(volume.getMaxX(), c2maxY, volume.getMinZ());
|
||||
// Block lastBlock = null;
|
||||
// if(BlockFace.NORTH == wall) {
|
||||
// for(int z = volume.getMinZ(); z < volume.getMaxZ(); z++) {
|
||||
// lastBlock = highestBlockToGlass(ne.getX(), z, lastBlock);
|
||||
// }
|
||||
// } else if (BlockFace.EAST == wall) {
|
||||
// for(int x = volume.getMinX(); x < volume.getMaxX(); x++) {
|
||||
// lastBlock = highestBlockToGlass(x, ne.getZ(), lastBlock);
|
||||
// }
|
||||
// } else if (BlockFace.SOUTH == wall) {
|
||||
// for(int z = volume.getMinZ(); z < volume.getMaxZ(); z++) {
|
||||
// lastBlock = highestBlockToGlass(se.getX(), z, lastBlock);
|
||||
// }
|
||||
// } else if (BlockFace.WEST == wall) {
|
||||
// for(int x = volume.getMinX(); x < volume.getMaxX(); x++) {
|
||||
// lastBlock = highestBlockToGlass(x, nw.getZ(), lastBlock);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
private Block highestBlockToGlass(int x, int z, Block lastBlock) {
|
||||
int highest = world.getHighestBlockYAt(x, z);
|
||||
Block block = world.getBlockAt(x, highest -1 , z);
|
||||
|
||||
if(block.getType() == Material.LEAVES) { // top of tree, lets find some dirt/ground
|
||||
Block over = block.getFace(BlockFace.DOWN);
|
||||
Block under = over.getFace(BlockFace.DOWN);
|
||||
int treeHeight = 0;
|
||||
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.WOOD && under.getType() != Material.WOOD && under.getType() != Material.AIR))
|
||||
&& treeHeight < 40) {
|
||||
over = under;
|
||||
if(over.getY() <= 0) break; // reached bottom
|
||||
under = over.getFace(BlockFace.DOWN);
|
||||
treeHeight++;
|
||||
}
|
||||
block = under; // found the ground
|
||||
}
|
||||
|
||||
block.setType(Material.GLASS);
|
||||
|
||||
if(lastBlock != null) {
|
||||
// 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
|
||||
Block under = block.getFace(BlockFace.DOWN);
|
||||
while(under.getY() != lastBlock.getY() - 1) {
|
||||
under.setType(Material.GLASS);
|
||||
if(under.getY() <= 0) break; // reached bottom
|
||||
under = under.getFace(BlockFace.DOWN);
|
||||
}
|
||||
} else if (lastBlock.getY() - block.getY() > 1) { // new block too low
|
||||
Block over = block.getFace(BlockFace.UP);
|
||||
while(over.getY() != lastBlock.getY() + 1) {
|
||||
over.setType(Material.GLASS);
|
||||
if(over.getY() >= 127) break;
|
||||
over = over.getFace(BlockFace.UP);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return block;
|
||||
}
|
||||
// private Block highestBlockToGlass(int x, int z, Block lastBlock) {
|
||||
// int highest = world.getHighestBlockYAt(x, z);
|
||||
// Block block = world.getBlockAt(x, highest -1 , z);
|
||||
//
|
||||
// if(block.getType() == Material.LEAVES) { // top of tree, lets find some dirt/ground
|
||||
// Block over = block.getFace(BlockFace.DOWN);
|
||||
// Block under = over.getFace(BlockFace.DOWN);
|
||||
// int treeHeight = 0;
|
||||
// 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.WOOD && under.getType() != Material.WOOD && under.getType() != Material.AIR))
|
||||
// && treeHeight < 40) {
|
||||
// over = under;
|
||||
// if(over.getY() <= 0) break; // reached bottom
|
||||
// under = over.getFace(BlockFace.DOWN);
|
||||
// treeHeight++;
|
||||
// }
|
||||
// block = under; // found the ground
|
||||
// }
|
||||
//
|
||||
// block.setType(Material.GLASS);
|
||||
//
|
||||
// if(lastBlock != null) {
|
||||
// // 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
|
||||
// Block under = block.getFace(BlockFace.DOWN);
|
||||
// while(under.getY() != lastBlock.getY() - 1) {
|
||||
// under.setType(Material.GLASS);
|
||||
// if(under.getY() <= 0) break; // reached bottom
|
||||
// under = under.getFace(BlockFace.DOWN);
|
||||
// }
|
||||
// } else if (lastBlock.getY() - block.getY() > 1) { // new block too low
|
||||
// Block over = block.getFace(BlockFace.UP);
|
||||
// while(over.getY() != lastBlock.getY() + 1) {
|
||||
// over.setType(Material.GLASS);
|
||||
// if(over.getY() >= 127) break;
|
||||
// over = over.getFace(BlockFace.UP);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return block;
|
||||
// }
|
||||
|
||||
public void endRound() {
|
||||
|
||||
@ -726,9 +726,9 @@ public class Warzone {
|
||||
playerGuards.add(guard);
|
||||
BlockFace guardWall = guard.getWall();
|
||||
getVolume().resetWallBlocks(guardWall);
|
||||
if(isDrawZoneOutline()) {
|
||||
addZoneOutline(guard.getWall());
|
||||
}
|
||||
// if(isDrawZoneOutline()) {
|
||||
// addZoneOutline(guard.getWall());
|
||||
// }
|
||||
if(lobby != null) {
|
||||
lobby.getVolume().resetBlocks(); // always reset the lobby even if the guard is on another wall
|
||||
// because player can go around corner
|
||||
|
@ -31,9 +31,6 @@ public class ZoneLobby {
|
||||
BlockInfo warHubLinkGate = null;
|
||||
|
||||
Map<String, BlockInfo> teamGateBlocks = new HashMap<String, BlockInfo>();
|
||||
// Block diamondGate = null;
|
||||
// Block ironGate = null;
|
||||
// Block goldGate = null;
|
||||
BlockInfo autoAssignGate = null;
|
||||
|
||||
BlockInfo zoneTeleportBlock = null;
|
||||
@ -50,7 +47,8 @@ public class ZoneLobby {
|
||||
if(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) {
|
||||
if(volume == null) {
|
||||
// no previous wall
|
||||
@ -106,51 +108,42 @@ public class ZoneLobby {
|
||||
int x = zoneVolume.getMinX();
|
||||
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.getVolume().getCenterY();
|
||||
lobbyMiddleWallBlock = new BlockInfo(warzone.getWorld().getBlockAt(x, highestNonAirBlockAtCenter, wallCenterPos));
|
||||
corner1 = warzone.getWorld().getBlockAt(x, highestNonAirBlockAtCenter - 1, wallCenterPos + lobbyHalfSide);
|
||||
corner2 = warzone.getWorld().getBlockAt(x - lobbyDepth,
|
||||
highestNonAirBlockAtCenter + 1 + lobbyHeight, wallCenterPos - lobbyHalfSide);
|
||||
int y = zoneVolume.getCenterY();
|
||||
lobbyMiddleWallBlock = new BlockInfo(warzone.getWorld().getBlockAt(x, y, wallCenterPos));
|
||||
corner1 = warzone.getWorld().getBlockAt(x, y - 1, wallCenterPos + lobbyHalfSide);
|
||||
corner2 = warzone.getWorld().getBlockAt(x - lobbyDepth, y + 1 + lobbyHeight, wallCenterPos - lobbyHalfSide);
|
||||
} else if (wall == BlockFace.EAST){
|
||||
int wallStart = zoneVolume.getMinX();
|
||||
int wallEnd = zoneVolume.getMaxX();
|
||||
int z = zoneVolume.getMinZ();
|
||||
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.getVolume().getCenterY();
|
||||
lobbyMiddleWallBlock = new BlockInfo(warzone.getWorld().getBlockAt(wallCenterPos, highestNonAirBlockAtCenter, z));
|
||||
corner1 = warzone.getWorld().getBlockAt(wallCenterPos - lobbyHalfSide, highestNonAirBlockAtCenter - 1, z);
|
||||
int y = zoneVolume.getCenterY();
|
||||
lobbyMiddleWallBlock = new BlockInfo(warzone.getWorld().getBlockAt(wallCenterPos, y, z));
|
||||
corner1 = warzone.getWorld().getBlockAt(wallCenterPos - lobbyHalfSide, y - 1, z);
|
||||
corner2 = warzone.getWorld().getBlockAt(wallCenterPos + lobbyHalfSide,
|
||||
highestNonAirBlockAtCenter + 1 + lobbyHeight, z - lobbyDepth);
|
||||
y + 1 + lobbyHeight, z - lobbyDepth);
|
||||
} else if (wall == BlockFace.SOUTH){
|
||||
int wallStart = zoneVolume.getMinZ();
|
||||
int wallEnd = zoneVolume.getMaxZ();
|
||||
int x = zoneVolume.getMaxX();
|
||||
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.getVolume().getCenterY();
|
||||
lobbyMiddleWallBlock = new BlockInfo(warzone.getWorld().getBlockAt(x, highestNonAirBlockAtCenter, wallCenterPos));
|
||||
corner1 = warzone.getWorld().getBlockAt(x, highestNonAirBlockAtCenter -1 , wallCenterPos - lobbyHalfSide);
|
||||
int y = zoneVolume.getCenterY();
|
||||
lobbyMiddleWallBlock = new BlockInfo(warzone.getWorld().getBlockAt(x, y, wallCenterPos));
|
||||
corner1 = warzone.getWorld().getBlockAt(x, y -1 , wallCenterPos - lobbyHalfSide);
|
||||
corner2 = warzone.getWorld().getBlockAt(x + lobbyDepth,
|
||||
highestNonAirBlockAtCenter + 1 + lobbyHeight, wallCenterPos + lobbyHalfSide);
|
||||
y + 1 + lobbyHeight, wallCenterPos + lobbyHalfSide);
|
||||
} else if (wall == BlockFace.WEST){
|
||||
int wallStart = zoneVolume.getMinX();
|
||||
int wallEnd = zoneVolume.getMaxX();
|
||||
int z = zoneVolume.getMaxZ();
|
||||
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.getVolume().getCenterY();
|
||||
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);
|
||||
int y = zoneVolume.getCenterY();
|
||||
lobbyMiddleWallBlock = new BlockInfo(warzone.getWorld().getBlockAt(wallCenterPos, y, z));
|
||||
corner1 = warzone.getWorld().getBlockAt(wallCenterPos + lobbyHalfSide, y - 1, z);
|
||||
corner2 = warzone.getWorld().getBlockAt(wallCenterPos - lobbyHalfSide, y + 1 + lobbyHeight, z + lobbyDepth);
|
||||
}
|
||||
|
||||
if(corner1 != null && corner2 != null) {
|
||||
@ -163,7 +156,7 @@ public class ZoneLobby {
|
||||
}
|
||||
|
||||
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
|
||||
setGatePositions(BlockInfo.getBlock(warzone.getWorld(), lobbyMiddleWallBlock));
|
||||
@ -193,9 +186,6 @@ public class ZoneLobby {
|
||||
BlockInfo gateInfo = teamGateBlocks.get(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()) {
|
||||
resetTeamGateSign(t);
|
||||
}
|
||||
@ -249,12 +239,6 @@ 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());
|
||||
// }
|
||||
}
|
||||
|
||||
private void setGatePositions(Block lobbyMiddleWallBlock) {
|
||||
|
@ -163,7 +163,7 @@ public class ZoneSetter {
|
||||
}
|
||||
|
||||
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() {
|
||||
@ -191,13 +191,20 @@ public class ZoneSetter {
|
||||
war.getWarHub().initialize();
|
||||
}
|
||||
war.msg(player, "Default lobby created on south side of zone. Use /setzonelobby <n/s/e/w> to change its position.");
|
||||
} else {
|
||||
// gotta move the lobby
|
||||
warzone.getLobby().changeWall(warzone.getLobby().getWall());
|
||||
}
|
||||
} //else {
|
||||
// gotta move the lobby (or dont because zone.initzon does it for you)
|
||||
//warzone.getLobby().changeWall(warzone.getLobby().getWall());
|
||||
//}
|
||||
warzone.initializeZone();
|
||||
WarzoneMapper.save(war, warzone, true);
|
||||
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 {
|
||||
}
|
||||
}
|
||||
}
|
||||
war.logInfo("Warzones ready.");
|
||||
if(war.getWarzones().size() > 0) {
|
||||
war.logInfo("Warzones ready.");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ import org.bukkit.material.MaterialData;
|
||||
|
||||
import bukkit.tommytony.war.War;
|
||||
|
||||
import com.tommytony.war.Warzone;
|
||||
import com.tommytony.war.volumes.Volume;
|
||||
import com.tommytony.war.volumes.ZoneVolume;
|
||||
|
||||
@ -34,8 +35,8 @@ public class VolumeMapper {
|
||||
}
|
||||
|
||||
public static ZoneVolume loadZoneVolume(String volumeName, String zoneName,
|
||||
War war, World world) {
|
||||
ZoneVolume volume = new ZoneVolume(volumeName, war, world);
|
||||
War war, World world, Warzone zone) {
|
||||
ZoneVolume volume = new ZoneVolume(volumeName, war, world, zone);
|
||||
load(volume, zoneName, war, world);
|
||||
return volume;
|
||||
}
|
||||
|
@ -242,7 +242,7 @@ public class WarzoneMapper {
|
||||
if(loadBlocks) {
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,10 @@ import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
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;
|
||||
|
||||
/**
|
||||
@ -14,8 +18,11 @@ import bukkit.tommytony.war.War;
|
||||
*/
|
||||
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);
|
||||
this.zone = zone;
|
||||
}
|
||||
|
||||
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
|
||||
maxZBlock.setZ(block.getZ());
|
||||
}
|
||||
if(tooSmall()) {
|
||||
if(tooSmall() || zoneStructuresAreOutside()) {
|
||||
super.setCornerOne(oldCornerOne);
|
||||
super.setCornerTwo(oldCornerTwo);
|
||||
throw new TooSmallException();
|
||||
@ -107,7 +114,7 @@ public class ZoneVolume extends Volume {
|
||||
BlockInfo minZBlock = getMinZBlock(); // east means min Z
|
||||
minZBlock.setZ(block.getZ());
|
||||
}
|
||||
if(tooSmall()) {
|
||||
if(tooSmall() || zoneStructuresAreOutside()) {
|
||||
super.setCornerOne(oldCornerOne);
|
||||
super.setCornerTwo(oldCornerTwo);
|
||||
throw new TooSmallException();
|
||||
@ -137,14 +144,13 @@ public class ZoneVolume extends Volume {
|
||||
if(!hasTwoCorners())
|
||||
return 0;
|
||||
else
|
||||
return (getMaxY() - getMinY())/2;
|
||||
|
||||
return getMinY() + (getMaxY() - getMinY())/2;
|
||||
}
|
||||
|
||||
public void setZoneCornerOne(Block block) throws TooSmallException, TooBigException {
|
||||
BlockInfo oldCornerOne = getCornerOne();
|
||||
super.setCornerOne(block);
|
||||
if(tooSmall()) {
|
||||
if(tooSmall() || zoneStructuresAreOutside()) {
|
||||
super.setCornerOne(oldCornerOne);
|
||||
throw new TooSmallException();
|
||||
} else if (tooBig()) {
|
||||
@ -156,7 +162,7 @@ public class ZoneVolume extends Volume {
|
||||
public void setZoneCornerTwo(Block block) throws TooSmallException, TooBigException {
|
||||
BlockInfo oldCornerTwo = getCornerTwo();
|
||||
super.setCornerTwo(block);
|
||||
if(tooSmall()) {
|
||||
if(tooSmall() || zoneStructuresAreOutside()) {
|
||||
super.setCornerTwo(oldCornerTwo);
|
||||
throw new TooSmallException();
|
||||
} else if (tooBig()) {
|
||||
@ -179,6 +185,42 @@ public class ZoneVolume extends Volume {
|
||||
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){
|
||||
return isEastWallBlock(block) || isNorthWallBlock(block)
|
||||
|| isSouthWallBlock(block) || isWestWallBlock(block)
|
||||
|
@ -1,5 +1,8 @@
|
||||
package com.tommytony.war.spec.volumes;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.junit.Test;
|
||||
@ -9,6 +12,9 @@ import static org.mockito.Mockito.*;
|
||||
|
||||
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.NotNorthwestException;
|
||||
import com.tommytony.war.volumes.NotSoutheastException;
|
||||
@ -25,7 +31,10 @@ public class ZoneVolumeSpec {
|
||||
// Arrange
|
||||
War warMock = mock(War.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);
|
||||
when(blockMock.getX()).thenReturn(0);
|
||||
when(blockMock.getY()).thenReturn(64); // at sea level
|
||||
@ -50,7 +59,10 @@ public class ZoneVolumeSpec {
|
||||
// Arrange
|
||||
War warMock = mock(War.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);
|
||||
when(blockMock.getX()).thenReturn(-64); // further north
|
||||
when(blockMock.getY()).thenReturn(64); // at sea level
|
||||
@ -81,7 +93,10 @@ public class ZoneVolumeSpec {
|
||||
// Arrange
|
||||
War warMock = mock(War.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);
|
||||
when(blockMock.getX()).thenReturn(64); // further south
|
||||
when(blockMock.getY()).thenReturn(64); // at sea level
|
||||
@ -112,7 +127,10 @@ public class ZoneVolumeSpec {
|
||||
// Arrange
|
||||
War warMock = mock(War.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);
|
||||
when(blockMock.getX()).thenReturn(-5); // further south
|
||||
when(blockMock.getY()).thenReturn(64); // at sea level
|
||||
@ -143,7 +161,10 @@ public class ZoneVolumeSpec {
|
||||
// Arrange
|
||||
War warMock = mock(War.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);
|
||||
when(blockMock.getX()).thenReturn(-1000); // further south
|
||||
when(blockMock.getY()).thenReturn(64); // at sea level
|
||||
@ -174,7 +195,10 @@ public class ZoneVolumeSpec {
|
||||
// Arrange
|
||||
War warMock = mock(War.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);
|
||||
when(blockMock.getX()).thenReturn(-64); // further north
|
||||
when(blockMock.getY()).thenReturn(64); // at sea level
|
||||
@ -207,7 +231,10 @@ public class ZoneVolumeSpec {
|
||||
// Arrange
|
||||
War warMock = mock(War.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);
|
||||
when(blockMock.getX()).thenReturn(-64); // further north
|
||||
when(blockMock.getY()).thenReturn(64); // at sea level
|
||||
@ -238,7 +265,10 @@ public class ZoneVolumeSpec {
|
||||
// Arrange
|
||||
War warMock = mock(War.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);
|
||||
when(blockMock.getX()).thenReturn(64); // further south
|
||||
when(blockMock.getY()).thenReturn(64); // at sea level
|
||||
@ -269,7 +299,10 @@ public class ZoneVolumeSpec {
|
||||
// Arrange
|
||||
War warMock = mock(War.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);
|
||||
when(blockMock.getX()).thenReturn(-64); // further north
|
||||
when(blockMock.getY()).thenReturn(64); // at sea level
|
||||
@ -305,7 +338,10 @@ public class ZoneVolumeSpec {
|
||||
// Arrange
|
||||
War warMock = mock(War.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);
|
||||
when(blockMock.getX()).thenReturn(-64); // further north
|
||||
when(blockMock.getY()).thenReturn(64); // at sea level
|
||||
@ -341,7 +377,10 @@ public class ZoneVolumeSpec {
|
||||
// Arrange
|
||||
War warMock = mock(War.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);
|
||||
when(blockMock.getX()).thenReturn(-64); // further north
|
||||
when(blockMock.getY()).thenReturn(64); // at sea level
|
||||
@ -377,7 +416,10 @@ public class ZoneVolumeSpec {
|
||||
// Arrange
|
||||
War warMock = mock(War.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);
|
||||
when(blockMock.getX()).thenReturn(-64); // further north
|
||||
when(blockMock.getY()).thenReturn(64); // at sea level
|
||||
@ -419,7 +461,10 @@ public class ZoneVolumeSpec {
|
||||
// Arrange
|
||||
War warMock = mock(War.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);
|
||||
when(blockMock.getX()).thenReturn(0);
|
||||
when(blockMock.getY()).thenReturn(64); // at sea level
|
||||
@ -444,7 +489,10 @@ public class ZoneVolumeSpec {
|
||||
// Arrange
|
||||
War warMock = mock(War.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);
|
||||
when(blockMock.getX()).thenReturn(64); // further south
|
||||
when(blockMock.getY()).thenReturn(64); // at sea level
|
||||
@ -475,7 +523,10 @@ public class ZoneVolumeSpec {
|
||||
// Arrange
|
||||
War warMock = mock(War.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);
|
||||
when(blockMock.getX()).thenReturn(-64); // further north
|
||||
when(blockMock.getY()).thenReturn(64); // at sea level
|
||||
@ -506,7 +557,10 @@ public class ZoneVolumeSpec {
|
||||
// Arrange
|
||||
War warMock = mock(War.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);
|
||||
when(blockMock.getX()).thenReturn(64); // further south
|
||||
when(blockMock.getY()).thenReturn(64); // at sea level
|
||||
@ -539,7 +593,10 @@ public class ZoneVolumeSpec {
|
||||
// Arrange
|
||||
War warMock = mock(War.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);
|
||||
when(blockMock.getX()).thenReturn(64); // further south
|
||||
when(blockMock.getY()).thenReturn(64); // at sea level
|
||||
@ -570,7 +627,10 @@ public class ZoneVolumeSpec {
|
||||
// Arrange
|
||||
War warMock = mock(War.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);
|
||||
when(blockMock.getX()).thenReturn(-64); // further north
|
||||
when(blockMock.getY()).thenReturn(64); // at sea level
|
||||
@ -601,7 +661,10 @@ public class ZoneVolumeSpec {
|
||||
// Arrange
|
||||
War warMock = mock(War.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);
|
||||
when(blockMock.getX()).thenReturn(64); // further south
|
||||
when(blockMock.getY()).thenReturn(64); // at sea level
|
||||
@ -637,7 +700,10 @@ public class ZoneVolumeSpec {
|
||||
// Arrange
|
||||
War warMock = mock(War.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);
|
||||
when(blockMock.getX()).thenReturn(64); // further south
|
||||
when(blockMock.getY()).thenReturn(64); // at sea level
|
||||
@ -673,7 +739,10 @@ public class ZoneVolumeSpec {
|
||||
// Arrange
|
||||
War warMock = mock(War.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);
|
||||
when(blockMock.getX()).thenReturn(64); // further south
|
||||
when(blockMock.getY()).thenReturn(64); // at sea level
|
||||
@ -709,7 +778,10 @@ public class ZoneVolumeSpec {
|
||||
// Arrange
|
||||
War warMock = mock(War.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);
|
||||
when(blockMock.getX()).thenReturn(64); // further south
|
||||
when(blockMock.getY()).thenReturn(64); // at sea level
|
||||
|
Loading…
Reference in New Issue
Block a user