Finally saving blocks correctly. Load is still a problem.

This commit is contained in:
taoneill 2011-01-14 14:56:38 -05:00
parent f3f596db3c
commit 40f14a7bb0
4 changed files with 15 additions and 6 deletions

View File

@ -56,7 +56,7 @@ public class WarBlockListener extends BlockListener {
// protect warzone lobbies // protect warzone lobbies
if(block != null) { if(block != null) {
for(Warzone wz: war.getWarzones()) { for(Warzone wz: war.getWarzones()) {
if(wz.getLobby().getVolume().contains(block) && !isZoneMaker) { if(wz.getLobby() != null && wz.getLobby().getVolume().contains(block) && !isZoneMaker) {
player.sendMessage(war.str("Can't build here.")); player.sendMessage(war.str("Can't build here."));
event.setCancelled(true); event.setCancelled(true);
} }

View File

@ -197,6 +197,11 @@ public class Warzone {
monument.addMonumentBlocks(); monument.addMonumentBlocks();
} }
// reset lobby
if(lobby != null) {
lobby.initialize();
}
this.setNorthwest(this.getNorthwest()); this.setNorthwest(this.getNorthwest());
this.setSoutheast(this.getSoutheast()); this.setSoutheast(this.getSoutheast());
} }
@ -237,7 +242,7 @@ public class Warzone {
Block under = over.getFace(BlockFace.Down); Block under = over.getFace(BlockFace.Down);
int treeHeight = 0; int treeHeight = 0;
while(!((over.getType() == Material.AIR || over.getType() == Material.LEAVES || over.getType() == Material.WOOD) while(!((over.getType() == Material.AIR || over.getType() == Material.LEAVES || over.getType() == Material.WOOD)
&& (under.getType() != Material.AIR || under.getType() == Material.LEAVES || under.getType() == Material.LEAVES)) && (under.getType() != Material.AIR || under.getType() != Material.LEAVES || under.getType() != Material.WOOD))
&& treeHeight < 40) { && treeHeight < 40) {
over = under; over = under;
under = over.getFace(BlockFace.Down); under = over.getFace(BlockFace.Down);

View File

@ -54,7 +54,9 @@ public class WarMapper {
Warzone zone = WarzoneMapper.load(war, warzoneName, !newWar); // cascade load, only load blocks if warzone exists Warzone zone = WarzoneMapper.load(war, warzoneName, !newWar); // cascade load, only load blocks if warzone exists
war.getWarzones().add(zone); war.getWarzones().add(zone);
zone.getVolume().resetBlocks(); zone.getVolume().resetBlocks();
zone.getLobby().getVolume().resetBlocks(); if(zone.getLobby() != null) {
zone.getLobby().getVolume().resetBlocks();
}
zone.initializeZone(); // is this wise? zone.initializeZone(); // is this wise?
} }
} }

View File

@ -171,7 +171,7 @@ public class WarzoneMapper {
if(loadBlocks && warzone.getNorthwest() != null && warzone.getSoutheast() != null) { if(loadBlocks && warzone.getNorthwest() != null && warzone.getSoutheast() != null) {
// zone blocks // zone blocks
VerticalVolume zoneVolume = VolumeMapper.loadVerticalVolume("zone", warzone.getName(), war, warzone.getWorld()); VerticalVolume zoneVolume = VolumeMapper.loadVerticalVolume(warzone.getName(), warzone.getName(), war, warzone.getWorld());
warzone.setVolume(zoneVolume); warzone.setVolume(zoneVolume);
// monument blocks // monument blocks
@ -185,8 +185,10 @@ public class WarzoneMapper {
} }
// lobby // lobby
Volume lobbyVolume = VolumeMapper.loadVolume("lobby", warzone.getName(), war, world); if(warzone.getLobby() != null) {
warzone.getLobby().setVolume(lobbyVolume); Volume lobbyVolume = VolumeMapper.loadVolume("lobby", warzone.getName(), war, world);
warzone.getLobby().setVolume(lobbyVolume);
}
//war.getLogger().info("Loaded warzone " + name + " config and blocks."); //war.getLogger().info("Loaded warzone " + name + " config and blocks.");
} else { } else {