From 317b813c4fe70eb11a44e2662440caeb3f393747 Mon Sep 17 00:00:00 2001 From: taoneill Date: Sun, 16 Jan 2011 20:35:53 -0500 Subject: [PATCH] Warhub and lobby link gates are working and pretty. --- war/src/main/java/bukkit/tommytony/war/War.java | 4 ++-- .../bukkit/tommytony/war/WarPlayerListener.java | 1 + war/src/main/java/com/tommytony/war/WarHub.java | 13 +++++++++---- .../main/java/com/tommytony/war/ZoneLobby.java | 15 ++++++--------- .../java/com/tommytony/war/mappers/WarMapper.java | 7 +++++++ 5 files changed, 25 insertions(+), 15 deletions(-) diff --git a/war/src/main/java/bukkit/tommytony/war/War.java b/war/src/main/java/bukkit/tommytony/war/War.java index b8fcfd9..b15a8ad 100644 --- a/war/src/main/java/bukkit/tommytony/war/War.java +++ b/war/src/main/java/bukkit/tommytony/war/War.java @@ -96,14 +96,14 @@ public class War extends JavaPlugin { String command = cmd.replace("/", ""); String[] arguments = null; // Handle both /war and /. 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]; arguments = new String[args.length - 2]; for(int i = 2; i <= arguments.length; i++) { arguments[i-2] = args[i]; } } 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.")); } else { arguments = new String[args.length - 1]; diff --git a/war/src/main/java/bukkit/tommytony/war/WarPlayerListener.java b/war/src/main/java/bukkit/tommytony/war/WarPlayerListener.java index c4ee2dd..57bff9c 100644 --- a/war/src/main/java/bukkit/tommytony/war/WarPlayerListener.java +++ b/war/src/main/java/bukkit/tommytony/war/WarPlayerListener.java @@ -166,6 +166,7 @@ public class WarPlayerListener extends PlayerListener { } else if (zone.getLobby().isInWarHubLinkGate(to)){ dropFromOldTeamIfAny(player); 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 if(zone.getLobby().isAutoAssignGate(to) diff --git a/war/src/main/java/com/tommytony/war/WarHub.java b/war/src/main/java/com/tommytony/war/WarHub.java index 673cbf7..cb97755 100644 --- a/war/src/main/java/com/tommytony/war/WarHub.java +++ b/war/src/main/java/com/tommytony/war/WarHub.java @@ -61,19 +61,24 @@ public class WarHub { if(noOfWarzones > 0) { int hubWidth = noOfWarzones * 4 + 1; int halfHubWidth = hubWidth / 2; - int hubDepth = 5; + int hubDepth = 6; int hubHeigth = 4; Block locationBlock = location.getWorld().getBlockAt(location.getBlockX(), location.getBlockY(), location.getBlockZ()); - volume.setCornerOne(locationBlock.getFace(BlockFace.SOUTH, halfHubWidth).getFace(BlockFace.DOWN)); - volume.setCornerTwo(locationBlock.getFace(BlockFace.NORTH, halfHubWidth).getFace(BlockFace.WEST, hubDepth).getFace(BlockFace.NORTH, hubHeigth)); + 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.UP, hubHeigth)); volume.saveBlocks(); + // glass floor + volume.setToMaterial(Material.AIR); + volume.setFaceMaterial(BlockFace.DOWN, Material.GLASS); + // 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 zoneGateBlocks.add(0, currentGateBlock); + currentGateBlock.getFace(BlockFace.DOWN).setType(Material.GLOWSTONE); currentGateBlock.setType(Material.PORTAL); currentGateBlock.getFace(BlockFace.UP).setType(Material.PORTAL); currentGateBlock.getFace(BlockFace.SOUTH).setType(Material.OBSIDIAN); diff --git a/war/src/main/java/com/tommytony/war/ZoneLobby.java b/war/src/main/java/com/tommytony/war/ZoneLobby.java index dec254a..8718aa1 100644 --- a/war/src/main/java/com/tommytony/war/ZoneLobby.java +++ b/war/src/main/java/com/tommytony/war/ZoneLobby.java @@ -163,15 +163,11 @@ public class ZoneLobby { // lets get some light in here 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, 7).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); + lobbyMiddleWallBlock.getFace(BlockFace.DOWN).getFace(BlockFace.WEST, lobbyHalfSide - 1).getFace(wall, 9).setType(Material.GLOWSTONE); + lobbyMiddleWallBlock.getFace(BlockFace.DOWN).getFace(BlockFace.EAST, lobbyHalfSide - 1).getFace(wall, 9).setType(Material.GLOWSTONE); } 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, 7).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); + lobbyMiddleWallBlock.getFace(BlockFace.DOWN).getFace(BlockFace.NORTH, lobbyHalfSide - 1).getFace(wall, 9).setType(Material.GLOWSTONE); + lobbyMiddleWallBlock.getFace(BlockFace.DOWN).getFace(BlockFace.SOUTH, lobbyHalfSide - 1).getFace(wall, 9).setType(Material.GLOWSTONE); } } else { war.getLogger().warning("Failed to initalize zone " + warzone.getName()); @@ -233,7 +229,7 @@ public class ZoneLobby { ironGate = lobbyMiddleWallBlock; goldGate = lobbyMiddleWallBlock.getFace(rightSide, 4); } - warHubLinkGate = lobbyMiddleWallBlock.getFace(wall, 8); + warHubLinkGate = lobbyMiddleWallBlock.getFace(wall, 9); } private void placeGate(Block block, @@ -254,6 +250,7 @@ public class ZoneLobby { leftSide = BlockFace.NORTH; rightSide = BlockFace.SOUTH; } + block.getFace(BlockFace.DOWN).setType(Material.GLOWSTONE); block.setType(Material.PORTAL); block.getFace(BlockFace.UP).setType(Material.PORTAL); block.getFace(leftSide).setType(teamMaterial); diff --git a/war/src/main/java/com/tommytony/war/mappers/WarMapper.java b/war/src/main/java/com/tommytony/war/mappers/WarMapper.java index 5e924c5..8968cca 100644 --- a/war/src/main/java/com/tommytony/war/mappers/WarMapper.java +++ b/war/src/main/java/com/tommytony/war/mappers/WarMapper.java @@ -111,6 +111,13 @@ public class WarMapper { hub.setVolume(vol); hub.getVolume().resetBlocks(); hub.initialize(); + + for(Warzone zone : war.getWarzones()) { + if(zone.getLobby() != null) { + zone.getLobby().initialize(); // adds the warhub link gate + } + + } } warConfig.close();