diff --git a/war/.classpath b/war/.classpath
index 21e4d33..4cd8809 100644
--- a/war/.classpath
+++ b/war/.classpath
@@ -9,5 +9,6 @@
+
diff --git a/war/src/main/java/bukkit/tommytony/war/War.java b/war/src/main/java/bukkit/tommytony/war/War.java
index 4cda4e6..07f77ba 100644
--- a/war/src/main/java/bukkit/tommytony/war/War.java
+++ b/war/src/main/java/bukkit/tommytony/war/War.java
@@ -22,6 +22,7 @@ import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
+import org.getspout.spoutapi.player.SpoutPlayer;
import com.nijiko.permissions.PermissionHandler;
import com.nijikokun.bukkit.Permissions.Permissions;
@@ -71,6 +72,7 @@ public class War extends JavaPlugin {
private boolean pvpInZonesOnly = false;
private boolean disablePvpMessage = false;
private boolean buildInZonesOnly = false;
+ private boolean disableBuildMessage = false;
private boolean tntInZonesOnly = false;
private int maxZones = 12;
private final List deadlyAdjectives = new ArrayList();
@@ -87,6 +89,7 @@ public class War extends JavaPlugin {
private boolean defaultFriendlyFire = false;
private boolean defaultAutoAssignOnly = false;
private boolean defaultFlagPointsOnly = false;
+ private boolean defaultFlagMustBeHome = true;
private boolean defaultUnbreakableZoneBlocks = false;
private boolean defaultNoCreatures = false;
private boolean defaultGlassWalls = true;
@@ -94,6 +97,7 @@ public class War extends JavaPlugin {
private boolean defaultInstaBreak = false;
private boolean defaultNoDrops = false;
private boolean defaultNoHunger = false;
+ private int defaultRespawnTimer = 10;
private int defaultSaturation = 10;
private int defaultMinPlayers = 1; // By default, 1 player on 1 team is enough for unlocking the cant-exit-spawn guard
private int defaultMinTeams = 1;
@@ -159,6 +163,12 @@ public class War extends JavaPlugin {
pm.registerEvent(Event.Type.BLOCK_PLACE, this.blockListener, Priority.Normal, this);
pm.registerEvent(Event.Type.BLOCK_DAMAGE, this.blockListener, Priority.Normal, this);
pm.registerEvent(Event.Type.BLOCK_BREAK, this.blockListener, Priority.Normal, this);
+ pm.registerEvent(Event.Type.BLOCK_PISTON_EXTEND, this.blockListener, Priority.Normal, this);
+ pm.registerEvent(Event.Type.BLOCK_PISTON_RETRACT, this.blockListener, Priority.Normal, this);
+
+ if (this.isSpoutServer()) {
+ pm.registerEvent(Event.Type.CUSTOM_EVENT, new WarSpoutListener(this), Priority.Low, this);
+ }
}
// Load files from disk or create them (using these defaults)
@@ -201,6 +211,14 @@ public class War extends JavaPlugin {
* Cleans up war
*/
public void unloadWar() {
+ if (this.isSpoutServer()) {
+ for (Player player : getServer().getOnlinePlayers()) {
+ SpoutPlayer sp = (SpoutPlayer) player;
+ if (sp.isSpoutCraftEnabled())
+ sp.getMainScreen().removeWidgets(this);
+ }
+ }
+
for (Warzone warzone : this.warzones) {
warzone.unload();
}
@@ -331,6 +349,10 @@ public class War extends JavaPlugin {
warzone.setScoreCap(Integer.parseInt(namedParams.get("maxscore")));
returnMessage.append(" maxscore set to " + warzone.getScoreCap() + ".");
}
+ if (namedParams.containsKey("respawntimer")) {
+ warzone.setRespawnTimer(Integer.parseInt(namedParams.get("respawntimer")));
+ returnMessage.append(" respawntimer set to " + warzone.getRespawnTimer() + ".");
+ }
if (namedParams.containsKey("ff")) {
String onOff = namedParams.get("ff");
warzone.setFriendlyFire(onOff.equals("on") || onOff.equals("true"));
@@ -346,6 +368,11 @@ public class War extends JavaPlugin {
warzone.setFlagPointsOnly(onOff.equals("on") || onOff.equals("true"));
returnMessage.append(" flagpointsonly set to " + String.valueOf(warzone.isFlagPointsOnly()) + ".");
}
+ if (namedParams.containsKey("flagmustbehome")) {
+ String onOff = namedParams.get("flagmustbehome");
+ warzone.setFlagMustBeHome(onOff.equals("on") || onOff.equals("true"));
+ returnMessage.append(" flagmustbehome set to " + String.valueOf(warzone.isFlagMustBeHome()) + ".");
+ }
if (namedParams.containsKey("blockheads")) {
String onOff = namedParams.get("blockheads");
warzone.setBlockHeads(onOff.equals("on") || onOff.equals("true"));
@@ -472,7 +499,6 @@ public class War extends JavaPlugin {
if (loadoutName.equals("default")) {
returnMessage.append(" Can't remove default loadout.");
} else {
- HashMap extraLoadout = warzone.getExtraLoadouts().get(loadoutName);
if (warzone.getExtraLoadouts().keySet().contains(loadoutName)) {
warzone.getExtraLoadouts().remove(loadoutName);
returnMessage.append(" " + loadoutName + " loadout removed.");
@@ -507,13 +533,18 @@ public class War extends JavaPlugin {
if (namedParams.containsKey("pvpinzonesonly")) {
String onOff = namedParams.get("pvpinzonesonly");
this.setPvpInZonesOnly(onOff.equals("on") || onOff.equals("true"));
- returnMessage.append(" flagpointsonly set to " + String.valueOf(war.isDefaultFlagPointsOnly()) + ".");
+ returnMessage.append(" pvpinzonesonly set to " + String.valueOf(war.isPvpInZonesOnly()) + ".");
}
if (namedParams.containsKey("disablepvpmessage")) {
String onOff = namedParams.get("disablepvpmessage");
this.setDisablePvpMessage(onOff.equals("on") || onOff.equals("true"));
returnMessage.append(" disablepvpmessage set to " + String.valueOf(war.isDisablePvpMessage()) + ".");
}
+ if (namedParams.containsKey("disablebuildmessage")) {
+ String onOff = namedParams.get("disablebuildmessage");
+ this.setDisableBuildMessage(onOff.equals("on") || onOff.equals("true"));
+ returnMessage.append(" disablebuildmessage set to " + String.valueOf(war.isDisableBuildMessage()) + ".");
+ }
if (namedParams.containsKey("buildinzonesonly")) {
String onOff = namedParams.get("buildinzonesonly");
this.setBuildInZonesOnly(onOff.equals("on") || onOff.equals("true"));
@@ -545,6 +576,10 @@ public class War extends JavaPlugin {
this.setDefaultScoreCap(Integer.parseInt(namedParams.get("maxscore")));
returnMessage.append(" maxscore set to " + war.getDefaultScoreCap() + ".");
}
+ if (namedParams.containsKey("respawntimer")) {
+ this.setDefaultRespawnTimer(Integer.parseInt(namedParams.get("respawntimer")));
+ returnMessage.append(" respawntimer set to " + war.getDefaultRespawnTimer() + ".");
+ }
if (namedParams.containsKey("ff")) {
String onOff = namedParams.get("ff");
this.setDefaultFriendlyFire(onOff.equals("on") || onOff.equals("true"));
@@ -559,7 +594,12 @@ public class War extends JavaPlugin {
String onOff = namedParams.get("flagpointsonly");
this.setDefaultFlagPointsOnly(onOff.equals("on") || onOff.equals("true"));
returnMessage.append(" flagpointsonly set to " + String.valueOf(war.isDefaultFlagPointsOnly()) + ".");
- }
+ }
+ if (namedParams.containsKey("flagmustbehome")) {
+ String onOff = namedParams.get("flagmustbehome");
+ this.setDefaultFlagMustBeHome(onOff.equals("on") || onOff.equals("true"));
+ returnMessage.append(" flagmustbehome set to " + String.valueOf(war.isDefaultFlagMustBeHome()) + ".");
+ }
if (namedParams.containsKey("blockheads")) {
String onOff = namedParams.get("blockheads");
this.setDefaultBlockHeads(onOff.equals("on") || onOff.equals("true"));
@@ -677,7 +717,6 @@ public class War extends JavaPlugin {
if (loadoutName.equals("default")) {
returnMessage.append(" Can't remove default loadout.");
} else {
- HashMap extraLoadout = this.getDefaultExtraLoadouts().get(loadoutName);
if (this.getDefaultExtraLoadouts().keySet().contains(loadoutName)) {
this.getDefaultExtraLoadouts().remove(loadoutName);
returnMessage.append(" " + loadoutName + " loadout removed.");
@@ -715,6 +754,7 @@ public class War extends JavaPlugin {
+ " ff:" + color + String.valueOf(zone.getFriendlyFire()) + normal
+ " autoassign:" + color + String.valueOf(zone.isAutoAssignOnly()) + normal
+ " flagpointsonly:" + color + String.valueOf(zone.isFlagPointsOnly()) + normal
+ + " flagmustbehome:" + color + String.valueOf(zone.isFlagMustBeHome()) + normal
+ " blockheads:" + color + String.valueOf(zone.isBlockHeads()) + normal
+ " spawnstyle:" + color + zone.getSpawnStyle() + normal
+ " flagreturn:" + color + zone.getFlagReturn() + normal
@@ -749,6 +789,7 @@ public class War extends JavaPlugin {
return "War config -"
+ " pvpinzonesonly:" + global + String.valueOf(this.isPvpInZonesOnly()) + normal
+ " disablepvpmessage:" + global + String.valueOf(this.isDisablePvpMessage()) + normal
+ + " disablebuildmessage:" + global + String.valueOf(this.isDisableBuildMessage()) + normal
+ " buildinzonesonly:" + global + String.valueOf(this.isBuildInZonesOnly()) + normal
+ " tntinzonesonly:" + global + String.valueOf(this.isTntInZonesOnly()) + normal
+ " maxzones:" + global + this.getMaxZones() + normal
@@ -759,6 +800,7 @@ public class War extends JavaPlugin {
+ " ff:" + color + String.valueOf(this.isDefaultFriendlyFire()) + normal
+ " autoassign:" + color + String.valueOf(this.isDefaultAutoAssignOnly()) + normal
+ " flagpointsonly:" + color + String.valueOf(this.isDefaultFlagPointsOnly()) + normal
+ + " flagmustbehome:" + color + String.valueOf(this.isDefaultFlagMustBeHome()) + normal
+ " blockheads:" + color + String.valueOf(this.isDefaultBlockHeads()) + normal
+ " spawnstyle:" + color + this.getDefaultSpawnStyle() + normal
+ " flagreturn:" + color + this.getDefaultFlagReturn() + normal
@@ -1051,6 +1093,15 @@ public class War extends JavaPlugin {
public Logger getLogger() {
return this.logger;
}
+
+ public boolean isSpoutServer() {
+ try {
+ Class.forName("org.getspout.spoutapi.player.SpoutPlayer");
+ return true;
+ } catch (ClassNotFoundException e) {
+ return false;
+ }
+ }
public Warzone zoneOfZoneWallAtProximity(Location location) {
for (Warzone zone : this.warzones) {
@@ -1119,6 +1170,14 @@ public class War extends JavaPlugin {
public void setDisablePvpMessage(boolean disablePvpMessage) {
this.disablePvpMessage = disablePvpMessage;
}
+
+ public boolean isDisableBuildMessage() {
+ return this.disableBuildMessage;
+ }
+
+ public void setDisableBuildMessage(boolean disableBuildMessage) {
+ this.disableBuildMessage = disableBuildMessage;
+ }
public boolean isBuildInZonesOnly() {
return this.buildInZonesOnly;
@@ -1263,6 +1322,14 @@ public class War extends JavaPlugin {
public boolean isDefaultFlagPointsOnly() {
return this.defaultFlagPointsOnly;
}
+
+ public void setDefaultFlagMustBeHome(boolean defaultFlagMustBeHome) {
+ this.defaultFlagMustBeHome = defaultFlagMustBeHome;
+ }
+
+ public boolean isDefaultFlagMustBeHome() {
+ return this.defaultFlagMustBeHome;
+ }
public void setDefaultMinPlayers(int defaultMinPlayers) {
this.defaultMinPlayers = defaultMinPlayers;
@@ -1347,5 +1414,13 @@ public class War extends JavaPlugin {
public int getMaxZones() {
return maxZones;
}
+
+ public void setDefaultRespawnTimer(int defaultRespawnTimer) {
+ this.defaultRespawnTimer = defaultRespawnTimer;
+ }
+
+ public int getDefaultRespawnTimer() {
+ return defaultRespawnTimer;
+ }
}
diff --git a/war/src/main/java/bukkit/tommytony/war/WarBlockListener.java b/war/src/main/java/bukkit/tommytony/war/WarBlockListener.java
index 8c42115..7aceb96 100644
--- a/war/src/main/java/bukkit/tommytony/war/WarBlockListener.java
+++ b/war/src/main/java/bukkit/tommytony/war/WarBlockListener.java
@@ -11,8 +11,11 @@ import org.bukkit.event.Cancellable;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.event.block.BlockListener;
+import org.bukkit.event.block.BlockPistonExtendEvent;
+import org.bukkit.event.block.BlockPistonRetractEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.inventory.ItemStack;
+import org.getspout.spoutapi.player.SpoutPlayer;
import com.tommytony.war.FlagReturn;
import com.tommytony.war.Monument;
@@ -86,7 +89,7 @@ public class WarBlockListener extends BlockListener {
}
// buildInZonesOnly
- if (zone == null && War.war.isBuildInZonesOnly() && !War.war.canBuildOutsideZone(player)) {
+ if (zone == null && War.war.isBuildInZonesOnly() && !War.war.canBuildOutsideZone(player) && !War.war.isDisableBuildMessage()) {
War.war.badMsg(player, "You can only build inside warzones. Ask for the 'war.build' permission to build outside.");
event.setCancelled(true);
return;
@@ -114,7 +117,34 @@ public class WarBlockListener extends BlockListener {
return;
}
}
-
+
+ // Do not allow moving of block into or from important zones
+ public void onBlockPistonExtend(BlockPistonExtendEvent event) {
+ Warzone zone = Warzone.getZoneByLocation(event.getBlock().getLocation());
+ if (zone!=null) {
+ for (Block b : event.getBlocks()) {
+ if (zone.isImportantBlock(b)) {
+ event.setCancelled(true);
+ return;
+ }
+ }
+ if (zone.isImportantBlock(event.getBlock().getRelative(event.getDirection(), event.getLength()+1))) {
+ event.setCancelled(true);
+ return;
+ }
+ }
+ }
+ public void onBlockPistonRetract(BlockPistonRetractEvent event) {
+ Warzone zone = Warzone.getZoneByLocation(event.getBlock().getLocation());
+ if (zone!=null) {
+ Block b = event.getBlock().getRelative(event.getDirection(), 2);
+ if (zone.isImportantBlock(b)) {
+ event.setCancelled(true);
+ return;
+ }
+ }
+ }
+
/**
* @see BlockListener.onBlockBreak()
*/
@@ -207,6 +237,15 @@ public class WarBlockListener extends BlockListener {
for (Team t : warzone.getTeams()) {
t.teamcast(team.getKind().getColor() + player.getName() + ChatColor.WHITE + " stole team " + lostFlagTeam.getName() + "'s flag.");
if (t.getName().equals(lostFlagTeam.getName())) {
+ if (War.war.isSpoutServer()) {
+ for (Player p : t.getPlayers()) {
+ SpoutPlayer sp = (SpoutPlayer) p;
+ if (sp.isSpoutCraftEnabled()) {
+ String tn = team.getName();
+ sp.sendNotification(tn.substring(0,1).toUpperCase()+tn.substring(1).toLowerCase()+" stole your Flag!","Stolen by "+player.getName(),lostFlagTeam.getKind().getMaterial(),lostFlagTeam.getKind().getData(),3000);
+ }
+ }
+ }
t.teamcast("Prevent " + team.getKind().getColor() + player.getName() + ChatColor.WHITE
+ " from reaching team " + team.getName() + "'s " + spawnOrFlag + ".");
}
diff --git a/war/src/main/java/bukkit/tommytony/war/WarEntityListener.java b/war/src/main/java/bukkit/tommytony/war/WarEntityListener.java
index a1f246c..0d8ae9d 100644
--- a/war/src/main/java/bukkit/tommytony/war/WarEntityListener.java
+++ b/war/src/main/java/bukkit/tommytony/war/WarEntityListener.java
@@ -22,14 +22,13 @@ import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.entity.EntityCombustEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
-import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
+import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.EntityListener;
import org.bukkit.event.entity.EntityRegainHealthEvent;
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
import org.bukkit.event.entity.FoodLevelChangeEvent;
-import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.inventory.ItemStack;
import com.tommytony.war.Team;
@@ -89,6 +88,15 @@ public class WarEntityListener extends EntityListener {
event.setCancelled(true);
return;
}
+ // Make sure none of them are respawning
+ } else if (defenderWarzone.isRespawning(d)) {
+ War.war.badMsg(a, "The target is currently respawning!");
+ event.setCancelled(true);
+ return;
+ } else if (attackerWarzone.isRespawning(a)) {
+ War.war.badMsg(a, "You can't attack while respawning!");
+ event.setCancelled(true);
+ return;
}
if (!attackerWarzone.isPvpInZone()) {
diff --git a/war/src/main/java/bukkit/tommytony/war/WarPlayerListener.java b/war/src/main/java/bukkit/tommytony/war/WarPlayerListener.java
index c2adf25..7d6edb4 100644
--- a/war/src/main/java/bukkit/tommytony/war/WarPlayerListener.java
+++ b/war/src/main/java/bukkit/tommytony/war/WarPlayerListener.java
@@ -25,6 +25,7 @@ import org.bukkit.event.player.PlayerToggleSneakEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
+import org.getspout.spoutapi.player.SpoutPlayer;
import com.tommytony.war.FlagReturn;
import com.tommytony.war.LoadoutSelection;
@@ -430,10 +431,20 @@ public class WarPlayerListener extends PlayerListener {
}
}
- if (!playerWarzone.isEnoughPlayers() && !playerTeam.getSpawnVolume().contains(playerLoc)) {
- War.war.badMsg(player, "Can't leave spawn until there's a minimum of " + playerWarzone.getMinPlayers() +" player(s) on at least " + playerWarzone.getMinTeams() + " team(s).");
- event.setTo(playerTeam.getTeamSpawn());
- return;
+ if (!playerTeam.getSpawnVolume().contains(playerLoc)) {
+ if (!playerWarzone.isEnoughPlayers()) {
+ War.war.badMsg(player, "Can't leave spawn until there's a minimum of " + playerWarzone.getMinPlayers() +" player(s) on at least " + playerWarzone.getMinTeams() + " team(s).");
+ event.setTo(playerTeam.getTeamSpawn());
+ return;
+ }
+ if (playerWarzone.isRespawning(player)) {
+ int rt = playerWarzone.getRespawnTimer();
+ String isS = "s";
+ if (rt==1) isS = "";
+ War.war.badMsg(player, "Can't leave spawn for "+rt+" second"+isS+" after spawning!");
+ event.setTo(playerTeam.getTeamSpawn());
+ return;
+ }
}
// Monuments
@@ -482,7 +493,7 @@ public class WarPlayerListener extends PlayerListener {
}
}
- if (playerWarzone.isTeamFlagStolen(playerTeam)) {
+ if (playerWarzone.isTeamFlagStolen(playerTeam) && playerWarzone.isFlagMustBeHome()) {
War.war.badMsg(player, "You can't capture the enemy flag until your team's flag is returned.");
} else {
synchronized (playerWarzone) {
@@ -500,6 +511,15 @@ public class WarPlayerListener extends PlayerListener {
victim.getFlagVolume().resetBlocks(); // bring back flag to team that lost it
victim.initializeTeamFlag();
for (Team t : playerWarzone.getTeams()) {
+ if (War.war.isSpoutServer()) {
+ for (Player p : t.getPlayers()) {
+ SpoutPlayer sp = (SpoutPlayer) p;
+ if (sp.isSpoutCraftEnabled()) {
+ String tn = playerTeam.getName();
+ sp.sendNotification(tn.substring(0,1).toUpperCase()+tn.substring(1).toLowerCase()+" captures Flag!","Capped by "+player.getName(),victim.getKind().getMaterial(),victim.getKind().getData(),3000);
+ }
+ }
+ }
t.teamcast(playerTeam.getKind().getColor() + player.getName() + ChatColor.WHITE
+ " captured team " + victim.getName() + "'s flag. Team " + playerTeam.getName() + " scores one point.");
}
@@ -545,7 +565,6 @@ public class WarPlayerListener extends PlayerListener {
} else {
War.war.badMsg(event.getPlayer(), "Can't change loadout after exiting the spawn.");
}
-
}
}
}
diff --git a/war/src/main/java/bukkit/tommytony/war/WarSpoutListener.java b/war/src/main/java/bukkit/tommytony/war/WarSpoutListener.java
new file mode 100644
index 0000000..722d3c3
--- /dev/null
+++ b/war/src/main/java/bukkit/tommytony/war/WarSpoutListener.java
@@ -0,0 +1,130 @@
+package bukkit.tommytony.war;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.bukkit.entity.Player;
+import org.bukkit.plugin.Plugin;
+import org.getspout.spoutapi.event.spout.SpoutCraftEnableEvent;
+import org.getspout.spoutapi.event.spout.SpoutListener;
+import org.getspout.spoutapi.gui.Color;
+import org.getspout.spoutapi.gui.GenericLabel;
+import org.getspout.spoutapi.gui.WidgetAnchor;
+import org.getspout.spoutapi.player.SpoutPlayer;
+
+import com.tommytony.war.Team;
+import com.tommytony.war.Warzone;
+
+public class WarSpoutListener extends SpoutListener {
+ static Plugin plugin;
+
+ public WarSpoutListener(Plugin plugin) {
+ WarSpoutListener.plugin = plugin;
+ }
+
+ @Override
+ public void onSpoutCraftEnable(SpoutCraftEnableEvent event) {
+ if(!event.getPlayer().isSpoutCraftEnabled()) {
+ //event.getPlayer().sendMessage("PROTIP: Get Spout at getspout.org for real-time scores display!");
+ return;
+ }
+ }
+
+ public static void updateStats(Warzone zone) {
+ List teamlines = new ArrayList();
+ List playerlines = new ArrayList();
+ List scorelines = new ArrayList();
+ List lifelines = new ArrayList();
+ int teammax = -15, playmax = -15, scoremax = -15;
+ GenericLabel line;
+
+ // First, we collect all the team names
+ int linecounter = 0;
+ for (Team t : zone.getTeams()) {
+ // team name
+ line = new GenericLabel(t.getName());
+ if (t.getPlayers().size()==0) line.setTextColor(new Color(100,100,100));
+ else line.setTextColor(t.getKind().getSpoutColor());
+ line.setTooltip("Warzone: "+zone.getName()).setAnchor(WidgetAnchor.TOP_LEFT);
+ line.setAlign(WidgetAnchor.TOP_LEFT).setX(3).setY(3+linecounter*(GenericLabel.getStringHeight("O")+3)).setWidth(GenericLabel.getStringWidth(line.getText())).setHeight(GenericLabel.getStringHeight(line.getText()));
+ teamlines.add(line);
+ linecounter++;
+ }
+ // We need to find the longest name
+ for (GenericLabel l : teamlines) {
+ if (GenericLabel.getStringWidth(l.getText()) > teammax) teammax=GenericLabel.getStringWidth(l.getText());
+ }
+
+ // Now for the players
+ linecounter = 0;
+ for (Team t : zone.getTeams()) {
+ // player number
+ line = new GenericLabel("Players: "+t.getPlayers().size());
+ if (t.getPlayers().size()==0) line.setTextColor(new Color(100,100,100));
+ line.setTooltip("Warzone: "+zone.getName()).setAnchor(WidgetAnchor.TOP_LEFT);
+ line.setAlign(WidgetAnchor.TOP_LEFT).setX(3+teammax+15).setY(3+linecounter*(GenericLabel.getStringHeight("O")+3)).setWidth(GenericLabel.getStringWidth(line.getText())).setHeight(GenericLabel.getStringHeight(line.getText()));
+ playerlines.add(line);
+ linecounter++;
+ }
+ // Again, we need the longest entry
+ for (GenericLabel l : playerlines) {
+ if (GenericLabel.getStringWidth(l.getText()) > playmax) playmax=GenericLabel.getStringWidth(l.getText());
+ }
+
+ // is there even a score cap (or is it just 1 point)?
+ if (zone.getScoreCap()>1) {
+ linecounter = 0;
+ for (Team t : zone.getTeams()) {
+ // scores
+ line = new GenericLabel(t.getPoints()+"/"+zone.getScoreCap()+" points");
+ if (t.getPlayers().size()==0) line.setTextColor(new Color(100,100,100));
+ line.setTooltip("Warzone: "+zone.getName()).setAnchor(WidgetAnchor.TOP_LEFT);
+ line.setAlign(WidgetAnchor.TOP_LEFT).setX(3+teammax+15+playmax+15).setY(3+linecounter*(GenericLabel.getStringHeight("O")+3)).setWidth(GenericLabel.getStringWidth(line.getText())).setHeight(GenericLabel.getStringHeight(line.getText()));
+ scorelines.add(line);
+ linecounter++;
+ }
+ // I bet you know what is done here!
+ for (GenericLabel l : scorelines) {
+ if (GenericLabel.getStringWidth(l.getText()) > scoremax) scoremax=GenericLabel.getStringWidth(l.getText());
+ }
+ }
+
+ // and finally, lives.
+ if (zone.getLifePool()>1) {
+ linecounter = 0;
+ for (Team t : zone.getTeams()) {
+ line = new GenericLabel(t.getRemainingLifes()+"/"+zone.getLifePool()+" lives");
+ if (t.getPlayers().size()==0) line.setTextColor(new Color(100,100,100));
+ line.setTooltip("Warzone: "+zone.getName()).setAnchor(WidgetAnchor.TOP_LEFT);
+ line.setAlign(WidgetAnchor.TOP_LEFT).setX(3+teammax+15+playmax+15+scoremax+15).setY(3+linecounter*(GenericLabel.getStringHeight("O")+3)).setWidth(GenericLabel.getStringWidth(line.getText())).setHeight(GenericLabel.getStringHeight(line.getText()));
+ scorelines.add(line);
+ linecounter++;
+ }
+ }
+
+ // Now to print it to the Spout players!
+ List lines = new ArrayList();
+ for (GenericLabel l : teamlines) lines.add(l);
+ for (GenericLabel l : playerlines) lines.add(l);
+ for (GenericLabel l : scorelines) lines.add(l);
+ for (GenericLabel l : lifelines) lines.add(l);
+ for (Team team : zone.getTeams()) {
+ for (Player player : team.getPlayers()) {
+ SpoutPlayer sp = (SpoutPlayer) player;
+ if (sp.isSpoutCraftEnabled()) {
+ drawStats(sp, lines);
+ }
+ }
+ }
+ }
+
+ private static void drawStats(SpoutPlayer sp, List lines) {
+ // remove old stats first
+ removeStats(sp);
+ for (GenericLabel l : lines) sp.getMainScreen().attachWidget(plugin,l.copy());
+ }
+
+ public static void removeStats(SpoutPlayer sp) {
+ sp.getMainScreen().removeWidgets(plugin);
+ }
+}
\ No newline at end of file
diff --git a/war/src/main/java/com/tommytony/war/Monument.java b/war/src/main/java/com/tommytony/war/Monument.java
index 25a29b2..e43fd9d 100644
--- a/war/src/main/java/com/tommytony/war/Monument.java
+++ b/war/src/main/java/com/tommytony/war/Monument.java
@@ -140,8 +140,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.getFace(BlockFace.DOWN).getFace(BlockFace.EAST, 2).getFace(BlockFace.SOUTH, 2));
- this.volume.setCornerTwo(locationBlock.getFace(BlockFace.UP, 2).getFace(BlockFace.WEST, 2).getFace(BlockFace.NORTH, 2));
+ 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.saveBlocks();
this.location = location;
this.addMonumentBlocks();
diff --git a/war/src/main/java/com/tommytony/war/PotionEffect.java b/war/src/main/java/com/tommytony/war/PotionEffect.java
index 040a0e6..90f16a9 100644
--- a/war/src/main/java/com/tommytony/war/PotionEffect.java
+++ b/war/src/main/java/com/tommytony/war/PotionEffect.java
@@ -2,7 +2,6 @@ package com.tommytony.war;
import java.util.ArrayList;
import java.util.List;
-import java.util.logging.Level;
import net.minecraft.server.MobEffect;
import net.minecraft.server.MobEffectList;
@@ -10,8 +9,6 @@ import net.minecraft.server.MobEffectList;
import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.entity.Player;
-import bukkit.tommytony.war.War;
-
public class PotionEffect {
private int id;
diff --git a/war/src/main/java/com/tommytony/war/Team.java b/war/src/main/java/com/tommytony/war/Team.java
index 992ebce..ff5d665 100644
--- a/war/src/main/java/com/tommytony/war/Team.java
+++ b/war/src/main/java/com/tommytony/war/Team.java
@@ -10,8 +10,8 @@ import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
-
import bukkit.tommytony.war.War;
+import bukkit.tommytony.war.WarSpoutListener;
import com.tommytony.war.utils.SignHelper;
import com.tommytony.war.volumes.Volume;
@@ -129,16 +129,16 @@ public class Team {
// SMALL style
if (yaw >= 0 && yaw < 90) {
signData = 10;
- signBlock = this.warzone.getWorld().getBlockAt(x, y, z).getFace(BlockFace.NORTH).getFace(BlockFace.WEST);
+ signBlock = this.warzone.getWorld().getBlockAt(x, y, z).getRelative(BlockFace.NORTH).getRelative(BlockFace.WEST);
} else if (yaw >= 90 && yaw <= 180) {
signData = 14;
- signBlock = this.warzone.getWorld().getBlockAt(x, y, z).getFace(BlockFace.NORTH).getFace(BlockFace.EAST);
+ signBlock = this.warzone.getWorld().getBlockAt(x, y, z).getRelative(BlockFace.NORTH).getRelative(BlockFace.EAST);
} else if (yaw >= 180 && yaw < 270) {
signData = 2;
- signBlock = this.warzone.getWorld().getBlockAt(x, y, z).getFace(BlockFace.SOUTH).getFace(BlockFace.EAST);
+ signBlock = this.warzone.getWorld().getBlockAt(x, y, z).getRelative(BlockFace.SOUTH).getRelative(BlockFace.EAST);
} else if (yaw >= 270 && yaw <= 360) {
signData = 6;
- signBlock = this.warzone.getWorld().getBlockAt(x, y, z).getFace(BlockFace.SOUTH).getFace(BlockFace.WEST);
+ signBlock = this.warzone.getWorld().getBlockAt(x, y, z).getRelative(BlockFace.SOUTH).getRelative(BlockFace.WEST);
}
} else {
// outer ring (FLAT or BIG)
@@ -169,7 +169,7 @@ public class Team {
facing = BlockFace.NORTH_WEST;
opposite = BlockFace.SOUTH_EAST;
signData = 10;
- signBlock = this.warzone.getWorld().getBlockAt(x, y, z).getFace(BlockFace.NORTH, 2).getFace(BlockFace.WEST, 2);
+ signBlock = this.warzone.getWorld().getBlockAt(x, y, z).getRelative(BlockFace.NORTH, 2).getRelative(BlockFace.WEST, 2);
if (this.warzone.getSpawnStyle().equals(TeamSpawnStyle.BIG)) {
// rim
@@ -202,7 +202,7 @@ public class Team {
facing = BlockFace.NORTH_EAST;
opposite = BlockFace.SOUTH_WEST;
signData = 14;
- signBlock = this.warzone.getWorld().getBlockAt(x, y, z).getFace(BlockFace.NORTH, 2).getFace(BlockFace.EAST, 2);
+ signBlock = this.warzone.getWorld().getBlockAt(x, y, z).getRelative(BlockFace.NORTH, 2).getRelative(BlockFace.EAST, 2);
if (this.warzone.getSpawnStyle().equals(TeamSpawnStyle.BIG)) {
// rim
this.setBlock(x + 1, y, z - 2, this.kind);
@@ -234,7 +234,7 @@ public class Team {
facing = BlockFace.SOUTH_EAST;
opposite = BlockFace.NORTH_WEST;
signData = 2;
- signBlock = this.warzone.getWorld().getBlockAt(x, y, z).getFace(BlockFace.SOUTH, 2).getFace(BlockFace.EAST, 2);
+ signBlock = this.warzone.getWorld().getBlockAt(x, y, z).getRelative(BlockFace.SOUTH, 2).getRelative(BlockFace.EAST, 2);
if (this.warzone.getSpawnStyle().equals(TeamSpawnStyle.BIG)) {
// rim
this.setBlock(x + 2, y, z + 1, this.kind);
@@ -266,7 +266,7 @@ public class Team {
facing = BlockFace.SOUTH_WEST;
opposite = BlockFace.NORTH_EAST;
signData = 6;
- signBlock = this.warzone.getWorld().getBlockAt(x, y, z).getFace(BlockFace.SOUTH, 2).getFace(BlockFace.WEST, 2);
+ signBlock = this.warzone.getWorld().getBlockAt(x, y, z).getRelative(BlockFace.SOUTH, 2).getRelative(BlockFace.WEST, 2);
if (this.warzone.getSpawnStyle().equals(TeamSpawnStyle.BIG)) {
// rim
this.setBlock(x - 1, y, z + 2, this.kind);
@@ -310,6 +310,10 @@ public class Team {
SignHelper.setToSign(War.war, signBlock, (byte) signData, lines);
}
+
+ if (War.war.isSpoutServer()) {
+ WarSpoutListener.updateStats(warzone);
+ }
}
private void setBlock(int x, int y, int z, TeamKind kind) {
diff --git a/war/src/main/java/com/tommytony/war/TeamKind.java b/war/src/main/java/com/tommytony/war/TeamKind.java
index cb00fe6..fbb6fbe 100644
--- a/war/src/main/java/com/tommytony/war/TeamKind.java
+++ b/war/src/main/java/com/tommytony/war/TeamKind.java
@@ -2,6 +2,7 @@ package com.tommytony.war;
import org.bukkit.ChatColor;
import org.bukkit.Material;
+import org.getspout.spoutapi.gui.Color;
public enum TeamKind {
WHITE ((byte) 0, Material.WOOL, ChatColor.WHITE),
@@ -47,6 +48,50 @@ public enum TeamKind {
public ChatColor getColor() {
return this.color;
}
+
+ /**
+ * Don't call unless War.war.isSpoutServer() is true
+ * @return
+ */
+ public Color getSpoutColor() {
+ int colorCode = (int)this.data;
+ switch (colorCode) {
+ case 0:
+ return new Color(255,255,255);
+ case 1:
+ return new Color(255,128,0);
+ case 2:
+ return new Color(255,128,255);
+ case 3:
+ return new Color(0,0,255);
+ case 4:
+ return new Color(0,255,255);
+ case 5:
+ return new Color(0,255,0);
+ case 6:
+ return new Color(255,255,255);
+ case 7:
+ return new Color(100,100,100);
+ case 8:
+ return new Color(200,200,200);
+ case 9:
+ return new Color(128,255,255);
+ case 10:
+ return new Color(128,0,255);
+ case 11:
+ return new Color(0,0,128);
+ case 12:
+ return new Color(128,0,0);
+ case 13:
+ return new Color(0,128,0);
+ case 14:
+ return new Color(255,0,0);
+ case 15:
+ return new Color(0,0,0);
+ default:
+ return new Color(255,255,255);
+ }
+ }
public Material getMaterial() {
return this.material;
diff --git a/war/src/main/java/com/tommytony/war/WarHub.java b/war/src/main/java/com/tommytony/war/WarHub.java
index 974033a..0e08396 100644
--- a/war/src/main/java/com/tommytony/war/WarHub.java
+++ b/war/src/main/java/com/tommytony/war/WarHub.java
@@ -144,9 +144,10 @@ public class WarHub {
}
Block locationBlock = this.location.getWorld().getBlockAt(this.location.getBlockX(), this.location.getBlockY(), this.location.getBlockZ());
+
this.volume.setWorld(this.location.getWorld());
- this.volume.setCornerOne(locationBlock.getFace(back).getFace(left, halfHubWidth).getFace(BlockFace.DOWN));
- this.volume.setCornerTwo(locationBlock.getFace(right, halfHubWidth).getFace(front, hubDepth).getFace(BlockFace.UP, hubHeigth));
+ this.volume.setCornerOne(locationBlock.getRelative(back).getRelative(left, halfHubWidth).getRelative(BlockFace.DOWN));
+ this.volume.setCornerTwo(locationBlock.getRelative(right, halfHubWidth).getRelative(front, hubDepth).getRelative(BlockFace.UP, hubHeigth));
this.volume.saveBlocks();
// glass floor
@@ -155,26 +156,26 @@ public class WarHub {
this.volume.setFaceMaterial(BlockFace.DOWN, Material.GLASS);
// draw gates
- Block currentGateBlock = BlockInfo.getBlock(this.location.getWorld(), this.volume.getCornerOne()).getFace(BlockFace.UP).getFace(front, hubDepth).getFace(right, 2);
+ Block currentGateBlock = BlockInfo.getBlock(this.location.getWorld(), this.volume.getCornerOne()).getRelative(BlockFace.UP).getRelative(front, hubDepth).getRelative(right, 2);
for (Warzone zone : War.war.getWarzones()) { // gonna use the index to find it again
if (!zone.isDisabled()) {
this.zoneGateBlocks.put(zone.getName(), currentGateBlock);
- currentGateBlock.getFace(BlockFace.DOWN).setType(Material.GLOWSTONE);
- currentGateBlock.getFace(left).setType(Material.OBSIDIAN);
- currentGateBlock.getFace(right).getFace(BlockFace.UP).setType(Material.OBSIDIAN);
- currentGateBlock.getFace(left).getFace(BlockFace.UP).getFace(BlockFace.UP).setType(Material.OBSIDIAN);
- currentGateBlock.getFace(right).setType(Material.OBSIDIAN);
- currentGateBlock.getFace(left).getFace(BlockFace.UP).setType(Material.OBSIDIAN);
- currentGateBlock.getFace(right).getFace(BlockFace.UP).getFace(BlockFace.UP).setType(Material.OBSIDIAN);
- currentGateBlock.getFace(BlockFace.UP).getFace(BlockFace.UP).setType(Material.OBSIDIAN);
- currentGateBlock = currentGateBlock.getFace(right, 4);
+ currentGateBlock.getRelative(BlockFace.DOWN).setType(Material.GLOWSTONE);
+ currentGateBlock.getRelative(left).setType(Material.OBSIDIAN);
+ currentGateBlock.getRelative(right).getRelative(BlockFace.UP).setType(Material.OBSIDIAN);
+ currentGateBlock.getRelative(left).getRelative(BlockFace.UP).getRelative(BlockFace.UP).setType(Material.OBSIDIAN);
+ currentGateBlock.getRelative(right).setType(Material.OBSIDIAN);
+ currentGateBlock.getRelative(left).getRelative(BlockFace.UP).setType(Material.OBSIDIAN);
+ currentGateBlock.getRelative(right).getRelative(BlockFace.UP).getRelative(BlockFace.UP).setType(Material.OBSIDIAN);
+ currentGateBlock.getRelative(BlockFace.UP).getRelative(BlockFace.UP).setType(Material.OBSIDIAN);
+ currentGateBlock = currentGateBlock.getRelative(right, 4);
}
}
// War hub sign
- Block signBlock = locationBlock.getFace(front);
+ Block signBlock = locationBlock.getRelative(front);
String[] lines = new String[4];
lines[0] = "War hub";
@@ -222,7 +223,7 @@ public class WarHub {
Block zoneGate = this.zoneGateBlocks.get(zone.getName());
if (zoneGate != null) {
- Block block = zoneGate.getFace(left).getFace(back, 1);
+ Block block = zoneGate.getRelative(left).getRelative(back, 1);
if (block.getType() != Material.SIGN_POST) {
block.setType(Material.SIGN_POST);
}
diff --git a/war/src/main/java/com/tommytony/war/Warzone.java b/war/src/main/java/com/tommytony/war/Warzone.java
index 80efc39..b4dfc4e 100644
--- a/war/src/main/java/com/tommytony/war/Warzone.java
+++ b/war/src/main/java/com/tommytony/war/Warzone.java
@@ -7,9 +7,6 @@ import java.util.List;
import java.util.Map;
import java.util.logging.Level;
-import net.minecraft.server.MobEffect;
-import net.minecraft.server.MobEffectList;
-
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.Location;
@@ -18,14 +15,16 @@ import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.entity.CraftItem;
-import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
+import org.getspout.spoutapi.player.SpoutPlayer;
+
import bukkit.tommytony.war.War;
+import bukkit.tommytony.war.WarSpoutListener;
import com.tommytony.war.jobs.InitZoneJob;
import com.tommytony.war.jobs.LoadoutResetJob;
@@ -45,6 +44,7 @@ public class Warzone {
private final List monuments = new ArrayList();
private final List authors = new ArrayList();
+ private final List respawn = new ArrayList();
private Location teleport;
private boolean friendlyFire = false;
@@ -67,6 +67,7 @@ public class Warzone {
private ZoneLobby lobby;
private boolean autoAssignOnly = false;
private boolean flagPointsOnly = false;
+ private boolean flagMustBeHome = true;
private boolean blockHeads = true;
private boolean unbreakableZoneBlocks = false;
private boolean disabled = false;
@@ -76,6 +77,7 @@ public class Warzone {
private boolean instaBreak = false;
private boolean noDrops = false;
private boolean noHunger = false;
+ private int respawnTimer = 10;
private int saturation = 10;
private int minPlayers = 1;
private int minTeams = 1;
@@ -98,6 +100,7 @@ public class Warzone {
this.reward = (HashMap)War.war.getDefaultReward().clone();
this.autoAssignOnly = War.war.isDefaultAutoAssignOnly();
this.setFlagPointsOnly(War.war.isDefaultFlagPointsOnly());
+ this.setFlagMustBeHome(War.war.isDefaultFlagMustBeHome());
this.teamCap = War.war.getDefaultTeamCap();
this.scoreCap = War.war.getDefaultScoreCap();
this.monumentHeal = War.war.getDefaultMonumentHeal();
@@ -111,6 +114,7 @@ public class Warzone {
this.setInstaBreak(War.war.isDefaultInstaBreak());
this.setNoDrops(War.war.isDefaultNoDrops());
this.setNoHunger(War.war.isDefaultNoHunger());
+ this.setRespawnTimer(War.war.getDefaultRespawnTimer());
this.setSaturation(War.war.getDefaultSaturation());
this.setMinPlayers(War.war.getDefaultMinPlayers());
this.setMinTeams(War.war.getDefaultMinTeams());
@@ -127,7 +131,7 @@ public class Warzone {
// perfect match, return right away
return warzone;
} else if (warzone.getName().toLowerCase().startsWith(name.toLowerCase())) {
- // prehaps there's a perfect match in the remaining zones, let's take this one aside
+ // perhaps there's a perfect match in the remaining zones, let's take this one aside
bestGuess = warzone;
}
}
@@ -329,14 +333,22 @@ public class Warzone {
// Teleport the player back to spawn
event.setTo(team.getTeamSpawn());
}
+
+ public boolean isRespawning(Player p) {
+ return respawn.contains(p);
+ }
- private void handleRespawn(Team team, Player player) {
+ private void handleRespawn(final Team team, final Player player) {
// Fill hp
player.setRemainingAir(300);
player.setHealth(20);
player.setFoodLevel(20);
player.setSaturation(this.getSaturation());
player.setExhaustion(0);
+ player.setFireTicks(0); //this works fine here, why put it in LoudoutResetJob...? I'll keep it over there though
+
+ player.getInventory().clear();
+
if (player.getGameMode() == GameMode.CREATIVE) {
player.setGameMode(GameMode.SURVIVAL);
}
@@ -348,9 +360,28 @@ public class Warzone {
} else {
this.getLoadoutSelections().get(player.getName()).setStillInSpawn(true);
}
-
- LoadoutResetJob job = new LoadoutResetJob(this, team, player);
- War.war.getServer().getScheduler().scheduleSyncDelayedTask(War.war, job);
+
+ // Spout
+ if (War.war.isSpoutServer()) {
+ ((SpoutPlayer) player).setTitle(team.getKind().getColor() + player.getName());
+ }
+
+ // "Respawn" Timer - player will not be able to leave spawn for a few seconds
+ final Warzone w = this;
+ if (respawnTimer == 0) {
+ LoadoutResetJob job = new LoadoutResetJob(w, team, player);
+ War.war.getServer().getScheduler().scheduleSyncDelayedTask(War.war, job);
+ } else {
+ respawn.add(player);
+ War.war.getServer().getScheduler().scheduleSyncDelayedTask(War.war, new Runnable() {
+ public void run() {
+ respawn.remove(player);
+ // Getting the Loadout as visual cue
+ LoadoutResetJob job = new LoadoutResetJob(w, team, player);
+ War.war.getServer().getScheduler().scheduleSyncDelayedTask(War.war, job);
+ }
+ }, respawnTimer * 20L); // 20 ticks = 1 second
+ }
}
public void resetInventory(Team team, Player player, HashMap loadout) {
@@ -923,6 +954,15 @@ public class Warzone {
player.setFireTicks(0);
player.setRemainingAir(300);
+ if (War.war.isSpoutServer()) {
+ SpoutPlayer sp = (SpoutPlayer) player;
+ if (sp.isSpoutCraftEnabled()) {
+ WarSpoutListener.removeStats(sp);
+ }
+ sp.resetTitle();
+ }
+
+
War.war.msg(player, "Left the zone. Your inventory is being restored.");
if (War.war.getWarHub() != null) {
War.war.getWarHub().resetZoneSign(this);
@@ -956,6 +996,15 @@ public class Warzone {
}
return false;
}
+
+ public boolean isFlagBlock(Block block) {
+ for (Team team : this.teams) {
+ if (team.isTeamFlagBlock(block)) {
+ return true;
+ }
+ }
+ return false;
+ }
public Team getTeamForFlagBlock(Block block) {
for (Team team : this.teams) {
@@ -1165,6 +1214,14 @@ public class Warzone {
public boolean isFlagPointsOnly() {
return this.flagPointsOnly;
}
+
+ public void setFlagMustBeHome(boolean flagMustBeHome) {
+ this.flagMustBeHome = flagMustBeHome;
+ }
+
+ public boolean isFlagMustBeHome() {
+ return this.flagMustBeHome;
+ }
public void setMinPlayers(int minPlayers) {
this.minPlayers = minPlayers;
@@ -1253,7 +1310,7 @@ public class Warzone {
public void equipPlayerLoadoutSelection(Player player, Team playerTeam) {
LoadoutSelection selection = this.getLoadoutSelections().get(player.getName());
- if (selection != null) {
+ if (selection != null && this.isRespawning(player)) {
int currentIndex = selection.getSelectedIndex();
if (currentIndex == 0) {
this.resetInventory(playerTeam, player, this.getLoadout());
@@ -1272,4 +1329,12 @@ public class Warzone {
}
}
}
+
+ public void setRespawnTimer(int respawnTimer) {
+ this.respawnTimer = respawnTimer;
+ }
+
+ public int getRespawnTimer() {
+ return this.respawnTimer;
+ }
}
diff --git a/war/src/main/java/com/tommytony/war/ZoneLobby.java b/war/src/main/java/com/tommytony/war/ZoneLobby.java
index db8e7d1..98cb38e 100644
--- a/war/src/main/java/com/tommytony/war/ZoneLobby.java
+++ b/war/src/main/java/com/tommytony/war/ZoneLobby.java
@@ -91,13 +91,13 @@ public class ZoneLobby {
// 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()).getFace(BlockFace.UP).getFace(BlockFace.EAST, this.lobbyHalfSide));
+ 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()).getFace(BlockFace.UP).getFace(BlockFace.SOUTH, this.lobbyHalfSide));
+ 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()).getFace(BlockFace.UP).getFace(BlockFace.WEST, this.lobbyHalfSide));
+ 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()).getFace(BlockFace.UP).getFace(BlockFace.NORTH, this.lobbyHalfSide));
+ this.lobbyMiddleWallBlock = new BlockInfo(BlockInfo.getBlock(warzone.getWorld(), volume.getCornerOne()).getRelative(BlockFace.UP).getRelative(BlockFace.NORTH, this.lobbyHalfSide));
}
}
@@ -149,7 +149,7 @@ public class ZoneLobby {
this.wall = opposite; // a player facing south places a lobby that looks just like a lobby stuck to the north wall
this.calculateLobbyWidth();
- this.lobbyMiddleWallBlock = new BlockInfo(lobbyWorld.getBlockAt(playerLocation.getBlockX(), playerLocation.getBlockY(), playerLocation.getBlockZ()).getFace(facing, 6));
+ this.lobbyMiddleWallBlock = new BlockInfo(lobbyWorld.getBlockAt(playerLocation.getBlockX(), playerLocation.getBlockY(), playerLocation.getBlockZ()).getRelative(facing, 6));
Block corner1 = null;
Block corner2 = null;
@@ -298,7 +298,7 @@ public class ZoneLobby {
}
// set zone tp
- this.zoneTeleportBlock = new BlockInfo(BlockInfo.getBlock(this.volume.getWorld(), this.lobbyMiddleWallBlock).getFace(this.wall, 6));
+ this.zoneTeleportBlock = new BlockInfo(BlockInfo.getBlock(this.volume.getWorld(), this.lobbyMiddleWallBlock).getRelative(this.wall, 6));
int yaw = 0;
if (this.wall == BlockFace.WEST) {
yaw = 180;
@@ -312,7 +312,7 @@ public class ZoneLobby {
this.warzone.setTeleport(new Location(this.volume.getWorld(), this.zoneTeleportBlock.getX(), this.zoneTeleportBlock.getY(), this.zoneTeleportBlock.getZ(), yaw, 0));
// set zone sign
- Block zoneSignBlock = BlockInfo.getBlock(this.volume.getWorld(), this.lobbyMiddleWallBlock).getFace(this.wall, 4);
+ Block zoneSignBlock = BlockInfo.getBlock(this.volume.getWorld(), this.lobbyMiddleWallBlock).getRelative(this.wall, 4);
byte data = 0;
if (this.wall == BlockFace.NORTH) {
data = (byte) 4;
@@ -337,11 +337,11 @@ public class ZoneLobby {
// lets get some light in here
if (this.wall == BlockFace.NORTH || this.wall == BlockFace.SOUTH) {
- BlockInfo.getBlock(this.volume.getWorld(), this.lobbyMiddleWallBlock).getFace(BlockFace.DOWN).getFace(BlockFace.WEST, this.lobbyHalfSide - 1).getFace(this.wall, 9).setType(Material.GLOWSTONE);
- BlockInfo.getBlock(this.volume.getWorld(), this.lobbyMiddleWallBlock).getFace(BlockFace.DOWN).getFace(BlockFace.EAST, this.lobbyHalfSide - 1).getFace(this.wall, 9).setType(Material.GLOWSTONE);
+ BlockInfo.getBlock(this.volume.getWorld(), this.lobbyMiddleWallBlock).getRelative(BlockFace.DOWN).getRelative(BlockFace.WEST, this.lobbyHalfSide - 1).getRelative(this.wall, 9).setType(Material.GLOWSTONE);
+ BlockInfo.getBlock(this.volume.getWorld(), this.lobbyMiddleWallBlock).getRelative(BlockFace.DOWN).getRelative(BlockFace.EAST, this.lobbyHalfSide - 1).getRelative(this.wall, 9).setType(Material.GLOWSTONE);
} else {
- BlockInfo.getBlock(this.volume.getWorld(), this.lobbyMiddleWallBlock).getFace(BlockFace.DOWN).getFace(BlockFace.NORTH, this.lobbyHalfSide - 1).getFace(this.wall, 9).setType(Material.GLOWSTONE);
- BlockInfo.getBlock(this.volume.getWorld(), this.lobbyMiddleWallBlock).getFace(BlockFace.DOWN).getFace(BlockFace.SOUTH, this.lobbyHalfSide - 1).getFace(this.wall, 9).setType(Material.GLOWSTONE);
+ BlockInfo.getBlock(this.volume.getWorld(), this.lobbyMiddleWallBlock).getRelative(BlockFace.DOWN).getRelative(BlockFace.NORTH, this.lobbyHalfSide - 1).getRelative(this.wall, 9).setType(Material.GLOWSTONE);
+ BlockInfo.getBlock(this.volume.getWorld(), this.lobbyMiddleWallBlock).getRelative(BlockFace.DOWN).getRelative(BlockFace.SOUTH, this.lobbyHalfSide - 1).getRelative(this.wall, 9).setType(Material.GLOWSTONE);
}
} else {
War.war.log("Failed to initalize zone lobby for zone " + this.warzone.getName(), java.util.logging.Level.WARNING);
@@ -375,23 +375,23 @@ public class ZoneLobby {
if (this.warzone.getTeams().size() % 2 == 0) {
// even number of teams
if (doorIndex % 2 == 0) {
- this.teamGateBlocks.put(team.getName(), new BlockInfo(lobbyMiddleWallBlock.getFace(rightSide, doorIndex * 2 + 2)));
+ this.teamGateBlocks.put(team.getName(), new BlockInfo(lobbyMiddleWallBlock.getRelative(rightSide, doorIndex * 2 + 2)));
} else {
- this.teamGateBlocks.put(team.getName(), new BlockInfo(lobbyMiddleWallBlock.getFace(leftSide, doorIndex * 2)));
+ this.teamGateBlocks.put(team.getName(), new BlockInfo(lobbyMiddleWallBlock.getRelative(leftSide, doorIndex * 2)));
}
} else {
if (doorIndex == 0) {
this.teamGateBlocks.put(team.getName(), new BlockInfo(lobbyMiddleWallBlock));
} else if (doorIndex % 2 == 0) {
- this.teamGateBlocks.put(team.getName(), new BlockInfo(lobbyMiddleWallBlock.getFace(rightSide, doorIndex * 2)));
+ this.teamGateBlocks.put(team.getName(), new BlockInfo(lobbyMiddleWallBlock.getRelative(rightSide, doorIndex * 2)));
} else {
- this.teamGateBlocks.put(team.getName(), new BlockInfo(lobbyMiddleWallBlock.getFace(leftSide, doorIndex * 2 + 2)));
+ this.teamGateBlocks.put(team.getName(), new BlockInfo(lobbyMiddleWallBlock.getRelative(leftSide, doorIndex * 2 + 2)));
}
}
}
}
- this.warHubLinkGate = new BlockInfo(lobbyMiddleWallBlock.getFace(this.wall, 9));
+ this.warHubLinkGate = new BlockInfo(lobbyMiddleWallBlock.getRelative(this.wall, 9));
}
private void placeGate(Block block, TeamKind teamKind) {
@@ -411,14 +411,14 @@ public class ZoneLobby {
leftSide = BlockFace.NORTH;
rightSide = BlockFace.SOUTH;
}
- block.getFace(BlockFace.DOWN).setType(Material.GLOWSTONE);
- this.setBlock(block.getFace(leftSide), teamKind);
- this.setBlock(block.getFace(rightSide).getFace(BlockFace.UP), teamKind);
- this.setBlock(block.getFace(leftSide).getFace(BlockFace.UP).getFace(BlockFace.UP), teamKind);
- this.setBlock(block.getFace(rightSide), teamKind);
- this.setBlock(block.getFace(leftSide).getFace(BlockFace.UP), teamKind);
- this.setBlock(block.getFace(rightSide).getFace(BlockFace.UP).getFace(BlockFace.UP), teamKind);
- this.setBlock(block.getFace(BlockFace.UP).getFace(BlockFace.UP), teamKind);
+ block.getRelative(BlockFace.DOWN).setType(Material.GLOWSTONE);
+ this.setBlock(block.getRelative(leftSide), teamKind);
+ this.setBlock(block.getRelative(rightSide).getRelative(BlockFace.UP), teamKind);
+ this.setBlock(block.getRelative(leftSide).getRelative(BlockFace.UP).getRelative(BlockFace.UP), teamKind);
+ this.setBlock(block.getRelative(rightSide), teamKind);
+ this.setBlock(block.getRelative(leftSide).getRelative(BlockFace.UP), teamKind);
+ this.setBlock(block.getRelative(rightSide).getRelative(BlockFace.UP).getRelative(BlockFace.UP), teamKind);
+ this.setBlock(block.getRelative(BlockFace.UP).getRelative(BlockFace.UP), teamKind);
}
}
@@ -439,14 +439,14 @@ public class ZoneLobby {
leftSide = BlockFace.NORTH;
rightSide = BlockFace.SOUTH;
}
- block.getFace(BlockFace.DOWN).setType(Material.GLOWSTONE);
- this.setBlock(block.getFace(leftSide), material);
- this.setBlock(block.getFace(rightSide).getFace(BlockFace.UP), material);
- this.setBlock(block.getFace(leftSide).getFace(BlockFace.UP).getFace(BlockFace.UP), material);
- this.setBlock(block.getFace(rightSide), material);
- this.setBlock(block.getFace(leftSide).getFace(BlockFace.UP), material);
- this.setBlock(block.getFace(rightSide).getFace(BlockFace.UP).getFace(BlockFace.UP), material);
- this.setBlock(block.getFace(BlockFace.UP).getFace(BlockFace.UP), material);
+ block.getRelative(BlockFace.DOWN).setType(Material.GLOWSTONE);
+ this.setBlock(block.getRelative(leftSide), material);
+ this.setBlock(block.getRelative(rightSide).getRelative(BlockFace.UP), material);
+ this.setBlock(block.getRelative(leftSide).getRelative(BlockFace.UP).getRelative(BlockFace.UP), material);
+ this.setBlock(block.getRelative(rightSide), material);
+ this.setBlock(block.getRelative(leftSide).getRelative(BlockFace.UP), material);
+ this.setBlock(block.getRelative(rightSide).getRelative(BlockFace.UP).getRelative(BlockFace.UP), material);
+ this.setBlock(block.getRelative(BlockFace.UP).getRelative(BlockFace.UP), material);
}
}
@@ -477,21 +477,22 @@ public class ZoneLobby {
rightSide = BlockFace.SOUTH;
}
List teams = this.warzone.getTeams();
+
Block autoAssignGateBlock = BlockInfo.getBlock(this.volume.getWorld(), this.autoAssignGate);
- this.setBlock(autoAssignGateBlock.getFace(BlockFace.DOWN), (Material.GLOWSTONE));
+ this.setBlock(autoAssignGateBlock.getRelative(BlockFace.DOWN), (Material.GLOWSTONE));
int size = teams.size();
if (size > 0) {
TeamKind[] doorBlockKinds = new TeamKind[7];
for (int i = 0; i < 7; i++) {
doorBlockKinds[i] = teams.get(i % size).getKind();
}
- this.setBlock(autoAssignGateBlock.getFace(leftSide), doorBlockKinds[0]);
- this.setBlock(autoAssignGateBlock.getFace(leftSide).getFace(BlockFace.UP), doorBlockKinds[1]);
- this.setBlock(autoAssignGateBlock.getFace(leftSide).getFace(BlockFace.UP).getFace(BlockFace.UP), doorBlockKinds[2]);
- this.setBlock(autoAssignGateBlock.getFace(BlockFace.UP).getFace(BlockFace.UP), doorBlockKinds[3]);
- this.setBlock(autoAssignGateBlock.getFace(rightSide).getFace(BlockFace.UP).getFace(BlockFace.UP), doorBlockKinds[4]);
- this.setBlock(autoAssignGateBlock.getFace(rightSide).getFace(BlockFace.UP), doorBlockKinds[5]);
- this.setBlock(autoAssignGateBlock.getFace(rightSide), doorBlockKinds[6]);
+ this.setBlock(autoAssignGateBlock.getRelative(leftSide), doorBlockKinds[0]);
+ this.setBlock(autoAssignGateBlock.getRelative(leftSide).getRelative(BlockFace.UP), doorBlockKinds[1]);
+ this.setBlock(autoAssignGateBlock.getRelative(leftSide).getRelative(BlockFace.UP).getRelative(BlockFace.UP), doorBlockKinds[2]);
+ this.setBlock(autoAssignGateBlock.getRelative(BlockFace.UP).getRelative(BlockFace.UP), doorBlockKinds[3]);
+ this.setBlock(autoAssignGateBlock.getRelative(rightSide).getRelative(BlockFace.UP).getRelative(BlockFace.UP), doorBlockKinds[4]);
+ this.setBlock(autoAssignGateBlock.getRelative(rightSide).getRelative(BlockFace.UP), doorBlockKinds[5]);
+ this.setBlock(autoAssignGateBlock.getRelative(rightSide), doorBlockKinds[6]);
}
}
}
@@ -565,7 +566,7 @@ public class ZoneLobby {
leftSide = BlockFace.NORTH;
rightSide = BlockFace.SOUTH;
}
- return (block.getX() == gateBlock.getX() && block.getY() == gateBlock.getY() && block.getZ() == gateBlock.getZ()) || (block.getX() == gateBlock.getFace(BlockFace.UP).getX() && block.getY() == gateBlock.getFace(BlockFace.UP).getY() && block.getZ() == gateBlock.getFace(BlockFace.UP).getZ()) || (block.getX() == gateBlock.getFace(leftSide).getX() && block.getY() == gateBlock.getFace(leftSide).getY() && block.getZ() == gateBlock.getFace(leftSide).getZ()) || (block.getX() == gateBlock.getFace(leftSide).getFace(BlockFace.UP).getX() && block.getY() == gateBlock.getFace(leftSide).getFace(BlockFace.UP).getY() && block.getZ() == gateBlock.getFace(leftSide).getFace(BlockFace.UP).getZ()) || (block.getX() == gateBlock.getFace(leftSide).getFace(BlockFace.UP).getFace(BlockFace.UP).getX() && block.getY() == gateBlock.getFace(leftSide).getFace(BlockFace.UP).getFace(BlockFace.UP).getY() && block.getZ() == gateBlock.getFace(leftSide).getFace(BlockFace.UP).getFace(BlockFace.UP).getZ()) || (block.getX() == gateBlock.getFace(BlockFace.UP).getFace(BlockFace.UP).getX() && block.getY() == gateBlock.getFace(BlockFace.UP).getFace(BlockFace.UP).getY() && block.getZ() == gateBlock.getFace(BlockFace.UP).getFace(BlockFace.UP).getZ()) || (block.getX() == gateBlock.getFace(rightSide).getFace(BlockFace.UP).getX() && block.getY() == gateBlock.getFace(rightSide).getFace(BlockFace.UP).getY() && block.getZ() == gateBlock.getFace(rightSide).getFace(BlockFace.UP).getZ()) || (block.getX() == gateBlock.getFace(rightSide).getFace(BlockFace.UP).getFace(BlockFace.UP).getX() && block.getY() == gateBlock.getFace(rightSide).getFace(BlockFace.UP).getFace(BlockFace.UP).getY() && block.getZ() == gateBlock.getFace(rightSide).getFace(BlockFace.UP).getFace(BlockFace.UP).getZ()) || (block.getX() == gateBlock.getFace(rightSide).getX() && block.getY() == gateBlock.getFace(rightSide).getY() && block.getZ() == gateBlock.getFace(rightSide).getZ()) || (block.getX() == gateBlock.getX() && block.getY() == gateBlock.getY() - 1 && block.getZ() == gateBlock.getZ());
+ 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());
}
return false;
}
@@ -612,28 +613,28 @@ public class ZoneLobby {
}
byte data = 0;
if (this.wall == BlockFace.NORTH) {
- block = gate.getFace(direction).getFace(BlockFace.EAST);
+ block = gate.getRelative(direction).getRelative(BlockFace.EAST);
if (awayFromWall) {
data = (byte) 4;
} else {
data = (byte) 12;
}
} else if (this.wall == BlockFace.EAST) {
- block = gate.getFace(direction).getFace(BlockFace.SOUTH);
+ block = gate.getRelative(direction).getRelative(BlockFace.SOUTH);
if (awayFromWall) {
data = (byte) 8;
} else {
data = (byte) 0;
}
} else if (this.wall == BlockFace.SOUTH) {
- block = gate.getFace(direction).getFace(BlockFace.WEST);
+ block = gate.getRelative(direction).getRelative(BlockFace.WEST);
if (awayFromWall) {
data = (byte) 12;
} else {
data = (byte) 4;
}
} else if (this.wall == BlockFace.WEST) {
- block = gate.getFace(direction).getFace(BlockFace.NORTH);
+ block = gate.getRelative(direction).getRelative(BlockFace.NORTH);
if (awayFromWall) {
data = (byte) 0;
} else {
@@ -683,9 +684,9 @@ public class ZoneLobby {
private boolean leaving(Location location, Block gate, BlockFace inside, BlockFace left, BlockFace right) {
// 3x4x1 deep
Volume gateExitVolume = new Volume("tempGateExit", location.getWorld());
- Block out = gate.getFace(inside);
- gateExitVolume.setCornerOne(out.getFace(left).getFace(BlockFace.DOWN));
- gateExitVolume.setCornerTwo(gate.getFace(right, 1).getFace(BlockFace.UP, 3));
+ Block out = gate.getRelative(inside);
+ gateExitVolume.setCornerOne(out.getRelative(left).getRelative(BlockFace.DOWN));
+ gateExitVolume.setCornerTwo(gate.getRelative(right, 1).getRelative(BlockFace.UP, 2));
if (gateExitVolume.contains(location)) {
return true;
diff --git a/war/src/main/java/com/tommytony/war/ZoneWallGuard.java b/war/src/main/java/com/tommytony/war/ZoneWallGuard.java
index 25c0ef6..a4e8cfa 100644
--- a/war/src/main/java/com/tommytony/war/ZoneWallGuard.java
+++ b/war/src/main/java/com/tommytony/war/ZoneWallGuard.java
@@ -40,121 +40,121 @@ public class ZoneWallGuard {
for (Block block : nearestWallBlocks) {
this.glassify(block, this.wall);
if (this.wall != BlockFace.UP && this.wall != BlockFace.DOWN) {
- this.glassify(block.getFace(BlockFace.UP), this.wall);
- this.glassify(block.getFace(BlockFace.UP, 2), this.wall);
- this.glassify(block.getFace(BlockFace.DOWN), this.wall);
- this.glassify(block.getFace(BlockFace.DOWN, 2), this.wall);
+ this.glassify(block.getRelative(BlockFace.UP), this.wall);
+ this.glassify(block.getRelative(BlockFace.UP, 2), this.wall);
+ 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.getFace(BlockFace.EAST), BlockFace.NORTH);
- this.glassify(block.getFace(BlockFace.EAST).getFace(BlockFace.UP), BlockFace.NORTH);
- this.glassify(block.getFace(BlockFace.EAST).getFace(BlockFace.DOWN), BlockFace.NORTH);
- this.glassify(block.getFace(BlockFace.EAST, 2), BlockFace.NORTH);
- this.glassify(block.getFace(BlockFace.EAST, 2).getFace(BlockFace.UP), BlockFace.NORTH);
- this.glassify(block.getFace(BlockFace.EAST, 2).getFace(BlockFace.DOWN), BlockFace.NORTH);
- this.glassify(block.getFace(BlockFace.EAST).getFace(BlockFace.UP, 2), BlockFace.NORTH);
- this.glassify(block.getFace(BlockFace.EAST).getFace(BlockFace.DOWN, 2), BlockFace.NORTH);
- this.glassify(block.getFace(BlockFace.WEST), BlockFace.NORTH);
- this.glassify(block.getFace(BlockFace.WEST).getFace(BlockFace.UP), BlockFace.NORTH);
- this.glassify(block.getFace(BlockFace.WEST).getFace(BlockFace.DOWN), BlockFace.NORTH);
- this.glassify(block.getFace(BlockFace.WEST, 2), BlockFace.NORTH);
- this.glassify(block.getFace(BlockFace.WEST, 2).getFace(BlockFace.UP), BlockFace.NORTH);
- this.glassify(block.getFace(BlockFace.WEST, 2).getFace(BlockFace.DOWN), BlockFace.NORTH);
- this.glassify(block.getFace(BlockFace.WEST).getFace(BlockFace.UP, 2), BlockFace.NORTH);
- this.glassify(block.getFace(BlockFace.WEST).getFace(BlockFace.DOWN, 2), BlockFace.NORTH);
+ 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.getFace(BlockFace.EAST), BlockFace.SOUTH);
- this.glassify(block.getFace(BlockFace.EAST).getFace(BlockFace.UP), BlockFace.SOUTH);
- this.glassify(block.getFace(BlockFace.EAST).getFace(BlockFace.DOWN), BlockFace.SOUTH);
- this.glassify(block.getFace(BlockFace.EAST, 2), BlockFace.SOUTH);
- this.glassify(block.getFace(BlockFace.EAST, 2).getFace(BlockFace.UP), BlockFace.SOUTH);
- this.glassify(block.getFace(BlockFace.EAST, 2).getFace(BlockFace.DOWN), BlockFace.SOUTH);
- this.glassify(block.getFace(BlockFace.EAST).getFace(BlockFace.UP, 2), BlockFace.SOUTH);
- this.glassify(block.getFace(BlockFace.EAST).getFace(BlockFace.DOWN, 2), BlockFace.SOUTH);
- this.glassify(block.getFace(BlockFace.WEST), BlockFace.SOUTH);
- this.glassify(block.getFace(BlockFace.WEST).getFace(BlockFace.UP), BlockFace.SOUTH);
- this.glassify(block.getFace(BlockFace.WEST).getFace(BlockFace.DOWN), BlockFace.SOUTH);
- this.glassify(block.getFace(BlockFace.WEST, 2), BlockFace.SOUTH);
- this.glassify(block.getFace(BlockFace.WEST, 2).getFace(BlockFace.UP), BlockFace.SOUTH);
- this.glassify(block.getFace(BlockFace.WEST, 2).getFace(BlockFace.DOWN), BlockFace.SOUTH);
- this.glassify(block.getFace(BlockFace.WEST).getFace(BlockFace.UP, 2), BlockFace.SOUTH);
- this.glassify(block.getFace(BlockFace.WEST).getFace(BlockFace.DOWN, 2), BlockFace.SOUTH);
+ 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.getFace(BlockFace.NORTH), BlockFace.EAST);
- this.glassify(block.getFace(BlockFace.NORTH).getFace(BlockFace.UP), BlockFace.EAST);
- this.glassify(block.getFace(BlockFace.NORTH).getFace(BlockFace.DOWN), BlockFace.EAST);
- this.glassify(block.getFace(BlockFace.NORTH, 2), BlockFace.EAST);
- this.glassify(block.getFace(BlockFace.NORTH, 2).getFace(BlockFace.UP), BlockFace.EAST);
- this.glassify(block.getFace(BlockFace.NORTH, 2).getFace(BlockFace.DOWN), BlockFace.EAST);
- this.glassify(block.getFace(BlockFace.NORTH).getFace(BlockFace.UP, 2), BlockFace.EAST);
- this.glassify(block.getFace(BlockFace.NORTH).getFace(BlockFace.DOWN, 2), BlockFace.EAST);
- this.glassify(block.getFace(BlockFace.SOUTH), BlockFace.EAST);
- this.glassify(block.getFace(BlockFace.SOUTH).getFace(BlockFace.UP), BlockFace.EAST);
- this.glassify(block.getFace(BlockFace.SOUTH).getFace(BlockFace.DOWN), BlockFace.EAST);
- this.glassify(block.getFace(BlockFace.SOUTH, 2), BlockFace.EAST);
- this.glassify(block.getFace(BlockFace.SOUTH, 2).getFace(BlockFace.UP), BlockFace.EAST);
- this.glassify(block.getFace(BlockFace.SOUTH, 2).getFace(BlockFace.DOWN), BlockFace.EAST);
- this.glassify(block.getFace(BlockFace.SOUTH).getFace(BlockFace.UP, 2), BlockFace.EAST);
- this.glassify(block.getFace(BlockFace.SOUTH).getFace(BlockFace.DOWN, 2), BlockFace.EAST);
+ 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.getFace(BlockFace.NORTH), BlockFace.WEST);
- this.glassify(block.getFace(BlockFace.NORTH).getFace(BlockFace.UP), BlockFace.WEST);
- this.glassify(block.getFace(BlockFace.NORTH).getFace(BlockFace.DOWN), BlockFace.WEST);
- this.glassify(block.getFace(BlockFace.NORTH, 2), BlockFace.WEST);
- this.glassify(block.getFace(BlockFace.NORTH, 2).getFace(BlockFace.UP), BlockFace.WEST);
- this.glassify(block.getFace(BlockFace.NORTH, 2).getFace(BlockFace.DOWN), BlockFace.WEST);
- this.glassify(block.getFace(BlockFace.NORTH).getFace(BlockFace.UP, 2), BlockFace.WEST);
- this.glassify(block.getFace(BlockFace.NORTH).getFace(BlockFace.DOWN, 2), BlockFace.WEST);
- this.glassify(block.getFace(BlockFace.SOUTH), BlockFace.WEST);
- this.glassify(block.getFace(BlockFace.SOUTH).getFace(BlockFace.UP), BlockFace.WEST);
- this.glassify(block.getFace(BlockFace.SOUTH).getFace(BlockFace.DOWN), BlockFace.WEST);
- this.glassify(block.getFace(BlockFace.SOUTH, 2), BlockFace.WEST);
- this.glassify(block.getFace(BlockFace.SOUTH, 2).getFace(BlockFace.UP), BlockFace.WEST);
- this.glassify(block.getFace(BlockFace.SOUTH, 2).getFace(BlockFace.DOWN), BlockFace.WEST);
- this.glassify(block.getFace(BlockFace.SOUTH).getFace(BlockFace.UP, 2), BlockFace.WEST);
- this.glassify(block.getFace(BlockFace.SOUTH).getFace(BlockFace.DOWN, 2), BlockFace.WEST);
+ 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);
} else if (this.wall == BlockFace.UP && this.warzone.getVolume().isUpWallBlock(block)) {
- this.glassify(block.getFace(BlockFace.EAST), BlockFace.UP);
- this.glassify(block.getFace(BlockFace.EAST, 2), BlockFace.UP);
- this.glassify(block.getFace(BlockFace.WEST), BlockFace.UP);
- this.glassify(block.getFace(BlockFace.WEST, 2), BlockFace.UP);
- this.glassify(block.getFace(BlockFace.NORTH), BlockFace.UP);
- this.glassify(block.getFace(BlockFace.NORTH).getFace(BlockFace.EAST), BlockFace.UP);
- this.glassify(block.getFace(BlockFace.NORTH).getFace(BlockFace.WEST), BlockFace.UP);
- this.glassify(block.getFace(BlockFace.NORTH, 2), BlockFace.UP);
- this.glassify(block.getFace(BlockFace.NORTH, 2).getFace(BlockFace.EAST), BlockFace.UP);
- this.glassify(block.getFace(BlockFace.NORTH, 2).getFace(BlockFace.WEST), BlockFace.UP);
- this.glassify(block.getFace(BlockFace.NORTH).getFace(BlockFace.EAST, 2), BlockFace.UP);
- this.glassify(block.getFace(BlockFace.NORTH).getFace(BlockFace.WEST, 2), BlockFace.UP);
- this.glassify(block.getFace(BlockFace.SOUTH), BlockFace.UP);
- this.glassify(block.getFace(BlockFace.SOUTH).getFace(BlockFace.EAST), BlockFace.UP);
- this.glassify(block.getFace(BlockFace.SOUTH).getFace(BlockFace.WEST), BlockFace.UP);
- this.glassify(block.getFace(BlockFace.SOUTH, 2), BlockFace.UP);
- this.glassify(block.getFace(BlockFace.SOUTH, 2).getFace(BlockFace.EAST), BlockFace.UP);
- this.glassify(block.getFace(BlockFace.SOUTH, 2).getFace(BlockFace.WEST), BlockFace.UP);
- this.glassify(block.getFace(BlockFace.SOUTH).getFace(BlockFace.UP, 2), BlockFace.UP);
- this.glassify(block.getFace(BlockFace.SOUTH).getFace(BlockFace.DOWN, 2), BlockFace.UP);
+ 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);
} else if (this.wall == BlockFace.DOWN && this.warzone.getVolume().isDownWallBlock(block)) {
- this.glassify(block.getFace(BlockFace.EAST), BlockFace.DOWN);
- this.glassify(block.getFace(BlockFace.EAST, 2), BlockFace.DOWN);
- this.glassify(block.getFace(BlockFace.WEST), BlockFace.DOWN);
- this.glassify(block.getFace(BlockFace.WEST, 2), BlockFace.DOWN);
- this.glassify(block.getFace(BlockFace.NORTH), BlockFace.DOWN);
- this.glassify(block.getFace(BlockFace.NORTH).getFace(BlockFace.EAST), BlockFace.DOWN);
- this.glassify(block.getFace(BlockFace.NORTH).getFace(BlockFace.WEST), BlockFace.DOWN);
- this.glassify(block.getFace(BlockFace.NORTH, 2), BlockFace.DOWN);
- this.glassify(block.getFace(BlockFace.NORTH, 2).getFace(BlockFace.EAST), BlockFace.DOWN);
- this.glassify(block.getFace(BlockFace.NORTH, 2).getFace(BlockFace.WEST), BlockFace.DOWN);
- this.glassify(block.getFace(BlockFace.NORTH).getFace(BlockFace.EAST, 2), BlockFace.DOWN);
- this.glassify(block.getFace(BlockFace.NORTH).getFace(BlockFace.WEST, 2), BlockFace.DOWN);
- this.glassify(block.getFace(BlockFace.SOUTH), BlockFace.DOWN);
- this.glassify(block.getFace(BlockFace.SOUTH).getFace(BlockFace.EAST), BlockFace.DOWN);
- this.glassify(block.getFace(BlockFace.SOUTH).getFace(BlockFace.WEST), BlockFace.DOWN);
- this.glassify(block.getFace(BlockFace.SOUTH, 2), BlockFace.DOWN);
- this.glassify(block.getFace(BlockFace.SOUTH, 2).getFace(BlockFace.EAST), BlockFace.DOWN);
- this.glassify(block.getFace(BlockFace.SOUTH, 2).getFace(BlockFace.WEST), BlockFace.DOWN);
- this.glassify(block.getFace(BlockFace.SOUTH).getFace(BlockFace.DOWN, 2), BlockFace.DOWN);
- this.glassify(block.getFace(BlockFace.SOUTH).getFace(BlockFace.DOWN, 2), BlockFace.DOWN);
+ 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);
}
}
}
diff --git a/war/src/main/java/com/tommytony/war/jobs/HelmetProtectionTask.java b/war/src/main/java/com/tommytony/war/jobs/HelmetProtectionTask.java
index 17db625..980c0e9 100644
--- a/war/src/main/java/com/tommytony/war/jobs/HelmetProtectionTask.java
+++ b/war/src/main/java/com/tommytony/war/jobs/HelmetProtectionTask.java
@@ -80,7 +80,7 @@ public class HelmetProtectionTask implements Runnable {
}
}
- private ItemStack createBlockHead(Team team) {
+ public ItemStack createBlockHead(Team team) {
return new ItemStack(team.getKind().getMaterial(), 1, (short) 1, new Byte(team.getKind().getData()));
}
}
diff --git a/war/src/main/java/com/tommytony/war/jobs/LoadoutResetJob.java b/war/src/main/java/com/tommytony/war/jobs/LoadoutResetJob.java
index bc87afb..10953e1 100644
--- a/war/src/main/java/com/tommytony/war/jobs/LoadoutResetJob.java
+++ b/war/src/main/java/com/tommytony/war/jobs/LoadoutResetJob.java
@@ -16,9 +16,10 @@ public class LoadoutResetJob implements Runnable {
this.team = team;
this.player = player;
}
-
+
public void run() {
this.zone.equipPlayerLoadoutSelection(player, team);
+
// Stop fire here, since doing it in the same tick as death doesn't extinguish it
this.player.setFireTicks(0);
}
diff --git a/war/src/main/java/com/tommytony/war/jobs/ResetCursorJob.java b/war/src/main/java/com/tommytony/war/jobs/ResetCursorJob.java
index 11fd145..e14faf3 100644
--- a/war/src/main/java/com/tommytony/war/jobs/ResetCursorJob.java
+++ b/war/src/main/java/com/tommytony/war/jobs/ResetCursorJob.java
@@ -21,17 +21,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.getFace(BlockFace.WEST).setType(this.originalCursorBlocks[1].getType());
- this.cornerBlock.getFace(BlockFace.WEST).setData(this.originalCursorBlocks[1].getData());
- this.cornerBlock.getFace(BlockFace.NORTH).setType(this.originalCursorBlocks[2].getType());
- this.cornerBlock.getFace(BlockFace.NORTH).setData(this.originalCursorBlocks[2].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());
} else {
this.cornerBlock.setType(this.originalCursorBlocks[0].getType());
this.cornerBlock.setData(this.originalCursorBlocks[0].getData());
- this.cornerBlock.getFace(BlockFace.EAST).setType(this.originalCursorBlocks[1].getType());
- this.cornerBlock.getFace(BlockFace.EAST).setData(this.originalCursorBlocks[1].getData());
- this.cornerBlock.getFace(BlockFace.SOUTH).setType(this.originalCursorBlocks[2].getType());
- this.cornerBlock.getFace(BlockFace.SOUTH).setData(this.originalCursorBlocks[2].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());
}
}
}
diff --git a/war/src/main/java/com/tommytony/war/jobs/ScoreCapReachedJob.java b/war/src/main/java/com/tommytony/war/jobs/ScoreCapReachedJob.java
index eccb7c4..bcbe222 100644
--- a/war/src/main/java/com/tommytony/war/jobs/ScoreCapReachedJob.java
+++ b/war/src/main/java/com/tommytony/war/jobs/ScoreCapReachedJob.java
@@ -2,6 +2,10 @@ package com.tommytony.war.jobs;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
+import org.getspout.spoutapi.player.SpoutPlayer;
+
+import bukkit.tommytony.war.War;
+import bukkit.tommytony.war.WarSpoutListener;
import com.tommytony.war.Team;
import com.tommytony.war.Warzone;
@@ -19,7 +23,14 @@ public class ScoreCapReachedJob implements Runnable {
public void run() {
for (Team t : this.zone.getTeams()) {
t.teamcast(this.winnersStr);
+ boolean isSpoutServer = War.war.isSpoutServer();
for (Player tp : t.getPlayers()) {
+ if (isSpoutServer) {
+ SpoutPlayer sp = (SpoutPlayer) tp;
+ if (sp.isSpoutCraftEnabled()) {
+ WarSpoutListener.removeStats(sp);
+ }
+ }
// Send everyone to rally point (or zone lobby if not rally point)
if (this.zone.getRallyPoint() != null) {
tp.teleport(this.zone.getRallyPoint());
diff --git a/war/src/main/java/com/tommytony/war/mappers/WarMapper.java b/war/src/main/java/com/tommytony/war/mappers/WarMapper.java
index 26f1cdf..4c65353 100644
--- a/war/src/main/java/com/tommytony/war/mappers/WarMapper.java
+++ b/war/src/main/java/com/tommytony/war/mappers/WarMapper.java
@@ -138,6 +138,11 @@ public class WarMapper {
if (warConfig.keyExists("defaultFlagPointsOnly")) {
War.war.setDefaultFlagPointsOnly(warConfig.getBoolean("defaultFlagPointsOnly"));
}
+
+ // defaultFlagMustBeHome
+ if (warConfig.keyExists("defaultFlagMustBeHome")) {
+ War.war.setDefaultFlagMustBeHome(warConfig.getBoolean("defaultFlagMustBeHome"));
+ }
// defaultTeamCap
if (warConfig.keyExists("defaultTeamCap")) {
@@ -148,6 +153,11 @@ public class WarMapper {
if (warConfig.keyExists("defaultScoreCap")) {
War.war.setDefaultScoreCap(warConfig.getInt("defaultScoreCap"));
}
+
+ // defaultRespawnTimer
+ if (warConfig.keyExists("defaultRespawnTimer")) {
+ War.war.setDefaultRespawnTimer(warConfig.getInt("defaultRespawnTimer"));
+ }
// pvpInZonesOnly
if (warConfig.keyExists("pvpInZonesOnly")) {
@@ -346,12 +356,18 @@ public class WarMapper {
// defaultFlagPointsOnly
warConfig.setBoolean("defaultFlagPointsOnly", War.war.isDefaultFlagPointsOnly());
+
+ // defaultFlagMustBeHome
+ warConfig.setBoolean("defaultFlagMustBeHome", War.war.isDefaultFlagMustBeHome());
// defaultTeamCap
warConfig.setInt("defaultTeamCap", War.war.getDefaultTeamCap());
// defaultScoreCap
warConfig.setInt("defaultScoreCap", War.war.getDefaultScoreCap());
+
+ // defaultRespawnTimer
+ warConfig.setInt("defaultRespawnTimer", War.war.getDefaultRespawnTimer());
// pvpInZonesOnly
warConfig.setBoolean("pvpInZonesOnly", War.war.isPvpInZonesOnly());
@@ -364,6 +380,9 @@ public class WarMapper {
// disablePVPMessage
warConfig.setBoolean("disablePvpMessage", War.war.isDisablePvpMessage());
+
+ // disableBuildMessage
+ warConfig.setBoolean("disableBuildMessage", War.war.isDisableBuildMessage());
// tntInZonesOnly
warConfig.setBoolean("tntInZonesOnly", War.war.isTntInZonesOnly());
@@ -371,7 +390,7 @@ public class WarMapper {
// spawnStyle
warConfig.setString("spawnStyle", War.war.getDefaultSpawnStyle().toString());
- // spawnStyle
+ // flagReturn
warConfig.setString("flagReturn", War.war.getDefaultFlagReturn().toString());
// defaultReward
diff --git a/war/src/main/java/com/tommytony/war/mappers/WarzoneMapper.java b/war/src/main/java/com/tommytony/war/mappers/WarzoneMapper.java
index d17bd5e..cf2d12f 100644
--- a/war/src/main/java/com/tommytony/war/mappers/WarzoneMapper.java
+++ b/war/src/main/java/com/tommytony/war/mappers/WarzoneMapper.java
@@ -180,6 +180,11 @@ public class WarzoneMapper {
if (warzoneConfig.containsKey("flagPointsOnly")) {
warzone.setFlagPointsOnly(warzoneConfig.getBoolean("flagPointsOnly"));
}
+
+ // flagMustBeHome
+ if (warzoneConfig.containsKey("flagMustBeHome")) {
+ warzone.setFlagMustBeHome(warzoneConfig.getBoolean("flagMustBeHome"));
+ }
// team cap
if (warzoneConfig.containsKey("teamCap")) {
@@ -190,6 +195,11 @@ public class WarzoneMapper {
if (warzoneConfig.containsKey("scoreCap")) {
warzone.setScoreCap(warzoneConfig.getInt("scoreCap"));
}
+
+ // respawn timer
+ if (warzoneConfig.containsKey("respawnTimer")) {
+ warzone.setRespawnTimer(warzoneConfig.getInt("respawnTimer"));
+ }
// blockHeads
if (warzoneConfig.containsKey("blockHeads")) {
@@ -459,14 +469,20 @@ public class WarzoneMapper {
// autoAssignOnly
warzoneConfig.setBoolean("autoAssignOnly", warzone.isAutoAssignOnly());
- // flagPointsOnly-+
+ // flagPointsOnly
warzoneConfig.setBoolean("flagPointsOnly", warzone.isFlagPointsOnly());
+
+ // flagMustBeHome
+ warzoneConfig.setBoolean("flagMustBeHome", warzone.isFlagMustBeHome());
// team cap
warzoneConfig.setInt("teamCap", warzone.getTeamCap());
// score cap
warzoneConfig.setInt("scoreCap", warzone.getScoreCap());
+
+ // respawn timer
+ warzoneConfig.setInt("respawnTimer", warzone.getRespawnTimer());
// blockHeads
warzoneConfig.setBoolean("blockHeads", warzone.isBlockHeads());
diff --git a/war/src/main/java/com/tommytony/war/volumes/Volume.java b/war/src/main/java/com/tommytony/war/volumes/Volume.java
index b4f1050..d084c79 100644
--- a/war/src/main/java/com/tommytony/war/volumes/Volume.java
+++ b/war/src/main/java/com/tommytony/war/volumes/Volume.java
@@ -169,7 +169,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.getFace(BlockFace.SOUTH);
+ Block southBlock = currentBlock.getRelative(BlockFace.SOUTH);
int oldSouthBlockType = this.getBlockTypes()[i + 1][j][k];
byte oldSouthBlockData = this.getBlockDatas()[i + 1][j][k];
if (southBlock.getTypeId() != oldSouthBlockType) {
@@ -255,7 +255,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.getFace(BlockFace.SOUTH);
+ Block southBlock = currentBlock.getRelative(BlockFace.SOUTH);
int oldSouthBlockType = this.getBlockTypes()[i + 1][j][k];
byte oldSouthBlockData = this.getBlockDatas()[i + 1][j][k];
if (southBlock.getTypeId() != oldSouthBlockType) {
diff --git a/war/src/main/java/plugin.yml b/war/src/main/java/plugin.yml
index c23fb41..21bf020 100644
--- a/war/src/main/java/plugin.yml
+++ b/war/src/main/java/plugin.yml
@@ -4,6 +4,7 @@ description: Lets you create TDM and CTF arenas (warzones) for a fast-paced and
author: tommytony
website: war.tommytony.com
main: bukkit.tommytony.war.War
+softdepend: [Spout]
permissions:
war.*:
description: Full War permissions. Create and destroy warzones. Change War configuration.
@@ -265,4 +266,4 @@ commands:
/war zone
War:
description: War> Same as /war. Used as fallback.
- usage: See /war.
\ No newline at end of file
+ usage: See /war.
diff --git a/war/target/classes/plugin.yml b/war/target/classes/plugin.yml
index c23fb41..21bf020 100644
--- a/war/target/classes/plugin.yml
+++ b/war/target/classes/plugin.yml
@@ -4,6 +4,7 @@ description: Lets you create TDM and CTF arenas (warzones) for a fast-paced and
author: tommytony
website: war.tommytony.com
main: bukkit.tommytony.war.War
+softdepend: [Spout]
permissions:
war.*:
description: Full War permissions. Create and destroy warzones. Change War configuration.
@@ -265,4 +266,4 @@ commands:
/war zone
War:
description: War> Same as /war. Used as fallback.
- usage: See /war.
\ No newline at end of file
+ usage: See /war.