int y = teamSpawn.getBlockY();
int z = teamSpawn.getBlockZ();
ItemStack light = this.warzone.getWarzoneMaterials().getLightBlock();
TeamSpawnStyle style = this.getTeamConfig().resolveSpawnStyle();
if (!style.equals(TeamSpawnStyle.INVISIBLE)) {
// first ring
this.setBlock(x + 1, y - 1, z + 1, this.kind);
this.setBlock(x + 1, y - 1, z, this.kind);
this.setBlock(x + 1, y - 1, z - 1, this.kind);
this.setBlock(x, y - 1, z + 1, this.kind);
BlockState lightBlock = this.warzone.getWorld().getBlockAt(x, y - 1, z).getState();
lightBlock.setType(light.getType());
lightBlock.setData(light.getData());
lightBlock.update(true);
this.setBlock(x, y - 1, z - 1, this.kind);
this.setBlock(x - 1, y - 1, z + 1, this.kind);
this.setBlock(x - 1, y - 1, z, this.kind);
this.setBlock(x - 1, y - 1, z - 1, this.kind);
}
// Orientation
int yaw = 0;
if (teamSpawn.getYaw() >= 0) {
yaw = (int) (teamSpawn.getYaw() % 360);
} else {
yaw = (int) (360 + (teamSpawn.getYaw() % 360));
}
Block signBlock = null;
BlockFace signDirection = null;
if (style.equals(TeamSpawnStyle.SMALL)) {
// SMALL style
if (yaw >= 0 && yaw < 90) {
signDirection = BlockFace.SOUTH_WEST.getOppositeFace();
signBlock = this.warzone.getWorld().getBlockAt(x, y, z).getRelative(Direction.NORTH()).getRelative(Direction.WEST());
} else if (yaw >= 90 && yaw <= 180) {
signDirection = BlockFace.NORTH_WEST.getOppositeFace();
signBlock = this.warzone.getWorld().getBlockAt(x, y, z).getRelative(Direction.NORTH()).getRelative(Direction.EAST());
} else if (yaw >= 180 && yaw < 270) {
signDirection = BlockFace.NORTH_EAST.getOppositeFace();
signBlock = this.warzone.getWorld().getBlockAt(x, y, z).getRelative(Direction.SOUTH()).getRelative(Direction.EAST());
} else if (yaw >= 270 && yaw <= 360) {
signDirection = BlockFace.SOUTH_EAST.getOppositeFace();
signBlock = this.warzone.getWorld().getBlockAt(x, y, z).getRelative(Direction.SOUTH()).getRelative(Direction.WEST());
}
} else if (!style.equals(TeamSpawnStyle.INVISIBLE)) {
// outer ring (FLAT or BIG)
this.setBlock(x + 2, y - 1, z + 2, this.kind);
this.setBlock(x + 2, y - 1, z + 1, this.kind);
this.setBlock(x + 2, y - 1, z, this.kind);
this.setBlock(x + 2, y - 1, z - 1, this.kind);
this.setBlock(x + 2, y - 1, z - 2, this.kind);
this.setBlock(x - 1, y - 1, z + 2, this.kind);
this.setBlock(x - 1, y - 1, z - 2, this.kind);
this.setBlock(x, y - 1, z + 2, this.kind);
this.setBlock(x, y - 1, z - 2, this.kind);
this.setBlock(x + 1, y - 1, z + 2, this.kind);
this.setBlock(x + 1, y - 1, z - 2, this.kind);
this.setBlock(x - 2, y - 1, z + 2, this.kind);
this.setBlock(x - 2, y - 1, z + 1, this.kind);
this.setBlock(x - 2, y - 1, z, this.kind);
this.setBlock(x - 2, y - 1, z - 1, this.kind);
this.setBlock(x - 2, y - 1, z - 2, this.kind);
if (yaw >= 0 && yaw < 90) {
signDirection = BlockFace.SOUTH_WEST.getOppositeFace();
signBlock = this.warzone.getWorld().getBlockAt(x, y, z).getRelative(Direction.NORTH(), 2).getRelative(Direction.WEST(), 2);
if (style.equals(TeamSpawnStyle.BIG)) {
// rim
this.setBlock(x - 2, y, z - 1, this.kind);
this.setBlock(x - 2, y, z - 2, this.kind);
this.setBlock(x - 1, y, z - 2, this.kind);
this.setBlock(x, y, z - 2, this.kind);
this.setBlock(x + 1, y, z - 2, this.kind);
this.setBlock(x + 2, y, z - 2, this.kind);
this.setBlock(x + 2, y, z - 1, this.kind);
this.setBlock(x + 2, y, z, this.kind);
this.setBlock(x + 2, y, z + 1, this.kind);
this.setBlock(x + 2, y, z + 2, this.kind);
this.setBlock(x + 1, y, z + 2, this.kind);
// tower
this.setBlock(x, y + 1, z - 2, this.kind);
this.setBlock(x + 1, y + 1, z - 2, this.kind);
this.setBlock(x + 2, y + 1, z - 2, this.kind);
this.setBlock(x + 2, y + 1, z - 1, this.kind);
this.setBlock(x + 2, y + 1, z, this.kind);
this.setBlock(x + 1, y + 2, z - 2, this.kind);
this.setBlock(x + 2, y + 2, z - 2, this.kind);
this.setBlock(x + 2, y + 2, z - 1, this.kind);
this.setBlock(x + 2, y + 3, z - 2, this.kind);
}
} else if (yaw >= 90 && yaw <= 180) {
signDirection = BlockFace.NORTH_WEST.getOppositeFace();
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);
this.setBlock(x + 2, y, z - 2, this.kind);
this.setBlock(x + 2, y, z - 1, this.kind);
this.setBlock(x + 2, y, z, this.kind);
this.setBlock(x + 2, y, z + 1, this.kind);
this.setBlock(x + 2, y, z + 2, this.kind);
this.setBlock(x + 1, y, z + 2, this.kind);
this.setBlock(x, y, z + 2, this.kind);
this.setBlock(x - 1, y, z + 2, this.kind);
this.setBlock(x - 2, y, z + 2, this.kind);
this.setBlock(x - 2, y, z + 1, this.kind);
// tower
this.setBlock(x + 2, y + 1, z, this.kind);
this.setBlock(x + 2, y + 1, z + 1, this.kind);
this.setBlock(x + 2, y + 1, z + 2, this.kind);
this.setBlock(x + 1, y + 1, z + 2, this.kind);
this.setBlock(x, y + 1, z + 2, this.kind);
this.setBlock(x + 2, y + 2, z + 1, this.kind);
this.setBlock(x + 2, y + 2, z + 2, this.kind);
this.setBlock(x + 1, y + 2, z + 2, this.kind);
this.setBlock(x + 2, y + 3, z + 2, this.kind);
}
} else if (yaw >= 180 && yaw < 270) {
signDirection = BlockFace.NORTH_EAST.getOppositeFace();
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);
this.setBlock(x + 2, y, z + 2, this.kind);
this.setBlock(x + 1, y, z + 2, this.kind);
this.setBlock(x, y, z + 2, this.kind);
this.setBlock(x - 1, y, z + 2, this.kind);
this.setBlock(x - 2, y, z + 2, this.kind);
this.setBlock(x - 2, y, z + 1, this.kind);
this.setBlock(x - 2, y, z, this.kind);
this.setBlock(x - 2, y, z - 1, this.kind);
this.setBlock(x - 2, y, z - 2, this.kind);
this.setBlock(x - 1, y, z - 2, this.kind);
// tower
this.setBlock(x, y + 1, z + 2, this.kind);
this.setBlock(x - 1, y + 1, z + 2, this.kind);
this.setBlock(x - 2, y + 1, z + 2, this.kind);
this.setBlock(x - 2, y + 1, z + 1, this.kind);
this.setBlock(x - 2, y + 1, z, this.kind);
this.setBlock(x - 1, y + 2, z + 2, this.kind);
this.setBlock(x - 2, y + 2, z + 2, this.kind);
this.setBlock(x - 2, y + 2, z + 1, this.kind);
this.setBlock(x - 2, y + 3, z + 2, this.kind);
}
} else if (yaw >= 270 && yaw <= 360) {
signDirection = BlockFace.SOUTH_EAST.getOppositeFace();
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);
this.setBlock(x - 2, y, z + 2, this.kind);
this.setBlock(x - 2, y, z + 1, this.kind);
this.setBlock(x - 2, y, z, this.kind);