Warhub and lobby link gates are working and pretty.

This commit is contained in:
taoneill 2011-01-16 20:35:53 -05:00
parent 2692f7ec8e
commit 317b813c4f
5 changed files with 25 additions and 15 deletions

View File

@ -96,14 +96,14 @@ public class War extends JavaPlugin {
String command = cmd.replace("/", ""); String command = cmd.replace("/", "");
String[] arguments = null; String[] arguments = null;
// Handle both /war <command> and /<war command>. I.e. "/war zone temple" == "/zone temple" // Handle both /war <command> and /<war command>. I.e. "/war zone temple" == "/zone temple"
if((command.equals("war") || command.equals("War")) && args.length > 0) { if((command.equals("war") || command.equals("War")) && args.length > 1) {
command = args[1]; command = args[1];
arguments = new String[args.length - 2]; arguments = new String[args.length - 2];
for(int i = 2; i <= arguments.length; i++) { for(int i = 2; i <= arguments.length; i++) {
arguments[i-2] = args[i]; arguments[i-2] = args[i];
} }
} else if (command.equals("war") || command.equals("War")) { } else if (command.equals("war") || command.equals("War")) {
player.sendMessage(this.str("War is on. Plese pick your battle." + player.sendMessage(this.str("War is on. Please pick your battle. " +
"Use /warhub, /zones and /zone.")); "Use /warhub, /zones and /zone."));
} else { } else {
arguments = new String[args.length - 1]; arguments = new String[args.length - 1];

View File

@ -166,6 +166,7 @@ public class WarPlayerListener extends PlayerListener {
} else if (zone.getLobby().isInWarHubLinkGate(to)){ } else if (zone.getLobby().isInWarHubLinkGate(to)){
dropFromOldTeamIfAny(player); dropFromOldTeamIfAny(player);
event.setTo(war.getWarHub().getLocation()); event.setTo(war.getWarHub().getLocation());
player.sendMessage(war.str("Welcome to the War hub."));
} }
} else if(war.inAnyWarzone(event.getFrom())) { // already in a team and in warzone, leaving } else if(war.inAnyWarzone(event.getFrom())) { // already in a team and in warzone, leaving
if(zone.getLobby().isAutoAssignGate(to) if(zone.getLobby().isAutoAssignGate(to)

View File

@ -61,19 +61,24 @@ public class WarHub {
if(noOfWarzones > 0) { if(noOfWarzones > 0) {
int hubWidth = noOfWarzones * 4 + 1; int hubWidth = noOfWarzones * 4 + 1;
int halfHubWidth = hubWidth / 2; int halfHubWidth = hubWidth / 2;
int hubDepth = 5; int hubDepth = 6;
int hubHeigth = 4; int hubHeigth = 4;
Block locationBlock = location.getWorld().getBlockAt(location.getBlockX(), location.getBlockY(), location.getBlockZ()); Block locationBlock = location.getWorld().getBlockAt(location.getBlockX(), location.getBlockY(), location.getBlockZ());
volume.setCornerOne(locationBlock.getFace(BlockFace.SOUTH, halfHubWidth).getFace(BlockFace.DOWN)); volume.setCornerOne(locationBlock.getFace(BlockFace.EAST).getFace(BlockFace.SOUTH, halfHubWidth).getFace(BlockFace.DOWN));
volume.setCornerTwo(locationBlock.getFace(BlockFace.NORTH, halfHubWidth).getFace(BlockFace.WEST, hubDepth).getFace(BlockFace.NORTH, hubHeigth)); volume.setCornerTwo(locationBlock.getFace(BlockFace.NORTH, halfHubWidth).getFace(BlockFace.WEST, hubDepth).getFace(BlockFace.UP, hubHeigth));
volume.saveBlocks(); volume.saveBlocks();
// glass floor
volume.setToMaterial(Material.AIR);
volume.setFaceMaterial(BlockFace.DOWN, Material.GLASS);
// draw gates // draw gates
Block currentGateBlock = locationBlock.getFace(BlockFace.SOUTH, halfHubWidth - 2).getFace(BlockFace.WEST, hubDepth); Block currentGateBlock = volume.getCornerOne().getFace(BlockFace.UP).getFace(BlockFace.WEST, hubDepth).getFace(BlockFace.NORTH, 2);
for(int i = 0;i < war.getWarzones().size(); i++) { // gonna use the index to find it again for(int i = 0;i < war.getWarzones().size(); i++) { // gonna use the index to find it again
zoneGateBlocks.add(0, currentGateBlock); zoneGateBlocks.add(0, currentGateBlock);
currentGateBlock.getFace(BlockFace.DOWN).setType(Material.GLOWSTONE);
currentGateBlock.setType(Material.PORTAL); currentGateBlock.setType(Material.PORTAL);
currentGateBlock.getFace(BlockFace.UP).setType(Material.PORTAL); currentGateBlock.getFace(BlockFace.UP).setType(Material.PORTAL);
currentGateBlock.getFace(BlockFace.SOUTH).setType(Material.OBSIDIAN); currentGateBlock.getFace(BlockFace.SOUTH).setType(Material.OBSIDIAN);

View File

@ -163,15 +163,11 @@ public class ZoneLobby {
// lets get some light in here // lets get some light in here
if(wall == BlockFace.NORTH || wall == BlockFace.SOUTH) { if(wall == BlockFace.NORTH || wall == BlockFace.SOUTH) {
lobbyMiddleWallBlock.getFace(BlockFace.DOWN).getFace(BlockFace.WEST, lobbyHalfSide - 1).getFace(wall, 3).setType(Material.GLOWSTONE); lobbyMiddleWallBlock.getFace(BlockFace.DOWN).getFace(BlockFace.WEST, lobbyHalfSide - 1).getFace(wall, 9).setType(Material.GLOWSTONE);
lobbyMiddleWallBlock.getFace(BlockFace.DOWN).getFace(BlockFace.WEST, lobbyHalfSide - 1).getFace(wall, 7).setType(Material.GLOWSTONE); lobbyMiddleWallBlock.getFace(BlockFace.DOWN).getFace(BlockFace.EAST, lobbyHalfSide - 1).getFace(wall, 9).setType(Material.GLOWSTONE);
lobbyMiddleWallBlock.getFace(BlockFace.DOWN).getFace(BlockFace.EAST, lobbyHalfSide - 1).getFace(wall, 3).setType(Material.GLOWSTONE);
lobbyMiddleWallBlock.getFace(BlockFace.DOWN).getFace(BlockFace.EAST, lobbyHalfSide - 1).getFace(wall, 7).setType(Material.GLOWSTONE);
} else { } else {
lobbyMiddleWallBlock.getFace(BlockFace.DOWN).getFace(BlockFace.NORTH, lobbyHalfSide - 1).getFace(wall, 3).setType(Material.GLOWSTONE); lobbyMiddleWallBlock.getFace(BlockFace.DOWN).getFace(BlockFace.NORTH, lobbyHalfSide - 1).getFace(wall, 9).setType(Material.GLOWSTONE);
lobbyMiddleWallBlock.getFace(BlockFace.DOWN).getFace(BlockFace.NORTH, lobbyHalfSide - 1).getFace(wall, 7).setType(Material.GLOWSTONE); lobbyMiddleWallBlock.getFace(BlockFace.DOWN).getFace(BlockFace.SOUTH, lobbyHalfSide - 1).getFace(wall, 9).setType(Material.GLOWSTONE);
lobbyMiddleWallBlock.getFace(BlockFace.DOWN).getFace(BlockFace.SOUTH, lobbyHalfSide - 1).getFace(wall, 3).setType(Material.GLOWSTONE);
lobbyMiddleWallBlock.getFace(BlockFace.DOWN).getFace(BlockFace.SOUTH, lobbyHalfSide - 1).getFace(wall, 7).setType(Material.GLOWSTONE);
} }
} else { } else {
war.getLogger().warning("Failed to initalize zone " + warzone.getName()); war.getLogger().warning("Failed to initalize zone " + warzone.getName());
@ -233,7 +229,7 @@ public class ZoneLobby {
ironGate = lobbyMiddleWallBlock; ironGate = lobbyMiddleWallBlock;
goldGate = lobbyMiddleWallBlock.getFace(rightSide, 4); goldGate = lobbyMiddleWallBlock.getFace(rightSide, 4);
} }
warHubLinkGate = lobbyMiddleWallBlock.getFace(wall, 8); warHubLinkGate = lobbyMiddleWallBlock.getFace(wall, 9);
} }
private void placeGate(Block block, private void placeGate(Block block,
@ -254,6 +250,7 @@ public class ZoneLobby {
leftSide = BlockFace.NORTH; leftSide = BlockFace.NORTH;
rightSide = BlockFace.SOUTH; rightSide = BlockFace.SOUTH;
} }
block.getFace(BlockFace.DOWN).setType(Material.GLOWSTONE);
block.setType(Material.PORTAL); block.setType(Material.PORTAL);
block.getFace(BlockFace.UP).setType(Material.PORTAL); block.getFace(BlockFace.UP).setType(Material.PORTAL);
block.getFace(leftSide).setType(teamMaterial); block.getFace(leftSide).setType(teamMaterial);

View File

@ -111,6 +111,13 @@ public class WarMapper {
hub.setVolume(vol); hub.setVolume(vol);
hub.getVolume().resetBlocks(); hub.getVolume().resetBlocks();
hub.initialize(); hub.initialize();
for(Warzone zone : war.getWarzones()) {
if(zone.getLobby() != null) {
zone.getLobby().initialize(); // adds the warhub link gate
}
}
} }
warConfig.close(); warConfig.close();