mirror of
https://github.com/taoneill/war.git
synced 2025-02-18 20:31:39 +01:00
Customizable warzone structure materials
Change flag, monument, bomb, cake and spawn look by typing "/zonecfg material:<main/stand/light>" while holding the block of your choosing. Complements the lobbymaterial and warhubmaterial settings. Brought back synchronization.
This commit is contained in:
parent
9f657c4a59
commit
60e4eafc13
@ -23,6 +23,7 @@ import com.tommytony.war.config.TeamSpawnStyle;
|
|||||||
import com.tommytony.war.structure.Bomb;
|
import com.tommytony.war.structure.Bomb;
|
||||||
import com.tommytony.war.structure.Cake;
|
import com.tommytony.war.structure.Cake;
|
||||||
import com.tommytony.war.utility.SignHelper;
|
import com.tommytony.war.utility.SignHelper;
|
||||||
|
import com.tommytony.war.volume.BlockInfo;
|
||||||
import com.tommytony.war.volume.Volume;
|
import com.tommytony.war.volume.Volume;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -94,25 +95,45 @@ public class Team {
|
|||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public void initializeTeamSpawn() {
|
public void initializeTeamSpawn() {
|
||||||
// make air
|
// make air (old two-high above floor)
|
||||||
this.spawnVolume.setToMaterial(Material.AIR);
|
Volume airGap = new Volume("airgap", this.warzone.getWorld());
|
||||||
|
airGap.setCornerOne(new BlockInfo(
|
||||||
|
this.spawnVolume.getCornerOne().getX(),
|
||||||
|
this.spawnVolume.getCornerOne().getY() + 1,
|
||||||
|
this.spawnVolume.getCornerOne().getZ(),
|
||||||
|
0,
|
||||||
|
(byte)0));
|
||||||
|
airGap.setCornerTwo(new BlockInfo(
|
||||||
|
this.spawnVolume.getCornerTwo().getX(),
|
||||||
|
this.spawnVolume.getCornerOne().getY() + 2,
|
||||||
|
this.spawnVolume.getCornerTwo().getZ(),
|
||||||
|
0,
|
||||||
|
(byte)0));
|
||||||
|
airGap.setToMaterial(Material.AIR);
|
||||||
|
|
||||||
// Set the spawn
|
// Set the spawn
|
||||||
int x = this.teamSpawn.getBlockX();
|
int x = this.teamSpawn.getBlockX();
|
||||||
int y = this.teamSpawn.getBlockY();
|
int y = this.teamSpawn.getBlockY();
|
||||||
int z = this.teamSpawn.getBlockZ();
|
int z = this.teamSpawn.getBlockZ();
|
||||||
|
|
||||||
|
Material light = Material.getMaterial(this.warzone.getWarzoneMaterials().getLightId());
|
||||||
|
byte lightData = this.warzone.getWarzoneMaterials().getLightData();
|
||||||
|
|
||||||
TeamSpawnStyle style = this.getTeamConfig().resolveSpawnStyle();
|
TeamSpawnStyle style = this.getTeamConfig().resolveSpawnStyle();
|
||||||
if (style.equals(TeamSpawnStyle.INVISIBLE)) {
|
if (style.equals(TeamSpawnStyle.INVISIBLE)) {
|
||||||
// nothing but glowstone
|
// nothing but glowstone
|
||||||
this.warzone.getWorld().getBlockAt(x, y - 1, z).setType(Material.GLOWSTONE);
|
Block lightBlock = this.warzone.getWorld().getBlockAt(x, y - 1, z);
|
||||||
|
lightBlock.setType(light);
|
||||||
|
lightBlock.setData(lightData);
|
||||||
} else {
|
} else {
|
||||||
// first ring
|
// first ring
|
||||||
this.setBlock(x + 1, 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, this.kind);
|
||||||
this.setBlock(x + 1, y - 1, z - 1, this.kind);
|
this.setBlock(x + 1, y - 1, z - 1, this.kind);
|
||||||
this.setBlock(x, y - 1, z + 1, this.kind);
|
this.setBlock(x, y - 1, z + 1, this.kind);
|
||||||
this.warzone.getWorld().getBlockAt(x, y - 1, z).setType(Material.GLOWSTONE);
|
Block lightBlock = this.warzone.getWorld().getBlockAt(x, y - 1, z);
|
||||||
|
lightBlock.setType(light);
|
||||||
|
lightBlock.setData(lightData);
|
||||||
this.setBlock(x, y - 1, z - 1, this.kind);
|
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 + 1, this.kind);
|
||||||
this.setBlock(x - 1, y - 1, z, this.kind);
|
this.setBlock(x - 1, y - 1, z, this.kind);
|
||||||
@ -508,29 +529,66 @@ public class Team {
|
|||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public void initializeTeamFlag() {
|
public void initializeTeamFlag() {
|
||||||
// make air
|
// make air (old two-high above floor)
|
||||||
this.flagVolume.setToMaterial(Material.AIR);
|
Volume airGap = new Volume("airgap", this.warzone.getWorld());
|
||||||
|
airGap.setCornerOne(new BlockInfo(
|
||||||
|
this.flagVolume.getCornerOne().getX(),
|
||||||
|
this.flagVolume.getCornerOne().getY() + 1,
|
||||||
|
this.flagVolume.getCornerOne().getZ(),
|
||||||
|
0,
|
||||||
|
(byte)0));
|
||||||
|
airGap.setCornerTwo(new BlockInfo(
|
||||||
|
this.flagVolume.getCornerTwo().getX(),
|
||||||
|
this.flagVolume.getCornerOne().getY() + 2,
|
||||||
|
this.flagVolume.getCornerTwo().getZ(),
|
||||||
|
0,
|
||||||
|
(byte)0));
|
||||||
|
airGap.setToMaterial(Material.AIR);
|
||||||
|
|
||||||
// Set the flag blocks
|
// Set the flag blocks
|
||||||
int x = this.teamFlag.getBlockX();
|
int x = this.teamFlag.getBlockX();
|
||||||
int y = this.teamFlag.getBlockY();
|
int y = this.teamFlag.getBlockY();
|
||||||
int z = this.teamFlag.getBlockZ();
|
int z = this.teamFlag.getBlockZ();
|
||||||
|
|
||||||
|
Material main = Material.getMaterial(this.warzone.getWarzoneMaterials().getMainId());
|
||||||
|
byte mainData = this.warzone.getWarzoneMaterials().getMainData();
|
||||||
|
Material stand = Material.getMaterial(this.warzone.getWarzoneMaterials().getStandId());
|
||||||
|
byte standData = this.warzone.getWarzoneMaterials().getStandData();
|
||||||
|
Material light = Material.getMaterial(this.warzone.getWarzoneMaterials().getLightId());
|
||||||
|
byte lightData = this.warzone.getWarzoneMaterials().getLightData();
|
||||||
|
|
||||||
// first ring
|
// first ring
|
||||||
this.warzone.getWorld().getBlockAt(x + 1, y - 1, z + 1).setType(Material.OBSIDIAN);
|
Block current = this.warzone.getWorld().getBlockAt(x + 1, y - 1, z + 1);
|
||||||
this.warzone.getWorld().getBlockAt(x + 1, y - 1, z).setType(Material.OBSIDIAN);
|
current.setType(main);
|
||||||
this.warzone.getWorld().getBlockAt(x + 1, y - 1, z - 1).setType(Material.OBSIDIAN);
|
current.setData(mainData);
|
||||||
this.warzone.getWorld().getBlockAt(x, y - 1, z + 1).setType(Material.OBSIDIAN);
|
current = this.warzone.getWorld().getBlockAt(x + 1, y - 1, z);
|
||||||
this.warzone.getWorld().getBlockAt(x, y - 1, z).setType(Material.GLOWSTONE);
|
current.setType(main);
|
||||||
this.warzone.getWorld().getBlockAt(x, y - 1, z - 1).setType(Material.OBSIDIAN);
|
current.setData(mainData);
|
||||||
this.warzone.getWorld().getBlockAt(x - 1, y - 1, z + 1).setType(Material.OBSIDIAN);
|
current = this.warzone.getWorld().getBlockAt(x + 1, y - 1, z - 1);
|
||||||
this.warzone.getWorld().getBlockAt(x - 1, y - 1, z).setType(Material.OBSIDIAN);
|
current.setType(main);
|
||||||
this.warzone.getWorld().getBlockAt(x - 1, y - 1, z - 1).setType(Material.OBSIDIAN);
|
current.setData(mainData);
|
||||||
|
current = this.warzone.getWorld().getBlockAt(x, y - 1, z + 1);
|
||||||
|
current.setType(main);
|
||||||
|
current.setData(mainData);
|
||||||
|
current = this.warzone.getWorld().getBlockAt(x, y - 1, z);
|
||||||
|
current.setType(light);
|
||||||
|
current.setData(lightData);
|
||||||
|
current = this.warzone.getWorld().getBlockAt(x, y - 1, z - 1);
|
||||||
|
current.setType(main);
|
||||||
|
current.setData(mainData);
|
||||||
|
current = this.warzone.getWorld().getBlockAt(x - 1, y - 1, z + 1);
|
||||||
|
current.setType(main);
|
||||||
|
current.setData(mainData);
|
||||||
|
current = this.warzone.getWorld().getBlockAt(x - 1, y - 1, z);
|
||||||
|
current.setType(main);
|
||||||
|
current.setData(mainData);
|
||||||
|
current = this.warzone.getWorld().getBlockAt(x - 1, y - 1, z - 1);
|
||||||
|
current.setType(main);
|
||||||
|
current.setData(mainData);
|
||||||
|
|
||||||
// flag
|
// flag
|
||||||
this.warzone.getWorld().getBlockAt(x, y + 1, z).setType(this.kind.getMaterial());
|
this.warzone.getWorld().getBlockAt(x, y + 1, z).setType(this.kind.getMaterial());
|
||||||
this.warzone.getWorld().getBlockAt(x, y + 1, z).setData(this.kind.getData());
|
this.warzone.getWorld().getBlockAt(x, y + 1, z).setData(this.kind.getData());
|
||||||
this.warzone.getWorld().getBlockAt(x, y + 2, z).setType(Material.FENCE);
|
|
||||||
|
|
||||||
// Flag post using Orientation
|
// Flag post using Orientation
|
||||||
int yaw = 0;
|
int yaw = 0;
|
||||||
@ -544,27 +602,39 @@ public class Team {
|
|||||||
if ((yaw >= 0 && yaw < 45) || (yaw >= 315 && yaw <= 360)) {
|
if ((yaw >= 0 && yaw < 45) || (yaw >= 315 && yaw <= 360)) {
|
||||||
facing = BlockFace.WEST;
|
facing = BlockFace.WEST;
|
||||||
opposite = BlockFace.EAST;
|
opposite = BlockFace.EAST;
|
||||||
this.warzone.getWorld().getBlockAt(x, y, z - 1).setType(Material.FENCE);
|
current = this.warzone.getWorld().getBlockAt(x, y, z - 1);
|
||||||
this.warzone.getWorld().getBlockAt(x, y + 1, z - 1).setType(Material.FENCE);
|
current.setType(stand);
|
||||||
this.warzone.getWorld().getBlockAt(x, y + 2, z - 1).setType(Material.FENCE);
|
current.setData(standData);
|
||||||
|
current = this.warzone.getWorld().getBlockAt(x, y + 1, z - 1);
|
||||||
|
current.setType(stand);
|
||||||
|
current.setData(standData);
|
||||||
} else if (yaw >= 45 && yaw < 135) {
|
} else if (yaw >= 45 && yaw < 135) {
|
||||||
facing = BlockFace.NORTH;
|
facing = BlockFace.NORTH;
|
||||||
opposite = BlockFace.SOUTH;
|
opposite = BlockFace.SOUTH;
|
||||||
this.warzone.getWorld().getBlockAt(x + 1, y, z).setType(Material.FENCE);
|
current = this.warzone.getWorld().getBlockAt(x + 1, y, z);
|
||||||
this.warzone.getWorld().getBlockAt(x + 1, y + 1, z).setType(Material.FENCE);
|
current.setType(stand);
|
||||||
this.warzone.getWorld().getBlockAt(x + 1, y + 2, z).setType(Material.FENCE);
|
current.setData(standData);
|
||||||
|
current = this.warzone.getWorld().getBlockAt(x + 1, y + 1, z);
|
||||||
|
current.setType(stand);
|
||||||
|
current.setData(standData);
|
||||||
} else if (yaw >= 135 && yaw < 225) {
|
} else if (yaw >= 135 && yaw < 225) {
|
||||||
facing = BlockFace.EAST;
|
facing = BlockFace.EAST;
|
||||||
opposite = BlockFace.WEST;
|
opposite = BlockFace.WEST;
|
||||||
this.warzone.getWorld().getBlockAt(x, y, z + 1).setType(Material.FENCE);
|
current = this.warzone.getWorld().getBlockAt(x, y, z + 1);
|
||||||
this.warzone.getWorld().getBlockAt(x, y + 1, z + 1).setType(Material.FENCE);
|
current.setType(stand);
|
||||||
this.warzone.getWorld().getBlockAt(x, y + 2, z + 1).setType(Material.FENCE);
|
current.setData(standData);
|
||||||
|
current = this.warzone.getWorld().getBlockAt(x, y + 1, z + 1);
|
||||||
|
current.setType(stand);
|
||||||
|
current.setData(standData);;
|
||||||
} else if (yaw >= 225 && yaw < 315) {
|
} else if (yaw >= 225 && yaw < 315) {
|
||||||
facing = BlockFace.SOUTH;
|
facing = BlockFace.SOUTH;
|
||||||
opposite = BlockFace.NORTH;
|
opposite = BlockFace.NORTH;
|
||||||
this.warzone.getWorld().getBlockAt(x - 1, y, z).setType(Material.FENCE);
|
current = this.warzone.getWorld().getBlockAt(x - 1, y, z);
|
||||||
this.warzone.getWorld().getBlockAt(x - 1, y + 1, z).setType(Material.FENCE);
|
current.setType(stand);
|
||||||
this.warzone.getWorld().getBlockAt(x - 1, y + 2, z).setType(Material.FENCE);
|
current.setData(standData);
|
||||||
|
current = this.warzone.getWorld().getBlockAt(x - 1, y + 1, z);
|
||||||
|
current.setType(stand);
|
||||||
|
current.setData(standData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,6 +44,9 @@ import com.tommytony.war.job.SpoutFadeOutMessageJob;
|
|||||||
import com.tommytony.war.mapper.WarYmlMapper;
|
import com.tommytony.war.mapper.WarYmlMapper;
|
||||||
import com.tommytony.war.mapper.WarzoneYmlMapper;
|
import com.tommytony.war.mapper.WarzoneYmlMapper;
|
||||||
import com.tommytony.war.spout.SpoutDisplayer;
|
import com.tommytony.war.spout.SpoutDisplayer;
|
||||||
|
import com.tommytony.war.structure.Bomb;
|
||||||
|
import com.tommytony.war.structure.Cake;
|
||||||
|
import com.tommytony.war.structure.Monument;
|
||||||
import com.tommytony.war.structure.WarHub;
|
import com.tommytony.war.structure.WarHub;
|
||||||
import com.tommytony.war.structure.HubLobbyMaterials;
|
import com.tommytony.war.structure.HubLobbyMaterials;
|
||||||
import com.tommytony.war.structure.ZoneLobby;
|
import com.tommytony.war.structure.ZoneLobby;
|
||||||
@ -523,6 +526,62 @@ public class War extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (namedParams.containsKey("material")) {
|
||||||
|
String whichBlocks = namedParams.get("material");
|
||||||
|
ItemStack blockInHand = player.getItemInHand();
|
||||||
|
boolean updatedMaterials = false;
|
||||||
|
|
||||||
|
int id = blockInHand.getTypeId();
|
||||||
|
byte data = (byte)0;
|
||||||
|
if (blockInHand.getData() != null) {
|
||||||
|
data = blockInHand.getData().getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!blockInHand.getType().isBlock()) {
|
||||||
|
this.badMsg(player, "Can only use blocks as material.");
|
||||||
|
} else {
|
||||||
|
if (whichBlocks.equals("main")) {
|
||||||
|
warzone.getWarzoneMaterials().setMainId(id);
|
||||||
|
warzone.getWarzoneMaterials().setMainData(data);
|
||||||
|
returnMessage.append(" main material set to id:" + id + " data:" + data + ".");
|
||||||
|
updatedMaterials = true;
|
||||||
|
} else if (whichBlocks.equals("stand")) {
|
||||||
|
warzone.getWarzoneMaterials().setStandId(id);
|
||||||
|
warzone.getWarzoneMaterials().setStandData(data);
|
||||||
|
returnMessage.append(" stand material set to id:" + id + " data:" + data + ".");
|
||||||
|
updatedMaterials = true;
|
||||||
|
} else if (whichBlocks.equals("light")) {
|
||||||
|
warzone.getWarzoneMaterials().setLightId(id);
|
||||||
|
warzone.getWarzoneMaterials().setLightData(data);
|
||||||
|
returnMessage.append(" light material set to id:" + id + " data:" + data + ".");
|
||||||
|
updatedMaterials = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (updatedMaterials) {
|
||||||
|
// reset all structures
|
||||||
|
for (Monument monument : warzone.getMonuments()) {
|
||||||
|
monument.getVolume().resetBlocks();
|
||||||
|
monument.addMonumentBlocks();
|
||||||
|
}
|
||||||
|
for (Cake cake : warzone.getCakes()) {
|
||||||
|
cake.getVolume().resetBlocks();
|
||||||
|
cake.addCakeBlocks();
|
||||||
|
}
|
||||||
|
for (Bomb bomb : warzone.getBombs()) {
|
||||||
|
bomb.getVolume().resetBlocks();
|
||||||
|
bomb.addBombBlocks();
|
||||||
|
}
|
||||||
|
for (Team team : warzone.getTeams()) {
|
||||||
|
team.getSpawnVolume().resetBlocks();
|
||||||
|
team.initializeTeamSpawn();
|
||||||
|
if (team.getTeamFlag() != null) {
|
||||||
|
team.getFlagVolume().resetBlocks();
|
||||||
|
team.initializeTeamFlag();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return returnMessage.toString();
|
return returnMessage.toString();
|
||||||
|
@ -37,6 +37,7 @@ import com.tommytony.war.structure.Bomb;
|
|||||||
import com.tommytony.war.structure.Cake;
|
import com.tommytony.war.structure.Cake;
|
||||||
import com.tommytony.war.structure.Monument;
|
import com.tommytony.war.structure.Monument;
|
||||||
import com.tommytony.war.structure.HubLobbyMaterials;
|
import com.tommytony.war.structure.HubLobbyMaterials;
|
||||||
|
import com.tommytony.war.structure.WarzoneMaterials;
|
||||||
import com.tommytony.war.structure.ZoneLobby;
|
import com.tommytony.war.structure.ZoneLobby;
|
||||||
import com.tommytony.war.structure.ZoneWallGuard;
|
import com.tommytony.war.structure.ZoneWallGuard;
|
||||||
import com.tommytony.war.utility.LoadoutSelection;
|
import com.tommytony.war.utility.LoadoutSelection;
|
||||||
@ -81,6 +82,7 @@ public class Warzone {
|
|||||||
private InventoryBag defaultInventories = new InventoryBag();
|
private InventoryBag defaultInventories = new InventoryBag();
|
||||||
|
|
||||||
private HubLobbyMaterials lobbyMaterials = null;
|
private HubLobbyMaterials lobbyMaterials = null;
|
||||||
|
private WarzoneMaterials warzoneMaterials = new WarzoneMaterials(49, (byte)0, 85, (byte)0, 89, (byte)0); // default main obsidian, stand ladder, light glowstone
|
||||||
|
|
||||||
private boolean isEndOfGame = false;
|
private boolean isEndOfGame = false;
|
||||||
private boolean isReinitializing = false;
|
private boolean isReinitializing = false;
|
||||||
@ -852,7 +854,7 @@ public class Warzone {
|
|||||||
//
|
//
|
||||||
// Concurrent execution of these events could cause the inventory reset of the last players to die to fail as
|
// Concurrent execution of these events could cause the inventory reset of the last players to die to fail as
|
||||||
// they get tp'ed back to the lobby, or perhaps kills to bleed into the next round.
|
// they get tp'ed back to the lobby, or perhaps kills to bleed into the next round.
|
||||||
//synchronized (this.getGameEndLock()) {
|
synchronized (this.getGameEndLock()) {
|
||||||
Team playerTeam = Team.getTeamByPlayerName(player.getName());
|
Team playerTeam = Team.getTeamByPlayerName(player.getName());
|
||||||
|
|
||||||
// Make sure the player that died is still part of a team, game may have ended while waiting on synchronized.
|
// Make sure the player that died is still part of a team, game may have ended while waiting on synchronized.
|
||||||
@ -1026,7 +1028,7 @@ public class Warzone {
|
|||||||
}
|
}
|
||||||
playerTeam.resetSign();
|
playerTeam.resetSign();
|
||||||
}
|
}
|
||||||
//}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reinitialize() {
|
public void reinitialize() {
|
||||||
@ -1393,9 +1395,9 @@ public class Warzone {
|
|||||||
return this.isReinitializing;
|
return this.isReinitializing;
|
||||||
}
|
}
|
||||||
|
|
||||||
// public Object getGameEndLock() {
|
public Object getGameEndLock() {
|
||||||
// return gameEndLock;
|
return gameEndLock;
|
||||||
// }
|
}
|
||||||
|
|
||||||
public void setName(String newName) {
|
public void setName(String newName) {
|
||||||
this.name = newName;
|
this.name = newName;
|
||||||
@ -1424,4 +1426,12 @@ public class Warzone {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setWarzoneMaterials(WarzoneMaterials warzoneMaterials) {
|
||||||
|
this.warzoneMaterials = warzoneMaterials;
|
||||||
|
}
|
||||||
|
|
||||||
|
public WarzoneMaterials getWarzoneMaterials() {
|
||||||
|
return warzoneMaterials;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -484,7 +484,7 @@ public class WarPlayerListener implements Listener {
|
|||||||
|
|
||||||
// Make sure game ends can't occur simultaneously.
|
// Make sure game ends can't occur simultaneously.
|
||||||
// See Warzone.handleDeath() for details.
|
// See Warzone.handleDeath() for details.
|
||||||
//synchronized (playerWarzone.getGameEndLock()) {
|
synchronized (playerWarzone.getGameEndLock()) {
|
||||||
|
|
||||||
boolean inSpawn = playerTeam.getSpawnVolume().contains(player.getLocation());
|
boolean inSpawn = playerTeam.getSpawnVolume().contains(player.getLocation());
|
||||||
boolean inFlag = (playerTeam.getFlagVolume() != null && playerTeam.getFlagVolume().contains(player.getLocation()));
|
boolean inFlag = (playerTeam.getFlagVolume() != null && playerTeam.getFlagVolume().contains(player.getLocation()));
|
||||||
@ -568,7 +568,7 @@ public class WarPlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
//}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bomb detonation
|
// Bomb detonation
|
||||||
@ -578,7 +578,7 @@ public class WarPlayerListener implements Listener {
|
|||||||
|
|
||||||
// Make sure game ends can't occur simultaneously.
|
// Make sure game ends can't occur simultaneously.
|
||||||
// See Warzone.handleDeath() for details.
|
// See Warzone.handleDeath() for details.
|
||||||
//synchronized (playerWarzone.getGameEndLock()) {
|
synchronized (playerWarzone.getGameEndLock()) {
|
||||||
|
|
||||||
boolean inEnemySpawn = false;
|
boolean inEnemySpawn = false;
|
||||||
Team victim = null;
|
Team victim = null;
|
||||||
@ -657,7 +657,7 @@ public class WarPlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
//}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cake retrieval
|
// Cake retrieval
|
||||||
@ -669,7 +669,7 @@ public class WarPlayerListener implements Listener {
|
|||||||
|
|
||||||
// Make sure game ends can't occur simultaneously.
|
// Make sure game ends can't occur simultaneously.
|
||||||
// See Warzone.handleDeath() for details.
|
// See Warzone.handleDeath() for details.
|
||||||
//synchronized (playerWarzone.getGameEndLock()) {
|
synchronized (playerWarzone.getGameEndLock()) {
|
||||||
boolean inSpawn = playerTeam.getSpawnVolume().contains(player.getLocation());
|
boolean inSpawn = playerTeam.getSpawnVolume().contains(player.getLocation());
|
||||||
|
|
||||||
if (inSpawn && playerTeam.getPlayers().contains(player)) {
|
if (inSpawn && playerTeam.getPlayers().contains(player)) {
|
||||||
@ -740,7 +740,7 @@ public class WarPlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
//}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Class selection lock
|
// Class selection lock
|
||||||
|
@ -24,6 +24,7 @@ import com.tommytony.war.structure.Bomb;
|
|||||||
import com.tommytony.war.structure.Cake;
|
import com.tommytony.war.structure.Cake;
|
||||||
import com.tommytony.war.structure.HubLobbyMaterials;
|
import com.tommytony.war.structure.HubLobbyMaterials;
|
||||||
import com.tommytony.war.structure.Monument;
|
import com.tommytony.war.structure.Monument;
|
||||||
|
import com.tommytony.war.structure.WarzoneMaterials;
|
||||||
import com.tommytony.war.structure.ZoneLobby;
|
import com.tommytony.war.structure.ZoneLobby;
|
||||||
import com.tommytony.war.volume.Volume;
|
import com.tommytony.war.volume.Volume;
|
||||||
import com.tommytony.war.volume.ZoneVolume;
|
import com.tommytony.war.volume.ZoneVolume;
|
||||||
@ -322,15 +323,15 @@ public class WarzoneYmlMapper {
|
|||||||
gateData = gateMaterialSection.getInt("data");
|
gateData = gateMaterialSection.getInt("data");
|
||||||
}
|
}
|
||||||
|
|
||||||
int lightId = War.war.getWarhubMaterials().getLightId();
|
int lobbyLightId = War.war.getWarhubMaterials().getLightId();
|
||||||
int lightData = War.war.getWarhubMaterials().getLightData();
|
int lobbyLightData = War.war.getWarhubMaterials().getLightData();
|
||||||
ConfigurationSection lightMaterialSection = warzoneRootSection.getConfigurationSection(lobbyPrefix + "materials.light");
|
ConfigurationSection lobbyLightMaterialSection = warzoneRootSection.getConfigurationSection(lobbyPrefix + "materials.light");
|
||||||
if (lightMaterialSection != null) {
|
if (lobbyLightMaterialSection != null) {
|
||||||
lightId = lightMaterialSection.getInt("id");
|
lobbyLightId = lobbyLightMaterialSection.getInt("id");
|
||||||
lightData = lightMaterialSection.getInt("data");
|
lobbyLightData = lobbyLightMaterialSection.getInt("data");
|
||||||
}
|
}
|
||||||
|
|
||||||
warzone.setLobbyMaterials(new HubLobbyMaterials(floorId, (byte)floorData, outlineId, (byte)outlineData, gateId, (byte)gateData, lightId, (byte)lightData));
|
warzone.setLobbyMaterials(new HubLobbyMaterials(floorId, (byte)floorData, outlineId, (byte)outlineData, gateId, (byte)gateData, lobbyLightId, (byte)lobbyLightData));
|
||||||
|
|
||||||
// lobby world
|
// lobby world
|
||||||
String lobbyWorldName = warzoneRootSection.getString(lobbyPrefix + "world");
|
String lobbyWorldName = warzoneRootSection.getString(lobbyPrefix + "world");
|
||||||
@ -340,7 +341,34 @@ public class WarzoneYmlMapper {
|
|||||||
Volume lobbyVolume = VolumeMapper.loadVolume("lobby", warzone.getName(), lobbyWorld);
|
Volume lobbyVolume = VolumeMapper.loadVolume("lobby", warzone.getName(), lobbyWorld);
|
||||||
ZoneLobby lobby = new ZoneLobby(warzone, lobbyFace, lobbyVolume);
|
ZoneLobby lobby = new ZoneLobby(warzone, lobbyFace, lobbyVolume);
|
||||||
warzone.setLobby(lobby);
|
warzone.setLobby(lobby);
|
||||||
|
|
||||||
|
// warzone materials
|
||||||
|
int mainId = warzone.getWarzoneMaterials().getMainId();
|
||||||
|
int mainData = warzone.getWarzoneMaterials().getMainData();
|
||||||
|
ConfigurationSection mainMaterialSection = warzoneRootSection.getConfigurationSection(zoneInfoPrefix + "materials.main");
|
||||||
|
if (mainMaterialSection != null) {
|
||||||
|
mainId = mainMaterialSection.getInt("id");
|
||||||
|
mainData = mainMaterialSection.getInt("data");
|
||||||
|
}
|
||||||
|
|
||||||
|
int standId = warzone.getWarzoneMaterials().getStandId();
|
||||||
|
int standData = warzone.getWarzoneMaterials().getStandData();
|
||||||
|
ConfigurationSection standMaterialSection = warzoneRootSection.getConfigurationSection(zoneInfoPrefix + "materials.stand");
|
||||||
|
if (standMaterialSection != null) {
|
||||||
|
standId = standMaterialSection.getInt("id");
|
||||||
|
standData = standMaterialSection.getInt("data");
|
||||||
|
}
|
||||||
|
|
||||||
|
int lightId = warzone.getWarzoneMaterials().getLightId();
|
||||||
|
int lightData = warzone.getWarzoneMaterials().getLightData();
|
||||||
|
ConfigurationSection lightMaterialSection = warzoneRootSection.getConfigurationSection(zoneInfoPrefix + "materials.light");
|
||||||
|
if (lightMaterialSection != null) {
|
||||||
|
lightId = lightMaterialSection.getInt("id");
|
||||||
|
lightData = lightMaterialSection.getInt("data");
|
||||||
|
}
|
||||||
|
|
||||||
|
warzone.setWarzoneMaterials(new WarzoneMaterials(mainId, (byte)mainData, standId, (byte)standData, lightId, (byte)lightData));
|
||||||
|
|
||||||
return warzone;
|
return warzone;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -405,6 +433,19 @@ public class WarzoneYmlMapper {
|
|||||||
lightSection.set("id", warzone.getLobbyMaterials().getLightId());
|
lightSection.set("id", warzone.getLobbyMaterials().getLightId());
|
||||||
lightSection.set("data", warzone.getLobbyMaterials().getLightData());
|
lightSection.set("data", warzone.getLobbyMaterials().getLightData());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// materials
|
||||||
|
if (warzone.getLobby() != null) {
|
||||||
|
ConfigurationSection mainSection = warzoneInfoSection.createSection("materials.main");
|
||||||
|
mainSection.set("id", warzone.getWarzoneMaterials().getMainId());
|
||||||
|
mainSection.set("data", warzone.getWarzoneMaterials().getMainData());
|
||||||
|
ConfigurationSection standSection = warzoneInfoSection.createSection("materials.stand");
|
||||||
|
standSection.set("id", warzone.getWarzoneMaterials().getStandId());
|
||||||
|
standSection.set("data", warzone.getWarzoneMaterials().getStandData());
|
||||||
|
ConfigurationSection lightSection = warzoneInfoSection.createSection("materials.light");
|
||||||
|
lightSection.set("id", warzone.getWarzoneMaterials().getLightId());
|
||||||
|
lightSection.set("data", warzone.getWarzoneMaterials().getLightData());
|
||||||
|
}
|
||||||
|
|
||||||
// rallyPoint
|
// rallyPoint
|
||||||
if (warzone.getRallyPoint() != null) {
|
if (warzone.getRallyPoint() != null) {
|
||||||
|
@ -7,6 +7,7 @@ import org.bukkit.block.BlockFace;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.tommytony.war.Warzone;
|
import com.tommytony.war.Warzone;
|
||||||
|
import com.tommytony.war.volume.BlockInfo;
|
||||||
import com.tommytony.war.volume.Volume;
|
import com.tommytony.war.volume.Volume;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -31,30 +32,73 @@ public class Bomb {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void addBombBlocks() {
|
public void addBombBlocks() {
|
||||||
this.volume.setToMaterial(Material.AIR);
|
// make air (old two-high above floor)
|
||||||
|
Volume airGap = new Volume("airgap", this.warzone.getWorld());
|
||||||
|
airGap.setCornerOne(new BlockInfo(
|
||||||
|
this.volume.getCornerOne().getX(),
|
||||||
|
this.volume.getCornerOne().getY() + 1,
|
||||||
|
this.volume.getCornerOne().getZ(),
|
||||||
|
0,
|
||||||
|
(byte)0));
|
||||||
|
airGap.setCornerTwo(new BlockInfo(
|
||||||
|
this.volume.getCornerTwo().getX(),
|
||||||
|
this.volume.getCornerOne().getY() + 3,
|
||||||
|
this.volume.getCornerTwo().getZ(),
|
||||||
|
0,
|
||||||
|
(byte)0));
|
||||||
|
airGap.setToMaterial(Material.AIR);
|
||||||
|
|
||||||
int x = this.location.getBlockX();
|
int x = this.location.getBlockX();
|
||||||
int y = this.location.getBlockY();
|
int y = this.location.getBlockY();
|
||||||
int z = this.location.getBlockZ();
|
int z = this.location.getBlockZ();
|
||||||
|
|
||||||
|
Material main = Material.getMaterial(this.warzone.getWarzoneMaterials().getMainId());
|
||||||
|
byte mainData = this.warzone.getWarzoneMaterials().getMainData();
|
||||||
|
Material stand = Material.getMaterial(this.warzone.getWarzoneMaterials().getStandId());
|
||||||
|
byte standData = this.warzone.getWarzoneMaterials().getStandData();
|
||||||
|
Material light = Material.getMaterial(this.warzone.getWarzoneMaterials().getLightId());
|
||||||
|
byte lightData = this.warzone.getWarzoneMaterials().getLightData();
|
||||||
|
|
||||||
// center
|
// center
|
||||||
this.warzone.getWorld().getBlockAt(x, y - 1, z).getState().setType(Material.OBSIDIAN);
|
Block current = this.warzone.getWorld().getBlockAt(x, y - 1, z);
|
||||||
|
current.setType(main);
|
||||||
|
current.setData(mainData);
|
||||||
|
|
||||||
// inner ring
|
// inner ring
|
||||||
this.warzone.getWorld().getBlockAt(x + 1, y - 1, z + 1).setType(Material.GLOWSTONE);
|
current = this.warzone.getWorld().getBlockAt(x + 1, y - 1, z + 1);
|
||||||
this.warzone.getWorld().getBlockAt(x + 1, y - 1, z).setType(Material.OBSIDIAN);
|
current.setType(light);
|
||||||
this.warzone.getWorld().getBlockAt(x + 1, y - 1, z - 1).setType(Material.GLOWSTONE);
|
current.setData(lightData);
|
||||||
|
current = this.warzone.getWorld().getBlockAt(x + 1, y - 1, z);
|
||||||
|
current.setType(main);
|
||||||
|
current.setData(mainData);
|
||||||
|
current = this.warzone.getWorld().getBlockAt(x + 1, y - 1, z - 1);
|
||||||
|
current.setType(main);
|
||||||
|
current.setData(mainData);
|
||||||
|
|
||||||
this.warzone.getWorld().getBlockAt(x, y - 1, z + 1).setType(Material.OBSIDIAN);
|
current = this.warzone.getWorld().getBlockAt(x, y - 1, z + 1);
|
||||||
this.warzone.getWorld().getBlockAt(x, y - 1, z).setType(Material.GLOWSTONE);
|
current.setType(main);
|
||||||
this.warzone.getWorld().getBlockAt(x, y - 1, z - 1).setType(Material.OBSIDIAN);
|
current.setData(mainData);
|
||||||
|
current = this.warzone.getWorld().getBlockAt(x, y - 1, z);
|
||||||
|
current.setType(light);
|
||||||
|
current.setData(lightData);
|
||||||
|
current = this.warzone.getWorld().getBlockAt(x, y - 1, z - 1);
|
||||||
|
current.setType(main);
|
||||||
|
current.setData(mainData);
|
||||||
|
|
||||||
this.warzone.getWorld().getBlockAt(x - 1, y - 1, z + 1).setType(Material.GLOWSTONE);
|
current = this.warzone.getWorld().getBlockAt(x - 1, y - 1, z + 1);
|
||||||
this.warzone.getWorld().getBlockAt(x - 1, y - 1, z).setType(Material.OBSIDIAN);
|
current.setType(main);
|
||||||
this.warzone.getWorld().getBlockAt(x - 1, y - 1, z - 1).setType(Material.GLOWSTONE);
|
current.setData(mainData);
|
||||||
|
current = this.warzone.getWorld().getBlockAt(x - 1, y - 1, z);
|
||||||
|
current.setType(main);
|
||||||
|
current.setData(mainData);
|
||||||
|
current = this.warzone.getWorld().getBlockAt(x - 1, y - 1, z - 1);
|
||||||
|
current.setType(light);
|
||||||
|
current.setData(lightData);
|
||||||
|
|
||||||
// block holder
|
// block holder
|
||||||
this.warzone.getWorld().getBlockAt(x, y, z).setType(Material.OBSIDIAN);
|
current = this.warzone.getWorld().getBlockAt(x, y, z);
|
||||||
|
current.setType(stand);
|
||||||
|
current.setData(standData);
|
||||||
Block tntBlock = this.warzone.getWorld().getBlockAt(x, y + 1, z);
|
Block tntBlock = this.warzone.getWorld().getBlockAt(x, y + 1, z);
|
||||||
tntBlock.setType(Material.TNT);
|
tntBlock.setType(Material.TNT);
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import org.bukkit.block.BlockFace;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.tommytony.war.Warzone;
|
import com.tommytony.war.Warzone;
|
||||||
|
import com.tommytony.war.volume.BlockInfo;
|
||||||
import com.tommytony.war.volume.Volume;
|
import com.tommytony.war.volume.Volume;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -31,30 +32,74 @@ public class Cake {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void addCakeBlocks() {
|
public void addCakeBlocks() {
|
||||||
this.volume.setToMaterial(Material.AIR);
|
// make air (old two-high above floor)
|
||||||
|
Volume airGap = new Volume("airgap", this.warzone.getWorld());
|
||||||
|
airGap.setCornerOne(new BlockInfo(
|
||||||
|
this.volume.getCornerOne().getX(),
|
||||||
|
this.volume.getCornerOne().getY() + 1,
|
||||||
|
this.volume.getCornerOne().getZ(),
|
||||||
|
0,
|
||||||
|
(byte)0));
|
||||||
|
airGap.setCornerTwo(new BlockInfo(
|
||||||
|
this.volume.getCornerTwo().getX(),
|
||||||
|
this.volume.getCornerOne().getY() + 2,
|
||||||
|
this.volume.getCornerTwo().getZ(),
|
||||||
|
0,
|
||||||
|
(byte)0));
|
||||||
|
airGap.setToMaterial(Material.AIR);
|
||||||
|
|
||||||
int x = this.location.getBlockX();
|
int x = this.location.getBlockX();
|
||||||
int y = this.location.getBlockY();
|
int y = this.location.getBlockY();
|
||||||
int z = this.location.getBlockZ();
|
int z = this.location.getBlockZ();
|
||||||
|
|
||||||
|
Material main = Material.getMaterial(this.warzone.getWarzoneMaterials().getMainId());
|
||||||
|
byte mainData = this.warzone.getWarzoneMaterials().getMainData();
|
||||||
|
Material stand = Material.getMaterial(this.warzone.getWarzoneMaterials().getStandId());
|
||||||
|
byte standData = this.warzone.getWarzoneMaterials().getStandData();
|
||||||
|
Material light = Material.getMaterial(this.warzone.getWarzoneMaterials().getLightId());
|
||||||
|
byte lightData = this.warzone.getWarzoneMaterials().getLightData();
|
||||||
|
|
||||||
// center
|
// center
|
||||||
this.warzone.getWorld().getBlockAt(x, y - 1, z).getState().setType(Material.OBSIDIAN);
|
Block current = this.warzone.getWorld().getBlockAt(x, y - 1, z);
|
||||||
|
current.setType(main);
|
||||||
|
current.setData(mainData);
|
||||||
|
|
||||||
// inner ring
|
// inner ring
|
||||||
this.warzone.getWorld().getBlockAt(x + 1, y - 1, z + 1).setType(Material.OBSIDIAN);
|
current = this.warzone.getWorld().getBlockAt(x + 1, y - 1, z + 1);
|
||||||
this.warzone.getWorld().getBlockAt(x + 1, y - 1, z).setType(Material.OBSIDIAN);
|
current.setType(main);
|
||||||
this.warzone.getWorld().getBlockAt(x + 1, y - 1, z - 1).setType(Material.OBSIDIAN);
|
current.setData(mainData);
|
||||||
|
current = this.warzone.getWorld().getBlockAt(x + 1, y - 1, z);
|
||||||
|
current.setType(main);
|
||||||
|
current.setData(mainData);
|
||||||
|
current = this.warzone.getWorld().getBlockAt(x + 1, y - 1, z - 1);
|
||||||
|
current.setType(light);
|
||||||
|
current.setData(lightData);
|
||||||
|
|
||||||
this.warzone.getWorld().getBlockAt(x, y - 1, z + 1).setType(Material.OBSIDIAN);
|
current = this.warzone.getWorld().getBlockAt(x, y - 1, z + 1);
|
||||||
this.warzone.getWorld().getBlockAt(x, y - 1, z).setType(Material.GLOWSTONE);
|
current.setType(main);
|
||||||
this.warzone.getWorld().getBlockAt(x, y - 1, z - 1).setType(Material.OBSIDIAN);
|
current.setData(mainData);
|
||||||
|
current = this.warzone.getWorld().getBlockAt(x, y - 1, z);
|
||||||
|
current.setType(light);
|
||||||
|
current.setData(lightData);
|
||||||
|
current = this.warzone.getWorld().getBlockAt(x, y - 1, z - 1);
|
||||||
|
current.setType(main);
|
||||||
|
current.setData(mainData);
|
||||||
|
|
||||||
this.warzone.getWorld().getBlockAt(x - 1, y - 1, z + 1).setType(Material.OBSIDIAN);
|
current = this.warzone.getWorld().getBlockAt(x - 1, y - 1, z + 1);
|
||||||
this.warzone.getWorld().getBlockAt(x - 1, y - 1, z).setType(Material.OBSIDIAN);
|
current.setType(light);
|
||||||
this.warzone.getWorld().getBlockAt(x - 1, y - 1, z - 1).setType(Material.OBSIDIAN);
|
current.setData(lightData);
|
||||||
|
current = this.warzone.getWorld().getBlockAt(x - 1, y - 1, z);
|
||||||
|
current.setType(main);
|
||||||
|
current.setData(mainData);
|
||||||
|
current = this.warzone.getWorld().getBlockAt(x - 1, y - 1, z - 1);
|
||||||
|
current.setType(main);
|
||||||
|
current.setData(mainData);
|
||||||
|
|
||||||
// block holder
|
// block holder
|
||||||
this.warzone.getWorld().getBlockAt(x, y, z).setType(Material.GLASS);
|
current = this.warzone.getWorld().getBlockAt(x, y, z);
|
||||||
|
current.setType(stand);
|
||||||
|
current.setData(standData);
|
||||||
|
|
||||||
Block cakeBlock = this.warzone.getWorld().getBlockAt(x, y + 1, z);
|
Block cakeBlock = this.warzone.getWorld().getBlockAt(x, y + 1, z);
|
||||||
cakeBlock.setType(Material.CAKE_BLOCK);
|
cakeBlock.setType(Material.CAKE_BLOCK);
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import org.bukkit.block.BlockFace;
|
|||||||
|
|
||||||
import com.tommytony.war.Team;
|
import com.tommytony.war.Team;
|
||||||
import com.tommytony.war.Warzone;
|
import com.tommytony.war.Warzone;
|
||||||
|
import com.tommytony.war.volume.BlockInfo;
|
||||||
import com.tommytony.war.volume.Volume;
|
import com.tommytony.war.volume.Volume;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -31,61 +32,146 @@ public class Monument {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void addMonumentBlocks() {
|
public void addMonumentBlocks() {
|
||||||
this.volume.setToMaterial(Material.AIR);
|
// make air (old three-high above floor)
|
||||||
|
Volume airGap = new Volume("airgap", this.warzone.getWorld());
|
||||||
|
airGap.setCornerOne(new BlockInfo(
|
||||||
|
this.volume.getCornerOne().getX(),
|
||||||
|
this.volume.getCornerOne().getY() + 1,
|
||||||
|
this.volume.getCornerOne().getZ(),
|
||||||
|
0,
|
||||||
|
(byte)0));
|
||||||
|
airGap.setCornerTwo(new BlockInfo(
|
||||||
|
this.volume.getCornerTwo().getX(),
|
||||||
|
this.volume.getCornerOne().getY() + 3,
|
||||||
|
this.volume.getCornerTwo().getZ(),
|
||||||
|
0,
|
||||||
|
(byte)0));
|
||||||
|
airGap.setToMaterial(Material.AIR);
|
||||||
|
|
||||||
this.ownerTeam = null;
|
this.ownerTeam = null;
|
||||||
int x = this.location.getBlockX();
|
int x = this.location.getBlockX();
|
||||||
int y = this.location.getBlockY();
|
int y = this.location.getBlockY();
|
||||||
int z = this.location.getBlockZ();
|
int z = this.location.getBlockZ();
|
||||||
|
|
||||||
|
Material main = Material.getMaterial(this.warzone.getWarzoneMaterials().getMainId());
|
||||||
|
byte mainData = this.warzone.getWarzoneMaterials().getMainData();
|
||||||
|
Material light = Material.getMaterial(this.warzone.getWarzoneMaterials().getLightId());
|
||||||
|
byte lightData = this.warzone.getWarzoneMaterials().getLightData();
|
||||||
|
|
||||||
// center
|
// center
|
||||||
this.warzone.getWorld().getBlockAt(x, y - 1, z).getState().setType(Material.OBSIDIAN);
|
Block current = this.warzone.getWorld().getBlockAt(x, y - 1, z);
|
||||||
|
current.setType(main);
|
||||||
|
current.setData(mainData);
|
||||||
|
|
||||||
// inner ring
|
// inner ring
|
||||||
this.warzone.getWorld().getBlockAt(x + 1, y - 1, z + 1).setType(Material.OBSIDIAN);
|
current = this.warzone.getWorld().getBlockAt(x + 1, y - 1, z + 1);
|
||||||
this.warzone.getWorld().getBlockAt(x + 1, y - 1, z).setType(Material.OBSIDIAN);
|
current.setType(main);
|
||||||
this.warzone.getWorld().getBlockAt(x + 1, y - 1, z - 1).setType(Material.OBSIDIAN);
|
current.setData(mainData);
|
||||||
|
current = this.warzone.getWorld().getBlockAt(x + 1, y - 1, z);
|
||||||
|
current.setType(main);
|
||||||
|
current.setData(mainData);
|
||||||
|
current = this.warzone.getWorld().getBlockAt(x + 1, y - 1, z - 1);
|
||||||
|
current.setType(main);
|
||||||
|
current.setData(mainData);
|
||||||
|
|
||||||
this.warzone.getWorld().getBlockAt(x, y - 1, z + 1).setType(Material.OBSIDIAN);
|
current = this.warzone.getWorld().getBlockAt(x, y - 1, z + 1);
|
||||||
this.warzone.getWorld().getBlockAt(x, y - 1, z - 1).setType(Material.OBSIDIAN);
|
current.setType(main);
|
||||||
|
current.setData(mainData);
|
||||||
|
current = this.warzone.getWorld().getBlockAt(x, y - 1, z - 1);
|
||||||
|
current.setType(main);
|
||||||
|
current.setData(mainData);
|
||||||
|
|
||||||
this.warzone.getWorld().getBlockAt(x - 1, y - 1, z + 1).setType(Material.OBSIDIAN);
|
current = this.warzone.getWorld().getBlockAt(x - 1, y - 1, z + 1);
|
||||||
this.warzone.getWorld().getBlockAt(x - 1, y - 1, z).setType(Material.OBSIDIAN);
|
current.setType(main);
|
||||||
this.warzone.getWorld().getBlockAt(x - 1, y - 1, z - 1).setType(Material.OBSIDIAN);
|
current.setData(mainData);
|
||||||
|
current = this.warzone.getWorld().getBlockAt(x - 1, y - 1, z);
|
||||||
|
current.setType(main);
|
||||||
|
current.setData(mainData);
|
||||||
|
current = this.warzone.getWorld().getBlockAt(x - 1, y - 1, z - 1);
|
||||||
|
current.setType(main);
|
||||||
|
current.setData(mainData);
|
||||||
|
|
||||||
// outer ring
|
// outer ring
|
||||||
this.warzone.getWorld().getBlockAt(x + 2, y - 1, z + 2).setType(Material.GLOWSTONE);
|
current = this.warzone.getWorld().getBlockAt(x + 2, y - 1, z + 2);
|
||||||
this.warzone.getWorld().getBlockAt(x + 2, y - 1, z + 1).setType(Material.OBSIDIAN);
|
current.setType(light);
|
||||||
this.warzone.getWorld().getBlockAt(x + 2, y - 1, z).setType(Material.OBSIDIAN);
|
current.setData(lightData);
|
||||||
this.warzone.getWorld().getBlockAt(x + 2, y - 1, z - 1).setType(Material.OBSIDIAN);
|
current = this.warzone.getWorld().getBlockAt(x + 2, y - 1, z + 1);
|
||||||
this.warzone.getWorld().getBlockAt(x + 2, y - 1, z - 2).setType(Material.GLOWSTONE);
|
current.setType(main);
|
||||||
|
current.setData(mainData);
|
||||||
|
current = this.warzone.getWorld().getBlockAt(x + 2, y - 1, z);
|
||||||
|
current.setType(main);
|
||||||
|
current.setData(mainData);
|
||||||
|
current = this.warzone.getWorld().getBlockAt(x + 2, y - 1, z - 1);
|
||||||
|
current.setType(main);
|
||||||
|
current.setData(mainData);
|
||||||
|
current = this.warzone.getWorld().getBlockAt(x + 2, y - 1, z - 2);
|
||||||
|
current.setType(light);
|
||||||
|
current.setData(lightData);
|
||||||
|
|
||||||
this.warzone.getWorld().getBlockAt(x - 1, y - 1, z + 2).setType(Material.OBSIDIAN);
|
current = this.warzone.getWorld().getBlockAt(x - 1, y - 1, z + 2);
|
||||||
this.warzone.getWorld().getBlockAt(x - 1, y - 1, z - 2).setType(Material.OBSIDIAN);
|
current.setType(main);
|
||||||
|
current.setData(mainData);
|
||||||
|
current = this.warzone.getWorld().getBlockAt(x - 1, y - 1, z - 2);
|
||||||
|
current.setType(main);
|
||||||
|
current.setData(mainData);
|
||||||
|
|
||||||
this.warzone.getWorld().getBlockAt(x, y - 1, z + 2).setType(Material.OBSIDIAN);
|
current = this.warzone.getWorld().getBlockAt(x, y - 1, z + 2);
|
||||||
this.warzone.getWorld().getBlockAt(x, y - 1, z - 2).setType(Material.OBSIDIAN);
|
current.setType(main);
|
||||||
|
current.setData(mainData);
|
||||||
|
current = this.warzone.getWorld().getBlockAt(x, y - 1, z - 2);
|
||||||
|
current.setType(main);
|
||||||
|
current.setData(mainData);
|
||||||
|
|
||||||
|
current = this.warzone.getWorld().getBlockAt(x + 1, y - 1, z + 2);
|
||||||
|
current.setType(main);
|
||||||
|
current.setData(mainData);
|
||||||
|
current = this.warzone.getWorld().getBlockAt(x + 1, y - 1, z - 2);
|
||||||
|
current.setType(main);
|
||||||
|
current.setData(mainData);
|
||||||
|
|
||||||
this.warzone.getWorld().getBlockAt(x + 1, y - 1, z + 2).setType(Material.OBSIDIAN);
|
current = this.warzone.getWorld().getBlockAt(x - 2, y - 1, z + 2);
|
||||||
this.warzone.getWorld().getBlockAt(x + 1, y - 1, z - 2).setType(Material.OBSIDIAN);
|
current.setType(light);
|
||||||
|
current.setData(lightData);
|
||||||
this.warzone.getWorld().getBlockAt(x - 2, y - 1, z + 2).setType(Material.GLOWSTONE);
|
current = this.warzone.getWorld().getBlockAt(x - 2, y - 1, z + 1);
|
||||||
this.warzone.getWorld().getBlockAt(x - 2, y - 1, z + 1).setType(Material.OBSIDIAN);
|
current.setType(main);
|
||||||
this.warzone.getWorld().getBlockAt(x - 2, y - 1, z).setType(Material.OBSIDIAN);
|
current.setData(mainData);
|
||||||
this.warzone.getWorld().getBlockAt(x - 2, y - 1, z - 1).setType(Material.OBSIDIAN);
|
current = this.warzone.getWorld().getBlockAt(x - 2, y - 1, z);
|
||||||
this.warzone.getWorld().getBlockAt(x - 2, y - 1, z - 2).setType(Material.GLOWSTONE);
|
current.setType(main);
|
||||||
|
current.setData(mainData);
|
||||||
|
current = this.warzone.getWorld().getBlockAt(x - 2, y - 1, z - 1);
|
||||||
|
current.setType(main);
|
||||||
|
current.setData(mainData);
|
||||||
|
current = this.warzone.getWorld().getBlockAt(x - 2, y - 1, z - 2);
|
||||||
|
current.setType(light);
|
||||||
|
current.setData(lightData);
|
||||||
|
|
||||||
// block holder
|
// block holder
|
||||||
this.warzone.getWorld().getBlockAt(x, y, z).setType(Material.OBSIDIAN);
|
current = this.warzone.getWorld().getBlockAt(x, y, z);
|
||||||
this.warzone.getWorld().getBlockAt(x, y, z - 1).setType(Material.OBSIDIAN);
|
current.setType(main);
|
||||||
this.warzone.getWorld().getBlockAt(x, y, z + 1).setType(Material.OBSIDIAN);
|
current.setData(mainData);
|
||||||
|
current = this.warzone.getWorld().getBlockAt(x, y, z - 1);
|
||||||
|
current.setType(main);
|
||||||
|
current.setData(mainData);
|
||||||
|
current = this.warzone.getWorld().getBlockAt(x, y, z + 1);
|
||||||
|
current.setType(main);
|
||||||
|
current.setData(mainData);
|
||||||
|
|
||||||
this.warzone.getWorld().getBlockAt(x, y + 1, z - 1).setType(Material.OBSIDIAN);
|
current = this.warzone.getWorld().getBlockAt(x, y + 1, z - 1);
|
||||||
this.warzone.getWorld().getBlockAt(x, y + 1, z + 1).setType(Material.OBSIDIAN);
|
current.setType(main);
|
||||||
|
current.setData(mainData);
|
||||||
|
current = this.warzone.getWorld().getBlockAt(x, y + 1, z + 1);
|
||||||
|
current.setType(main);
|
||||||
|
current.setData(mainData);
|
||||||
|
|
||||||
this.warzone.getWorld().getBlockAt(x, y + 2, z).setType(Material.OBSIDIAN);
|
current = this.warzone.getWorld().getBlockAt(x, y + 2, z);
|
||||||
this.warzone.getWorld().getBlockAt(x, y + 2, z - 1).setType(Material.OBSIDIAN);
|
current.setType(main);
|
||||||
this.warzone.getWorld().getBlockAt(x, y + 2, z + 1).setType(Material.OBSIDIAN);
|
current.setData(mainData);
|
||||||
|
current = this.warzone.getWorld().getBlockAt(x, y + 2, z - 1);
|
||||||
|
current.setType(main);
|
||||||
|
current.setData(mainData);
|
||||||
|
current = this.warzone.getWorld().getBlockAt(x, y + 2, z + 1);
|
||||||
|
current.setType(main);
|
||||||
|
current.setData(mainData);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,104 @@
|
|||||||
|
package com.tommytony.war.structure;
|
||||||
|
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
|
||||||
|
import com.tommytony.war.War;
|
||||||
|
|
||||||
|
public class WarzoneMaterials {
|
||||||
|
private int mainId;
|
||||||
|
private byte mainData;
|
||||||
|
|
||||||
|
private int standId;
|
||||||
|
private byte standData;
|
||||||
|
|
||||||
|
private int lightId;
|
||||||
|
private byte lightData;
|
||||||
|
|
||||||
|
public WarzoneMaterials(int mainId, byte mainData, int standId, byte standData, int lightId, byte lightData) {
|
||||||
|
// Make sure we are using legal blocks or AIR as material
|
||||||
|
if (isBlockOrAir(mainId)) {
|
||||||
|
this.setMainId(mainId);
|
||||||
|
this.setMainData(mainData);
|
||||||
|
} else {
|
||||||
|
this.setMainId(49); // default obsidian
|
||||||
|
this.setMainData((byte)0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isBlockOrAir(standId)) {
|
||||||
|
this.setStandId(standId);
|
||||||
|
this.setStandData(standData);
|
||||||
|
} else {
|
||||||
|
this.setStandId(85); // default ladder
|
||||||
|
this.setStandData((byte)0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isBlockOrAir(lightId)) {
|
||||||
|
this.setLightId(lightId);
|
||||||
|
this.setLightData(lightData);
|
||||||
|
} else {
|
||||||
|
this.setLightId(89); // default glowstone
|
||||||
|
this.setLightData((byte)0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isBlockOrAir(int itemId) {
|
||||||
|
Material material = Material.getMaterial(itemId);
|
||||||
|
if (material.isBlock() || material.equals(Material.AIR)) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
War.war.log("Can't use item with id:" + itemId + " as warzone material.", Level.WARNING);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMainId() {
|
||||||
|
return mainId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte getMainData() {
|
||||||
|
return mainData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLightId() {
|
||||||
|
return lightId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte getLightData() {
|
||||||
|
return lightData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getStandId() {
|
||||||
|
return standId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte getStandData() {
|
||||||
|
return standData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMainId(int mainId) {
|
||||||
|
this.mainId = mainId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMainData(byte mainData) {
|
||||||
|
this.mainData = mainData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStandId(int standId) {
|
||||||
|
this.standId = standId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStandData(byte standData) {
|
||||||
|
this.standData = standData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLightId(int lightId) {
|
||||||
|
this.lightId = lightId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLightData(byte lightData) {
|
||||||
|
this.lightData = lightData;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -427,7 +427,7 @@ public class Volume {
|
|||||||
|
|
||||||
public void setToMaterial(Material material) {
|
public void setToMaterial(Material material) {
|
||||||
try {
|
try {
|
||||||
if (this.hasTwoCorners() && this.isSaved()) {
|
if (this.hasTwoCorners()) {
|
||||||
int x = this.getMinX();
|
int x = this.getMinX();
|
||||||
for (int i = 0; i < this.getSizeX(); i++) {
|
for (int i = 0; i < this.getSizeX(); i++) {
|
||||||
int y = this.getMaxY();
|
int y = this.getMaxY();
|
||||||
|
@ -115,6 +115,7 @@ commands:
|
|||||||
/savezone [zone-name] reward:default => sets the winner's reward to your current items.
|
/savezone [zone-name] reward:default => sets the winner's reward to your current items.
|
||||||
/savezone [zone-name] author:tommytony,someguy => adds these players as authors of the warzone, allowing them to edit it.
|
/savezone [zone-name] author:tommytony,someguy => adds these players as authors of the warzone, allowing them to edit it.
|
||||||
/savezone [zone-name] deleteauthor:tommytony,someguy => removes these players from the warzone authors.
|
/savezone [zone-name] deleteauthor:tommytony,someguy => removes these players from the warzone authors.
|
||||||
|
/savezone [zone-name] warhubmaterial:<floor/outline/gate/light> => while holding block, changes look for different parts of warhub.
|
||||||
setzonelobby:
|
setzonelobby:
|
||||||
description: War> Creates or changes the position of the warzone lobby.
|
description: War> Creates or changes the position of the warzone lobby.
|
||||||
usage: Creates or changes the position of the warzone lobby.
|
usage: Creates or changes the position of the warzone lobby.
|
||||||
@ -202,6 +203,8 @@ commands:
|
|||||||
/setzoneconfig [zone-name] reward:default => sets the winner's reward to your current items.
|
/setzoneconfig [zone-name] reward:default => sets the winner's reward to your current items.
|
||||||
/setzoneconfig [zone-name] author:tommytony,someguy => adds these players as authors of the warzone, allowing them to edit it.
|
/setzoneconfig [zone-name] author:tommytony,someguy => adds these players as authors of the warzone, allowing them to edit it.
|
||||||
/setzoneconfig [zone-name] deleteauthor:tommytony,someguy => removes these players from the warzone authors.
|
/setzoneconfig [zone-name] deleteauthor:tommytony,someguy => removes these players from the warzone authors.
|
||||||
|
/setzoneconfig [zone-name] material:<main/stand/light> => while holding block, changes look for structures like flag stands and monuments.
|
||||||
|
/setzoneconfig [zone-name] lobbymaterial:<floor/outline/gate/light> => while holding block, changes look for different parts of lobby.
|
||||||
zonecfg:
|
zonecfg:
|
||||||
description: War> Alias for /setzoneconfig
|
description: War> Alias for /setzoneconfig
|
||||||
usage: Use named parameters to change the configuration of the warzone and default team settings. Resets blocks like /nextbattle. Does not save zone blocks like /savezone. Provide a zone name if not standing in warzone or lobby.
|
usage: Use named parameters to change the configuration of the warzone and default team settings. Resets blocks like /nextbattle. Does not save zone blocks like /savezone. Provide a zone name if not standing in warzone or lobby.
|
||||||
@ -214,6 +217,8 @@ commands:
|
|||||||
/zonecfg [zone-name] reward:default => sets the winner's reward to your current items.
|
/zonecfg [zone-name] reward:default => sets the winner's reward to your current items.
|
||||||
/zonecfg [zone-name] author:tommytony,someguy => adds these players as authors of the warzone, allowing them to edit it.
|
/zonecfg [zone-name] author:tommytony,someguy => adds these players as authors of the warzone, allowing them to edit it.
|
||||||
/zonecfg [zone-name] deleteauthor:tommytony,someguy => removes these players from the warzone authors.
|
/zonecfg [zone-name] deleteauthor:tommytony,someguy => removes these players from the warzone authors.
|
||||||
|
/zonecfg [zone-name] material:<main/stand/light> => while holding block, changes look for structures like flag stands and monuments.
|
||||||
|
/zonecfg [zone-name] lobbymaterial:<floor/outline/gate/light> => while holding block, changes look for different parts of lobby.
|
||||||
setteamconfig:
|
setteamconfig:
|
||||||
description: War> Use named parameters to change team-specific settings. Resets warzone blocks like /nextbattle. Does not save zone blocks like /savezone.
|
description: War> Use named parameters to change team-specific settings. Resets warzone blocks like /nextbattle. Does not save zone blocks like /savezone.
|
||||||
usage: Use named parameters to change the configuration of the warzone. Resets blocks like /nextbattle. Does not save zone blocks like /savezone. Provide a zone name if not standing in warzone or lobby.
|
usage: Use named parameters to change the configuration of the warzone. Resets blocks like /nextbattle. Does not save zone blocks like /savezone. Provide a zone name if not standing in warzone or lobby.
|
||||||
|
Loading…
Reference in New Issue
Block a user