mirror of
https://github.com/taoneill/war.git
synced 2024-11-23 18:55:28 +01:00
Warhub and lobby link gates are working and pretty.
This commit is contained in:
parent
2692f7ec8e
commit
317b813c4f
@ -96,14 +96,14 @@ public class War extends JavaPlugin {
|
||||
String command = cmd.replace("/", "");
|
||||
String[] arguments = null;
|
||||
// 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];
|
||||
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];
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user