Started testing with beta 1.2_01. Warzone makers dont get bothered wiht zone wall blocks anymore. Fixed config file names.

This commit is contained in:
taoneill 2011-01-14 10:31:16 -05:00
parent 4222b2eedf
commit 0753f76350
4 changed files with 72 additions and 46 deletions

View File

@ -326,8 +326,19 @@ public class WarPlayerListener extends PlayerListener {
} else {
Warzone warzone = war.warzone(player.getLocation());
BlockFace wall = null;
String wallStr = "";
if(arguments[0].equals("north") || arguments[0].equals("n")) {
wall = BlockFace.North;
wallStr = "north";
} else if(arguments[0].equals("east") || arguments[0].equals("e")) {
wall = BlockFace.East;
wallStr = "east";
} else if(arguments[0].equals("south") || arguments[0].equals("s")) {
wall = BlockFace.South;
wallStr = "south";
} else if(arguments[0].equals("west") || arguments[0].equals("w")) {
wall = BlockFace.West;
wallStr = "west";
}
ZoneLobby lobby = warzone.getLobby();
if(lobby != null) {
@ -335,6 +346,13 @@ public class WarPlayerListener extends PlayerListener {
lobby.getVolume().resetBlocks();
lobby.setWall(wall);
lobby.initialize();
player.sendMessage(war.str("Warzone lobby moved to " + wallStr + "side of zone."));
} else {
// new lobby
lobby = new ZoneLobby(war, warzone, wall);
warzone.setLobby(lobby);
lobby.initialize();
player.sendMessage(war.str("Warzone lobby created on " + wallStr + "side of zone."));
}
WarzoneMapper.save(war, warzone, false);
}
@ -536,7 +554,7 @@ public class WarPlayerListener extends PlayerListener {
// Zone walls
if(to != null) {
Warzone nearbyZone = war.zoneOfZoneWallAtProximity(to);
if(nearbyZone != null) {
if(nearbyZone != null && !war.isZoneMaker(player.getName())) { // zone makers don't get bothered with guard walls
nearbyZone.protectZoneWallAgainstPlayer(player);
} else {
// make sure to delete any wall guards as you leave
@ -563,50 +581,55 @@ public class WarPlayerListener extends PlayerListener {
if(to != null) {
// Warzone lobby gates
for(Warzone zone : war.getWarzones()){
if(zone.getLobby().isAutoAssignGate(to)) {
dropFromOldTeamIfAny(player);
zone.autoAssign(player);
} else if (zone.getLobby().isInTeamGate(TeamMaterials.TEAMDIAMOND, to)){
dropFromOldTeamIfAny(player);
Team diamondTeam = zone.getTeamByMaterial(TeamMaterials.TEAMDIAMOND);
diamondTeam.addPlayer(player);
zone.keepPlayerInventory(player);
player.sendMessage(war.str("Your inventory is is storage until you /leave."));
zone.respawnPlayer(diamondTeam, player);
for(Team team : zone.getTeams()){
team.teamcast(war.str("" + player.getName() + " joined team diamond."));
if(zone.getLobby() != null) {
if(zone.getLobby().isAutoAssignGate(to)) {
dropFromOldTeamIfAny(player);
zone.autoAssign(player);
} else if (zone.getLobby().isInTeamGate(TeamMaterials.TEAMDIAMOND, to)){
dropFromOldTeamIfAny(player);
Team diamondTeam = zone.getTeamByMaterial(TeamMaterials.TEAMDIAMOND);
diamondTeam.addPlayer(player);
zone.keepPlayerInventory(player);
player.sendMessage(war.str("Your inventory is is storage until you /leave."));
zone.respawnPlayer(diamondTeam, player);
for(Team team : zone.getTeams()){
team.teamcast(war.str("" + player.getName() + " joined team diamond."));
}
} else if (zone.getLobby().isInTeamGate(TeamMaterials.TEAMIRON, to)){
dropFromOldTeamIfAny(player);
Team ironTeam = zone.getTeamByMaterial(TeamMaterials.TEAMIRON);
ironTeam.addPlayer(player);
zone.keepPlayerInventory(player);
player.sendMessage(war.str("Your inventory is is storage until you /leave."));
zone.respawnPlayer(ironTeam, player);
for(Team team : zone.getTeams()){
team.teamcast(war.str("" + player.getName() + " joined team iron."));
}
} else if (zone.getLobby().isInTeamGate(TeamMaterials.TEAMGOLD, to)){
dropFromOldTeamIfAny(player);
Team goldTeam = zone.getTeamByMaterial(TeamMaterials.TEAMGOLD);
goldTeam.addPlayer(player);
zone.keepPlayerInventory(player);
player.sendMessage(war.str("Your inventory is is storage until you /leave."));
zone.respawnPlayer(goldTeam, player);
for(Team team : zone.getTeams()){
team.teamcast(war.str("" + player.getName() + " joined team gold."));
}
} else if (zone.getLobby().isInWarHubLinkGate(to)){
dropFromOldTeamIfAny(player);
player.teleportTo(war.getWarHub().getLocation());
}
} else if (zone.getLobby().isInTeamGate(TeamMaterials.TEAMIRON, to)){
dropFromOldTeamIfAny(player);
Team ironTeam = zone.getTeamByMaterial(TeamMaterials.TEAMIRON);
ironTeam.addPlayer(player);
zone.keepPlayerInventory(player);
player.sendMessage(war.str("Your inventory is is storage until you /leave."));
zone.respawnPlayer(ironTeam, player);
for(Team team : zone.getTeams()){
team.teamcast(war.str("" + player.getName() + " joined team iron."));
}
} else if (zone.getLobby().isInTeamGate(TeamMaterials.TEAMGOLD, to)){
dropFromOldTeamIfAny(player);
Team goldTeam = zone.getTeamByMaterial(TeamMaterials.TEAMGOLD);
goldTeam.addPlayer(player);
zone.keepPlayerInventory(player);
player.sendMessage(war.str("Your inventory is is storage until you /leave."));
zone.respawnPlayer(goldTeam, player);
for(Team team : zone.getTeams()){
team.teamcast(war.str("" + player.getName() + " joined team gold."));
}
} else if (zone.getLobby().isInWarHubLinkGate(to)){
dropFromOldTeamIfAny(player);
player.teleportTo(war.getWarHub().getLocation());
}
}
// Warhub zone gates
WarHub hub = war.getWarHub();
Warzone zone = hub.getDestinationWarzoneForLocation(player.getLocation());
if(zone != null) {
player.teleportTo(zone.getTeleport());
player.sendMessage(war.str("Welcome to warzone " + zone.getName() + "."));
if(hub != null) {
Warzone zone = hub.getDestinationWarzoneForLocation(player.getLocation());
if(zone != null) {
player.teleportTo(zone.getTeleport());
player.sendMessage(war.str("Welcome to warzone " + zone.getName() + "."));
}
}
}
}

View File

@ -103,7 +103,7 @@ public class ZoneLobby {
this.volume.setCornerOne(corner1);
this.volume.setCornerTwo(corner2);
this.volume.saveBlocks();
VolumeMapper.save(volume, "lobby", war);
VolumeMapper.save(volume, warzone.getName(), war);
// flatten the area (set all but floor to air, then replace any floor air blocks with glass)
this.volume.setToMaterial(Material.AIR);

View File

@ -169,12 +169,12 @@ public class WarzoneMapper {
if(loadBlocks && warzone.getNorthwest() != null && warzone.getSoutheast() != null) {
// zone blocks
VerticalVolume zoneVolume = VolumeMapper.loadVerticalVolume(warzone.getName(), "zone", war, warzone.getWorld());
VerticalVolume zoneVolume = VolumeMapper.loadVerticalVolume("zone", warzone.getName(), war, warzone.getWorld());
warzone.setVolume(zoneVolume);
// monument blocks
for(Monument monument: warzone.getMonuments()) {
monument.setVolume(VolumeMapper.loadCenteredVolume(warzone.getName(), monument.getName(), 7, war, world));
monument.setVolume(VolumeMapper.loadCenteredVolume(monument.getName(),warzone.getName(), 7, war, world));
}
// team spawn blocks
@ -196,6 +196,7 @@ public class WarzoneMapper {
}
public static void save(War war, Warzone warzone, boolean saveBlocks) {
(new File(war.getName()+"/warzone-"+warzone.getName())).mkdir();
PropertiesFile warzoneConfig = new PropertiesFile(war.getName() + "/warzone-" + warzone.getName() + "/warzone-" + warzone.getName() + ".txt");
//war.getLogger().info("Saving warzone " + warzone.getName() + "...");
@ -279,9 +280,8 @@ public class WarzoneMapper {
warzoneConfig.close();
if(saveBlocks) {
(new File(war.getName()+"/"+warzone.getName())).mkdir();
// zone blocks
VolumeMapper.save(warzone.getVolume(), "zone", war);
VolumeMapper.save(warzone.getVolume(), warzone.getName(), war);
// monument blocks
for(Monument monument: monuments) {

View File

@ -0,0 +1,3 @@
name: War
main: bukkit.tommytony.war.War
version: 0.3