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
if(block != null) {
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."));
event.setCancelled(true);
}

View File

@ -196,6 +196,11 @@ public class Warzone {
monument.remove();
monument.addMonumentBlocks();
}
// reset lobby
if(lobby != null) {
lobby.initialize();
}
this.setNorthwest(this.getNorthwest());
this.setSoutheast(this.getSoutheast());
@ -237,7 +242,7 @@ public class Warzone {
Block under = over.getFace(BlockFace.Down);
int treeHeight = 0;
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) {
over = under;
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
war.getWarzones().add(zone);
zone.getVolume().resetBlocks();
zone.getLobby().getVolume().resetBlocks();
if(zone.getLobby() != null) {
zone.getLobby().getVolume().resetBlocks();
}
zone.initializeZone(); // is this wise?
}
}

View File

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