Basic support for RB 1.4.5-R1.0.

Backward compatible with 1.4.5-R0.2 and previous. Switched version to
War v1.7.4-PREVIEW. Lobbies and warhubs should line up properly now, at
least. Commands such as '/setzonelobby east' still use the wrong
directions.
This commit is contained in:
taoneill 2012-12-20 00:10:40 -05:00
parent 381047f915
commit 0245476130
21 changed files with 469 additions and 379 deletions

View File

@ -3,7 +3,7 @@
<groupId>com.tommytony</groupId>
<artifactId>war</artifactId>
<version>1.7.3</version>
<version>1.7.4-PREVIEW</version>
<packaging>jar</packaging>
<name>War</name>
@ -68,7 +68,7 @@
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.4.5-R0.2</version>
<version>1.4.5-R1.0</version>
<scope>compile</scope>
</dependency>
<dependency>

View File

@ -22,6 +22,7 @@ import com.tommytony.war.config.TeamKind;
import com.tommytony.war.config.TeamSpawnStyle;
import com.tommytony.war.structure.Bomb;
import com.tommytony.war.structure.Cake;
import com.tommytony.war.utility.Direction;
import com.tommytony.war.utility.SignHelper;
import com.tommytony.war.volume.BlockInfo;
import com.tommytony.war.volume.Volume;
@ -166,16 +167,16 @@ public class Team {
// SMALL style
if (yaw >= 0 && yaw < 90) {
signData = 10;
signBlock = this.warzone.getWorld().getBlockAt(x, y, z).getRelative(BlockFace.NORTH).getRelative(BlockFace.WEST);
signBlock = this.warzone.getWorld().getBlockAt(x, y, z).getRelative(Direction.NORTH()).getRelative(Direction.WEST());
} else if (yaw >= 90 && yaw <= 180) {
signData = 14;
signBlock = this.warzone.getWorld().getBlockAt(x, y, z).getRelative(BlockFace.NORTH).getRelative(BlockFace.EAST);
signBlock = this.warzone.getWorld().getBlockAt(x, y, z).getRelative(Direction.NORTH()).getRelative(Direction.EAST());
} else if (yaw >= 180 && yaw < 270) {
signData = 2;
signBlock = this.warzone.getWorld().getBlockAt(x, y, z).getRelative(BlockFace.SOUTH).getRelative(BlockFace.EAST);
signBlock = this.warzone.getWorld().getBlockAt(x, y, z).getRelative(Direction.SOUTH()).getRelative(Direction.EAST());
} else if (yaw >= 270 && yaw <= 360) {
signData = 6;
signBlock = this.warzone.getWorld().getBlockAt(x, y, z).getRelative(BlockFace.SOUTH).getRelative(BlockFace.WEST);
signBlock = this.warzone.getWorld().getBlockAt(x, y, z).getRelative(Direction.SOUTH()).getRelative(Direction.WEST());
}
} else {
// outer ring (FLAT or BIG)
@ -203,10 +204,10 @@ public class Team {
BlockFace facing = null;
BlockFace opposite = null;
if (yaw >= 0 && yaw < 90) {
facing = BlockFace.NORTH_WEST;
opposite = BlockFace.SOUTH_EAST;
facing = Direction.NORTH_WEST();
opposite = Direction.SOUTH_EAST();
signData = 10;
signBlock = this.warzone.getWorld().getBlockAt(x, y, z).getRelative(BlockFace.NORTH, 2).getRelative(BlockFace.WEST, 2);
signBlock = this.warzone.getWorld().getBlockAt(x, y, z).getRelative(Direction.NORTH(), 2).getRelative(Direction.WEST(), 2);
if (style.equals(TeamSpawnStyle.BIG)) {
// rim
@ -236,10 +237,10 @@ public class Team {
this.setBlock(x + 2, y + 3, z - 2, this.kind);
}
} else if (yaw >= 90 && yaw <= 180) {
facing = BlockFace.NORTH_EAST;
opposite = BlockFace.SOUTH_WEST;
facing = Direction.NORTH_EAST();
opposite = Direction.SOUTH_WEST();
signData = 14;
signBlock = this.warzone.getWorld().getBlockAt(x, y, z).getRelative(BlockFace.NORTH, 2).getRelative(BlockFace.EAST, 2);
signBlock = this.warzone.getWorld().getBlockAt(x, y, z).getRelative(Direction.NORTH(), 2).getRelative(Direction.EAST(), 2);
if (style.equals(TeamSpawnStyle.BIG)) {
// rim
this.setBlock(x + 1, y, z - 2, this.kind);
@ -268,10 +269,10 @@ public class Team {
this.setBlock(x + 2, y + 3, z + 2, this.kind);
}
} else if (yaw >= 180 && yaw < 270) {
facing = BlockFace.SOUTH_EAST;
opposite = BlockFace.NORTH_WEST;
facing = Direction.SOUTH_EAST();
opposite = Direction.NORTH_WEST();
signData = 2;
signBlock = this.warzone.getWorld().getBlockAt(x, y, z).getRelative(BlockFace.SOUTH, 2).getRelative(BlockFace.EAST, 2);
signBlock = this.warzone.getWorld().getBlockAt(x, y, z).getRelative(Direction.SOUTH(), 2).getRelative(Direction.EAST(), 2);
if (style.equals(TeamSpawnStyle.BIG)) {
// rim
this.setBlock(x + 2, y, z + 1, this.kind);
@ -300,10 +301,10 @@ public class Team {
this.setBlock(x - 2, y + 3, z + 2, this.kind);
}
} else if (yaw >= 270 && yaw <= 360) {
facing = BlockFace.SOUTH_WEST;
opposite = BlockFace.NORTH_EAST;
facing = Direction.SOUTH_WEST();
opposite = Direction.NORTH_EAST();
signData = 6;
signBlock = this.warzone.getWorld().getBlockAt(x, y, z).getRelative(BlockFace.SOUTH, 2).getRelative(BlockFace.WEST, 2);
signBlock = this.warzone.getWorld().getBlockAt(x, y, z).getRelative(Direction.SOUTH(), 2).getRelative(Direction.WEST(), 2);
if (style.equals(TeamSpawnStyle.BIG)) {
// rim
this.setBlock(x - 1, y, z + 2, this.kind);
@ -600,8 +601,8 @@ public class Team {
BlockFace facing = null;
BlockFace opposite = null;
if ((yaw >= 0 && yaw < 45) || (yaw >= 315 && yaw <= 360)) {
facing = BlockFace.WEST;
opposite = BlockFace.EAST;
facing = Direction.WEST();
opposite = Direction.EAST();
current = this.warzone.getWorld().getBlockAt(x, y, z - 1);
current.setType(stand);
current.setData(standData);
@ -609,8 +610,8 @@ public class Team {
current.setType(stand);
current.setData(standData);
} else if (yaw >= 45 && yaw < 135) {
facing = BlockFace.NORTH;
opposite = BlockFace.SOUTH;
facing = Direction.NORTH();
opposite = Direction.SOUTH();
current = this.warzone.getWorld().getBlockAt(x + 1, y, z);
current.setType(stand);
current.setData(standData);
@ -618,8 +619,8 @@ public class Team {
current.setType(stand);
current.setData(standData);
} else if (yaw >= 135 && yaw < 225) {
facing = BlockFace.EAST;
opposite = BlockFace.WEST;
facing = Direction.EAST();
opposite = Direction.WEST();
current = this.warzone.getWorld().getBlockAt(x, y, z + 1);
current.setType(stand);
current.setData(standData);
@ -627,8 +628,8 @@ public class Team {
current.setType(stand);
current.setData(standData);;
} else if (yaw >= 225 && yaw < 315) {
facing = BlockFace.SOUTH;
opposite = BlockFace.NORTH;
facing = Direction.SOUTH();
opposite = Direction.NORTH();
current = this.warzone.getWorld().getBlockAt(x - 1, y, z);
current.setType(stand);
current.setData(standData);

View File

@ -40,6 +40,7 @@ import com.tommytony.war.structure.HubLobbyMaterials;
import com.tommytony.war.structure.WarzoneMaterials;
import com.tommytony.war.structure.ZoneLobby;
import com.tommytony.war.structure.ZoneWallGuard;
import com.tommytony.war.utility.Direction;
import com.tommytony.war.utility.LoadoutSelection;
import com.tommytony.war.utility.PlayerState;
import com.tommytony.war.utility.PotionEffectHelper;
@ -745,22 +746,22 @@ public class Warzone {
List<BlockFace> walls = new ArrayList<BlockFace>();
if (Math.abs(this.volume.getSoutheastZ() - latestPlayerLocation.getBlockZ()) < this.minSafeDistanceFromWall && latestPlayerLocation.getBlockX() <= this.volume.getSoutheastX() && latestPlayerLocation.getBlockX() >= this.volume.getNorthwestX() && latestPlayerLocation.getBlockY() >= this.volume.getMinY() && latestPlayerLocation.getBlockY() <= this.volume.getMaxY()) {
// near east wall
walls.add(BlockFace.EAST);
walls.add(Direction.EAST());
}
if (Math.abs(this.volume.getSoutheastX() - latestPlayerLocation.getBlockX()) < this.minSafeDistanceFromWall && latestPlayerLocation.getBlockZ() <= this.volume.getNorthwestZ() && latestPlayerLocation.getBlockZ() >= this.volume.getSoutheastZ() && latestPlayerLocation.getBlockY() >= this.volume.getMinY() && latestPlayerLocation.getBlockY() <= this.volume.getMaxY()) {
// near south wall
walls.add(BlockFace.SOUTH);
walls.add(Direction.SOUTH());
}
if (Math.abs(this.volume.getNorthwestX() - latestPlayerLocation.getBlockX()) < this.minSafeDistanceFromWall && latestPlayerLocation.getBlockZ() <= this.volume.getNorthwestZ() && latestPlayerLocation.getBlockZ() >= this.volume.getSoutheastZ() && latestPlayerLocation.getBlockY() >= this.volume.getMinY() && latestPlayerLocation.getBlockY() <= this.volume.getMaxY()) {
// near north wall
walls.add(BlockFace.NORTH);
walls.add(Direction.NORTH());
}
if (Math.abs(this.volume.getNorthwestZ() - latestPlayerLocation.getBlockZ()) < this.minSafeDistanceFromWall && latestPlayerLocation.getBlockX() <= this.volume.getSoutheastX() && latestPlayerLocation.getBlockX() >= this.volume.getNorthwestX() && latestPlayerLocation.getBlockY() >= this.volume.getMinY() && latestPlayerLocation.getBlockY() <= this.volume.getMaxY()) {
// near west wall
walls.add(BlockFace.WEST);
walls.add(Direction.WEST());
}
if (Math.abs(this.volume.getMaxY() - latestPlayerLocation.getBlockY()) < this.minSafeDistanceFromWall && latestPlayerLocation.getBlockX() <= this.volume.getMaxX() && latestPlayerLocation.getBlockX() >= this.volume.getMinX() && latestPlayerLocation.getBlockZ() <= this.volume.getMaxZ() && latestPlayerLocation.getBlockZ() >= this.volume.getMinZ()) {

View File

@ -11,6 +11,7 @@ import com.tommytony.war.War;
import com.tommytony.war.Warzone;
import com.tommytony.war.mapper.WarzoneYmlMapper;
import com.tommytony.war.structure.ZoneLobby;
import com.tommytony.war.utility.Direction;
/**
* Places the zonelobby
@ -78,19 +79,19 @@ public class SetZoneLobbyCommand extends AbstractZoneMakerCommand {
}
ZoneLobby lobby = zone.getLobby();
BlockFace wall = BlockFace.WEST;
BlockFace wall = Direction.WEST();
String wallStr = "";
if (this.args[0].equals("north") || this.args[0].equals("n")) {
wall = BlockFace.NORTH;
wall = Direction.NORTH();
wallStr = "north";
} else if (this.args[0].equals("east") || this.args[0].equals("e")) {
wall = BlockFace.EAST;
wall = Direction.EAST();
wallStr = "east";
} else if (this.args[0].equals("south") || this.args[0].equals("s")) {
wall = BlockFace.SOUTH;
wall = Direction.SOUTH();
wallStr = "south";
} else if (this.args[0].equals("west") || this.args[0].equals("w")) {
wall = BlockFace.WEST;
wall = Direction.WEST();
wallStr = "west";
}

View File

@ -13,6 +13,7 @@ import com.tommytony.war.config.WarConfig;
import com.tommytony.war.mapper.WarYmlMapper;
import com.tommytony.war.mapper.WarzoneYmlMapper;
import com.tommytony.war.structure.ZoneLobby;
import com.tommytony.war.utility.Direction;
import com.tommytony.war.volume.NotNorthwestException;
import com.tommytony.war.volume.NotSoutheastException;
import com.tommytony.war.volume.TooBigException;
@ -249,7 +250,7 @@ public class ZoneSetter {
if (warzone.getLobby() == null) {
// Set default lobby on south side
ZoneLobby lobby = new ZoneLobby(warzone, BlockFace.SOUTH);
ZoneLobby lobby = new ZoneLobby(warzone, Direction.SOUTH());
warzone.setLobby(lobby);
if (War.war.getWarHub() != null) { // warhub has to change
War.war.getWarHub().getVolume().resetBlocks();

View File

@ -40,6 +40,7 @@ import com.tommytony.war.structure.Bomb;
import com.tommytony.war.structure.Cake;
import com.tommytony.war.structure.WarHub;
import com.tommytony.war.structure.ZoneLobby;
import com.tommytony.war.utility.Direction;
import com.tommytony.war.utility.LoadoutSelection;
/**
@ -391,18 +392,18 @@ public class WarPlayerListener implements Listener {
int upDownMove = 0;
int moveDistance = 1;
if (nearestWalls.contains(BlockFace.NORTH)) {
if (nearestWalls.contains(Direction.NORTH())) {
// move south
northSouthMove += moveDistance;
} else if (nearestWalls.contains(BlockFace.SOUTH)) {
} else if (nearestWalls.contains(Direction.SOUTH())) {
// move north
northSouthMove -= moveDistance;
}
if (nearestWalls.contains(BlockFace.EAST)) {
if (nearestWalls.contains(Direction.EAST())) {
// move west
eastWestMove += moveDistance;
} else if (nearestWalls.contains(BlockFace.WEST)) {
} else if (nearestWalls.contains(Direction.WEST())) {
// move east
eastWestMove -= moveDistance;
}

View File

@ -12,6 +12,7 @@ import org.bukkit.entity.Player;
import com.tommytony.war.Team;
import com.tommytony.war.War;
import com.tommytony.war.utility.Direction;
public class CantReEnterSpawnJob implements Runnable {
@ -84,16 +85,16 @@ public class CantReEnterSpawnJob implements Runnable {
switch (zeroToSeven) {
case 0:
nextCandidateBlock = playerTeam.getTeamSpawn().getBlock().getRelative(BlockFace.WEST, distanceAwayMultiplier);
nextCandidateBlock = playerTeam.getTeamSpawn().getBlock().getRelative(Direction.WEST(), distanceAwayMultiplier);
break;
case 1:
nextCandidateBlock = playerTeam.getTeamSpawn().getBlock().getRelative(BlockFace.EAST, distanceAwayMultiplier);
nextCandidateBlock = playerTeam.getTeamSpawn().getBlock().getRelative(Direction.EAST(), distanceAwayMultiplier);
break;
case 2:
nextCandidateBlock = playerTeam.getTeamSpawn().getBlock().getRelative(BlockFace.NORTH, distanceAwayMultiplier);
nextCandidateBlock = playerTeam.getTeamSpawn().getBlock().getRelative(Direction.NORTH(), distanceAwayMultiplier);
break;
case 3:
nextCandidateBlock = playerTeam.getTeamSpawn().getBlock().getRelative(BlockFace.SOUTH, distanceAwayMultiplier);
nextCandidateBlock = playerTeam.getTeamSpawn().getBlock().getRelative(Direction.SOUTH(), distanceAwayMultiplier);
break;
case 4:
nextCandidateBlock = playerTeam.getTeamSpawn().getBlock().getRelative(BlockFace.NORTH_WEST, distanceAwayMultiplier);

View File

@ -17,6 +17,7 @@ import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack;
import com.tommytony.war.utility.DeferredBlockReset;
import com.tommytony.war.utility.Direction;
import com.tommytony.war.volume.Volume;
public class DeferredBlockResetsJob implements Runnable {
@ -154,8 +155,8 @@ public class DeferredBlockResetsJob implements Runnable {
private void scrubDroppedDoors(Block block) {
Chunk chunk = block.getWorld().getChunkAt(block);
Volume scrubVolume = new Volume("scrub", block.getWorld());
scrubVolume.setCornerOne(block.getRelative(BlockFace.DOWN).getRelative(BlockFace.EAST).getRelative(BlockFace.NORTH));
scrubVolume.setCornerTwo(block.getRelative(BlockFace.UP).getRelative(BlockFace.WEST).getRelative(BlockFace.SOUTH));
scrubVolume.setCornerOne(block.getRelative(BlockFace.DOWN).getRelative(Direction.EAST()).getRelative(Direction.NORTH()));
scrubVolume.setCornerTwo(block.getRelative(BlockFace.UP).getRelative(Direction.WEST()).getRelative(Direction.SOUTH()));
for (Entity entity : chunk.getEntities()) {
if ((entity instanceof Item && (((Item)entity).getItemStack().getTypeId() == Material.IRON_DOOR.getId()
|| ((Item)entity).getItemStack().getTypeId() == Material.WOOD_DOOR.getId()))

View File

@ -3,6 +3,7 @@ package com.tommytony.war.job;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import com.tommytony.war.utility.Direction;
import com.tommytony.war.volume.BlockInfo;
public class ResetCursorJob implements Runnable {
@ -21,17 +22,17 @@ public class ResetCursorJob implements Runnable {
if (this.isSoutheast) {
this.cornerBlock.setType(this.originalCursorBlocks[0].getType());
this.cornerBlock.setData(this.originalCursorBlocks[0].getData());
this.cornerBlock.getRelative(BlockFace.WEST).setType(this.originalCursorBlocks[1].getType());
this.cornerBlock.getRelative(BlockFace.WEST).setData(this.originalCursorBlocks[1].getData());
this.cornerBlock.getRelative(BlockFace.NORTH).setType(this.originalCursorBlocks[2].getType());
this.cornerBlock.getRelative(BlockFace.NORTH).setData(this.originalCursorBlocks[2].getData());
this.cornerBlock.getRelative(Direction.WEST()).setType(this.originalCursorBlocks[1].getType());
this.cornerBlock.getRelative(Direction.WEST()).setData(this.originalCursorBlocks[1].getData());
this.cornerBlock.getRelative(Direction.NORTH()).setType(this.originalCursorBlocks[2].getType());
this.cornerBlock.getRelative(Direction.NORTH()).setData(this.originalCursorBlocks[2].getData());
} else {
this.cornerBlock.setType(this.originalCursorBlocks[0].getType());
this.cornerBlock.setData(this.originalCursorBlocks[0].getData());
this.cornerBlock.getRelative(BlockFace.EAST).setType(this.originalCursorBlocks[1].getType());
this.cornerBlock.getRelative(BlockFace.EAST).setData(this.originalCursorBlocks[1].getData());
this.cornerBlock.getRelative(BlockFace.SOUTH).setType(this.originalCursorBlocks[2].getType());
this.cornerBlock.getRelative(BlockFace.SOUTH).setData(this.originalCursorBlocks[2].getData());
this.cornerBlock.getRelative(Direction.EAST()).setType(this.originalCursorBlocks[1].getType());
this.cornerBlock.getRelative(Direction.EAST()).setData(this.originalCursorBlocks[1].getData());
this.cornerBlock.getRelative(Direction.SOUTH()).setType(this.originalCursorBlocks[2].getType());
this.cornerBlock.getRelative(Direction.SOUTH()).setData(this.originalCursorBlocks[2].getData());
}
}
}

View File

@ -21,6 +21,7 @@ import com.tommytony.war.config.TeamSpawnStyle;
import com.tommytony.war.config.WarzoneConfig;
import com.tommytony.war.structure.Monument;
import com.tommytony.war.structure.ZoneLobby;
import com.tommytony.war.utility.Direction;
import com.tommytony.war.volume.Volume;
import com.tommytony.war.volume.ZoneVolume;
@ -360,13 +361,13 @@ public class WarzoneTxtMapper {
if (lobbyStrSplit.length > 0) {
// lobby orientation
if (lobbyStrSplit[0].equals("south")) {
lobbyFace = BlockFace.SOUTH;
lobbyFace = Direction.SOUTH();
} else if (lobbyStrSplit[0].equals("east")) {
lobbyFace = BlockFace.EAST;
lobbyFace = Direction.EAST();
} else if (lobbyStrSplit[0].equals("north")) {
lobbyFace = BlockFace.NORTH;
lobbyFace = Direction.NORTH();
} else if (lobbyStrSplit[0].equals("west")) {
lobbyFace = BlockFace.WEST;
lobbyFace = Direction.WEST();
}
// lobby world
@ -572,13 +573,13 @@ public class WarzoneTxtMapper {
// // lobby
// String lobbyStr = "";
// if (warzone.getLobby() != null) {
// if (BlockFace.SOUTH == warzone.getLobby().getWall()) {
// if (Direction.SOUTH() == warzone.getLobby().getWall()) {
// lobbyStr = "south";
// } else if (BlockFace.EAST == warzone.getLobby().getWall()) {
// } else if (Direction.EAST() == warzone.getLobby().getWall()) {
// lobbyStr = "east";
// } else if (BlockFace.NORTH == warzone.getLobby().getWall()) {
// } else if (Direction.NORTH() == warzone.getLobby().getWall()) {
// lobbyStr = "north";
// } else if (BlockFace.WEST == warzone.getLobby().getWall()) {
// } else if (Direction.WEST() == warzone.getLobby().getWall()) {
// lobbyStr = "west";
// }
// }

View File

@ -26,6 +26,7 @@ import com.tommytony.war.structure.HubLobbyMaterials;
import com.tommytony.war.structure.Monument;
import com.tommytony.war.structure.WarzoneMaterials;
import com.tommytony.war.structure.ZoneLobby;
import com.tommytony.war.utility.Direction;
import com.tommytony.war.volume.Volume;
import com.tommytony.war.volume.ZoneVolume;
@ -289,13 +290,13 @@ public class WarzoneYmlMapper {
String lobbyOrientation = warzoneRootSection.getString(lobbyPrefix + "orientation");
BlockFace lobbyFace = null;
if (lobbyOrientation.equals("south")) {
lobbyFace = BlockFace.SOUTH;
lobbyFace = Direction.SOUTH();
} else if (lobbyOrientation.equals("east")) {
lobbyFace = BlockFace.EAST;
lobbyFace = Direction.EAST();
} else if (lobbyOrientation.equals("north")) {
lobbyFace = BlockFace.NORTH;
lobbyFace = Direction.NORTH();
} else if (lobbyOrientation.equals("west")) {
lobbyFace = BlockFace.WEST;
lobbyFace = Direction.WEST();
}
// lobby materials
@ -406,13 +407,13 @@ public class WarzoneYmlMapper {
// lobby
if (warzone.getLobby() != null) {
String lobbyOrientation = "";
if (BlockFace.SOUTH == warzone.getLobby().getWall()) {
if (Direction.SOUTH() == warzone.getLobby().getWall()) {
lobbyOrientation = "south";
} else if (BlockFace.EAST == warzone.getLobby().getWall()) {
} else if (Direction.EAST() == warzone.getLobby().getWall()) {
lobbyOrientation = "east";
} else if (BlockFace.NORTH == warzone.getLobby().getWall()) {
} else if (Direction.NORTH() == warzone.getLobby().getWall()) {
lobbyOrientation = "north";
} else if (BlockFace.WEST == warzone.getLobby().getWall()) {
} else if (Direction.WEST() == warzone.getLobby().getWall()) {
lobbyOrientation = "west";
}

View File

@ -7,6 +7,7 @@ import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import com.tommytony.war.Warzone;
import com.tommytony.war.utility.Direction;
import com.tommytony.war.volume.BlockInfo;
import com.tommytony.war.volume.Volume;
@ -138,8 +139,8 @@ public class Bomb {
public void setLocation(Location location) {
Block locationBlock = this.warzone.getWorld().getBlockAt(location.getBlockX(), location.getBlockY(), location.getBlockZ());
this.volume.setCornerOne(locationBlock.getRelative(BlockFace.DOWN).getRelative(BlockFace.EAST, 1).getRelative(BlockFace.SOUTH, 1));
this.volume.setCornerTwo(locationBlock.getRelative(BlockFace.UP, 2).getRelative(BlockFace.WEST, 1).getRelative(BlockFace.NORTH, 1));
this.volume.setCornerOne(locationBlock.getRelative(BlockFace.DOWN).getRelative(Direction.EAST(), 1).getRelative(Direction.SOUTH(), 1));
this.volume.setCornerTwo(locationBlock.getRelative(BlockFace.UP, 2).getRelative(Direction.WEST(), 1).getRelative(Direction.NORTH(), 1));
this.volume.saveBlocks();
this.location = location;
this.addBombBlocks();

View File

@ -7,6 +7,7 @@ import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import com.tommytony.war.Warzone;
import com.tommytony.war.utility.Direction;
import com.tommytony.war.volume.BlockInfo;
import com.tommytony.war.volume.Volume;
@ -139,8 +140,8 @@ public class Cake {
public void setLocation(Location location) {
Block locationBlock = this.warzone.getWorld().getBlockAt(location.getBlockX(), location.getBlockY(), location.getBlockZ());
this.volume.setCornerOne(locationBlock.getRelative(BlockFace.DOWN).getRelative(BlockFace.EAST, 1).getRelative(BlockFace.SOUTH, 1));
this.volume.setCornerTwo(locationBlock.getRelative(BlockFace.UP, 2).getRelative(BlockFace.WEST, 1).getRelative(BlockFace.NORTH, 1));
this.volume.setCornerOne(locationBlock.getRelative(BlockFace.DOWN).getRelative(Direction.EAST(), 1).getRelative(Direction.SOUTH(), 1));
this.volume.setCornerTwo(locationBlock.getRelative(BlockFace.UP, 2).getRelative(Direction.WEST(), 1).getRelative(Direction.NORTH(), 1));
this.volume.saveBlocks();
this.location = location;
this.addCakeBlocks();

View File

@ -7,6 +7,7 @@ import org.bukkit.block.BlockFace;
import com.tommytony.war.Team;
import com.tommytony.war.Warzone;
import com.tommytony.war.utility.Direction;
import com.tommytony.war.volume.BlockInfo;
import com.tommytony.war.volume.Volume;
@ -225,8 +226,8 @@ public class Monument {
public void setLocation(Location location) {
Block locationBlock = this.warzone.getWorld().getBlockAt(location.getBlockX(), location.getBlockY(), location.getBlockZ());
this.volume.setCornerOne(locationBlock.getRelative(BlockFace.DOWN).getRelative(BlockFace.EAST, 2).getRelative(BlockFace.SOUTH, 2));
this.volume.setCornerTwo(locationBlock.getRelative(BlockFace.UP, 2).getRelative(BlockFace.WEST, 2).getRelative(BlockFace.NORTH, 2));
this.volume.setCornerOne(locationBlock.getRelative(BlockFace.DOWN).getRelative(Direction.EAST(), 2).getRelative(Direction.SOUTH(), 2));
this.volume.setCornerTwo(locationBlock.getRelative(BlockFace.UP, 2).getRelative(Direction.WEST(), 2).getRelative(Direction.NORTH(), 2));
this.volume.saveBlocks();
this.location = location;

View File

@ -15,6 +15,7 @@ import com.tommytony.war.War;
import com.tommytony.war.Warzone;
import com.tommytony.war.config.TeamConfig;
import com.tommytony.war.config.WarzoneConfig;
import com.tommytony.war.utility.Direction;
import com.tommytony.war.utility.SignHelper;
import com.tommytony.war.volume.BlockInfo;
import com.tommytony.war.volume.Volume;
@ -34,16 +35,16 @@ public class WarHub {
int yaw = 0;
if (hubOrientation.equals("south")) {
yaw = 270;
this.setOrientation(BlockFace.SOUTH);
this.setOrientation(Direction.SOUTH());
} else if (hubOrientation.equals("north")) {
yaw = 90;
this.setOrientation(BlockFace.NORTH);
this.setOrientation(Direction.NORTH());
} else if (hubOrientation.equals("east")) {
yaw = 180;
this.setOrientation(BlockFace.EAST);
this.setOrientation(Direction.EAST());
} else {
yaw = 0;
this.setOrientation(BlockFace.WEST);
this.setOrientation(Direction.WEST());
}
this.location = new Location(location.getWorld(),
@ -78,13 +79,13 @@ public class WarHub {
BlockFace facing = null;
if ((yaw >= 0 && yaw < 45) || (yaw >= 315 && yaw <= 360)) {
facing = BlockFace.WEST;
facing = Direction.WEST();
} else if (yaw >= 45 && yaw < 135) {
facing = BlockFace.NORTH;
facing = Direction.NORTH();
} else if (yaw >= 135 && yaw < 225) {
facing = BlockFace.EAST;
facing = Direction.EAST();
} else if (yaw >= 225 && yaw < 315) {
facing = BlockFace.SOUTH;
facing = Direction.SOUTH();
}
this.setOrientation(facing);
}
@ -125,26 +126,26 @@ public class WarHub {
BlockFace front = this.getOrientation();
BlockFace back;
byte data;
if (this.getOrientation() == BlockFace.SOUTH) {
if (this.getOrientation() == Direction.SOUTH()) {
data = (byte) 4;
left = BlockFace.EAST;
right = BlockFace.WEST;
back = BlockFace.NORTH;
} else if (this.getOrientation() == BlockFace.NORTH) {
left = Direction.EAST();
right = Direction.WEST();
back = Direction.NORTH();
} else if (this.getOrientation() == Direction.NORTH()) {
data = (byte) 12;
left = BlockFace.WEST;
right = BlockFace.EAST;
back = BlockFace.SOUTH;
} else if (this.getOrientation() == BlockFace.EAST) {
left = Direction.WEST();
right = Direction.EAST();
back = Direction.SOUTH();
} else if (this.getOrientation() == Direction.EAST()) {
data = (byte) 0;
left = BlockFace.NORTH;
right = BlockFace.SOUTH;
back = BlockFace.WEST;
left = Direction.NORTH();
right = Direction.SOUTH();
back = Direction.WEST();
} else {
data = (byte) 8;
left = BlockFace.SOUTH;
right = BlockFace.NORTH;
back = BlockFace.EAST;
left = Direction.SOUTH();
right = Direction.NORTH();
back = Direction.EAST();
}
Block locationBlock = this.location.getWorld().getBlockAt(this.location.getBlockX(), this.location.getBlockY(), this.location.getBlockZ());
@ -260,22 +261,22 @@ public class WarHub {
BlockFace left;
BlockFace back;
byte data;
if (this.getOrientation() == BlockFace.SOUTH) {
if (this.getOrientation() == Direction.SOUTH()) {
data = (byte) 4;
left = BlockFace.EAST;
back = BlockFace.NORTH;
} else if (this.getOrientation() == BlockFace.NORTH) {
left = Direction.EAST();
back = Direction.NORTH();
} else if (this.getOrientation() == Direction.NORTH()) {
data = (byte) 12;
left = BlockFace.WEST;
back = BlockFace.SOUTH;
} else if (this.getOrientation() == BlockFace.EAST) {
left = Direction.WEST();
back = Direction.SOUTH();
} else if (this.getOrientation() == Direction.EAST()) {
data = (byte) 0;
left = BlockFace.NORTH;
back = BlockFace.WEST;
left = Direction.NORTH();
back = Direction.WEST();
} else {
data = (byte) 8;
left = BlockFace.SOUTH;
back = BlockFace.EAST;
left = Direction.SOUTH();
back = Direction.EAST();
}
Block zoneGate = this.zoneGateBlocks.get(zone.getName());

View File

@ -18,6 +18,7 @@ import com.tommytony.war.Warzone;
import com.tommytony.war.config.TeamConfig;
import com.tommytony.war.config.TeamKind;
import com.tommytony.war.config.WarzoneConfig;
import com.tommytony.war.utility.Direction;
import com.tommytony.war.utility.SignHelper;
import com.tommytony.war.volume.BlockInfo;
import com.tommytony.war.volume.Volume;
@ -95,14 +96,14 @@ public class ZoneLobby {
this.setVolume(volume);
// we're setting the zoneVolume directly, so we need to figure out the lobbyMiddleWallBlock on our own
if (wall == BlockFace.NORTH) {
this.lobbyMiddleWallBlock = new BlockInfo(BlockInfo.getBlock(warzone.getWorld(), volume.getCornerOne()).getRelative(BlockFace.UP).getRelative(BlockFace.EAST, this.lobbyHalfSide));
} else if (wall == BlockFace.EAST) {
this.lobbyMiddleWallBlock = new BlockInfo(BlockInfo.getBlock(warzone.getWorld(), volume.getCornerOne()).getRelative(BlockFace.UP).getRelative(BlockFace.SOUTH, this.lobbyHalfSide));
} else if (wall == BlockFace.SOUTH) {
this.lobbyMiddleWallBlock = new BlockInfo(BlockInfo.getBlock(warzone.getWorld(), volume.getCornerOne()).getRelative(BlockFace.UP).getRelative(BlockFace.WEST, this.lobbyHalfSide));
} else if (wall == BlockFace.WEST) {
this.lobbyMiddleWallBlock = new BlockInfo(BlockInfo.getBlock(warzone.getWorld(), volume.getCornerOne()).getRelative(BlockFace.UP).getRelative(BlockFace.NORTH, this.lobbyHalfSide));
if (wall == Direction.NORTH()) {
this.lobbyMiddleWallBlock = new BlockInfo(BlockInfo.getBlock(warzone.getWorld(), volume.getCornerOne()).getRelative(BlockFace.UP).getRelative(Direction.EAST(), this.lobbyHalfSide));
} else if (wall == Direction.EAST()) {
this.lobbyMiddleWallBlock = new BlockInfo(BlockInfo.getBlock(warzone.getWorld(), volume.getCornerOne()).getRelative(BlockFace.UP).getRelative(Direction.SOUTH(), this.lobbyHalfSide));
} else if (wall == Direction.SOUTH()) {
this.lobbyMiddleWallBlock = new BlockInfo(BlockInfo.getBlock(warzone.getWorld(), volume.getCornerOne()).getRelative(BlockFace.UP).getRelative(Direction.WEST(), this.lobbyHalfSide));
} else if (wall == Direction.WEST()) {
this.lobbyMiddleWallBlock = new BlockInfo(BlockInfo.getBlock(warzone.getWorld(), volume.getCornerOne()).getRelative(BlockFace.UP).getRelative(Direction.NORTH(), this.lobbyHalfSide));
}
}
@ -138,17 +139,17 @@ public class ZoneLobby {
BlockFace facing = null;
BlockFace opposite = null;
if ((yaw >= 0 && yaw < 45) || (yaw >= 315 && yaw <= 360)) {
facing = BlockFace.WEST;
opposite = BlockFace.EAST;
facing = Direction.WEST();
opposite = Direction.EAST();
} else if (yaw >= 45 && yaw < 135) {
facing = BlockFace.NORTH;
opposite = BlockFace.SOUTH;
facing = Direction.NORTH();
opposite = Direction.SOUTH();
} else if (yaw >= 135 && yaw < 225) {
facing = BlockFace.EAST;
opposite = BlockFace.WEST;
facing = Direction.EAST();
opposite = Direction.WEST();
} else if (yaw >= 225 && yaw < 315) {
facing = BlockFace.SOUTH;
opposite = BlockFace.NORTH;
facing = Direction.SOUTH();
opposite = Direction.NORTH();
}
this.wall = opposite; // a player facing south places a lobby that looks just like a lobby stuck to the north wall
@ -162,16 +163,16 @@ public class ZoneLobby {
int y = this.lobbyMiddleWallBlock.getY();
int z = this.lobbyMiddleWallBlock.getZ();
if (this.wall == BlockFace.NORTH) {
if (this.wall == Direction.NORTH()) {
corner1 = lobbyWorld.getBlockAt(x, y - 1, z + this.lobbyHalfSide);
corner2 = lobbyWorld.getBlockAt(x - this.lobbyDepth, y + 1 + this.lobbyHeight, z - this.lobbyHalfSide);
} else if (this.wall == BlockFace.EAST) {
} else if (this.wall == Direction.EAST()) {
corner1 = lobbyWorld.getBlockAt(x - this.lobbyHalfSide, y - 1, z);
corner2 = lobbyWorld.getBlockAt(x + this.lobbyHalfSide, y + 1 + this.lobbyHeight, z - this.lobbyDepth);
} else if (this.wall == BlockFace.SOUTH) {
} else if (this.wall == Direction.SOUTH()) {
corner1 = lobbyWorld.getBlockAt(x, y - 1, z - this.lobbyHalfSide);
corner2 = lobbyWorld.getBlockAt(x + this.lobbyDepth, y + 1 + this.lobbyHeight, z + this.lobbyHalfSide);
} else if (this.wall == BlockFace.WEST) {
} else if (this.wall == Direction.WEST()) {
corner1 = lobbyWorld.getBlockAt(x + this.lobbyHalfSide, y - 1, z);
corner2 = lobbyWorld.getBlockAt(x - this.lobbyHalfSide, y + 1 + this.lobbyHeight, z + this.lobbyDepth);
}
@ -194,7 +195,7 @@ public class ZoneLobby {
Block corner1 = null;
Block corner2 = null;
if (this.wall == BlockFace.NORTH) {
if (this.wall == Direction.NORTH()) {
int wallStart = zoneVolume.getMinZ();
int wallEnd = zoneVolume.getMaxZ();
int x = zoneVolume.getMinX();
@ -204,7 +205,7 @@ public class ZoneLobby {
this.lobbyMiddleWallBlock = new BlockInfo(this.warzone.getWorld().getBlockAt(x, y, wallCenterPos));
corner1 = this.warzone.getWorld().getBlockAt(x, y - 1, wallCenterPos + this.lobbyHalfSide);
corner2 = this.warzone.getWorld().getBlockAt(x - this.lobbyDepth, y + 1 + this.lobbyHeight, wallCenterPos - this.lobbyHalfSide);
} else if (this.wall == BlockFace.EAST) {
} else if (this.wall == Direction.EAST()) {
int wallStart = zoneVolume.getMinX();
int wallEnd = zoneVolume.getMaxX();
int z = zoneVolume.getMinZ();
@ -214,7 +215,7 @@ public class ZoneLobby {
this.lobbyMiddleWallBlock = new BlockInfo(this.warzone.getWorld().getBlockAt(wallCenterPos, y, z));
corner1 = this.warzone.getWorld().getBlockAt(wallCenterPos - this.lobbyHalfSide, y - 1, z);
corner2 = this.warzone.getWorld().getBlockAt(wallCenterPos + this.lobbyHalfSide, y + 1 + this.lobbyHeight, z - this.lobbyDepth);
} else if (this.wall == BlockFace.SOUTH) {
} else if (this.wall == Direction.SOUTH()) {
int wallStart = zoneVolume.getMinZ();
int wallEnd = zoneVolume.getMaxZ();
int x = zoneVolume.getMaxX();
@ -224,7 +225,7 @@ public class ZoneLobby {
this.lobbyMiddleWallBlock = new BlockInfo(this.warzone.getWorld().getBlockAt(x, y, wallCenterPos));
corner1 = this.warzone.getWorld().getBlockAt(x, y - 1, wallCenterPos - this.lobbyHalfSide);
corner2 = this.warzone.getWorld().getBlockAt(x + this.lobbyDepth, y + 1 + this.lobbyHeight, wallCenterPos + this.lobbyHalfSide);
} else if (this.wall == BlockFace.WEST) {
} else if (this.wall == Direction.WEST()) {
int wallStart = zoneVolume.getMinX();
int wallEnd = zoneVolume.getMaxX();
int z = zoneVolume.getMaxZ();
@ -319,13 +320,13 @@ public class ZoneLobby {
// set zone tp
this.zoneTeleportBlock = new BlockInfo(BlockInfo.getBlock(this.volume.getWorld(), this.lobbyMiddleWallBlock).getRelative(this.wall, 6));
int yaw = 0;
if (this.wall == BlockFace.WEST) {
if (this.wall == Direction.WEST()) {
yaw = 180;
} else if (this.wall == BlockFace.SOUTH) {
} else if (this.wall == Direction.SOUTH()) {
yaw = 90;
} else if (this.wall == BlockFace.EAST) {
} else if (this.wall == Direction.EAST()) {
yaw = 0;
} else if (this.wall == BlockFace.NORTH) {
} else if (this.wall == Direction.NORTH()) {
yaw = 270;
}
this.warzone.setTeleport(new Location(this.volume.getWorld(), this.zoneTeleportBlock.getX(), this.zoneTeleportBlock.getY(), this.zoneTeleportBlock.getZ(), yaw, 0));
@ -335,18 +336,18 @@ public class ZoneLobby {
BlockFace leftSide = null; // looking at the zone
BlockFace rightSide = null;
if (this.wall == BlockFace.NORTH) {
leftSide = BlockFace.EAST;
rightSide = BlockFace.WEST;
} else if (this.wall == BlockFace.EAST) {
leftSide = BlockFace.SOUTH;
rightSide = BlockFace.NORTH;
} else if (this.wall == BlockFace.SOUTH) {
leftSide = BlockFace.WEST;
rightSide = BlockFace.EAST;
} else if (this.wall == BlockFace.WEST) {
leftSide = BlockFace.NORTH;
rightSide = BlockFace.SOUTH;
if (this.wall == Direction.NORTH()) {
leftSide = Direction.EAST();
rightSide = Direction.WEST();
} else if (this.wall == Direction.EAST()) {
leftSide = Direction.SOUTH();
rightSide = Direction.NORTH();
} else if (this.wall == Direction.SOUTH()) {
leftSide = Direction.WEST();
rightSide = Direction.EAST();
} else if (this.wall == Direction.WEST()) {
leftSide = Direction.NORTH();
rightSide = Direction.SOUTH();
}
Block clearedPathStartBlock = BlockInfo.getBlock(this.warzone.getWorld(), this.lobbyMiddleWallBlock).getRelative(this.wall, 2);
@ -371,13 +372,13 @@ public class ZoneLobby {
// set zone sign
Block zoneSignBlock = BlockInfo.getBlock(this.volume.getWorld(), this.lobbyMiddleWallBlock).getRelative(this.wall, 4);
byte data = 0;
if (this.wall == BlockFace.NORTH) {
if (this.wall == Direction.NORTH()) {
data = (byte) 4;
} else if (this.wall == BlockFace.EAST) {
} else if (this.wall == Direction.EAST()) {
data = (byte) 8;
} else if (this.wall == BlockFace.SOUTH) {
} else if (this.wall == Direction.SOUTH()) {
data = (byte) 12;
} else if (this.wall == BlockFace.WEST) {
} else if (this.wall == Direction.WEST()) {
data = (byte) 0;
}
String[] lines = new String[4];
@ -395,18 +396,18 @@ public class ZoneLobby {
// lets get some light in here
Material light = Material.getMaterial(this.warzone.getLobbyMaterials().getLightId());
byte lightData = this.warzone.getLobbyMaterials().getLightData();
if (this.wall == BlockFace.NORTH || this.wall == BlockFace.SOUTH) {
Block one = BlockInfo.getBlock(this.volume.getWorld(), this.lobbyMiddleWallBlock).getRelative(BlockFace.DOWN).getRelative(BlockFace.WEST, this.lobbyHalfSide - 1).getRelative(this.wall, 9);
if (this.wall == Direction.NORTH() || this.wall == Direction.SOUTH()) {
Block one = BlockInfo.getBlock(this.volume.getWorld(), this.lobbyMiddleWallBlock).getRelative(BlockFace.DOWN).getRelative(Direction.WEST(), this.lobbyHalfSide - 1).getRelative(this.wall, 9);
one.setType(light);
one.setData(lightData);
Block two = BlockInfo.getBlock(this.volume.getWorld(), this.lobbyMiddleWallBlock).getRelative(BlockFace.DOWN).getRelative(BlockFace.EAST, this.lobbyHalfSide - 1).getRelative(this.wall, 9);
Block two = BlockInfo.getBlock(this.volume.getWorld(), this.lobbyMiddleWallBlock).getRelative(BlockFace.DOWN).getRelative(Direction.EAST(), this.lobbyHalfSide - 1).getRelative(this.wall, 9);
two.setType(light);
two.setData(lightData);
} else {
Block one = BlockInfo.getBlock(this.volume.getWorld(), this.lobbyMiddleWallBlock).getRelative(BlockFace.DOWN).getRelative(BlockFace.NORTH, this.lobbyHalfSide - 1).getRelative(this.wall, 9);
Block one = BlockInfo.getBlock(this.volume.getWorld(), this.lobbyMiddleWallBlock).getRelative(BlockFace.DOWN).getRelative(Direction.NORTH(), this.lobbyHalfSide - 1).getRelative(this.wall, 9);
one.setType(light);
one.setData(lightData);
Block two = BlockInfo.getBlock(this.volume.getWorld(), this.lobbyMiddleWallBlock).getRelative(BlockFace.DOWN).getRelative(BlockFace.SOUTH, this.lobbyHalfSide - 1).getRelative(this.wall, 9);
Block two = BlockInfo.getBlock(this.volume.getWorld(), this.lobbyMiddleWallBlock).getRelative(BlockFace.DOWN).getRelative(Direction.SOUTH(), this.lobbyHalfSide - 1).getRelative(this.wall, 9);
two.setType(light);
two.setData(lightData);
}
@ -418,18 +419,18 @@ public class ZoneLobby {
private void setGatePositions(Block lobbyMiddleWallBlock) {
BlockFace leftSide = null; // look at the zone
BlockFace rightSide = null;
if (this.wall == BlockFace.NORTH) {
leftSide = BlockFace.EAST;
rightSide = BlockFace.WEST;
} else if (this.wall == BlockFace.EAST) {
leftSide = BlockFace.SOUTH;
rightSide = BlockFace.NORTH;
} else if (this.wall == BlockFace.SOUTH) {
leftSide = BlockFace.WEST;
rightSide = BlockFace.EAST;
} else if (this.wall == BlockFace.WEST) {
leftSide = BlockFace.NORTH;
rightSide = BlockFace.SOUTH;
if (this.wall == Direction.NORTH()) {
leftSide = Direction.EAST();
rightSide = Direction.WEST();
} else if (this.wall == Direction.EAST()) {
leftSide = Direction.SOUTH();
rightSide = Direction.NORTH();
} else if (this.wall == Direction.SOUTH()) {
leftSide = Direction.WEST();
rightSide = Direction.EAST();
} else if (this.wall == Direction.WEST()) {
leftSide = Direction.NORTH();
rightSide = Direction.SOUTH();
}
this.teamGateBlocks.clear();
if (this.warzone.getWarzoneConfig().getBoolean(WarzoneConfig.AUTOASSIGN)) {
@ -467,18 +468,18 @@ public class ZoneLobby {
BlockFace leftSide = null; // looking at the zone
BlockFace rightSide = null;
if (this.wall == BlockFace.NORTH) {
leftSide = BlockFace.EAST;
rightSide = BlockFace.WEST;
} else if (this.wall == BlockFace.EAST) {
leftSide = BlockFace.SOUTH;
rightSide = BlockFace.NORTH;
} else if (this.wall == BlockFace.SOUTH) {
leftSide = BlockFace.WEST;
rightSide = BlockFace.EAST;
} else if (this.wall == BlockFace.WEST) {
leftSide = BlockFace.NORTH;
rightSide = BlockFace.SOUTH;
if (this.wall == Direction.NORTH()) {
leftSide = Direction.EAST();
rightSide = Direction.WEST();
} else if (this.wall == Direction.EAST()) {
leftSide = Direction.SOUTH();
rightSide = Direction.NORTH();
} else if (this.wall == Direction.SOUTH()) {
leftSide = Direction.WEST();
rightSide = Direction.EAST();
} else if (this.wall == Direction.WEST()) {
leftSide = Direction.NORTH();
rightSide = Direction.SOUTH();
}
// minimal air path
@ -504,29 +505,29 @@ public class ZoneLobby {
BlockFace rightSide = null;
// warhub link is opposite direction as zone wall
if (this.wall == BlockFace.NORTH) {
front = BlockFace.SOUTH;
} else if (this.wall == BlockFace.EAST) {
front = BlockFace.WEST;
} else if (this.wall == BlockFace.SOUTH) {
front = BlockFace.NORTH;
} else if (this.wall == BlockFace.WEST) {
front = BlockFace.EAST;
if (this.wall == Direction.NORTH()) {
front = Direction.SOUTH();
} else if (this.wall == Direction.EAST()) {
front = Direction.WEST();
} else if (this.wall == Direction.SOUTH()) {
front = Direction.NORTH();
} else if (this.wall == Direction.WEST()) {
front = Direction.EAST();
}
if (this.wall == BlockFace.NORTH) {
leftSide = BlockFace.EAST;
rightSide = BlockFace.WEST;
if (this.wall == Direction.NORTH()) {
leftSide = Direction.EAST();
rightSide = Direction.WEST();
} else if (this.wall == BlockFace.EAST) {
leftSide = BlockFace.SOUTH;
rightSide = BlockFace.NORTH;
} else if (this.wall == BlockFace.SOUTH) {
leftSide = BlockFace.WEST;
rightSide = BlockFace.EAST;
} else if (this.wall == BlockFace.WEST) {
leftSide = BlockFace.NORTH;
rightSide = BlockFace.SOUTH;
} else if (this.wall == Direction.EAST()) {
leftSide = Direction.SOUTH();
rightSide = Direction.NORTH();
} else if (this.wall == Direction.SOUTH()) {
leftSide = Direction.WEST();
rightSide = Direction.EAST();
} else if (this.wall == Direction.WEST()) {
leftSide = Direction.NORTH();
rightSide = Direction.SOUTH();
}
// minimal air path
@ -561,18 +562,18 @@ public class ZoneLobby {
BlockFace leftSide = null; // lookingat the zone
BlockFace rightSide = null;
if (this.wall == BlockFace.NORTH) {
leftSide = BlockFace.EAST;
rightSide = BlockFace.WEST;
} else if (this.wall == BlockFace.EAST) {
leftSide = BlockFace.SOUTH;
rightSide = BlockFace.NORTH;
} else if (this.wall == BlockFace.SOUTH) {
leftSide = BlockFace.WEST;
rightSide = BlockFace.EAST;
} else if (this.wall == BlockFace.WEST) {
leftSide = BlockFace.NORTH;
rightSide = BlockFace.SOUTH;
if (this.wall == Direction.NORTH()) {
leftSide = Direction.EAST();
rightSide = Direction.WEST();
} else if (this.wall == Direction.EAST()) {
leftSide = Direction.SOUTH();
rightSide = Direction.NORTH();
} else if (this.wall == Direction.SOUTH()) {
leftSide = Direction.WEST();
rightSide = Direction.EAST();
} else if (this.wall == Direction.WEST()) {
leftSide = Direction.NORTH();
rightSide = Direction.SOUTH();
}
@ -670,18 +671,18 @@ public class ZoneLobby {
if (gateBlock != null) {
BlockFace leftSide = null; // look at the zone
BlockFace rightSide = null;
if (this.wall == BlockFace.NORTH) {
leftSide = BlockFace.EAST;
rightSide = BlockFace.WEST;
} else if (this.wall == BlockFace.EAST) {
leftSide = BlockFace.SOUTH;
rightSide = BlockFace.NORTH;
} else if (this.wall == BlockFace.SOUTH) {
leftSide = BlockFace.WEST;
rightSide = BlockFace.EAST;
} else if (this.wall == BlockFace.WEST) {
leftSide = BlockFace.NORTH;
rightSide = BlockFace.SOUTH;
if (this.wall == Direction.NORTH()) {
leftSide = Direction.EAST();
rightSide = Direction.WEST();
} else if (this.wall == Direction.EAST()) {
leftSide = Direction.SOUTH();
rightSide = Direction.NORTH();
} else if (this.wall == Direction.SOUTH()) {
leftSide = Direction.WEST();
rightSide = Direction.EAST();
} else if (this.wall == Direction.WEST()) {
leftSide = Direction.NORTH();
rightSide = Direction.SOUTH();
}
return (block.getX() == gateBlock.getX() && block.getY() == gateBlock.getY() && block.getZ() == gateBlock.getZ()) || (block.getX() == gateBlock.getRelative(BlockFace.UP).getX() && block.getY() == gateBlock.getRelative(BlockFace.UP).getY() && block.getZ() == gateBlock.getRelative(BlockFace.UP).getZ()) || (block.getX() == gateBlock.getRelative(leftSide).getX() && block.getY() == gateBlock.getRelative(leftSide).getY() && block.getZ() == gateBlock.getRelative(leftSide).getZ()) || (block.getX() == gateBlock.getRelative(leftSide).getRelative(BlockFace.UP).getX() && block.getY() == gateBlock.getRelative(leftSide).getRelative(BlockFace.UP).getY() && block.getZ() == gateBlock.getRelative(leftSide).getRelative(BlockFace.UP).getZ()) || (block.getX() == gateBlock.getRelative(leftSide).getRelative(BlockFace.UP).getRelative(BlockFace.UP).getX() && block.getY() == gateBlock.getRelative(leftSide).getRelative(BlockFace.UP).getRelative(BlockFace.UP).getY() && block.getZ() == gateBlock.getRelative(leftSide).getRelative(BlockFace.UP).getRelative(BlockFace.UP).getZ()) || (block.getX() == gateBlock.getRelative(BlockFace.UP).getRelative(BlockFace.UP).getX() && block.getY() == gateBlock.getRelative(BlockFace.UP).getRelative(BlockFace.UP).getY() && block.getZ() == gateBlock.getRelative(BlockFace.UP).getRelative(BlockFace.UP).getZ()) || (block.getX() == gateBlock.getRelative(rightSide).getRelative(BlockFace.UP).getX() && block.getY() == gateBlock.getRelative(rightSide).getRelative(BlockFace.UP).getY() && block.getZ() == gateBlock.getRelative(rightSide).getRelative(BlockFace.UP).getZ()) || (block.getX() == gateBlock.getRelative(rightSide).getRelative(BlockFace.UP).getRelative(BlockFace.UP).getX() && block.getY() == gateBlock.getRelative(rightSide).getRelative(BlockFace.UP).getRelative(BlockFace.UP).getY() && block.getZ() == gateBlock.getRelative(rightSide).getRelative(BlockFace.UP).getRelative(BlockFace.UP).getZ()) || (block.getX() == gateBlock.getRelative(rightSide).getX() && block.getY() == gateBlock.getRelative(rightSide).getY() && block.getZ() == gateBlock.getRelative(rightSide).getZ()) || (block.getX() == gateBlock.getX() && block.getY() == gateBlock.getY() - 1 && block.getZ() == gateBlock.getZ());
}
@ -719,39 +720,39 @@ public class ZoneLobby {
BlockFace direction = null;
if (awayFromWall) {
direction = this.wall;
} else if (this.wall == BlockFace.NORTH) {
direction = BlockFace.SOUTH;
} else if (this.wall == BlockFace.EAST) {
direction = BlockFace.WEST;
} else if (this.wall == BlockFace.SOUTH) {
direction = BlockFace.NORTH;
} else if (this.wall == BlockFace.WEST) {
direction = BlockFace.EAST;
} else if (this.wall == Direction.NORTH()) {
direction = Direction.SOUTH();
} else if (this.wall == Direction.EAST()) {
direction = Direction.WEST();
} else if (this.wall == Direction.SOUTH()) {
direction = Direction.NORTH();
} else if (this.wall == Direction.WEST()) {
direction = Direction.EAST();
}
byte data = 0;
if (this.wall == BlockFace.NORTH) {
block = gate.getRelative(direction).getRelative(BlockFace.EAST);
if (this.wall == Direction.NORTH()) {
block = gate.getRelative(direction).getRelative(Direction.EAST());
if (awayFromWall) {
data = (byte) 4;
} else {
data = (byte) 12;
}
} else if (this.wall == BlockFace.EAST) {
block = gate.getRelative(direction).getRelative(BlockFace.SOUTH);
} else if (this.wall == Direction.EAST()) {
block = gate.getRelative(direction).getRelative(Direction.SOUTH());
if (awayFromWall) {
data = (byte) 8;
} else {
data = (byte) 0;
}
} else if (this.wall == BlockFace.SOUTH) {
block = gate.getRelative(direction).getRelative(BlockFace.WEST);
} else if (this.wall == Direction.SOUTH()) {
block = gate.getRelative(direction).getRelative(Direction.WEST());
if (awayFromWall) {
data = (byte) 12;
} else {
data = (byte) 4;
}
} else if (this.wall == BlockFace.WEST) {
block = gate.getRelative(direction).getRelative(BlockFace.NORTH);
} else if (this.wall == Direction.WEST()) {
block = gate.getRelative(direction).getRelative(Direction.NORTH());
if (awayFromWall) {
data = (byte) 0;
} else {
@ -766,22 +767,22 @@ public class ZoneLobby {
BlockFace inside = null;
BlockFace left = null;
BlockFace right = null;
if (this.wall == BlockFace.NORTH) {
inside = BlockFace.SOUTH;
left = BlockFace.WEST;
right = BlockFace.EAST;
} else if (this.wall == BlockFace.EAST) {
inside = BlockFace.WEST;
left = BlockFace.NORTH;
right = BlockFace.SOUTH;
} else if (this.wall == BlockFace.SOUTH) {
inside = BlockFace.NORTH;
left = BlockFace.EAST;
right = BlockFace.WEST;
} else if (this.wall == BlockFace.WEST) {
inside = BlockFace.EAST;
left = BlockFace.SOUTH;
right = BlockFace.NORTH;
if (this.wall == Direction.NORTH()) {
inside = Direction.SOUTH();
left = Direction.WEST();
right = Direction.EAST();
} else if (this.wall == Direction.EAST()) {
inside = Direction.WEST();
left = Direction.NORTH();
right = Direction.SOUTH();
} else if (this.wall == Direction.SOUTH()) {
inside = Direction.NORTH();
left = Direction.EAST();
right = Direction.WEST();
} else if (this.wall == Direction.WEST()) {
inside = Direction.EAST();
left = Direction.SOUTH();
right = Direction.NORTH();
}
if (this.autoAssignGate != null) {
if (this.leaving(location, BlockInfo.getBlock(this.volume.getWorld(), this.autoAssignGate), inside, left, right)) {

View File

@ -11,6 +11,7 @@ import org.bukkit.entity.Player;
import com.tommytony.war.War;
import com.tommytony.war.Warzone;
import com.tommytony.war.utility.Direction;
import com.tommytony.war.volume.BlockInfo;
@ -46,116 +47,116 @@ public class ZoneWallGuard {
this.glassify(block.getRelative(BlockFace.DOWN), this.wall);
this.glassify(block.getRelative(BlockFace.DOWN, 2), this.wall);
}
if (this.wall == BlockFace.NORTH && this.warzone.getVolume().isNorthWallBlock(block)) {
this.glassify(block.getRelative(BlockFace.EAST), BlockFace.NORTH);
this.glassify(block.getRelative(BlockFace.EAST).getRelative(BlockFace.UP), BlockFace.NORTH);
this.glassify(block.getRelative(BlockFace.EAST).getRelative(BlockFace.DOWN), BlockFace.NORTH);
this.glassify(block.getRelative(BlockFace.EAST, 2), BlockFace.NORTH);
this.glassify(block.getRelative(BlockFace.EAST, 2).getRelative(BlockFace.UP), BlockFace.NORTH);
this.glassify(block.getRelative(BlockFace.EAST, 2).getRelative(BlockFace.DOWN), BlockFace.NORTH);
this.glassify(block.getRelative(BlockFace.EAST).getRelative(BlockFace.UP, 2), BlockFace.NORTH);
this.glassify(block.getRelative(BlockFace.EAST).getRelative(BlockFace.DOWN, 2), BlockFace.NORTH);
this.glassify(block.getRelative(BlockFace.WEST), BlockFace.NORTH);
this.glassify(block.getRelative(BlockFace.WEST).getRelative(BlockFace.UP), BlockFace.NORTH);
this.glassify(block.getRelative(BlockFace.WEST).getRelative(BlockFace.DOWN), BlockFace.NORTH);
this.glassify(block.getRelative(BlockFace.WEST, 2), BlockFace.NORTH);
this.glassify(block.getRelative(BlockFace.WEST, 2).getRelative(BlockFace.UP), BlockFace.NORTH);
this.glassify(block.getRelative(BlockFace.WEST, 2).getRelative(BlockFace.DOWN), BlockFace.NORTH);
this.glassify(block.getRelative(BlockFace.WEST).getRelative(BlockFace.UP, 2), BlockFace.NORTH);
this.glassify(block.getRelative(BlockFace.WEST).getRelative(BlockFace.DOWN, 2), BlockFace.NORTH);
} else if (this.wall == BlockFace.SOUTH && this.warzone.getVolume().isSouthWallBlock(block)) {
this.glassify(block.getRelative(BlockFace.EAST), BlockFace.SOUTH);
this.glassify(block.getRelative(BlockFace.EAST).getRelative(BlockFace.UP), BlockFace.SOUTH);
this.glassify(block.getRelative(BlockFace.EAST).getRelative(BlockFace.DOWN), BlockFace.SOUTH);
this.glassify(block.getRelative(BlockFace.EAST, 2), BlockFace.SOUTH);
this.glassify(block.getRelative(BlockFace.EAST, 2).getRelative(BlockFace.UP), BlockFace.SOUTH);
this.glassify(block.getRelative(BlockFace.EAST, 2).getRelative(BlockFace.DOWN), BlockFace.SOUTH);
this.glassify(block.getRelative(BlockFace.EAST).getRelative(BlockFace.UP, 2), BlockFace.SOUTH);
this.glassify(block.getRelative(BlockFace.EAST).getRelative(BlockFace.DOWN, 2), BlockFace.SOUTH);
this.glassify(block.getRelative(BlockFace.WEST), BlockFace.SOUTH);
this.glassify(block.getRelative(BlockFace.WEST).getRelative(BlockFace.UP), BlockFace.SOUTH);
this.glassify(block.getRelative(BlockFace.WEST).getRelative(BlockFace.DOWN), BlockFace.SOUTH);
this.glassify(block.getRelative(BlockFace.WEST, 2), BlockFace.SOUTH);
this.glassify(block.getRelative(BlockFace.WEST, 2).getRelative(BlockFace.UP), BlockFace.SOUTH);
this.glassify(block.getRelative(BlockFace.WEST, 2).getRelative(BlockFace.DOWN), BlockFace.SOUTH);
this.glassify(block.getRelative(BlockFace.WEST).getRelative(BlockFace.UP, 2), BlockFace.SOUTH);
this.glassify(block.getRelative(BlockFace.WEST).getRelative(BlockFace.DOWN, 2), BlockFace.SOUTH);
} else if (this.wall == BlockFace.EAST && this.warzone.getVolume().isEastWallBlock(block)) {
this.glassify(block.getRelative(BlockFace.NORTH), BlockFace.EAST);
this.glassify(block.getRelative(BlockFace.NORTH).getRelative(BlockFace.UP), BlockFace.EAST);
this.glassify(block.getRelative(BlockFace.NORTH).getRelative(BlockFace.DOWN), BlockFace.EAST);
this.glassify(block.getRelative(BlockFace.NORTH, 2), BlockFace.EAST);
this.glassify(block.getRelative(BlockFace.NORTH, 2).getRelative(BlockFace.UP), BlockFace.EAST);
this.glassify(block.getRelative(BlockFace.NORTH, 2).getRelative(BlockFace.DOWN), BlockFace.EAST);
this.glassify(block.getRelative(BlockFace.NORTH).getRelative(BlockFace.UP, 2), BlockFace.EAST);
this.glassify(block.getRelative(BlockFace.NORTH).getRelative(BlockFace.DOWN, 2), BlockFace.EAST);
this.glassify(block.getRelative(BlockFace.SOUTH), BlockFace.EAST);
this.glassify(block.getRelative(BlockFace.SOUTH).getRelative(BlockFace.UP), BlockFace.EAST);
this.glassify(block.getRelative(BlockFace.SOUTH).getRelative(BlockFace.DOWN), BlockFace.EAST);
this.glassify(block.getRelative(BlockFace.SOUTH, 2), BlockFace.EAST);
this.glassify(block.getRelative(BlockFace.SOUTH, 2).getRelative(BlockFace.UP), BlockFace.EAST);
this.glassify(block.getRelative(BlockFace.SOUTH, 2).getRelative(BlockFace.DOWN), BlockFace.EAST);
this.glassify(block.getRelative(BlockFace.SOUTH).getRelative(BlockFace.UP, 2), BlockFace.EAST);
this.glassify(block.getRelative(BlockFace.SOUTH).getRelative(BlockFace.DOWN, 2), BlockFace.EAST);
} else if (this.wall == BlockFace.WEST && this.warzone.getVolume().isWestWallBlock(block)) {
this.glassify(block.getRelative(BlockFace.NORTH), BlockFace.WEST);
this.glassify(block.getRelative(BlockFace.NORTH).getRelative(BlockFace.UP), BlockFace.WEST);
this.glassify(block.getRelative(BlockFace.NORTH).getRelative(BlockFace.DOWN), BlockFace.WEST);
this.glassify(block.getRelative(BlockFace.NORTH, 2), BlockFace.WEST);
this.glassify(block.getRelative(BlockFace.NORTH, 2).getRelative(BlockFace.UP), BlockFace.WEST);
this.glassify(block.getRelative(BlockFace.NORTH, 2).getRelative(BlockFace.DOWN), BlockFace.WEST);
this.glassify(block.getRelative(BlockFace.NORTH).getRelative(BlockFace.UP, 2), BlockFace.WEST);
this.glassify(block.getRelative(BlockFace.NORTH).getRelative(BlockFace.DOWN, 2), BlockFace.WEST);
this.glassify(block.getRelative(BlockFace.SOUTH), BlockFace.WEST);
this.glassify(block.getRelative(BlockFace.SOUTH).getRelative(BlockFace.UP), BlockFace.WEST);
this.glassify(block.getRelative(BlockFace.SOUTH).getRelative(BlockFace.DOWN), BlockFace.WEST);
this.glassify(block.getRelative(BlockFace.SOUTH, 2), BlockFace.WEST);
this.glassify(block.getRelative(BlockFace.SOUTH, 2).getRelative(BlockFace.UP), BlockFace.WEST);
this.glassify(block.getRelative(BlockFace.SOUTH, 2).getRelative(BlockFace.DOWN), BlockFace.WEST);
this.glassify(block.getRelative(BlockFace.SOUTH).getRelative(BlockFace.UP, 2), BlockFace.WEST);
this.glassify(block.getRelative(BlockFace.SOUTH).getRelative(BlockFace.DOWN, 2), BlockFace.WEST);
if (this.wall == Direction.NORTH() && this.warzone.getVolume().isNorthWallBlock(block)) {
this.glassify(block.getRelative(Direction.EAST()), Direction.NORTH());
this.glassify(block.getRelative(Direction.EAST()).getRelative(BlockFace.UP), Direction.NORTH());
this.glassify(block.getRelative(Direction.EAST()).getRelative(BlockFace.DOWN), Direction.NORTH());
this.glassify(block.getRelative(Direction.EAST(), 2), Direction.NORTH());
this.glassify(block.getRelative(Direction.EAST(), 2).getRelative(BlockFace.UP), Direction.NORTH());
this.glassify(block.getRelative(Direction.EAST(), 2).getRelative(BlockFace.DOWN), Direction.NORTH());
this.glassify(block.getRelative(Direction.EAST()).getRelative(BlockFace.UP, 2), Direction.NORTH());
this.glassify(block.getRelative(Direction.EAST()).getRelative(BlockFace.DOWN, 2), Direction.NORTH());
this.glassify(block.getRelative(Direction.WEST()), Direction.NORTH());
this.glassify(block.getRelative(Direction.WEST()).getRelative(BlockFace.UP), Direction.NORTH());
this.glassify(block.getRelative(Direction.WEST()).getRelative(BlockFace.DOWN), Direction.NORTH());
this.glassify(block.getRelative(Direction.WEST(), 2), Direction.NORTH());
this.glassify(block.getRelative(Direction.WEST(), 2).getRelative(BlockFace.UP), Direction.NORTH());
this.glassify(block.getRelative(Direction.WEST(), 2).getRelative(BlockFace.DOWN), Direction.NORTH());
this.glassify(block.getRelative(Direction.WEST()).getRelative(BlockFace.UP, 2), Direction.NORTH());
this.glassify(block.getRelative(Direction.WEST()).getRelative(BlockFace.DOWN, 2), Direction.NORTH());
} else if (this.wall == Direction.SOUTH() && this.warzone.getVolume().isSouthWallBlock(block)) {
this.glassify(block.getRelative(Direction.EAST()), Direction.SOUTH());
this.glassify(block.getRelative(Direction.EAST()).getRelative(BlockFace.UP), Direction.SOUTH());
this.glassify(block.getRelative(Direction.EAST()).getRelative(BlockFace.DOWN), Direction.SOUTH());
this.glassify(block.getRelative(Direction.EAST(), 2), Direction.SOUTH());
this.glassify(block.getRelative(Direction.EAST(), 2).getRelative(BlockFace.UP), Direction.SOUTH());
this.glassify(block.getRelative(Direction.EAST(), 2).getRelative(BlockFace.DOWN), Direction.SOUTH());
this.glassify(block.getRelative(Direction.EAST()).getRelative(BlockFace.UP, 2), Direction.SOUTH());
this.glassify(block.getRelative(Direction.EAST()).getRelative(BlockFace.DOWN, 2), Direction.SOUTH());
this.glassify(block.getRelative(Direction.WEST()), Direction.SOUTH());
this.glassify(block.getRelative(Direction.WEST()).getRelative(BlockFace.UP), Direction.SOUTH());
this.glassify(block.getRelative(Direction.WEST()).getRelative(BlockFace.DOWN), Direction.SOUTH());
this.glassify(block.getRelative(Direction.WEST(), 2), Direction.SOUTH());
this.glassify(block.getRelative(Direction.WEST(), 2).getRelative(BlockFace.UP), Direction.SOUTH());
this.glassify(block.getRelative(Direction.WEST(), 2).getRelative(BlockFace.DOWN), Direction.SOUTH());
this.glassify(block.getRelative(Direction.WEST()).getRelative(BlockFace.UP, 2), Direction.SOUTH());
this.glassify(block.getRelative(Direction.WEST()).getRelative(BlockFace.DOWN, 2), Direction.SOUTH());
} else if (this.wall == Direction.EAST() && this.warzone.getVolume().isEastWallBlock(block)) {
this.glassify(block.getRelative(Direction.NORTH()), Direction.EAST());
this.glassify(block.getRelative(Direction.NORTH()).getRelative(BlockFace.UP), Direction.EAST());
this.glassify(block.getRelative(Direction.NORTH()).getRelative(BlockFace.DOWN), Direction.EAST());
this.glassify(block.getRelative(Direction.NORTH(), 2), Direction.EAST());
this.glassify(block.getRelative(Direction.NORTH(), 2).getRelative(BlockFace.UP), Direction.EAST());
this.glassify(block.getRelative(Direction.NORTH(), 2).getRelative(BlockFace.DOWN), Direction.EAST());
this.glassify(block.getRelative(Direction.NORTH()).getRelative(BlockFace.UP, 2), Direction.EAST());
this.glassify(block.getRelative(Direction.NORTH()).getRelative(BlockFace.DOWN, 2), Direction.EAST());
this.glassify(block.getRelative(Direction.SOUTH()), Direction.EAST());
this.glassify(block.getRelative(Direction.SOUTH()).getRelative(BlockFace.UP), Direction.EAST());
this.glassify(block.getRelative(Direction.SOUTH()).getRelative(BlockFace.DOWN), Direction.EAST());
this.glassify(block.getRelative(Direction.SOUTH(), 2), Direction.EAST());
this.glassify(block.getRelative(Direction.SOUTH(), 2).getRelative(BlockFace.UP), Direction.EAST());
this.glassify(block.getRelative(Direction.SOUTH(), 2).getRelative(BlockFace.DOWN), Direction.EAST());
this.glassify(block.getRelative(Direction.SOUTH()).getRelative(BlockFace.UP, 2), Direction.EAST());
this.glassify(block.getRelative(Direction.SOUTH()).getRelative(BlockFace.DOWN, 2), Direction.EAST());
} else if (this.wall == Direction.WEST() && this.warzone.getVolume().isWestWallBlock(block)) {
this.glassify(block.getRelative(Direction.NORTH()), Direction.WEST());
this.glassify(block.getRelative(Direction.NORTH()).getRelative(BlockFace.UP), Direction.WEST());
this.glassify(block.getRelative(Direction.NORTH()).getRelative(BlockFace.DOWN), Direction.WEST());
this.glassify(block.getRelative(Direction.NORTH(), 2), Direction.WEST());
this.glassify(block.getRelative(Direction.NORTH(), 2).getRelative(BlockFace.UP), Direction.WEST());
this.glassify(block.getRelative(Direction.NORTH(), 2).getRelative(BlockFace.DOWN), Direction.WEST());
this.glassify(block.getRelative(Direction.NORTH()).getRelative(BlockFace.UP, 2), Direction.WEST());
this.glassify(block.getRelative(Direction.NORTH()).getRelative(BlockFace.DOWN, 2), Direction.WEST());
this.glassify(block.getRelative(Direction.SOUTH()), Direction.WEST());
this.glassify(block.getRelative(Direction.SOUTH()).getRelative(BlockFace.UP), Direction.WEST());
this.glassify(block.getRelative(Direction.SOUTH()).getRelative(BlockFace.DOWN), Direction.WEST());
this.glassify(block.getRelative(Direction.SOUTH(), 2), Direction.WEST());
this.glassify(block.getRelative(Direction.SOUTH(), 2).getRelative(BlockFace.UP), Direction.WEST());
this.glassify(block.getRelative(Direction.SOUTH(), 2).getRelative(BlockFace.DOWN), Direction.WEST());
this.glassify(block.getRelative(Direction.SOUTH()).getRelative(BlockFace.UP, 2), Direction.WEST());
this.glassify(block.getRelative(Direction.SOUTH()).getRelative(BlockFace.DOWN, 2), Direction.WEST());
} else if (this.wall == BlockFace.UP && this.warzone.getVolume().isUpWallBlock(block)) {
this.glassify(block.getRelative(BlockFace.EAST), BlockFace.UP);
this.glassify(block.getRelative(BlockFace.EAST, 2), BlockFace.UP);
this.glassify(block.getRelative(BlockFace.WEST), BlockFace.UP);
this.glassify(block.getRelative(BlockFace.WEST, 2), BlockFace.UP);
this.glassify(block.getRelative(BlockFace.NORTH), BlockFace.UP);
this.glassify(block.getRelative(BlockFace.NORTH).getRelative(BlockFace.EAST), BlockFace.UP);
this.glassify(block.getRelative(BlockFace.NORTH).getRelative(BlockFace.WEST), BlockFace.UP);
this.glassify(block.getRelative(BlockFace.NORTH, 2), BlockFace.UP);
this.glassify(block.getRelative(BlockFace.NORTH, 2).getRelative(BlockFace.EAST), BlockFace.UP);
this.glassify(block.getRelative(BlockFace.NORTH, 2).getRelative(BlockFace.WEST), BlockFace.UP);
this.glassify(block.getRelative(BlockFace.NORTH).getRelative(BlockFace.EAST, 2), BlockFace.UP);
this.glassify(block.getRelative(BlockFace.NORTH).getRelative(BlockFace.WEST, 2), BlockFace.UP);
this.glassify(block.getRelative(BlockFace.SOUTH), BlockFace.UP);
this.glassify(block.getRelative(BlockFace.SOUTH).getRelative(BlockFace.EAST), BlockFace.UP);
this.glassify(block.getRelative(BlockFace.SOUTH).getRelative(BlockFace.WEST), BlockFace.UP);
this.glassify(block.getRelative(BlockFace.SOUTH, 2), BlockFace.UP);
this.glassify(block.getRelative(BlockFace.SOUTH, 2).getRelative(BlockFace.EAST), BlockFace.UP);
this.glassify(block.getRelative(BlockFace.SOUTH, 2).getRelative(BlockFace.WEST), BlockFace.UP);
this.glassify(block.getRelative(BlockFace.SOUTH).getRelative(BlockFace.UP, 2), BlockFace.UP);
this.glassify(block.getRelative(BlockFace.SOUTH).getRelative(BlockFace.DOWN, 2), BlockFace.UP);
this.glassify(block.getRelative(Direction.EAST()), BlockFace.UP);
this.glassify(block.getRelative(Direction.EAST(), 2), BlockFace.UP);
this.glassify(block.getRelative(Direction.WEST()), BlockFace.UP);
this.glassify(block.getRelative(Direction.WEST(), 2), BlockFace.UP);
this.glassify(block.getRelative(Direction.NORTH()), BlockFace.UP);
this.glassify(block.getRelative(Direction.NORTH()).getRelative(Direction.EAST()), BlockFace.UP);
this.glassify(block.getRelative(Direction.NORTH()).getRelative(Direction.WEST()), BlockFace.UP);
this.glassify(block.getRelative(Direction.NORTH(), 2), BlockFace.UP);
this.glassify(block.getRelative(Direction.NORTH(), 2).getRelative(Direction.EAST()), BlockFace.UP);
this.glassify(block.getRelative(Direction.NORTH(), 2).getRelative(Direction.WEST()), BlockFace.UP);
this.glassify(block.getRelative(Direction.NORTH()).getRelative(Direction.EAST(), 2), BlockFace.UP);
this.glassify(block.getRelative(Direction.NORTH()).getRelative(Direction.WEST(), 2), BlockFace.UP);
this.glassify(block.getRelative(Direction.SOUTH()), BlockFace.UP);
this.glassify(block.getRelative(Direction.SOUTH()).getRelative(Direction.EAST()), BlockFace.UP);
this.glassify(block.getRelative(Direction.SOUTH()).getRelative(Direction.WEST()), BlockFace.UP);
this.glassify(block.getRelative(Direction.SOUTH(), 2), BlockFace.UP);
this.glassify(block.getRelative(Direction.SOUTH(), 2).getRelative(Direction.EAST()), BlockFace.UP);
this.glassify(block.getRelative(Direction.SOUTH(), 2).getRelative(Direction.WEST()), BlockFace.UP);
this.glassify(block.getRelative(Direction.SOUTH()).getRelative(BlockFace.UP, 2), BlockFace.UP);
this.glassify(block.getRelative(Direction.SOUTH()).getRelative(BlockFace.DOWN, 2), BlockFace.UP);
} else if (this.wall == BlockFace.DOWN && this.warzone.getVolume().isDownWallBlock(block)) {
this.glassify(block.getRelative(BlockFace.EAST), BlockFace.DOWN);
this.glassify(block.getRelative(BlockFace.EAST, 2), BlockFace.DOWN);
this.glassify(block.getRelative(BlockFace.WEST), BlockFace.DOWN);
this.glassify(block.getRelative(BlockFace.WEST, 2), BlockFace.DOWN);
this.glassify(block.getRelative(BlockFace.NORTH), BlockFace.DOWN);
this.glassify(block.getRelative(BlockFace.NORTH).getRelative(BlockFace.EAST), BlockFace.DOWN);
this.glassify(block.getRelative(BlockFace.NORTH).getRelative(BlockFace.WEST), BlockFace.DOWN);
this.glassify(block.getRelative(BlockFace.NORTH, 2), BlockFace.DOWN);
this.glassify(block.getRelative(BlockFace.NORTH, 2).getRelative(BlockFace.EAST), BlockFace.DOWN);
this.glassify(block.getRelative(BlockFace.NORTH, 2).getRelative(BlockFace.WEST), BlockFace.DOWN);
this.glassify(block.getRelative(BlockFace.NORTH).getRelative(BlockFace.EAST, 2), BlockFace.DOWN);
this.glassify(block.getRelative(BlockFace.NORTH).getRelative(BlockFace.WEST, 2), BlockFace.DOWN);
this.glassify(block.getRelative(BlockFace.SOUTH), BlockFace.DOWN);
this.glassify(block.getRelative(BlockFace.SOUTH).getRelative(BlockFace.EAST), BlockFace.DOWN);
this.glassify(block.getRelative(BlockFace.SOUTH).getRelative(BlockFace.WEST), BlockFace.DOWN);
this.glassify(block.getRelative(BlockFace.SOUTH, 2), BlockFace.DOWN);
this.glassify(block.getRelative(BlockFace.SOUTH, 2).getRelative(BlockFace.EAST), BlockFace.DOWN);
this.glassify(block.getRelative(BlockFace.SOUTH, 2).getRelative(BlockFace.WEST), BlockFace.DOWN);
this.glassify(block.getRelative(BlockFace.SOUTH).getRelative(BlockFace.DOWN, 2), BlockFace.DOWN);
this.glassify(block.getRelative(BlockFace.SOUTH).getRelative(BlockFace.DOWN, 2), BlockFace.DOWN);
this.glassify(block.getRelative(Direction.EAST()), BlockFace.DOWN);
this.glassify(block.getRelative(Direction.EAST(), 2), BlockFace.DOWN);
this.glassify(block.getRelative(Direction.WEST()), BlockFace.DOWN);
this.glassify(block.getRelative(Direction.WEST(), 2), BlockFace.DOWN);
this.glassify(block.getRelative(Direction.NORTH()), BlockFace.DOWN);
this.glassify(block.getRelative(Direction.NORTH()).getRelative(Direction.EAST()), BlockFace.DOWN);
this.glassify(block.getRelative(Direction.NORTH()).getRelative(Direction.WEST()), BlockFace.DOWN);
this.glassify(block.getRelative(Direction.NORTH(), 2), BlockFace.DOWN);
this.glassify(block.getRelative(Direction.NORTH(), 2).getRelative(Direction.EAST()), BlockFace.DOWN);
this.glassify(block.getRelative(Direction.NORTH(), 2).getRelative(Direction.WEST()), BlockFace.DOWN);
this.glassify(block.getRelative(Direction.NORTH()).getRelative(Direction.EAST(), 2), BlockFace.DOWN);
this.glassify(block.getRelative(Direction.NORTH()).getRelative(Direction.WEST(), 2), BlockFace.DOWN);
this.glassify(block.getRelative(Direction.SOUTH()), BlockFace.DOWN);
this.glassify(block.getRelative(Direction.SOUTH()).getRelative(Direction.EAST()), BlockFace.DOWN);
this.glassify(block.getRelative(Direction.SOUTH()).getRelative(Direction.WEST()), BlockFace.DOWN);
this.glassify(block.getRelative(Direction.SOUTH(), 2), BlockFace.DOWN);
this.glassify(block.getRelative(Direction.SOUTH(), 2).getRelative(Direction.EAST()), BlockFace.DOWN);
this.glassify(block.getRelative(Direction.SOUTH(), 2).getRelative(Direction.WEST()), BlockFace.DOWN);
this.glassify(block.getRelative(Direction.SOUTH()).getRelative(BlockFace.DOWN, 2), BlockFace.DOWN);
this.glassify(block.getRelative(Direction.SOUTH()).getRelative(BlockFace.DOWN, 2), BlockFace.DOWN);
}
}
}
@ -164,22 +165,22 @@ public class ZoneWallGuard {
// face here means which wall we are working on
if ((block.getTypeId() == Material.AIR.getId() || block.getTypeId() == Material.WATER.getId()) && (this.warzone.getLobby() == null || (this.warzone.getLobby() != null && !this.warzone.getLobby().blockIsAGateBlock(block, wall)))) {
if (wall == BlockFace.NORTH) {
if (wall == Direction.NORTH()) {
if (this.warzone.getVolume().isNorthWallBlock(block)) {
this.glassified.add(new BlockInfo(block));
block.setType(Material.GLASS);
}
} else if (wall == BlockFace.SOUTH) {
} else if (wall == Direction.SOUTH()) {
if (this.warzone.getVolume().isSouthWallBlock(block)) {
this.glassified.add(new BlockInfo(block));
block.setType(Material.GLASS);
}
} else if (wall == BlockFace.EAST) {
} else if (wall == Direction.EAST()) {
if (this.warzone.getVolume().isEastWallBlock(block)) {
this.glassified.add(new BlockInfo(block));
block.setType(Material.GLASS);
}
} else if (wall == BlockFace.WEST) {
} else if (wall == Direction.WEST()) {
if (this.warzone.getVolume().isWestWallBlock(block)) {
this.glassified.add(new BlockInfo(block));
block.setType(Material.GLASS);

View File

@ -0,0 +1,72 @@
package com.tommytony.war.utility;
import org.bukkit.block.BlockFace;
public class Direction {
private static boolean isLegacy = BlockFace.NORTH.getModX() == -1;
public static BlockFace NORTH() {
if (!isLegacy) {
return BlockFace.WEST;
} else {
return BlockFace.NORTH;
}
}
public static BlockFace EAST() {
if (!isLegacy) {
return BlockFace.NORTH;
} else {
return BlockFace.EAST;
}
}
public static BlockFace SOUTH() {
if (!isLegacy) {
return BlockFace.EAST;
} else {
return BlockFace.SOUTH;
}
}
public static BlockFace WEST() {
if (!isLegacy) {
return BlockFace.SOUTH;
} else {
return BlockFace.WEST;
}
}
public static BlockFace NORTH_EAST() {
if (!isLegacy) {
return BlockFace.NORTH_WEST;
} else {
return BlockFace.NORTH_EAST;
}
}
public static BlockFace NORTH_WEST() {
if (!isLegacy) {
return BlockFace.SOUTH_WEST;
} else {
return BlockFace.NORTH_WEST;
}
}
public static BlockFace SOUTH_EAST() {
if (!isLegacy) {
return BlockFace.NORTH_EAST;
} else {
return BlockFace.SOUTH_EAST;
}
}
public static BlockFace SOUTH_WEST() {
if (!isLegacy) {
return BlockFace.NORTH_WEST;
} else {
return BlockFace.SOUTH_WEST;
}
}
}

View File

@ -8,6 +8,7 @@ import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import com.tommytony.war.War;
import com.tommytony.war.utility.Direction;
/**
@ -73,7 +74,7 @@ public class VerticalVolume extends Volume {
int noOfResetBlocks = 0;
try {
if (this.hasTwoCorners() && this.getBlockTypes() != null) {
if (wall == BlockFace.EAST) {
if (wall == Direction.EAST()) {
int z = this.getMinZ();
int k = 0;
int y = this.getMinY();
@ -90,7 +91,7 @@ public class VerticalVolume extends Volume {
}
y++;
}
} else if (wall == BlockFace.WEST) {
} else if (wall == Direction.WEST()) {
int z = this.getMaxZ();
int k = this.getSizeZ() - 1;
int y = this.getMinY();
@ -107,7 +108,7 @@ public class VerticalVolume extends Volume {
}
y++;
}
} else if (wall == BlockFace.NORTH) {
} else if (wall == Direction.NORTH()) {
int x = this.getMinX();
int i = 0;
int y = this.getMinY();
@ -124,7 +125,7 @@ public class VerticalVolume extends Volume {
}
y++;
}
} else if (wall == BlockFace.SOUTH) {
} else if (wall == Direction.SOUTH()) {
int x = this.getMaxX();
int i = this.getSizeX() - 1;
int y = this.getMinY();

View File

@ -20,6 +20,7 @@ import org.bukkit.inventory.ItemStack;
import com.tommytony.war.War;
import com.tommytony.war.job.BlockResetJob;
import com.tommytony.war.utility.Direction;
/**
*
@ -169,7 +170,7 @@ public class Volume {
if (oldBlockType == Material.WALL_SIGN.getId() || oldBlockType == Material.SIGN_POST.getId()) {
// Signs
if (oldBlockType == Material.SIGN_POST.getId() && ((oldBlockData & 0x04) == 0x04) && i + 1 != this.getSizeX()) {
Block southBlock = currentBlock.getRelative(BlockFace.SOUTH);
Block southBlock = currentBlock.getRelative(Direction.SOUTH());
int oldSouthBlockType = this.getBlockTypes()[i + 1][j][k];
byte oldSouthBlockData = this.getBlockDatas()[i + 1][j][k];
if (southBlock.getTypeId() != oldSouthBlockType) {
@ -255,7 +256,7 @@ public class Volume {
}
} else if (((oldBlockType == Material.TORCH.getId() && ((oldBlockData & 0x02) == 0x02)) || (oldBlockType == Material.REDSTONE_TORCH_OFF.getId() && ((oldBlockData & 0x02) == 0x02)) || (oldBlockType == Material.REDSTONE_TORCH_ON.getId() && ((oldBlockData & 0x02) == 0x02)) || (oldBlockType == Material.LEVER.getId() && ((oldBlockData & 0x02) == 0x02)) || (oldBlockType == Material.STONE_BUTTON.getId() && ((oldBlockData & 0x02) == 0x02)) || (oldBlockType == Material.LADDER.getId() && ((oldBlockData & 0x04) == 0x04)) || (oldBlockType == Material.RAILS.getId() && ((oldBlockData & 0x02) == 0x02))) && i + 1 != this.getSizeX()) {
// Blocks that hang on a block south of themselves need to make sure that block is there before placing themselves... lol
Block southBlock = currentBlock.getRelative(BlockFace.SOUTH);
Block southBlock = currentBlock.getRelative(Direction.SOUTH());
int oldSouthBlockType = this.getBlockTypes()[i + 1][j][k];
byte oldSouthBlockData = this.getBlockDatas()[i + 1][j][k];
if (southBlock.getTypeId() != oldSouthBlockType) {
@ -457,7 +458,7 @@ public class Volume {
for (int j = 0; j < this.getSizeY(); j++) {
int z = this.getMinZ();
for (int k = 0; k < this.getSizeZ(); k++) {
if ((face == BlockFace.DOWN && y == this.getMinY()) || (face == BlockFace.UP && y == this.getMaxY()) || (face == BlockFace.NORTH && x == this.getMinX()) || (face == BlockFace.EAST && z == this.getMinZ()) || (face == BlockFace.SOUTH && x == this.getMaxX()) || (face == BlockFace.WEST && z == this.getMaxZ())) {
if ((face == BlockFace.DOWN && y == this.getMinY()) || (face == BlockFace.UP && y == this.getMaxY()) || (face == Direction.NORTH() && x == this.getMinX()) || (face == Direction.EAST() && z == this.getMinZ()) || (face == Direction.SOUTH() && x == this.getMaxX()) || (face == Direction.WEST() && z == this.getMaxZ())) {
Block currentBlock = this.getWorld().getBlockAt(x, y, z);
currentBlock.setType(material);
currentBlock.setData(data);

View File

@ -1,5 +1,5 @@
name: War
version: 1.7.3 (Doolittle)
version: 1.7.4-PREVIEW (Doolittle)
description: Minecraft PVP arenas (called warzones) for a fast-paced and structured PVP experience with TDM, CTF & more!
author: tommytony
website: http://war.tommytony.com