Fixing merge conflicts with pull request from @Superyoshi. Mostly untested. Isolated Spout code behind checks for spout so War doesn't completely fall over if Spout isn't available on the server.

This commit is contained in:
taoneill 2011-12-27 16:29:39 -05:00
commit bd872be244
23 changed files with 658 additions and 224 deletions

View File

@ -9,5 +9,6 @@
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/> <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="lib" path="C:/dev/war/war/lib/mockito-all-1.8.5.jar"/> <classpathentry kind="lib" path="C:/dev/war/war/lib/mockito-all-1.8.5.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/Permissions"/> <classpathentry combineaccessrules="false" kind="src" path="/Permissions"/>
<classpathentry kind="lib" path="C:/dev/war/war/lib/SpoutPluginAPI.jar"/>
<classpathentry kind="output" path="target/classes"/> <classpathentry kind="output" path="target/classes"/>
</classpath> </classpath>

View File

@ -22,6 +22,7 @@ import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import org.getspout.spoutapi.player.SpoutPlayer;
import com.nijiko.permissions.PermissionHandler; import com.nijiko.permissions.PermissionHandler;
import com.nijikokun.bukkit.Permissions.Permissions; import com.nijikokun.bukkit.Permissions.Permissions;
@ -71,6 +72,7 @@ public class War extends JavaPlugin {
private boolean pvpInZonesOnly = false; private boolean pvpInZonesOnly = false;
private boolean disablePvpMessage = false; private boolean disablePvpMessage = false;
private boolean buildInZonesOnly = false; private boolean buildInZonesOnly = false;
private boolean disableBuildMessage = false;
private boolean tntInZonesOnly = false; private boolean tntInZonesOnly = false;
private int maxZones = 12; private int maxZones = 12;
private final List<String> deadlyAdjectives = new ArrayList<String>(); private final List<String> deadlyAdjectives = new ArrayList<String>();
@ -87,6 +89,7 @@ public class War extends JavaPlugin {
private boolean defaultFriendlyFire = false; private boolean defaultFriendlyFire = false;
private boolean defaultAutoAssignOnly = false; private boolean defaultAutoAssignOnly = false;
private boolean defaultFlagPointsOnly = false; private boolean defaultFlagPointsOnly = false;
private boolean defaultFlagMustBeHome = true;
private boolean defaultUnbreakableZoneBlocks = false; private boolean defaultUnbreakableZoneBlocks = false;
private boolean defaultNoCreatures = false; private boolean defaultNoCreatures = false;
private boolean defaultGlassWalls = true; private boolean defaultGlassWalls = true;
@ -94,6 +97,7 @@ public class War extends JavaPlugin {
private boolean defaultInstaBreak = false; private boolean defaultInstaBreak = false;
private boolean defaultNoDrops = false; private boolean defaultNoDrops = false;
private boolean defaultNoHunger = false; private boolean defaultNoHunger = false;
private int defaultRespawnTimer = 10;
private int defaultSaturation = 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 defaultMinPlayers = 1; // By default, 1 player on 1 team is enough for unlocking the cant-exit-spawn guard
private int defaultMinTeams = 1; 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_PLACE, this.blockListener, Priority.Normal, this);
pm.registerEvent(Event.Type.BLOCK_DAMAGE, 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_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) // Load files from disk or create them (using these defaults)
@ -201,6 +211,14 @@ public class War extends JavaPlugin {
* Cleans up war * Cleans up war
*/ */
public void unloadWar() { 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) { for (Warzone warzone : this.warzones) {
warzone.unload(); warzone.unload();
} }
@ -331,6 +349,10 @@ public class War extends JavaPlugin {
warzone.setScoreCap(Integer.parseInt(namedParams.get("maxscore"))); warzone.setScoreCap(Integer.parseInt(namedParams.get("maxscore")));
returnMessage.append(" maxscore set to " + warzone.getScoreCap() + "."); 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")) { if (namedParams.containsKey("ff")) {
String onOff = namedParams.get("ff"); String onOff = namedParams.get("ff");
warzone.setFriendlyFire(onOff.equals("on") || onOff.equals("true")); 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")); warzone.setFlagPointsOnly(onOff.equals("on") || onOff.equals("true"));
returnMessage.append(" flagpointsonly set to " + String.valueOf(warzone.isFlagPointsOnly()) + "."); 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")) { if (namedParams.containsKey("blockheads")) {
String onOff = namedParams.get("blockheads"); String onOff = namedParams.get("blockheads");
warzone.setBlockHeads(onOff.equals("on") || onOff.equals("true")); warzone.setBlockHeads(onOff.equals("on") || onOff.equals("true"));
@ -472,7 +499,6 @@ public class War extends JavaPlugin {
if (loadoutName.equals("default")) { if (loadoutName.equals("default")) {
returnMessage.append(" Can't remove default loadout."); returnMessage.append(" Can't remove default loadout.");
} else { } else {
HashMap<Integer, ItemStack> extraLoadout = warzone.getExtraLoadouts().get(loadoutName);
if (warzone.getExtraLoadouts().keySet().contains(loadoutName)) { if (warzone.getExtraLoadouts().keySet().contains(loadoutName)) {
warzone.getExtraLoadouts().remove(loadoutName); warzone.getExtraLoadouts().remove(loadoutName);
returnMessage.append(" " + loadoutName + " loadout removed."); returnMessage.append(" " + loadoutName + " loadout removed.");
@ -507,13 +533,18 @@ public class War extends JavaPlugin {
if (namedParams.containsKey("pvpinzonesonly")) { if (namedParams.containsKey("pvpinzonesonly")) {
String onOff = namedParams.get("pvpinzonesonly"); String onOff = namedParams.get("pvpinzonesonly");
this.setPvpInZonesOnly(onOff.equals("on") || onOff.equals("true")); 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")) { if (namedParams.containsKey("disablepvpmessage")) {
String onOff = namedParams.get("disablepvpmessage"); String onOff = namedParams.get("disablepvpmessage");
this.setDisablePvpMessage(onOff.equals("on") || onOff.equals("true")); this.setDisablePvpMessage(onOff.equals("on") || onOff.equals("true"));
returnMessage.append(" disablepvpmessage set to " + String.valueOf(war.isDisablePvpMessage()) + "."); 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")) { if (namedParams.containsKey("buildinzonesonly")) {
String onOff = namedParams.get("buildinzonesonly"); String onOff = namedParams.get("buildinzonesonly");
this.setBuildInZonesOnly(onOff.equals("on") || onOff.equals("true")); this.setBuildInZonesOnly(onOff.equals("on") || onOff.equals("true"));
@ -545,6 +576,10 @@ public class War extends JavaPlugin {
this.setDefaultScoreCap(Integer.parseInt(namedParams.get("maxscore"))); this.setDefaultScoreCap(Integer.parseInt(namedParams.get("maxscore")));
returnMessage.append(" maxscore set to " + war.getDefaultScoreCap() + "."); 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")) { if (namedParams.containsKey("ff")) {
String onOff = namedParams.get("ff"); String onOff = namedParams.get("ff");
this.setDefaultFriendlyFire(onOff.equals("on") || onOff.equals("true")); this.setDefaultFriendlyFire(onOff.equals("on") || onOff.equals("true"));
@ -559,7 +594,12 @@ public class War extends JavaPlugin {
String onOff = namedParams.get("flagpointsonly"); String onOff = namedParams.get("flagpointsonly");
this.setDefaultFlagPointsOnly(onOff.equals("on") || onOff.equals("true")); this.setDefaultFlagPointsOnly(onOff.equals("on") || onOff.equals("true"));
returnMessage.append(" flagpointsonly set to " + String.valueOf(war.isDefaultFlagPointsOnly()) + "."); 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")) { if (namedParams.containsKey("blockheads")) {
String onOff = namedParams.get("blockheads"); String onOff = namedParams.get("blockheads");
this.setDefaultBlockHeads(onOff.equals("on") || onOff.equals("true")); this.setDefaultBlockHeads(onOff.equals("on") || onOff.equals("true"));
@ -677,7 +717,6 @@ public class War extends JavaPlugin {
if (loadoutName.equals("default")) { if (loadoutName.equals("default")) {
returnMessage.append(" Can't remove default loadout."); returnMessage.append(" Can't remove default loadout.");
} else { } else {
HashMap<Integer, ItemStack> extraLoadout = this.getDefaultExtraLoadouts().get(loadoutName);
if (this.getDefaultExtraLoadouts().keySet().contains(loadoutName)) { if (this.getDefaultExtraLoadouts().keySet().contains(loadoutName)) {
this.getDefaultExtraLoadouts().remove(loadoutName); this.getDefaultExtraLoadouts().remove(loadoutName);
returnMessage.append(" " + loadoutName + " loadout removed."); returnMessage.append(" " + loadoutName + " loadout removed.");
@ -715,6 +754,7 @@ public class War extends JavaPlugin {
+ " ff:" + color + String.valueOf(zone.getFriendlyFire()) + normal + " ff:" + color + String.valueOf(zone.getFriendlyFire()) + normal
+ " autoassign:" + color + String.valueOf(zone.isAutoAssignOnly()) + normal + " autoassign:" + color + String.valueOf(zone.isAutoAssignOnly()) + normal
+ " flagpointsonly:" + color + String.valueOf(zone.isFlagPointsOnly()) + normal + " flagpointsonly:" + color + String.valueOf(zone.isFlagPointsOnly()) + normal
+ " flagmustbehome:" + color + String.valueOf(zone.isFlagMustBeHome()) + normal
+ " blockheads:" + color + String.valueOf(zone.isBlockHeads()) + normal + " blockheads:" + color + String.valueOf(zone.isBlockHeads()) + normal
+ " spawnstyle:" + color + zone.getSpawnStyle() + normal + " spawnstyle:" + color + zone.getSpawnStyle() + normal
+ " flagreturn:" + color + zone.getFlagReturn() + normal + " flagreturn:" + color + zone.getFlagReturn() + normal
@ -749,6 +789,7 @@ public class War extends JavaPlugin {
return "War config -" return "War config -"
+ " pvpinzonesonly:" + global + String.valueOf(this.isPvpInZonesOnly()) + normal + " pvpinzonesonly:" + global + String.valueOf(this.isPvpInZonesOnly()) + normal
+ " disablepvpmessage:" + global + String.valueOf(this.isDisablePvpMessage()) + normal + " disablepvpmessage:" + global + String.valueOf(this.isDisablePvpMessage()) + normal
+ " disablebuildmessage:" + global + String.valueOf(this.isDisableBuildMessage()) + normal
+ " buildinzonesonly:" + global + String.valueOf(this.isBuildInZonesOnly()) + normal + " buildinzonesonly:" + global + String.valueOf(this.isBuildInZonesOnly()) + normal
+ " tntinzonesonly:" + global + String.valueOf(this.isTntInZonesOnly()) + normal + " tntinzonesonly:" + global + String.valueOf(this.isTntInZonesOnly()) + normal
+ " maxzones:" + global + this.getMaxZones() + normal + " maxzones:" + global + this.getMaxZones() + normal
@ -759,6 +800,7 @@ public class War extends JavaPlugin {
+ " ff:" + color + String.valueOf(this.isDefaultFriendlyFire()) + normal + " ff:" + color + String.valueOf(this.isDefaultFriendlyFire()) + normal
+ " autoassign:" + color + String.valueOf(this.isDefaultAutoAssignOnly()) + normal + " autoassign:" + color + String.valueOf(this.isDefaultAutoAssignOnly()) + normal
+ " flagpointsonly:" + color + String.valueOf(this.isDefaultFlagPointsOnly()) + normal + " flagpointsonly:" + color + String.valueOf(this.isDefaultFlagPointsOnly()) + normal
+ " flagmustbehome:" + color + String.valueOf(this.isDefaultFlagMustBeHome()) + normal
+ " blockheads:" + color + String.valueOf(this.isDefaultBlockHeads()) + normal + " blockheads:" + color + String.valueOf(this.isDefaultBlockHeads()) + normal
+ " spawnstyle:" + color + this.getDefaultSpawnStyle() + normal + " spawnstyle:" + color + this.getDefaultSpawnStyle() + normal
+ " flagreturn:" + color + this.getDefaultFlagReturn() + normal + " flagreturn:" + color + this.getDefaultFlagReturn() + normal
@ -1051,6 +1093,15 @@ public class War extends JavaPlugin {
public Logger getLogger() { public Logger getLogger() {
return this.logger; 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) { public Warzone zoneOfZoneWallAtProximity(Location location) {
for (Warzone zone : this.warzones) { for (Warzone zone : this.warzones) {
@ -1119,6 +1170,14 @@ public class War extends JavaPlugin {
public void setDisablePvpMessage(boolean disablePvpMessage) { public void setDisablePvpMessage(boolean disablePvpMessage) {
this.disablePvpMessage = disablePvpMessage; this.disablePvpMessage = disablePvpMessage;
} }
public boolean isDisableBuildMessage() {
return this.disableBuildMessage;
}
public void setDisableBuildMessage(boolean disableBuildMessage) {
this.disableBuildMessage = disableBuildMessage;
}
public boolean isBuildInZonesOnly() { public boolean isBuildInZonesOnly() {
return this.buildInZonesOnly; return this.buildInZonesOnly;
@ -1263,6 +1322,14 @@ public class War extends JavaPlugin {
public boolean isDefaultFlagPointsOnly() { public boolean isDefaultFlagPointsOnly() {
return this.defaultFlagPointsOnly; return this.defaultFlagPointsOnly;
} }
public void setDefaultFlagMustBeHome(boolean defaultFlagMustBeHome) {
this.defaultFlagMustBeHome = defaultFlagMustBeHome;
}
public boolean isDefaultFlagMustBeHome() {
return this.defaultFlagMustBeHome;
}
public void setDefaultMinPlayers(int defaultMinPlayers) { public void setDefaultMinPlayers(int defaultMinPlayers) {
this.defaultMinPlayers = defaultMinPlayers; this.defaultMinPlayers = defaultMinPlayers;
@ -1347,5 +1414,13 @@ public class War extends JavaPlugin {
public int getMaxZones() { public int getMaxZones() {
return maxZones; return maxZones;
} }
public void setDefaultRespawnTimer(int defaultRespawnTimer) {
this.defaultRespawnTimer = defaultRespawnTimer;
}
public int getDefaultRespawnTimer() {
return defaultRespawnTimer;
}
} }

View File

@ -11,8 +11,11 @@ import org.bukkit.event.Cancellable;
import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockDamageEvent; import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.event.block.BlockListener; 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.event.block.BlockPlaceEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.getspout.spoutapi.player.SpoutPlayer;
import com.tommytony.war.FlagReturn; import com.tommytony.war.FlagReturn;
import com.tommytony.war.Monument; import com.tommytony.war.Monument;
@ -86,7 +89,7 @@ public class WarBlockListener extends BlockListener {
} }
// buildInZonesOnly // 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."); War.war.badMsg(player, "You can only build inside warzones. Ask for the 'war.build' permission to build outside.");
event.setCancelled(true); event.setCancelled(true);
return; return;
@ -114,7 +117,34 @@ public class WarBlockListener extends BlockListener {
return; 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() * @see BlockListener.onBlockBreak()
*/ */
@ -207,6 +237,15 @@ public class WarBlockListener extends BlockListener {
for (Team t : warzone.getTeams()) { for (Team t : warzone.getTeams()) {
t.teamcast(team.getKind().getColor() + player.getName() + ChatColor.WHITE + " stole team " + lostFlagTeam.getName() + "'s flag."); t.teamcast(team.getKind().getColor() + player.getName() + ChatColor.WHITE + " stole team " + lostFlagTeam.getName() + "'s flag.");
if (t.getName().equals(lostFlagTeam.getName())) { 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 t.teamcast("Prevent " + team.getKind().getColor() + player.getName() + ChatColor.WHITE
+ " from reaching team " + team.getName() + "'s " + spawnOrFlag + "."); + " from reaching team " + team.getName() + "'s " + spawnOrFlag + ".");
} }

View File

@ -22,14 +22,13 @@ import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.entity.EntityCombustEvent; import org.bukkit.event.entity.EntityCombustEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.EntityListener; import org.bukkit.event.entity.EntityListener;
import org.bukkit.event.entity.EntityRegainHealthEvent; import org.bukkit.event.entity.EntityRegainHealthEvent;
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
import org.bukkit.event.entity.FoodLevelChangeEvent; import org.bukkit.event.entity.FoodLevelChangeEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import com.tommytony.war.Team; import com.tommytony.war.Team;
@ -89,6 +88,15 @@ public class WarEntityListener extends EntityListener {
event.setCancelled(true); event.setCancelled(true);
return; 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()) { if (!attackerWarzone.isPvpInZone()) {

View File

@ -25,6 +25,7 @@ import org.bukkit.event.player.PlayerToggleSneakEvent;
import org.bukkit.inventory.Inventory; import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory; import org.bukkit.inventory.PlayerInventory;
import org.getspout.spoutapi.player.SpoutPlayer;
import com.tommytony.war.FlagReturn; import com.tommytony.war.FlagReturn;
import com.tommytony.war.LoadoutSelection; import com.tommytony.war.LoadoutSelection;
@ -430,10 +431,20 @@ public class WarPlayerListener extends PlayerListener {
} }
} }
if (!playerWarzone.isEnoughPlayers() && !playerTeam.getSpawnVolume().contains(playerLoc)) { if (!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)."); if (!playerWarzone.isEnoughPlayers()) {
event.setTo(playerTeam.getTeamSpawn()); 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).");
return; 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 // 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."); War.war.badMsg(player, "You can't capture the enemy flag until your team's flag is returned.");
} else { } else {
synchronized (playerWarzone) { synchronized (playerWarzone) {
@ -500,6 +511,15 @@ public class WarPlayerListener extends PlayerListener {
victim.getFlagVolume().resetBlocks(); // bring back flag to team that lost it victim.getFlagVolume().resetBlocks(); // bring back flag to team that lost it
victim.initializeTeamFlag(); victim.initializeTeamFlag();
for (Team t : playerWarzone.getTeams()) { 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 t.teamcast(playerTeam.getKind().getColor() + player.getName() + ChatColor.WHITE
+ " captured team " + victim.getName() + "'s flag. Team " + playerTeam.getName() + " scores one point."); + " captured team " + victim.getName() + "'s flag. Team " + playerTeam.getName() + " scores one point.");
} }
@ -545,7 +565,6 @@ public class WarPlayerListener extends PlayerListener {
} else { } else {
War.war.badMsg(event.getPlayer(), "Can't change loadout after exiting the spawn."); War.war.badMsg(event.getPlayer(), "Can't change loadout after exiting the spawn.");
} }
} }
} }
} }

View File

@ -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<GenericLabel> teamlines = new ArrayList<GenericLabel>();
List<GenericLabel> playerlines = new ArrayList<GenericLabel>();
List<GenericLabel> scorelines = new ArrayList<GenericLabel>();
List<GenericLabel> lifelines = new ArrayList<GenericLabel>();
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<GenericLabel> lines = new ArrayList<GenericLabel>();
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<GenericLabel> 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);
}
}

View File

@ -140,8 +140,8 @@ public class Monument {
public void setLocation(Location location) { public void setLocation(Location location) {
Block locationBlock = this.warzone.getWorld().getBlockAt(location.getBlockX(), location.getBlockY(), location.getBlockZ()); 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.setCornerOne(locationBlock.getRelative(BlockFace.DOWN).getRelative(BlockFace.EAST, 2).getRelative(BlockFace.SOUTH, 2));
this.volume.setCornerTwo(locationBlock.getFace(BlockFace.UP, 2).getFace(BlockFace.WEST, 2).getFace(BlockFace.NORTH, 2)); this.volume.setCornerTwo(locationBlock.getRelative(BlockFace.UP, 2).getRelative(BlockFace.WEST, 2).getRelative(BlockFace.NORTH, 2));
this.volume.saveBlocks(); this.volume.saveBlocks();
this.location = location; this.location = location;
this.addMonumentBlocks(); this.addMonumentBlocks();

View File

@ -2,7 +2,6 @@ package com.tommytony.war;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.logging.Level;
import net.minecraft.server.MobEffect; import net.minecraft.server.MobEffect;
import net.minecraft.server.MobEffectList; import net.minecraft.server.MobEffectList;
@ -10,8 +9,6 @@ import net.minecraft.server.MobEffectList;
import org.bukkit.craftbukkit.entity.CraftPlayer; import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import bukkit.tommytony.war.War;
public class PotionEffect { public class PotionEffect {
private int id; private int id;

View File

@ -10,8 +10,8 @@ import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import bukkit.tommytony.war.War; import bukkit.tommytony.war.War;
import bukkit.tommytony.war.WarSpoutListener;
import com.tommytony.war.utils.SignHelper; import com.tommytony.war.utils.SignHelper;
import com.tommytony.war.volumes.Volume; import com.tommytony.war.volumes.Volume;
@ -129,16 +129,16 @@ public class Team {
// SMALL style // SMALL style
if (yaw >= 0 && yaw < 90) { if (yaw >= 0 && yaw < 90) {
signData = 10; 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) { } else if (yaw >= 90 && yaw <= 180) {
signData = 14; 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) { } else if (yaw >= 180 && yaw < 270) {
signData = 2; 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) { } else if (yaw >= 270 && yaw <= 360) {
signData = 6; 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 { } else {
// outer ring (FLAT or BIG) // outer ring (FLAT or BIG)
@ -169,7 +169,7 @@ public class Team {
facing = BlockFace.NORTH_WEST; facing = BlockFace.NORTH_WEST;
opposite = BlockFace.SOUTH_EAST; opposite = BlockFace.SOUTH_EAST;
signData = 10; 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)) { if (this.warzone.getSpawnStyle().equals(TeamSpawnStyle.BIG)) {
// rim // rim
@ -202,7 +202,7 @@ public class Team {
facing = BlockFace.NORTH_EAST; facing = BlockFace.NORTH_EAST;
opposite = BlockFace.SOUTH_WEST; opposite = BlockFace.SOUTH_WEST;
signData = 14; 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)) { if (this.warzone.getSpawnStyle().equals(TeamSpawnStyle.BIG)) {
// rim // rim
this.setBlock(x + 1, y, z - 2, this.kind); this.setBlock(x + 1, y, z - 2, this.kind);
@ -234,7 +234,7 @@ public class Team {
facing = BlockFace.SOUTH_EAST; facing = BlockFace.SOUTH_EAST;
opposite = BlockFace.NORTH_WEST; opposite = BlockFace.NORTH_WEST;
signData = 2; 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)) { if (this.warzone.getSpawnStyle().equals(TeamSpawnStyle.BIG)) {
// rim // rim
this.setBlock(x + 2, y, z + 1, this.kind); this.setBlock(x + 2, y, z + 1, this.kind);
@ -266,7 +266,7 @@ public class Team {
facing = BlockFace.SOUTH_WEST; facing = BlockFace.SOUTH_WEST;
opposite = BlockFace.NORTH_EAST; opposite = BlockFace.NORTH_EAST;
signData = 6; 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)) { if (this.warzone.getSpawnStyle().equals(TeamSpawnStyle.BIG)) {
// rim // rim
this.setBlock(x - 1, y, z + 2, this.kind); this.setBlock(x - 1, y, z + 2, this.kind);
@ -310,6 +310,10 @@ public class Team {
SignHelper.setToSign(War.war, signBlock, (byte) signData, lines); 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) { private void setBlock(int x, int y, int z, TeamKind kind) {

View File

@ -2,6 +2,7 @@ package com.tommytony.war;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.getspout.spoutapi.gui.Color;
public enum TeamKind { public enum TeamKind {
WHITE ((byte) 0, Material.WOOL, ChatColor.WHITE), WHITE ((byte) 0, Material.WOOL, ChatColor.WHITE),
@ -47,6 +48,50 @@ public enum TeamKind {
public ChatColor getColor() { public ChatColor getColor() {
return this.color; 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() { public Material getMaterial() {
return this.material; return this.material;

View File

@ -144,9 +144,10 @@ public class WarHub {
} }
Block locationBlock = this.location.getWorld().getBlockAt(this.location.getBlockX(), this.location.getBlockY(), this.location.getBlockZ()); Block locationBlock = this.location.getWorld().getBlockAt(this.location.getBlockX(), this.location.getBlockY(), this.location.getBlockZ());
this.volume.setWorld(this.location.getWorld()); this.volume.setWorld(this.location.getWorld());
this.volume.setCornerOne(locationBlock.getFace(back).getFace(left, halfHubWidth).getFace(BlockFace.DOWN)); this.volume.setCornerOne(locationBlock.getRelative(back).getRelative(left, halfHubWidth).getRelative(BlockFace.DOWN));
this.volume.setCornerTwo(locationBlock.getFace(right, halfHubWidth).getFace(front, hubDepth).getFace(BlockFace.UP, hubHeigth)); this.volume.setCornerTwo(locationBlock.getRelative(right, halfHubWidth).getRelative(front, hubDepth).getRelative(BlockFace.UP, hubHeigth));
this.volume.saveBlocks(); this.volume.saveBlocks();
// glass floor // glass floor
@ -155,26 +156,26 @@ public class WarHub {
this.volume.setFaceMaterial(BlockFace.DOWN, Material.GLASS); this.volume.setFaceMaterial(BlockFace.DOWN, Material.GLASS);
// draw gates // 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 for (Warzone zone : War.war.getWarzones()) { // gonna use the index to find it again
if (!zone.isDisabled()) { if (!zone.isDisabled()) {
this.zoneGateBlocks.put(zone.getName(), currentGateBlock); this.zoneGateBlocks.put(zone.getName(), currentGateBlock);
currentGateBlock.getFace(BlockFace.DOWN).setType(Material.GLOWSTONE); currentGateBlock.getRelative(BlockFace.DOWN).setType(Material.GLOWSTONE);
currentGateBlock.getFace(left).setType(Material.OBSIDIAN); currentGateBlock.getRelative(left).setType(Material.OBSIDIAN);
currentGateBlock.getFace(right).getFace(BlockFace.UP).setType(Material.OBSIDIAN); currentGateBlock.getRelative(right).getRelative(BlockFace.UP).setType(Material.OBSIDIAN);
currentGateBlock.getFace(left).getFace(BlockFace.UP).getFace(BlockFace.UP).setType(Material.OBSIDIAN); currentGateBlock.getRelative(left).getRelative(BlockFace.UP).getRelative(BlockFace.UP).setType(Material.OBSIDIAN);
currentGateBlock.getFace(right).setType(Material.OBSIDIAN); currentGateBlock.getRelative(right).setType(Material.OBSIDIAN);
currentGateBlock.getFace(left).getFace(BlockFace.UP).setType(Material.OBSIDIAN); currentGateBlock.getRelative(left).getRelative(BlockFace.UP).setType(Material.OBSIDIAN);
currentGateBlock.getFace(right).getFace(BlockFace.UP).getFace(BlockFace.UP).setType(Material.OBSIDIAN); currentGateBlock.getRelative(right).getRelative(BlockFace.UP).getRelative(BlockFace.UP).setType(Material.OBSIDIAN);
currentGateBlock.getFace(BlockFace.UP).getFace(BlockFace.UP).setType(Material.OBSIDIAN); currentGateBlock.getRelative(BlockFace.UP).getRelative(BlockFace.UP).setType(Material.OBSIDIAN);
currentGateBlock = currentGateBlock.getFace(right, 4); currentGateBlock = currentGateBlock.getRelative(right, 4);
} }
} }
// War hub sign // War hub sign
Block signBlock = locationBlock.getFace(front); Block signBlock = locationBlock.getRelative(front);
String[] lines = new String[4]; String[] lines = new String[4];
lines[0] = "War hub"; lines[0] = "War hub";
@ -222,7 +223,7 @@ public class WarHub {
Block zoneGate = this.zoneGateBlocks.get(zone.getName()); Block zoneGate = this.zoneGateBlocks.get(zone.getName());
if (zoneGate != null) { 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) { if (block.getType() != Material.SIGN_POST) {
block.setType(Material.SIGN_POST); block.setType(Material.SIGN_POST);
} }

View File

@ -7,9 +7,6 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.logging.Level; import java.util.logging.Level;
import net.minecraft.server.MobEffect;
import net.minecraft.server.MobEffectList;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Location; import org.bukkit.Location;
@ -18,14 +15,16 @@ import org.bukkit.World;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.entity.CraftItem; import org.bukkit.craftbukkit.entity.CraftItem;
import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Item; import org.bukkit.entity.Item;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory; import org.bukkit.inventory.PlayerInventory;
import org.getspout.spoutapi.player.SpoutPlayer;
import bukkit.tommytony.war.War; import bukkit.tommytony.war.War;
import bukkit.tommytony.war.WarSpoutListener;
import com.tommytony.war.jobs.InitZoneJob; import com.tommytony.war.jobs.InitZoneJob;
import com.tommytony.war.jobs.LoadoutResetJob; import com.tommytony.war.jobs.LoadoutResetJob;
@ -45,6 +44,7 @@ public class Warzone {
private final List<Monument> monuments = new ArrayList<Monument>(); private final List<Monument> monuments = new ArrayList<Monument>();
private final List<String> authors = new ArrayList<String>(); private final List<String> authors = new ArrayList<String>();
private final List<Player> respawn = new ArrayList<Player>();
private Location teleport; private Location teleport;
private boolean friendlyFire = false; private boolean friendlyFire = false;
@ -67,6 +67,7 @@ public class Warzone {
private ZoneLobby lobby; private ZoneLobby lobby;
private boolean autoAssignOnly = false; private boolean autoAssignOnly = false;
private boolean flagPointsOnly = false; private boolean flagPointsOnly = false;
private boolean flagMustBeHome = true;
private boolean blockHeads = true; private boolean blockHeads = true;
private boolean unbreakableZoneBlocks = false; private boolean unbreakableZoneBlocks = false;
private boolean disabled = false; private boolean disabled = false;
@ -76,6 +77,7 @@ public class Warzone {
private boolean instaBreak = false; private boolean instaBreak = false;
private boolean noDrops = false; private boolean noDrops = false;
private boolean noHunger = false; private boolean noHunger = false;
private int respawnTimer = 10;
private int saturation = 10; private int saturation = 10;
private int minPlayers = 1; private int minPlayers = 1;
private int minTeams = 1; private int minTeams = 1;
@ -98,6 +100,7 @@ public class Warzone {
this.reward = (HashMap<Integer, ItemStack>)War.war.getDefaultReward().clone(); this.reward = (HashMap<Integer, ItemStack>)War.war.getDefaultReward().clone();
this.autoAssignOnly = War.war.isDefaultAutoAssignOnly(); this.autoAssignOnly = War.war.isDefaultAutoAssignOnly();
this.setFlagPointsOnly(War.war.isDefaultFlagPointsOnly()); this.setFlagPointsOnly(War.war.isDefaultFlagPointsOnly());
this.setFlagMustBeHome(War.war.isDefaultFlagMustBeHome());
this.teamCap = War.war.getDefaultTeamCap(); this.teamCap = War.war.getDefaultTeamCap();
this.scoreCap = War.war.getDefaultScoreCap(); this.scoreCap = War.war.getDefaultScoreCap();
this.monumentHeal = War.war.getDefaultMonumentHeal(); this.monumentHeal = War.war.getDefaultMonumentHeal();
@ -111,6 +114,7 @@ public class Warzone {
this.setInstaBreak(War.war.isDefaultInstaBreak()); this.setInstaBreak(War.war.isDefaultInstaBreak());
this.setNoDrops(War.war.isDefaultNoDrops()); this.setNoDrops(War.war.isDefaultNoDrops());
this.setNoHunger(War.war.isDefaultNoHunger()); this.setNoHunger(War.war.isDefaultNoHunger());
this.setRespawnTimer(War.war.getDefaultRespawnTimer());
this.setSaturation(War.war.getDefaultSaturation()); this.setSaturation(War.war.getDefaultSaturation());
this.setMinPlayers(War.war.getDefaultMinPlayers()); this.setMinPlayers(War.war.getDefaultMinPlayers());
this.setMinTeams(War.war.getDefaultMinTeams()); this.setMinTeams(War.war.getDefaultMinTeams());
@ -127,7 +131,7 @@ public class Warzone {
// perfect match, return right away // perfect match, return right away
return warzone; return warzone;
} else if (warzone.getName().toLowerCase().startsWith(name.toLowerCase())) { } 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; bestGuess = warzone;
} }
} }
@ -329,14 +333,22 @@ public class Warzone {
// Teleport the player back to spawn // Teleport the player back to spawn
event.setTo(team.getTeamSpawn()); 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 // Fill hp
player.setRemainingAir(300); player.setRemainingAir(300);
player.setHealth(20); player.setHealth(20);
player.setFoodLevel(20); player.setFoodLevel(20);
player.setSaturation(this.getSaturation()); player.setSaturation(this.getSaturation());
player.setExhaustion(0); 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) { if (player.getGameMode() == GameMode.CREATIVE) {
player.setGameMode(GameMode.SURVIVAL); player.setGameMode(GameMode.SURVIVAL);
} }
@ -348,9 +360,28 @@ public class Warzone {
} else { } else {
this.getLoadoutSelections().get(player.getName()).setStillInSpawn(true); this.getLoadoutSelections().get(player.getName()).setStillInSpawn(true);
} }
LoadoutResetJob job = new LoadoutResetJob(this, team, player); // Spout
War.war.getServer().getScheduler().scheduleSyncDelayedTask(War.war, job); 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<Integer, ItemStack> loadout) { public void resetInventory(Team team, Player player, HashMap<Integer, ItemStack> loadout) {
@ -923,6 +954,15 @@ public class Warzone {
player.setFireTicks(0); player.setFireTicks(0);
player.setRemainingAir(300); 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."); War.war.msg(player, "Left the zone. Your inventory is being restored.");
if (War.war.getWarHub() != null) { if (War.war.getWarHub() != null) {
War.war.getWarHub().resetZoneSign(this); War.war.getWarHub().resetZoneSign(this);
@ -956,6 +996,15 @@ public class Warzone {
} }
return false; 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) { public Team getTeamForFlagBlock(Block block) {
for (Team team : this.teams) { for (Team team : this.teams) {
@ -1165,6 +1214,14 @@ public class Warzone {
public boolean isFlagPointsOnly() { public boolean isFlagPointsOnly() {
return this.flagPointsOnly; return this.flagPointsOnly;
} }
public void setFlagMustBeHome(boolean flagMustBeHome) {
this.flagMustBeHome = flagMustBeHome;
}
public boolean isFlagMustBeHome() {
return this.flagMustBeHome;
}
public void setMinPlayers(int minPlayers) { public void setMinPlayers(int minPlayers) {
this.minPlayers = minPlayers; this.minPlayers = minPlayers;
@ -1253,7 +1310,7 @@ public class Warzone {
public void equipPlayerLoadoutSelection(Player player, Team playerTeam) { public void equipPlayerLoadoutSelection(Player player, Team playerTeam) {
LoadoutSelection selection = this.getLoadoutSelections().get(player.getName()); LoadoutSelection selection = this.getLoadoutSelections().get(player.getName());
if (selection != null) { if (selection != null && this.isRespawning(player)) {
int currentIndex = selection.getSelectedIndex(); int currentIndex = selection.getSelectedIndex();
if (currentIndex == 0) { if (currentIndex == 0) {
this.resetInventory(playerTeam, player, this.getLoadout()); 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;
}
} }

View File

@ -91,13 +91,13 @@ public class ZoneLobby {
// we're setting the zoneVolume directly, so we need to figure out the lobbyMiddleWallBlock on our own // we're setting the zoneVolume directly, so we need to figure out the lobbyMiddleWallBlock on our own
if (wall == BlockFace.NORTH) { 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) { } 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) { } 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) { } 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.wall = opposite; // a player facing south places a lobby that looks just like a lobby stuck to the north wall
this.calculateLobbyWidth(); 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 corner1 = null;
Block corner2 = null; Block corner2 = null;
@ -298,7 +298,7 @@ public class ZoneLobby {
} }
// set zone tp // 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; int yaw = 0;
if (this.wall == BlockFace.WEST) { if (this.wall == BlockFace.WEST) {
yaw = 180; 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)); this.warzone.setTeleport(new Location(this.volume.getWorld(), this.zoneTeleportBlock.getX(), this.zoneTeleportBlock.getY(), this.zoneTeleportBlock.getZ(), yaw, 0));
// set zone sign // 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; byte data = 0;
if (this.wall == BlockFace.NORTH) { if (this.wall == BlockFace.NORTH) {
data = (byte) 4; data = (byte) 4;
@ -337,11 +337,11 @@ public class ZoneLobby {
// lets get some light in here // lets get some light in here
if (this.wall == BlockFace.NORTH || this.wall == BlockFace.SOUTH) { 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).getRelative(BlockFace.DOWN).getRelative(BlockFace.WEST, this.lobbyHalfSide - 1).getRelative(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.EAST, this.lobbyHalfSide - 1).getRelative(this.wall, 9).setType(Material.GLOWSTONE);
} else { } 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).getRelative(BlockFace.DOWN).getRelative(BlockFace.NORTH, this.lobbyHalfSide - 1).getRelative(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.SOUTH, this.lobbyHalfSide - 1).getRelative(this.wall, 9).setType(Material.GLOWSTONE);
} }
} else { } else {
War.war.log("Failed to initalize zone lobby for zone " + this.warzone.getName(), java.util.logging.Level.WARNING); 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) { if (this.warzone.getTeams().size() % 2 == 0) {
// even number of teams // even number of teams
if (doorIndex % 2 == 0) { 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 { } 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 { } else {
if (doorIndex == 0) { if (doorIndex == 0) {
this.teamGateBlocks.put(team.getName(), new BlockInfo(lobbyMiddleWallBlock)); this.teamGateBlocks.put(team.getName(), new BlockInfo(lobbyMiddleWallBlock));
} else if (doorIndex % 2 == 0) { } 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 { } 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) { private void placeGate(Block block, TeamKind teamKind) {
@ -411,14 +411,14 @@ public class ZoneLobby {
leftSide = BlockFace.NORTH; leftSide = BlockFace.NORTH;
rightSide = BlockFace.SOUTH; rightSide = BlockFace.SOUTH;
} }
block.getFace(BlockFace.DOWN).setType(Material.GLOWSTONE); block.getRelative(BlockFace.DOWN).setType(Material.GLOWSTONE);
this.setBlock(block.getFace(leftSide), teamKind); this.setBlock(block.getRelative(leftSide), teamKind);
this.setBlock(block.getFace(rightSide).getFace(BlockFace.UP), teamKind); this.setBlock(block.getRelative(rightSide).getRelative(BlockFace.UP), teamKind);
this.setBlock(block.getFace(leftSide).getFace(BlockFace.UP).getFace(BlockFace.UP), teamKind); this.setBlock(block.getRelative(leftSide).getRelative(BlockFace.UP).getRelative(BlockFace.UP), teamKind);
this.setBlock(block.getFace(rightSide), teamKind); this.setBlock(block.getRelative(rightSide), teamKind);
this.setBlock(block.getFace(leftSide).getFace(BlockFace.UP), teamKind); this.setBlock(block.getRelative(leftSide).getRelative(BlockFace.UP), teamKind);
this.setBlock(block.getFace(rightSide).getFace(BlockFace.UP).getFace(BlockFace.UP), teamKind); this.setBlock(block.getRelative(rightSide).getRelative(BlockFace.UP).getRelative(BlockFace.UP), teamKind);
this.setBlock(block.getFace(BlockFace.UP).getFace(BlockFace.UP), teamKind); this.setBlock(block.getRelative(BlockFace.UP).getRelative(BlockFace.UP), teamKind);
} }
} }
@ -439,14 +439,14 @@ public class ZoneLobby {
leftSide = BlockFace.NORTH; leftSide = BlockFace.NORTH;
rightSide = BlockFace.SOUTH; rightSide = BlockFace.SOUTH;
} }
block.getFace(BlockFace.DOWN).setType(Material.GLOWSTONE); block.getRelative(BlockFace.DOWN).setType(Material.GLOWSTONE);
this.setBlock(block.getFace(leftSide), material); this.setBlock(block.getRelative(leftSide), material);
this.setBlock(block.getFace(rightSide).getFace(BlockFace.UP), material); this.setBlock(block.getRelative(rightSide).getRelative(BlockFace.UP), material);
this.setBlock(block.getFace(leftSide).getFace(BlockFace.UP).getFace(BlockFace.UP), material); this.setBlock(block.getRelative(leftSide).getRelative(BlockFace.UP).getRelative(BlockFace.UP), material);
this.setBlock(block.getFace(rightSide), material); this.setBlock(block.getRelative(rightSide), material);
this.setBlock(block.getFace(leftSide).getFace(BlockFace.UP), material); this.setBlock(block.getRelative(leftSide).getRelative(BlockFace.UP), material);
this.setBlock(block.getFace(rightSide).getFace(BlockFace.UP).getFace(BlockFace.UP), material); this.setBlock(block.getRelative(rightSide).getRelative(BlockFace.UP).getRelative(BlockFace.UP), material);
this.setBlock(block.getFace(BlockFace.UP).getFace(BlockFace.UP), material); this.setBlock(block.getRelative(BlockFace.UP).getRelative(BlockFace.UP), material);
} }
} }
@ -477,21 +477,22 @@ public class ZoneLobby {
rightSide = BlockFace.SOUTH; rightSide = BlockFace.SOUTH;
} }
List<Team> teams = this.warzone.getTeams(); List<Team> teams = this.warzone.getTeams();
Block autoAssignGateBlock = BlockInfo.getBlock(this.volume.getWorld(), this.autoAssignGate); 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(); int size = teams.size();
if (size > 0) { if (size > 0) {
TeamKind[] doorBlockKinds = new TeamKind[7]; TeamKind[] doorBlockKinds = new TeamKind[7];
for (int i = 0; i < 7; i++) { for (int i = 0; i < 7; i++) {
doorBlockKinds[i] = teams.get(i % size).getKind(); doorBlockKinds[i] = teams.get(i % size).getKind();
} }
this.setBlock(autoAssignGateBlock.getFace(leftSide), doorBlockKinds[0]); this.setBlock(autoAssignGateBlock.getRelative(leftSide), doorBlockKinds[0]);
this.setBlock(autoAssignGateBlock.getFace(leftSide).getFace(BlockFace.UP), doorBlockKinds[1]); this.setBlock(autoAssignGateBlock.getRelative(leftSide).getRelative(BlockFace.UP), doorBlockKinds[1]);
this.setBlock(autoAssignGateBlock.getFace(leftSide).getFace(BlockFace.UP).getFace(BlockFace.UP), doorBlockKinds[2]); this.setBlock(autoAssignGateBlock.getRelative(leftSide).getRelative(BlockFace.UP).getRelative(BlockFace.UP), doorBlockKinds[2]);
this.setBlock(autoAssignGateBlock.getFace(BlockFace.UP).getFace(BlockFace.UP), doorBlockKinds[3]); this.setBlock(autoAssignGateBlock.getRelative(BlockFace.UP).getRelative(BlockFace.UP), doorBlockKinds[3]);
this.setBlock(autoAssignGateBlock.getFace(rightSide).getFace(BlockFace.UP).getFace(BlockFace.UP), doorBlockKinds[4]); this.setBlock(autoAssignGateBlock.getRelative(rightSide).getRelative(BlockFace.UP).getRelative(BlockFace.UP), doorBlockKinds[4]);
this.setBlock(autoAssignGateBlock.getFace(rightSide).getFace(BlockFace.UP), doorBlockKinds[5]); this.setBlock(autoAssignGateBlock.getRelative(rightSide).getRelative(BlockFace.UP), doorBlockKinds[5]);
this.setBlock(autoAssignGateBlock.getFace(rightSide), doorBlockKinds[6]); this.setBlock(autoAssignGateBlock.getRelative(rightSide), doorBlockKinds[6]);
} }
} }
} }
@ -565,7 +566,7 @@ public class ZoneLobby {
leftSide = BlockFace.NORTH; leftSide = BlockFace.NORTH;
rightSide = BlockFace.SOUTH; 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; return false;
} }
@ -612,28 +613,28 @@ public class ZoneLobby {
} }
byte data = 0; byte data = 0;
if (this.wall == BlockFace.NORTH) { if (this.wall == BlockFace.NORTH) {
block = gate.getFace(direction).getFace(BlockFace.EAST); block = gate.getRelative(direction).getRelative(BlockFace.EAST);
if (awayFromWall) { if (awayFromWall) {
data = (byte) 4; data = (byte) 4;
} else { } else {
data = (byte) 12; data = (byte) 12;
} }
} else if (this.wall == BlockFace.EAST) { } else if (this.wall == BlockFace.EAST) {
block = gate.getFace(direction).getFace(BlockFace.SOUTH); block = gate.getRelative(direction).getRelative(BlockFace.SOUTH);
if (awayFromWall) { if (awayFromWall) {
data = (byte) 8; data = (byte) 8;
} else { } else {
data = (byte) 0; data = (byte) 0;
} }
} else if (this.wall == BlockFace.SOUTH) { } else if (this.wall == BlockFace.SOUTH) {
block = gate.getFace(direction).getFace(BlockFace.WEST); block = gate.getRelative(direction).getRelative(BlockFace.WEST);
if (awayFromWall) { if (awayFromWall) {
data = (byte) 12; data = (byte) 12;
} else { } else {
data = (byte) 4; data = (byte) 4;
} }
} else if (this.wall == BlockFace.WEST) { } else if (this.wall == BlockFace.WEST) {
block = gate.getFace(direction).getFace(BlockFace.NORTH); block = gate.getRelative(direction).getRelative(BlockFace.NORTH);
if (awayFromWall) { if (awayFromWall) {
data = (byte) 0; data = (byte) 0;
} else { } else {
@ -683,9 +684,9 @@ public class ZoneLobby {
private boolean leaving(Location location, Block gate, BlockFace inside, BlockFace left, BlockFace right) { private boolean leaving(Location location, Block gate, BlockFace inside, BlockFace left, BlockFace right) {
// 3x4x1 deep // 3x4x1 deep
Volume gateExitVolume = new Volume("tempGateExit", location.getWorld()); Volume gateExitVolume = new Volume("tempGateExit", location.getWorld());
Block out = gate.getFace(inside); Block out = gate.getRelative(inside);
gateExitVolume.setCornerOne(out.getFace(left).getFace(BlockFace.DOWN)); gateExitVolume.setCornerOne(out.getRelative(left).getRelative(BlockFace.DOWN));
gateExitVolume.setCornerTwo(gate.getFace(right, 1).getFace(BlockFace.UP, 3)); gateExitVolume.setCornerTwo(gate.getRelative(right, 1).getRelative(BlockFace.UP, 2));
if (gateExitVolume.contains(location)) { if (gateExitVolume.contains(location)) {
return true; return true;

View File

@ -40,121 +40,121 @@ public class ZoneWallGuard {
for (Block block : nearestWallBlocks) { for (Block block : nearestWallBlocks) {
this.glassify(block, this.wall); this.glassify(block, this.wall);
if (this.wall != BlockFace.UP && this.wall != BlockFace.DOWN) { if (this.wall != BlockFace.UP && this.wall != BlockFace.DOWN) {
this.glassify(block.getFace(BlockFace.UP), this.wall); this.glassify(block.getRelative(BlockFace.UP), this.wall);
this.glassify(block.getFace(BlockFace.UP, 2), this.wall); this.glassify(block.getRelative(BlockFace.UP, 2), this.wall);
this.glassify(block.getFace(BlockFace.DOWN), this.wall); this.glassify(block.getRelative(BlockFace.DOWN), this.wall);
this.glassify(block.getFace(BlockFace.DOWN, 2), this.wall); this.glassify(block.getRelative(BlockFace.DOWN, 2), this.wall);
} }
if (this.wall == BlockFace.NORTH && this.warzone.getVolume().isNorthWallBlock(block)) { if (this.wall == BlockFace.NORTH && this.warzone.getVolume().isNorthWallBlock(block)) {
this.glassify(block.getFace(BlockFace.EAST), BlockFace.NORTH); this.glassify(block.getRelative(BlockFace.EAST), BlockFace.NORTH);
this.glassify(block.getFace(BlockFace.EAST).getFace(BlockFace.UP), BlockFace.NORTH); this.glassify(block.getRelative(BlockFace.EAST).getRelative(BlockFace.UP), BlockFace.NORTH);
this.glassify(block.getFace(BlockFace.EAST).getFace(BlockFace.DOWN), BlockFace.NORTH); this.glassify(block.getRelative(BlockFace.EAST).getRelative(BlockFace.DOWN), BlockFace.NORTH);
this.glassify(block.getFace(BlockFace.EAST, 2), BlockFace.NORTH); this.glassify(block.getRelative(BlockFace.EAST, 2), BlockFace.NORTH);
this.glassify(block.getFace(BlockFace.EAST, 2).getFace(BlockFace.UP), BlockFace.NORTH); this.glassify(block.getRelative(BlockFace.EAST, 2).getRelative(BlockFace.UP), BlockFace.NORTH);
this.glassify(block.getFace(BlockFace.EAST, 2).getFace(BlockFace.DOWN), BlockFace.NORTH); this.glassify(block.getRelative(BlockFace.EAST, 2).getRelative(BlockFace.DOWN), BlockFace.NORTH);
this.glassify(block.getFace(BlockFace.EAST).getFace(BlockFace.UP, 2), BlockFace.NORTH); this.glassify(block.getRelative(BlockFace.EAST).getRelative(BlockFace.UP, 2), BlockFace.NORTH);
this.glassify(block.getFace(BlockFace.EAST).getFace(BlockFace.DOWN, 2), BlockFace.NORTH); this.glassify(block.getRelative(BlockFace.EAST).getRelative(BlockFace.DOWN, 2), BlockFace.NORTH);
this.glassify(block.getFace(BlockFace.WEST), BlockFace.NORTH); this.glassify(block.getRelative(BlockFace.WEST), BlockFace.NORTH);
this.glassify(block.getFace(BlockFace.WEST).getFace(BlockFace.UP), BlockFace.NORTH); this.glassify(block.getRelative(BlockFace.WEST).getRelative(BlockFace.UP), BlockFace.NORTH);
this.glassify(block.getFace(BlockFace.WEST).getFace(BlockFace.DOWN), BlockFace.NORTH); this.glassify(block.getRelative(BlockFace.WEST).getRelative(BlockFace.DOWN), BlockFace.NORTH);
this.glassify(block.getFace(BlockFace.WEST, 2), BlockFace.NORTH); this.glassify(block.getRelative(BlockFace.WEST, 2), BlockFace.NORTH);
this.glassify(block.getFace(BlockFace.WEST, 2).getFace(BlockFace.UP), BlockFace.NORTH); this.glassify(block.getRelative(BlockFace.WEST, 2).getRelative(BlockFace.UP), BlockFace.NORTH);
this.glassify(block.getFace(BlockFace.WEST, 2).getFace(BlockFace.DOWN), BlockFace.NORTH); this.glassify(block.getRelative(BlockFace.WEST, 2).getRelative(BlockFace.DOWN), BlockFace.NORTH);
this.glassify(block.getFace(BlockFace.WEST).getFace(BlockFace.UP, 2), BlockFace.NORTH); this.glassify(block.getRelative(BlockFace.WEST).getRelative(BlockFace.UP, 2), BlockFace.NORTH);
this.glassify(block.getFace(BlockFace.WEST).getFace(BlockFace.DOWN, 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)) { } else if (this.wall == BlockFace.SOUTH && this.warzone.getVolume().isSouthWallBlock(block)) {
this.glassify(block.getFace(BlockFace.EAST), BlockFace.SOUTH); this.glassify(block.getRelative(BlockFace.EAST), BlockFace.SOUTH);
this.glassify(block.getFace(BlockFace.EAST).getFace(BlockFace.UP), BlockFace.SOUTH); this.glassify(block.getRelative(BlockFace.EAST).getRelative(BlockFace.UP), BlockFace.SOUTH);
this.glassify(block.getFace(BlockFace.EAST).getFace(BlockFace.DOWN), BlockFace.SOUTH); this.glassify(block.getRelative(BlockFace.EAST).getRelative(BlockFace.DOWN), BlockFace.SOUTH);
this.glassify(block.getFace(BlockFace.EAST, 2), BlockFace.SOUTH); this.glassify(block.getRelative(BlockFace.EAST, 2), BlockFace.SOUTH);
this.glassify(block.getFace(BlockFace.EAST, 2).getFace(BlockFace.UP), BlockFace.SOUTH); this.glassify(block.getRelative(BlockFace.EAST, 2).getRelative(BlockFace.UP), BlockFace.SOUTH);
this.glassify(block.getFace(BlockFace.EAST, 2).getFace(BlockFace.DOWN), BlockFace.SOUTH); this.glassify(block.getRelative(BlockFace.EAST, 2).getRelative(BlockFace.DOWN), BlockFace.SOUTH);
this.glassify(block.getFace(BlockFace.EAST).getFace(BlockFace.UP, 2), BlockFace.SOUTH); this.glassify(block.getRelative(BlockFace.EAST).getRelative(BlockFace.UP, 2), BlockFace.SOUTH);
this.glassify(block.getFace(BlockFace.EAST).getFace(BlockFace.DOWN, 2), BlockFace.SOUTH); this.glassify(block.getRelative(BlockFace.EAST).getRelative(BlockFace.DOWN, 2), BlockFace.SOUTH);
this.glassify(block.getFace(BlockFace.WEST), BlockFace.SOUTH); this.glassify(block.getRelative(BlockFace.WEST), BlockFace.SOUTH);
this.glassify(block.getFace(BlockFace.WEST).getFace(BlockFace.UP), BlockFace.SOUTH); this.glassify(block.getRelative(BlockFace.WEST).getRelative(BlockFace.UP), BlockFace.SOUTH);
this.glassify(block.getFace(BlockFace.WEST).getFace(BlockFace.DOWN), BlockFace.SOUTH); this.glassify(block.getRelative(BlockFace.WEST).getRelative(BlockFace.DOWN), BlockFace.SOUTH);
this.glassify(block.getFace(BlockFace.WEST, 2), BlockFace.SOUTH); this.glassify(block.getRelative(BlockFace.WEST, 2), BlockFace.SOUTH);
this.glassify(block.getFace(BlockFace.WEST, 2).getFace(BlockFace.UP), BlockFace.SOUTH); this.glassify(block.getRelative(BlockFace.WEST, 2).getRelative(BlockFace.UP), BlockFace.SOUTH);
this.glassify(block.getFace(BlockFace.WEST, 2).getFace(BlockFace.DOWN), BlockFace.SOUTH); this.glassify(block.getRelative(BlockFace.WEST, 2).getRelative(BlockFace.DOWN), BlockFace.SOUTH);
this.glassify(block.getFace(BlockFace.WEST).getFace(BlockFace.UP, 2), BlockFace.SOUTH); this.glassify(block.getRelative(BlockFace.WEST).getRelative(BlockFace.UP, 2), BlockFace.SOUTH);
this.glassify(block.getFace(BlockFace.WEST).getFace(BlockFace.DOWN, 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)) { } else if (this.wall == BlockFace.EAST && this.warzone.getVolume().isEastWallBlock(block)) {
this.glassify(block.getFace(BlockFace.NORTH), BlockFace.EAST); this.glassify(block.getRelative(BlockFace.NORTH), BlockFace.EAST);
this.glassify(block.getFace(BlockFace.NORTH).getFace(BlockFace.UP), BlockFace.EAST); this.glassify(block.getRelative(BlockFace.NORTH).getRelative(BlockFace.UP), BlockFace.EAST);
this.glassify(block.getFace(BlockFace.NORTH).getFace(BlockFace.DOWN), BlockFace.EAST); this.glassify(block.getRelative(BlockFace.NORTH).getRelative(BlockFace.DOWN), BlockFace.EAST);
this.glassify(block.getFace(BlockFace.NORTH, 2), BlockFace.EAST); this.glassify(block.getRelative(BlockFace.NORTH, 2), BlockFace.EAST);
this.glassify(block.getFace(BlockFace.NORTH, 2).getFace(BlockFace.UP), BlockFace.EAST); this.glassify(block.getRelative(BlockFace.NORTH, 2).getRelative(BlockFace.UP), BlockFace.EAST);
this.glassify(block.getFace(BlockFace.NORTH, 2).getFace(BlockFace.DOWN), BlockFace.EAST); this.glassify(block.getRelative(BlockFace.NORTH, 2).getRelative(BlockFace.DOWN), BlockFace.EAST);
this.glassify(block.getFace(BlockFace.NORTH).getFace(BlockFace.UP, 2), BlockFace.EAST); this.glassify(block.getRelative(BlockFace.NORTH).getRelative(BlockFace.UP, 2), BlockFace.EAST);
this.glassify(block.getFace(BlockFace.NORTH).getFace(BlockFace.DOWN, 2), BlockFace.EAST); this.glassify(block.getRelative(BlockFace.NORTH).getRelative(BlockFace.DOWN, 2), BlockFace.EAST);
this.glassify(block.getFace(BlockFace.SOUTH), BlockFace.EAST); this.glassify(block.getRelative(BlockFace.SOUTH), BlockFace.EAST);
this.glassify(block.getFace(BlockFace.SOUTH).getFace(BlockFace.UP), BlockFace.EAST); this.glassify(block.getRelative(BlockFace.SOUTH).getRelative(BlockFace.UP), BlockFace.EAST);
this.glassify(block.getFace(BlockFace.SOUTH).getFace(BlockFace.DOWN), BlockFace.EAST); this.glassify(block.getRelative(BlockFace.SOUTH).getRelative(BlockFace.DOWN), BlockFace.EAST);
this.glassify(block.getFace(BlockFace.SOUTH, 2), BlockFace.EAST); this.glassify(block.getRelative(BlockFace.SOUTH, 2), BlockFace.EAST);
this.glassify(block.getFace(BlockFace.SOUTH, 2).getFace(BlockFace.UP), BlockFace.EAST); this.glassify(block.getRelative(BlockFace.SOUTH, 2).getRelative(BlockFace.UP), BlockFace.EAST);
this.glassify(block.getFace(BlockFace.SOUTH, 2).getFace(BlockFace.DOWN), BlockFace.EAST); this.glassify(block.getRelative(BlockFace.SOUTH, 2).getRelative(BlockFace.DOWN), BlockFace.EAST);
this.glassify(block.getFace(BlockFace.SOUTH).getFace(BlockFace.UP, 2), BlockFace.EAST); this.glassify(block.getRelative(BlockFace.SOUTH).getRelative(BlockFace.UP, 2), BlockFace.EAST);
this.glassify(block.getFace(BlockFace.SOUTH).getFace(BlockFace.DOWN, 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)) { } else if (this.wall == BlockFace.WEST && this.warzone.getVolume().isWestWallBlock(block)) {
this.glassify(block.getFace(BlockFace.NORTH), BlockFace.WEST); this.glassify(block.getRelative(BlockFace.NORTH), BlockFace.WEST);
this.glassify(block.getFace(BlockFace.NORTH).getFace(BlockFace.UP), BlockFace.WEST); this.glassify(block.getRelative(BlockFace.NORTH).getRelative(BlockFace.UP), BlockFace.WEST);
this.glassify(block.getFace(BlockFace.NORTH).getFace(BlockFace.DOWN), BlockFace.WEST); this.glassify(block.getRelative(BlockFace.NORTH).getRelative(BlockFace.DOWN), BlockFace.WEST);
this.glassify(block.getFace(BlockFace.NORTH, 2), BlockFace.WEST); this.glassify(block.getRelative(BlockFace.NORTH, 2), BlockFace.WEST);
this.glassify(block.getFace(BlockFace.NORTH, 2).getFace(BlockFace.UP), BlockFace.WEST); this.glassify(block.getRelative(BlockFace.NORTH, 2).getRelative(BlockFace.UP), BlockFace.WEST);
this.glassify(block.getFace(BlockFace.NORTH, 2).getFace(BlockFace.DOWN), BlockFace.WEST); this.glassify(block.getRelative(BlockFace.NORTH, 2).getRelative(BlockFace.DOWN), BlockFace.WEST);
this.glassify(block.getFace(BlockFace.NORTH).getFace(BlockFace.UP, 2), BlockFace.WEST); this.glassify(block.getRelative(BlockFace.NORTH).getRelative(BlockFace.UP, 2), BlockFace.WEST);
this.glassify(block.getFace(BlockFace.NORTH).getFace(BlockFace.DOWN, 2), BlockFace.WEST); this.glassify(block.getRelative(BlockFace.NORTH).getRelative(BlockFace.DOWN, 2), BlockFace.WEST);
this.glassify(block.getFace(BlockFace.SOUTH), BlockFace.WEST); this.glassify(block.getRelative(BlockFace.SOUTH), BlockFace.WEST);
this.glassify(block.getFace(BlockFace.SOUTH).getFace(BlockFace.UP), BlockFace.WEST); this.glassify(block.getRelative(BlockFace.SOUTH).getRelative(BlockFace.UP), BlockFace.WEST);
this.glassify(block.getFace(BlockFace.SOUTH).getFace(BlockFace.DOWN), BlockFace.WEST); this.glassify(block.getRelative(BlockFace.SOUTH).getRelative(BlockFace.DOWN), BlockFace.WEST);
this.glassify(block.getFace(BlockFace.SOUTH, 2), BlockFace.WEST); this.glassify(block.getRelative(BlockFace.SOUTH, 2), BlockFace.WEST);
this.glassify(block.getFace(BlockFace.SOUTH, 2).getFace(BlockFace.UP), BlockFace.WEST); this.glassify(block.getRelative(BlockFace.SOUTH, 2).getRelative(BlockFace.UP), BlockFace.WEST);
this.glassify(block.getFace(BlockFace.SOUTH, 2).getFace(BlockFace.DOWN), BlockFace.WEST); this.glassify(block.getRelative(BlockFace.SOUTH, 2).getRelative(BlockFace.DOWN), BlockFace.WEST);
this.glassify(block.getFace(BlockFace.SOUTH).getFace(BlockFace.UP, 2), BlockFace.WEST); this.glassify(block.getRelative(BlockFace.SOUTH).getRelative(BlockFace.UP, 2), BlockFace.WEST);
this.glassify(block.getFace(BlockFace.SOUTH).getFace(BlockFace.DOWN, 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)) { } else if (this.wall == BlockFace.UP && this.warzone.getVolume().isUpWallBlock(block)) {
this.glassify(block.getFace(BlockFace.EAST), BlockFace.UP); this.glassify(block.getRelative(BlockFace.EAST), BlockFace.UP);
this.glassify(block.getFace(BlockFace.EAST, 2), BlockFace.UP); this.glassify(block.getRelative(BlockFace.EAST, 2), BlockFace.UP);
this.glassify(block.getFace(BlockFace.WEST), BlockFace.UP); this.glassify(block.getRelative(BlockFace.WEST), BlockFace.UP);
this.glassify(block.getFace(BlockFace.WEST, 2), BlockFace.UP); this.glassify(block.getRelative(BlockFace.WEST, 2), BlockFace.UP);
this.glassify(block.getFace(BlockFace.NORTH), BlockFace.UP); this.glassify(block.getRelative(BlockFace.NORTH), BlockFace.UP);
this.glassify(block.getFace(BlockFace.NORTH).getFace(BlockFace.EAST), BlockFace.UP); this.glassify(block.getRelative(BlockFace.NORTH).getRelative(BlockFace.EAST), BlockFace.UP);
this.glassify(block.getFace(BlockFace.NORTH).getFace(BlockFace.WEST), BlockFace.UP); this.glassify(block.getRelative(BlockFace.NORTH).getRelative(BlockFace.WEST), BlockFace.UP);
this.glassify(block.getFace(BlockFace.NORTH, 2), BlockFace.UP); this.glassify(block.getRelative(BlockFace.NORTH, 2), BlockFace.UP);
this.glassify(block.getFace(BlockFace.NORTH, 2).getFace(BlockFace.EAST), BlockFace.UP); this.glassify(block.getRelative(BlockFace.NORTH, 2).getRelative(BlockFace.EAST), BlockFace.UP);
this.glassify(block.getFace(BlockFace.NORTH, 2).getFace(BlockFace.WEST), BlockFace.UP); this.glassify(block.getRelative(BlockFace.NORTH, 2).getRelative(BlockFace.WEST), BlockFace.UP);
this.glassify(block.getFace(BlockFace.NORTH).getFace(BlockFace.EAST, 2), BlockFace.UP); this.glassify(block.getRelative(BlockFace.NORTH).getRelative(BlockFace.EAST, 2), BlockFace.UP);
this.glassify(block.getFace(BlockFace.NORTH).getFace(BlockFace.WEST, 2), BlockFace.UP); this.glassify(block.getRelative(BlockFace.NORTH).getRelative(BlockFace.WEST, 2), BlockFace.UP);
this.glassify(block.getFace(BlockFace.SOUTH), BlockFace.UP); this.glassify(block.getRelative(BlockFace.SOUTH), BlockFace.UP);
this.glassify(block.getFace(BlockFace.SOUTH).getFace(BlockFace.EAST), BlockFace.UP); this.glassify(block.getRelative(BlockFace.SOUTH).getRelative(BlockFace.EAST), BlockFace.UP);
this.glassify(block.getFace(BlockFace.SOUTH).getFace(BlockFace.WEST), BlockFace.UP); this.glassify(block.getRelative(BlockFace.SOUTH).getRelative(BlockFace.WEST), BlockFace.UP);
this.glassify(block.getFace(BlockFace.SOUTH, 2), BlockFace.UP); this.glassify(block.getRelative(BlockFace.SOUTH, 2), BlockFace.UP);
this.glassify(block.getFace(BlockFace.SOUTH, 2).getFace(BlockFace.EAST), BlockFace.UP); this.glassify(block.getRelative(BlockFace.SOUTH, 2).getRelative(BlockFace.EAST), BlockFace.UP);
this.glassify(block.getFace(BlockFace.SOUTH, 2).getFace(BlockFace.WEST), BlockFace.UP); this.glassify(block.getRelative(BlockFace.SOUTH, 2).getRelative(BlockFace.WEST), BlockFace.UP);
this.glassify(block.getFace(BlockFace.SOUTH).getFace(BlockFace.UP, 2), BlockFace.UP); this.glassify(block.getRelative(BlockFace.SOUTH).getRelative(BlockFace.UP, 2), BlockFace.UP);
this.glassify(block.getFace(BlockFace.SOUTH).getFace(BlockFace.DOWN, 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)) { } else if (this.wall == BlockFace.DOWN && this.warzone.getVolume().isDownWallBlock(block)) {
this.glassify(block.getFace(BlockFace.EAST), BlockFace.DOWN); this.glassify(block.getRelative(BlockFace.EAST), BlockFace.DOWN);
this.glassify(block.getFace(BlockFace.EAST, 2), BlockFace.DOWN); this.glassify(block.getRelative(BlockFace.EAST, 2), BlockFace.DOWN);
this.glassify(block.getFace(BlockFace.WEST), BlockFace.DOWN); this.glassify(block.getRelative(BlockFace.WEST), BlockFace.DOWN);
this.glassify(block.getFace(BlockFace.WEST, 2), BlockFace.DOWN); this.glassify(block.getRelative(BlockFace.WEST, 2), BlockFace.DOWN);
this.glassify(block.getFace(BlockFace.NORTH), BlockFace.DOWN); this.glassify(block.getRelative(BlockFace.NORTH), BlockFace.DOWN);
this.glassify(block.getFace(BlockFace.NORTH).getFace(BlockFace.EAST), BlockFace.DOWN); this.glassify(block.getRelative(BlockFace.NORTH).getRelative(BlockFace.EAST), BlockFace.DOWN);
this.glassify(block.getFace(BlockFace.NORTH).getFace(BlockFace.WEST), BlockFace.DOWN); this.glassify(block.getRelative(BlockFace.NORTH).getRelative(BlockFace.WEST), BlockFace.DOWN);
this.glassify(block.getFace(BlockFace.NORTH, 2), BlockFace.DOWN); this.glassify(block.getRelative(BlockFace.NORTH, 2), BlockFace.DOWN);
this.glassify(block.getFace(BlockFace.NORTH, 2).getFace(BlockFace.EAST), BlockFace.DOWN); this.glassify(block.getRelative(BlockFace.NORTH, 2).getRelative(BlockFace.EAST), BlockFace.DOWN);
this.glassify(block.getFace(BlockFace.NORTH, 2).getFace(BlockFace.WEST), BlockFace.DOWN); this.glassify(block.getRelative(BlockFace.NORTH, 2).getRelative(BlockFace.WEST), BlockFace.DOWN);
this.glassify(block.getFace(BlockFace.NORTH).getFace(BlockFace.EAST, 2), BlockFace.DOWN); this.glassify(block.getRelative(BlockFace.NORTH).getRelative(BlockFace.EAST, 2), BlockFace.DOWN);
this.glassify(block.getFace(BlockFace.NORTH).getFace(BlockFace.WEST, 2), BlockFace.DOWN); this.glassify(block.getRelative(BlockFace.NORTH).getRelative(BlockFace.WEST, 2), BlockFace.DOWN);
this.glassify(block.getFace(BlockFace.SOUTH), BlockFace.DOWN); this.glassify(block.getRelative(BlockFace.SOUTH), BlockFace.DOWN);
this.glassify(block.getFace(BlockFace.SOUTH).getFace(BlockFace.EAST), BlockFace.DOWN); this.glassify(block.getRelative(BlockFace.SOUTH).getRelative(BlockFace.EAST), BlockFace.DOWN);
this.glassify(block.getFace(BlockFace.SOUTH).getFace(BlockFace.WEST), BlockFace.DOWN); this.glassify(block.getRelative(BlockFace.SOUTH).getRelative(BlockFace.WEST), BlockFace.DOWN);
this.glassify(block.getFace(BlockFace.SOUTH, 2), BlockFace.DOWN); this.glassify(block.getRelative(BlockFace.SOUTH, 2), BlockFace.DOWN);
this.glassify(block.getFace(BlockFace.SOUTH, 2).getFace(BlockFace.EAST), BlockFace.DOWN); this.glassify(block.getRelative(BlockFace.SOUTH, 2).getRelative(BlockFace.EAST), BlockFace.DOWN);
this.glassify(block.getFace(BlockFace.SOUTH, 2).getFace(BlockFace.WEST), BlockFace.DOWN); this.glassify(block.getRelative(BlockFace.SOUTH, 2).getRelative(BlockFace.WEST), BlockFace.DOWN);
this.glassify(block.getFace(BlockFace.SOUTH).getFace(BlockFace.DOWN, 2), BlockFace.DOWN); this.glassify(block.getRelative(BlockFace.SOUTH).getRelative(BlockFace.DOWN, 2), BlockFace.DOWN);
this.glassify(block.getFace(BlockFace.SOUTH).getFace(BlockFace.DOWN, 2), BlockFace.DOWN); this.glassify(block.getRelative(BlockFace.SOUTH).getRelative(BlockFace.DOWN, 2), BlockFace.DOWN);
} }
} }
} }

View File

@ -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())); return new ItemStack(team.getKind().getMaterial(), 1, (short) 1, new Byte(team.getKind().getData()));
} }
} }

View File

@ -16,9 +16,10 @@ public class LoadoutResetJob implements Runnable {
this.team = team; this.team = team;
this.player = player; this.player = player;
} }
public void run() { public void run() {
this.zone.equipPlayerLoadoutSelection(player, team); this.zone.equipPlayerLoadoutSelection(player, team);
// Stop fire here, since doing it in the same tick as death doesn't extinguish it // Stop fire here, since doing it in the same tick as death doesn't extinguish it
this.player.setFireTicks(0); this.player.setFireTicks(0);
} }

View File

@ -21,17 +21,17 @@ public class ResetCursorJob implements Runnable {
if (this.isSoutheast) { if (this.isSoutheast) {
this.cornerBlock.setType(this.originalCursorBlocks[0].getType()); this.cornerBlock.setType(this.originalCursorBlocks[0].getType());
this.cornerBlock.setData(this.originalCursorBlocks[0].getData()); this.cornerBlock.setData(this.originalCursorBlocks[0].getData());
this.cornerBlock.getFace(BlockFace.WEST).setType(this.originalCursorBlocks[1].getType()); this.cornerBlock.getRelative(BlockFace.WEST).setType(this.originalCursorBlocks[1].getType());
this.cornerBlock.getFace(BlockFace.WEST).setData(this.originalCursorBlocks[1].getData()); this.cornerBlock.getRelative(BlockFace.WEST).setData(this.originalCursorBlocks[1].getData());
this.cornerBlock.getFace(BlockFace.NORTH).setType(this.originalCursorBlocks[2].getType()); this.cornerBlock.getRelative(BlockFace.NORTH).setType(this.originalCursorBlocks[2].getType());
this.cornerBlock.getFace(BlockFace.NORTH).setData(this.originalCursorBlocks[2].getData()); this.cornerBlock.getRelative(BlockFace.NORTH).setData(this.originalCursorBlocks[2].getData());
} else { } else {
this.cornerBlock.setType(this.originalCursorBlocks[0].getType()); this.cornerBlock.setType(this.originalCursorBlocks[0].getType());
this.cornerBlock.setData(this.originalCursorBlocks[0].getData()); this.cornerBlock.setData(this.originalCursorBlocks[0].getData());
this.cornerBlock.getFace(BlockFace.EAST).setType(this.originalCursorBlocks[1].getType()); this.cornerBlock.getRelative(BlockFace.EAST).setType(this.originalCursorBlocks[1].getType());
this.cornerBlock.getFace(BlockFace.EAST).setData(this.originalCursorBlocks[1].getData()); this.cornerBlock.getRelative(BlockFace.EAST).setData(this.originalCursorBlocks[1].getData());
this.cornerBlock.getFace(BlockFace.SOUTH).setType(this.originalCursorBlocks[2].getType()); this.cornerBlock.getRelative(BlockFace.SOUTH).setType(this.originalCursorBlocks[2].getType());
this.cornerBlock.getFace(BlockFace.SOUTH).setData(this.originalCursorBlocks[2].getData()); this.cornerBlock.getRelative(BlockFace.SOUTH).setData(this.originalCursorBlocks[2].getData());
} }
} }
} }

View File

@ -2,6 +2,10 @@ package com.tommytony.war.jobs;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; 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.Team;
import com.tommytony.war.Warzone; import com.tommytony.war.Warzone;
@ -19,7 +23,14 @@ public class ScoreCapReachedJob implements Runnable {
public void run() { public void run() {
for (Team t : this.zone.getTeams()) { for (Team t : this.zone.getTeams()) {
t.teamcast(this.winnersStr); t.teamcast(this.winnersStr);
boolean isSpoutServer = War.war.isSpoutServer();
for (Player tp : t.getPlayers()) { 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) // Send everyone to rally point (or zone lobby if not rally point)
if (this.zone.getRallyPoint() != null) { if (this.zone.getRallyPoint() != null) {
tp.teleport(this.zone.getRallyPoint()); tp.teleport(this.zone.getRallyPoint());

View File

@ -138,6 +138,11 @@ public class WarMapper {
if (warConfig.keyExists("defaultFlagPointsOnly")) { if (warConfig.keyExists("defaultFlagPointsOnly")) {
War.war.setDefaultFlagPointsOnly(warConfig.getBoolean("defaultFlagPointsOnly")); War.war.setDefaultFlagPointsOnly(warConfig.getBoolean("defaultFlagPointsOnly"));
} }
// defaultFlagMustBeHome
if (warConfig.keyExists("defaultFlagMustBeHome")) {
War.war.setDefaultFlagMustBeHome(warConfig.getBoolean("defaultFlagMustBeHome"));
}
// defaultTeamCap // defaultTeamCap
if (warConfig.keyExists("defaultTeamCap")) { if (warConfig.keyExists("defaultTeamCap")) {
@ -148,6 +153,11 @@ public class WarMapper {
if (warConfig.keyExists("defaultScoreCap")) { if (warConfig.keyExists("defaultScoreCap")) {
War.war.setDefaultScoreCap(warConfig.getInt("defaultScoreCap")); War.war.setDefaultScoreCap(warConfig.getInt("defaultScoreCap"));
} }
// defaultRespawnTimer
if (warConfig.keyExists("defaultRespawnTimer")) {
War.war.setDefaultRespawnTimer(warConfig.getInt("defaultRespawnTimer"));
}
// pvpInZonesOnly // pvpInZonesOnly
if (warConfig.keyExists("pvpInZonesOnly")) { if (warConfig.keyExists("pvpInZonesOnly")) {
@ -346,12 +356,18 @@ public class WarMapper {
// defaultFlagPointsOnly // defaultFlagPointsOnly
warConfig.setBoolean("defaultFlagPointsOnly", War.war.isDefaultFlagPointsOnly()); warConfig.setBoolean("defaultFlagPointsOnly", War.war.isDefaultFlagPointsOnly());
// defaultFlagMustBeHome
warConfig.setBoolean("defaultFlagMustBeHome", War.war.isDefaultFlagMustBeHome());
// defaultTeamCap // defaultTeamCap
warConfig.setInt("defaultTeamCap", War.war.getDefaultTeamCap()); warConfig.setInt("defaultTeamCap", War.war.getDefaultTeamCap());
// defaultScoreCap // defaultScoreCap
warConfig.setInt("defaultScoreCap", War.war.getDefaultScoreCap()); warConfig.setInt("defaultScoreCap", War.war.getDefaultScoreCap());
// defaultRespawnTimer
warConfig.setInt("defaultRespawnTimer", War.war.getDefaultRespawnTimer());
// pvpInZonesOnly // pvpInZonesOnly
warConfig.setBoolean("pvpInZonesOnly", War.war.isPvpInZonesOnly()); warConfig.setBoolean("pvpInZonesOnly", War.war.isPvpInZonesOnly());
@ -364,6 +380,9 @@ public class WarMapper {
// disablePVPMessage // disablePVPMessage
warConfig.setBoolean("disablePvpMessage", War.war.isDisablePvpMessage()); warConfig.setBoolean("disablePvpMessage", War.war.isDisablePvpMessage());
// disableBuildMessage
warConfig.setBoolean("disableBuildMessage", War.war.isDisableBuildMessage());
// tntInZonesOnly // tntInZonesOnly
warConfig.setBoolean("tntInZonesOnly", War.war.isTntInZonesOnly()); warConfig.setBoolean("tntInZonesOnly", War.war.isTntInZonesOnly());
@ -371,7 +390,7 @@ public class WarMapper {
// spawnStyle // spawnStyle
warConfig.setString("spawnStyle", War.war.getDefaultSpawnStyle().toString()); warConfig.setString("spawnStyle", War.war.getDefaultSpawnStyle().toString());
// spawnStyle // flagReturn
warConfig.setString("flagReturn", War.war.getDefaultFlagReturn().toString()); warConfig.setString("flagReturn", War.war.getDefaultFlagReturn().toString());
// defaultReward // defaultReward

View File

@ -180,6 +180,11 @@ public class WarzoneMapper {
if (warzoneConfig.containsKey("flagPointsOnly")) { if (warzoneConfig.containsKey("flagPointsOnly")) {
warzone.setFlagPointsOnly(warzoneConfig.getBoolean("flagPointsOnly")); warzone.setFlagPointsOnly(warzoneConfig.getBoolean("flagPointsOnly"));
} }
// flagMustBeHome
if (warzoneConfig.containsKey("flagMustBeHome")) {
warzone.setFlagMustBeHome(warzoneConfig.getBoolean("flagMustBeHome"));
}
// team cap // team cap
if (warzoneConfig.containsKey("teamCap")) { if (warzoneConfig.containsKey("teamCap")) {
@ -190,6 +195,11 @@ public class WarzoneMapper {
if (warzoneConfig.containsKey("scoreCap")) { if (warzoneConfig.containsKey("scoreCap")) {
warzone.setScoreCap(warzoneConfig.getInt("scoreCap")); warzone.setScoreCap(warzoneConfig.getInt("scoreCap"));
} }
// respawn timer
if (warzoneConfig.containsKey("respawnTimer")) {
warzone.setRespawnTimer(warzoneConfig.getInt("respawnTimer"));
}
// blockHeads // blockHeads
if (warzoneConfig.containsKey("blockHeads")) { if (warzoneConfig.containsKey("blockHeads")) {
@ -459,14 +469,20 @@ public class WarzoneMapper {
// autoAssignOnly // autoAssignOnly
warzoneConfig.setBoolean("autoAssignOnly", warzone.isAutoAssignOnly()); warzoneConfig.setBoolean("autoAssignOnly", warzone.isAutoAssignOnly());
// flagPointsOnly-+ // flagPointsOnly
warzoneConfig.setBoolean("flagPointsOnly", warzone.isFlagPointsOnly()); warzoneConfig.setBoolean("flagPointsOnly", warzone.isFlagPointsOnly());
// flagMustBeHome
warzoneConfig.setBoolean("flagMustBeHome", warzone.isFlagMustBeHome());
// team cap // team cap
warzoneConfig.setInt("teamCap", warzone.getTeamCap()); warzoneConfig.setInt("teamCap", warzone.getTeamCap());
// score cap // score cap
warzoneConfig.setInt("scoreCap", warzone.getScoreCap()); warzoneConfig.setInt("scoreCap", warzone.getScoreCap());
// respawn timer
warzoneConfig.setInt("respawnTimer", warzone.getRespawnTimer());
// blockHeads // blockHeads
warzoneConfig.setBoolean("blockHeads", warzone.isBlockHeads()); warzoneConfig.setBoolean("blockHeads", warzone.isBlockHeads());

View File

@ -169,7 +169,7 @@ public class Volume {
if (oldBlockType == Material.WALL_SIGN.getId() || oldBlockType == Material.SIGN_POST.getId()) { if (oldBlockType == Material.WALL_SIGN.getId() || oldBlockType == Material.SIGN_POST.getId()) {
// Signs // Signs
if (oldBlockType == Material.SIGN_POST.getId() && ((oldBlockData & 0x04) == 0x04) && i + 1 != this.getSizeX()) { 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]; int oldSouthBlockType = this.getBlockTypes()[i + 1][j][k];
byte oldSouthBlockData = this.getBlockDatas()[i + 1][j][k]; byte oldSouthBlockData = this.getBlockDatas()[i + 1][j][k];
if (southBlock.getTypeId() != oldSouthBlockType) { 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()) { } 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 // 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]; int oldSouthBlockType = this.getBlockTypes()[i + 1][j][k];
byte oldSouthBlockData = this.getBlockDatas()[i + 1][j][k]; byte oldSouthBlockData = this.getBlockDatas()[i + 1][j][k];
if (southBlock.getTypeId() != oldSouthBlockType) { if (southBlock.getTypeId() != oldSouthBlockType) {

View File

@ -4,6 +4,7 @@ description: Lets you create TDM and CTF arenas (warzones) for a fast-paced and
author: tommytony author: tommytony
website: war.tommytony.com website: war.tommytony.com
main: bukkit.tommytony.war.War main: bukkit.tommytony.war.War
softdepend: [Spout]
permissions: permissions:
war.*: war.*:
description: Full War permissions. Create and destroy warzones. Change War configuration. description: Full War permissions. Create and destroy warzones. Change War configuration.
@ -265,4 +266,4 @@ commands:
/war zone <zone-name> /war zone <zone-name>
War: War:
description: War> Same as /war. Used as fallback. description: War> Same as /war. Used as fallback.
usage: See /war. usage: See /war.

View File

@ -4,6 +4,7 @@ description: Lets you create TDM and CTF arenas (warzones) for a fast-paced and
author: tommytony author: tommytony
website: war.tommytony.com website: war.tommytony.com
main: bukkit.tommytony.war.War main: bukkit.tommytony.war.War
softdepend: [Spout]
permissions: permissions:
war.*: war.*:
description: Full War permissions. Create and destroy warzones. Change War configuration. description: Full War permissions. Create and destroy warzones. Change War configuration.
@ -265,4 +266,4 @@ commands:
/war zone <zone-name> /war zone <zone-name>
War: War:
description: War> Same as /war. Used as fallback. description: War> Same as /war. Used as fallback.
usage: See /war. usage: See /war.