Esempio n. 1
0
 public void onCreatureSpawn(CreatureSpawnEvent event) {
   Location location = event.getLocation();
   Warzone zone = war.warzone(location);
   if (zone != null && zone.isNoCreatures()) {
     event.setCancelled(true);
     // war.logInfo("Prevented " + event.getMobType().getName() + " from spawning in zone " +
     // zone.getName());
   }
 }
Esempio n. 2
0
 public void onEntityDeath(EntityDeathEvent event) {
   Entity e = event.getEntity();
   if (e instanceof Player) {
     Player player = (Player) e;
     Team team = war.getPlayerTeam(player.getName());
     if (team != null) {
       Warzone zone = war.getPlayerTeamWarzone(player.getName());
       zone.handleDeath(player);
       //				if(zone.isDropLootOnDeath()) {
       //					war.getServer().getScheduler().scheduleAsyncDelayedTask(war,
       //							new LootDropperTask(player.getLocation(), event.getDrops()),
       //							750);
       //				}
       event.getDrops().clear(); // no loot
     }
   }
 }
Esempio n. 3
0
 @Override
 public boolean handle() {
   if (!(this.getSender() instanceof Player)) {
     this.badMsg("You can't do this if you are not in-game.");
     return true;
   }
   if (this.args.length != 0) {
     return false;
   }
   Player player = (Player) this.getSender();
   if (War.war.getWarHub() == null) {
     this.badMsg("No warhub on this War server. Try /zones and /zone.");
   } else if (!War.war.canWarp(player)) {
     this.badMsg("Can't warp to warhub. You need the 'war.warp' permission.");
   } else {
     Warzone playerWarzone = Warzone.getZoneByPlayerName(player.getName());
     if (playerWarzone != null) { // was in zone
       playerWarzone.handlePlayerLeave(player, War.war.getWarHub().getLocation(), true);
     }
     player.teleport(War.war.getWarHub().getLocation());
   }
   return true;
 }
Esempio n. 4
0
 public void onEntityExplode(EntityExplodeEvent event) {
   // protect zones elements, lobbies and warhub from creepers
   List<Block> explodedBlocks = event.blockList();
   for (Block block : explodedBlocks) {
     if (war.getWarHub() != null && war.getWarHub().getVolume().contains(block)) {
       event.setCancelled(true);
       war.logInfo("Explosion prevented at warhub.");
       return;
     }
     for (Warzone zone : war.getWarzones()) {
       if (zone.isImportantBlock(block)) {
         event.setCancelled(true);
         war.logInfo("Explosion prevented in zone " + zone.getName() + ".");
         return;
       } else if (zone.getLobby() != null && zone.getLobby().getVolume().contains(block)) {
         event.setCancelled(true);
         war.logInfo("Explosion prevented at zone " + zone.getName() + " lobby.");
         return;
       }
     }
   }
 }
Esempio n. 5
0
  private void handlerAttackDefend(EntityDamageByEntityEvent event) {
    Entity attacker = event.getDamager();
    Entity defender = event.getEntity();

    if (attacker != null
        && defender != null
        && attacker instanceof Player
        && defender instanceof Player) {
      // only let adversaries (same warzone, different team) attack each other
      Player a = (Player) attacker;
      Player d = (Player) defender;
      Warzone attackerWarzone = war.getPlayerTeamWarzone(a.getName());
      Team attackerTeam = war.getPlayerTeam(a.getName());
      Warzone defenderWarzone = war.getPlayerTeamWarzone(d.getName());
      Team defenderTeam = war.getPlayerTeam(d.getName());
      if (attackerTeam != null
          && defenderTeam != null
          && attackerTeam != defenderTeam
          && attackerWarzone == defenderWarzone) {
        // Make sure one of the players isn't in the spawn
        //				if(!){
        //				// A real attack: handle death scenario. ==> now handled in entity damage as well
        //				//synchronized(d) {
        ////					if(d.getHealth() <= 0) {
        //////						// Player died, loot him!
        //////						PlayerInventory attackerInv = a.getInventory();
        //////						PlayerInventory defenderInv = d.getInventory();
        //////						HashMap<Integer, ItemStack> noMorePlace = new HashMap<Integer, ItemStack>();
        //////						for(ItemStack stack : defenderInv.getContents()) {
        //////							HashMap<Integer, ItemStack> newNoMorePlace = attackerInv.addItem(stack);
        //////							noMorePlace.putAll(newNoMorePlace);
        //////						}
        //////
        //////						// attacker inventory is full, drop the rest.
        //////						if(!noMorePlace.isEmpty()) {
        //////							for(Integer key : noMorePlace.keySet()) {
        //////								ItemStack toDrop = noMorePlace.get(key);
        //////								defender.getWorld().dropItem(defender.getLocation(), toDrop);
        //////							}
        //////						}
        ////
        ////						handleDeath(d, defenderWarzone, defenderTeam);
        ////						event.setCancelled(true);
        //					//}
        //				}
        if (defenderTeam.getSpawnVolume().contains(d.getLocation())) { // attacking person in spawn
          war.badMsg(a, "Can't attack a player that's inside his team's spawn.");
          event.setCancelled(true);
        } else if (attackerTeam.getSpawnVolume().contains(a.getLocation())
            && !attackerTeam.getSpawnVolume().contains(d.getLocation())) {
          // only let a player inside spawn attack an enemy player if that player enters the spawn
          war.badMsg(a, "Can't attack a player from inside your spawn.");
          event.setCancelled(true);
        }
        // }
      } else if (attackerTeam != null
          && defenderTeam != null
          && attackerTeam == defenderTeam
          && attackerWarzone == defenderWarzone
          && attacker.getEntityId() != defender.getEntityId()) {
        // same team, but not same person
        if (attackerWarzone.getFriendlyFire()) {
          war.badMsg(
              a,
              "Friendly fire is on! Please, don't hurt your teammates."); // if ff is on, let the
                                                                          // attack go through
        } else {
          war.badMsg(a, "Your attack missed! Your target is on your team.");
          event.setCancelled(true); // ff is off
        }
      } else if (attackerTeam == null && defenderTeam == null && !war.isPvpInZonesOnly()) {
        // let normal PVP through is its not turned off
      } else if (attackerTeam == null && defenderTeam == null && war.isPvpInZonesOnly()) {
        war.badMsg(
            a,
            "Your attack missed! Global PVP is turned off. You can only attack other players in warzones. Try /warhub, /zones and /zone.");
        event.setCancelled(true); // global pvp is off
      } else {
        war.badMsg(a, "Your attack missed!");
        if (attackerTeam == null) {
          war.badMsg(
              a,
              "You must join a team "
                  + ", then you'll be able to damage people "
                  + "in the other teams in that warzone.");
        } else if (defenderTeam == null) {
          war.badMsg(a, "Your target is not in a team.");
        } else if (attackerTeam == defenderTeam) {
          war.badMsg(a, "Your target is on your team.");
        } else if (attackerWarzone != defenderWarzone) {
          war.badMsg(a, "Your target is playing in another warzone.");
        }
        event.setCancelled(true); // can't attack someone inside a warzone if you're not in a team
      }

      //			if(event.isCancelled() && event instanceof EntityDamageByProjectileEvent) {
      //				//((EntityDamageByProjectileEvent)event).setBounce(true);
      //			}
    }
  }
Esempio n. 6
0
  /** @see Runnable.run() */
  public void run() {
    if (!War.war.isLoaded()) {
      return;
    }
    for (Warzone zone : War.war.getWarzones()) {
      for (Team team : zone.getTeams()) {
        for (Player player : team.getPlayers()) {
          PlayerInventory playerInv = player.getInventory();
          Material teamBlockMaterial;
          if (zone.getWarzoneConfig().getBoolean(WarzoneConfig.BLOCKHEADS)) {
            teamBlockMaterial = team.getKind().getMaterial();
            // 1) Replace missing block head
            if (playerInv.getHelmet().getType() != teamBlockMaterial) {
              playerInv.setHelmet(this.createBlockHead(team));
            }
            // 2) Get rid of extra blocks in inventory: only keep one
            HashMap<Integer, ? extends ItemStack> blocks = playerInv.all(teamBlockMaterial);
            if (blocks.size() > 1
                || (blocks.size() == 1
                    && blocks.get(blocks.keySet().iterator().next()).getAmount() > 1)) {
              int i = 0;
              int removed = 0;
              for (ItemStack item : playerInv.getContents()) {
                // remove only same colored wool
                if (item != null
                    && item.getType() == teamBlockMaterial
                    && item.getData().getData() == team.getKind().getData()) {
                  playerInv.clear(i);
                  removed++;
                }
                i++;
              }

              int firstEmpty = playerInv.firstEmpty();
              if (firstEmpty > 0) {
                playerInv.setItem(firstEmpty, this.createBlockHead(team));
              }

              if (removed > 1) {
                War.war.badMsg(
                    player, "All that " + team.getName() + " wool must have been heavy!");
              }
            }
          } else {
            // enfore helmet (good thing?)
            if (team.getKind() == TeamKind.GOLD) {
              teamBlockMaterial = Material.GOLD_HELMET;
            } else if (team.getKind() == TeamKind.DIAMOND) {
              teamBlockMaterial = Material.DIAMOND_HELMET;
            } else if (team.getKind() == TeamKind.IRON) {
              teamBlockMaterial = Material.IRON_HELMET;
            } else {
              teamBlockMaterial = Material.LEATHER_HELMET;
            }
            if (playerInv.getHelmet() != null
                && playerInv.getHelmet().getType() != teamBlockMaterial) {
              playerInv.setHelmet(new ItemStack(teamBlockMaterial));
            }
            HashMap<Integer, ? extends ItemStack> helmets = playerInv.all(teamBlockMaterial);
            if (helmets.size() > 1
                || (helmets.size() == 1
                    && helmets.get(helmets.keySet().iterator().next()).getAmount() > 1)) {
              playerInv.remove(teamBlockMaterial);
              playerInv.setItem(playerInv.firstEmpty(), new ItemStack(teamBlockMaterial));
              War.war.badMsg(player, "All those helmets must have been heavy!");
            }
          }

          // check for thieves without their treasure in their hands
          if (zone.isFlagThief(player.getName())) {
            Team victim = zone.getVictimTeamForFlagThief(player.getName());
            player.setItemInHand(null);
            player
                .getInventory()
                .addItem(
                    new ItemStack(
                        victim.getKind().getMaterial(),
                        2240,
                        victim.getKind().getData(),
                        victim.getKind().getData()));
          } else if (zone.isBombThief(player.getName())) {
            player.setItemInHand(null);
            player.getInventory().addItem(new ItemStack(Material.TNT, 2240));
          } else if (zone.isCakeThief(player.getName())) {
            player.setItemInHand(null);
            player.getInventory().addItem(new ItemStack(Material.CAKE_BLOCK, 2240));
          }
        }
      }
    }
  }
Esempio n. 7
0
  public static Warzone load(String name, boolean createNewVolume) {
    // war.getLogger().info("Loading warzone " + name + " config and blocks...");
    PropertiesFile warzoneConfig =
        new PropertiesFile(War.war.getDataFolder().getPath() + "/warzone-" + name + ".txt");
    try {
      warzoneConfig.load();
    } catch (IOException e) {
      War.war.getLogger().info("Failed to load warzone-" + name + ".txt file.");
      e.printStackTrace();
    }

    // world
    String worldStr = warzoneConfig.getProperty("world");
    World world = null;
    if (worldStr == null || worldStr.equals("")) {
      world = War.war.getServer().getWorlds().get(0); // default to first world
    } else {
      world = War.war.getServer().getWorld(worldStr);
    }

    if (world == null) {
      War.war.log(
          "Failed to restore warzone "
              + name
              + ". The specified world (name: "
              + worldStr
              + ") does not exist!",
          Level.WARNING);
    } else {
      // Create the zone
      Warzone warzone = new Warzone(world, name);

      // Create file if needed
      if (!warzoneConfig.containsKey("name")) {
        WarzoneTxtMapper.save(warzone, false);
        War.war.getLogger().info("Warzone " + name + " config file created.");
        try {
          warzoneConfig.load();
        } catch (IOException e) {
          // war.getLogger().info("Failed to reload warzone-" + name + ".txt file after creating
          // it.");
          e.printStackTrace();
        }
      }

      // teleport
      String teleportStr = warzoneConfig.getString("teleport");
      if (teleportStr != null && !teleportStr.equals("")) {
        String[] teleportSplit = teleportStr.split(",");
        int teleX = Integer.parseInt(teleportSplit[0]);
        int teleY = Integer.parseInt(teleportSplit[1]);
        int teleZ = Integer.parseInt(teleportSplit[2]);
        int yaw = Integer.parseInt(teleportSplit[3]);
        warzone.setTeleport(new Location(world, teleX, teleY, teleZ, yaw, 0));
      }

      // ff
      if (warzoneConfig.containsKey("friendlyFire")) {
        warzone
            .getWarzoneConfig()
            .put(WarzoneConfig.FRIENDLYFIRE, warzoneConfig.getBoolean("friendlyFire"));
      }

      // loadout
      warzone.getDefaultInventories().getLoadouts().clear();

      String loadoutStr = warzoneConfig.getString("loadout");
      if (loadoutStr != null && !loadoutStr.equals("")) {
        warzone
            .getDefaultInventories()
            .getLoadouts()
            .put("default", new HashMap<Integer, ItemStack>());
        LoadoutTxtMapper.fromStringToLoadout(
            loadoutStr, warzone.getDefaultInventories().getLoadouts().get("default"));
      }

      // extraLoadouts
      String extraLoadoutStr = warzoneConfig.getString("extraLoadouts");
      String[] extraLoadoutsSplit = extraLoadoutStr.split(",");

      for (String nameStr : extraLoadoutsSplit) {
        if (nameStr != null && !nameStr.equals("")) {
          warzone
              .getDefaultInventories()
              .getLoadouts()
              .put(nameStr, new HashMap<Integer, ItemStack>());
        }
      }

      for (String extraName : extraLoadoutsSplit) {
        if (extraName != null && !extraName.equals("")) {
          String loadoutString = warzoneConfig.getString(extraName + "Loadout");
          HashMap<Integer, ItemStack> loadout =
              warzone.getDefaultInventories().getLoadouts().get(extraName);
          LoadoutTxtMapper.fromStringToLoadout(loadoutString, loadout);
        }
      }

      // authors
      if (warzoneConfig.containsKey("author") && !warzoneConfig.getString("author").equals("")) {
        for (String authorStr : warzoneConfig.getString("author").split(",")) {
          if (!authorStr.equals("")) {
            warzone.addAuthor(authorStr);
          }
        }
      }

      // life pool (always set after teams, so the teams' remaining lives get initialized properly
      // by this setter)
      if (warzoneConfig.containsKey("lifePool")) {
        warzone.getTeamDefaultConfig().put(TeamConfig.LIFEPOOL, warzoneConfig.getInt("lifePool"));
      }

      // monument heal
      if (warzoneConfig.containsKey("monumentHeal")) {
        warzone
            .getWarzoneConfig()
            .put(WarzoneConfig.MONUMENTHEAL, warzoneConfig.getInt("monumentHeal"));
      }

      // autoAssignOnly
      if (warzoneConfig.containsKey("autoAssignOnly")) {
        warzone
            .getWarzoneConfig()
            .put(WarzoneConfig.AUTOASSIGN, warzoneConfig.getBoolean("autoAssignOnly"));
      }

      // flagPointsOnly
      if (warzoneConfig.containsKey("flagPointsOnly")) {
        warzone
            .getTeamDefaultConfig()
            .put(TeamConfig.FLAGPOINTSONLY, warzoneConfig.getBoolean("flagPointsOnly"));
      }

      // flagMustBeHome
      if (warzoneConfig.containsKey("flagMustBeHome")) {
        warzone
            .getTeamDefaultConfig()
            .put(TeamConfig.FLAGMUSTBEHOME, warzoneConfig.getBoolean("flagMustBeHome"));
      }

      // team cap
      if (warzoneConfig.containsKey("teamCap")) {
        warzone.getTeamDefaultConfig().put(TeamConfig.TEAMSIZE, warzoneConfig.getInt("teamCap"));
      }

      // score cap
      if (warzoneConfig.containsKey("scoreCap")) {
        warzone.getTeamDefaultConfig().put(TeamConfig.MAXSCORE, warzoneConfig.getInt("scoreCap"));
      }

      // respawn timer
      if (warzoneConfig.containsKey("respawnTimer")) {
        warzone
            .getTeamDefaultConfig()
            .put(TeamConfig.RESPAWNTIMER, warzoneConfig.getInt("respawnTimer"));
      }

      // blockHeads
      if (warzoneConfig.containsKey("blockHeads")) {
        warzone
            .getWarzoneConfig()
            .put(WarzoneConfig.BLOCKHEADS, warzoneConfig.getBoolean("blockHeads"));
      }

      // spawnStyle
      String spawnStyle = warzoneConfig.getString("spawnStyle");
      if (spawnStyle != null && !spawnStyle.equals("")) {
        warzone
            .getTeamDefaultConfig()
            .put(TeamConfig.SPAWNSTYLE, TeamSpawnStyle.getStyleFromString(spawnStyle));
      }

      // flagReturn
      String flagReturn = warzoneConfig.getString("flagReturn");
      if (flagReturn != null && !flagReturn.equals("")) {
        warzone
            .getTeamDefaultConfig()
            .put(TeamConfig.FLAGRETURN, FlagReturn.getFromString(flagReturn));
      }

      // reward
      String rewardStr = warzoneConfig.getString("reward");
      if (rewardStr != null && !rewardStr.equals("")) {
        HashMap<Integer, ItemStack> reward = new HashMap<Integer, ItemStack>();
        LoadoutTxtMapper.fromStringToLoadout(rewardStr, reward);
        warzone.getDefaultInventories().setReward(reward);
      }

      // unbreakableZoneBlocks
      if (warzoneConfig.containsKey("unbreakableZoneBlocks")) {
        warzone
            .getWarzoneConfig()
            .put(WarzoneConfig.UNBREAKABLE, warzoneConfig.getBoolean("unbreakableZoneBlocks"));
      }

      // disabled
      if (warzoneConfig.containsKey("disabled")) {
        warzone
            .getWarzoneConfig()
            .put(WarzoneConfig.DISABLED, warzoneConfig.getBoolean("disabled"));
      }

      // noCreatures
      if (warzoneConfig.containsKey("noCreatures")) {
        warzone
            .getWarzoneConfig()
            .put(WarzoneConfig.NOCREATURES, warzoneConfig.getBoolean("noCreatures"));
      }

      // glassWalls
      if (warzoneConfig.containsKey("glassWalls")) {
        warzone
            .getWarzoneConfig()
            .put(WarzoneConfig.GLASSWALLS, warzoneConfig.getBoolean("glassWalls"));
      }

      // pvpInZone
      if (warzoneConfig.containsKey("pvpInZone")) {
        warzone
            .getWarzoneConfig()
            .put(WarzoneConfig.PVPINZONE, warzoneConfig.getBoolean("pvpInZone"));
      }

      // instaBreak
      if (warzoneConfig.containsKey("instaBreak")) {
        warzone
            .getWarzoneConfig()
            .put(WarzoneConfig.INSTABREAK, warzoneConfig.getBoolean("instaBreak"));
      }

      // noDrops
      if (warzoneConfig.containsKey("noDrops")) {
        warzone.getWarzoneConfig().put(WarzoneConfig.NODROPS, warzoneConfig.getBoolean("noDrops"));
      }

      // noHunger
      if (warzoneConfig.containsKey("noHunger")) {
        warzone
            .getTeamDefaultConfig()
            .put(TeamConfig.NOHUNGER, warzoneConfig.getBoolean("noHunger"));
      }

      // saturation
      if (warzoneConfig.containsKey("saturation")) {
        warzone
            .getTeamDefaultConfig()
            .put(TeamConfig.SATURATION, warzoneConfig.getInt("saturation"));
      }

      // minPlayers
      if (warzoneConfig.containsKey("minPlayers")) {
        warzone
            .getWarzoneConfig()
            .put(WarzoneConfig.MINPLAYERS, warzoneConfig.getInt("minPlayers"));
      }

      // minTeams
      if (warzoneConfig.containsKey("minTeams")) {
        warzone.getWarzoneConfig().put(WarzoneConfig.MINTEAMS, warzoneConfig.getInt("minTeams"));
      }

      // resetOnEmpty
      if (warzoneConfig.containsKey("resetOnEmpty")) {
        warzone
            .getWarzoneConfig()
            .put(WarzoneConfig.RESETONEMPTY, warzoneConfig.getBoolean("resetOnEmpty"));
      }

      // resetOnLoad
      if (warzoneConfig.containsKey("resetOnLoad")) {
        warzone
            .getWarzoneConfig()
            .put(WarzoneConfig.RESETONLOAD, warzoneConfig.getBoolean("resetOnLoad"));
      }

      // resetOnUnload
      if (warzoneConfig.containsKey("resetOnUnload")) {
        warzone
            .getWarzoneConfig()
            .put(WarzoneConfig.RESETONUNLOAD, warzoneConfig.getBoolean("resetOnUnload"));
      }

      // rallyPoint
      String rallyPointStr = warzoneConfig.getString("rallyPoint");
      if (rallyPointStr != null && !rallyPointStr.equals("")) {
        String[] rallyPointStrSplit = rallyPointStr.split(",");

        int rpX = Integer.parseInt(rallyPointStrSplit[0]);
        int rpY = Integer.parseInt(rallyPointStrSplit[1]);
        int rpZ = Integer.parseInt(rallyPointStrSplit[2]);
        Location rallyPoint = new Location(world, rpX, rpY, rpZ);
        warzone.setRallyPoint(rallyPoint);
      }

      // monuments
      String monumentsStr = warzoneConfig.getString("monuments");
      if (monumentsStr != null && !monumentsStr.equals("")) {
        String[] monumentsSplit = monumentsStr.split(";");
        warzone.getMonuments().clear();
        for (String monumentStr : monumentsSplit) {
          if (monumentStr != null && !monumentStr.equals("")) {
            String[] monumentStrSplit = monumentStr.split(",");
            int monumentX = Integer.parseInt(monumentStrSplit[1]);
            int monumentY = Integer.parseInt(monumentStrSplit[2]);
            int monumentZ = Integer.parseInt(monumentStrSplit[3]);
            Monument monument =
                new Monument(
                    monumentStrSplit[0],
                    warzone,
                    new Location(world, monumentX, monumentY, monumentZ));
            warzone.getMonuments().add(monument);
          }
        }
      }

      // teams
      String teamsStr = warzoneConfig.getString("teams");
      if (teamsStr != null && !teamsStr.equals("")) {
        String[] teamsSplit = teamsStr.split(";");
        warzone.getTeams().clear();
        for (String teamStr : teamsSplit) {
          if (teamStr != null && !teamStr.equals("")) {
            String[] teamStrSplit = teamStr.split(",");
            int teamX = Integer.parseInt(teamStrSplit[1]);
            int teamY = Integer.parseInt(teamStrSplit[2]);
            int teamZ = Integer.parseInt(teamStrSplit[3]);
            Location teamLocation = new Location(world, teamX, teamY, teamZ);
            if (teamStrSplit.length > 4) {
              int yaw = Integer.parseInt(teamStrSplit[4]);
              teamLocation.setYaw(yaw);
            }
            Team team =
                new Team(
                    teamStrSplit[0],
                    TeamKind.teamKindFromString(teamStrSplit[0]),
                    teamLocation,
                    warzone);
            team.setRemainingLives(warzone.getTeamDefaultConfig().resolveInt(TeamConfig.LIFEPOOL));
            warzone.getTeams().add(team);
          }
        }
      }

      // teamFlags
      String teamFlagsStr = warzoneConfig.getString("teamFlags");
      if (teamFlagsStr != null && !teamFlagsStr.equals("")) {
        String[] teamFlagsSplit = teamFlagsStr.split(";");
        for (String teamFlagStr : teamFlagsSplit) {
          if (teamFlagStr != null && !teamFlagStr.equals("")) {
            String[] teamFlagStrSplit = teamFlagStr.split(",");
            Team team = warzone.getTeamByKind(TeamKind.teamKindFromString(teamFlagStrSplit[0]));
            if (team != null) {
              int teamFlagX = Integer.parseInt(teamFlagStrSplit[1]);
              int teamFlagY = Integer.parseInt(teamFlagStrSplit[2]);
              int teamFlagZ = Integer.parseInt(teamFlagStrSplit[3]);
              Location teamFlagLocation = new Location(world, teamFlagX, teamFlagY, teamFlagZ);
              if (teamFlagStrSplit.length > 4) {
                int yaw = Integer.parseInt(teamFlagStrSplit[4]);
                teamFlagLocation.setYaw(yaw);
              }
              team.setTeamFlag(teamFlagLocation); // this may screw things up
            }
          }
        }
      }

      // lobby
      String lobbyStr = warzoneConfig.getString("lobby");

      warzoneConfig.close();

      if (createNewVolume) {
        ZoneVolume zoneVolume =
            new ZoneVolume(
                warzone.getName(),
                world,
                warzone); // VolumeMapper.loadZoneVolume(warzone.getName(), warzone.getName(), war,
                          // warzone.getWorld(), warzone);
        warzone.setVolume(zoneVolume);
      }

      // monument blocks
      for (Monument monument : warzone.getMonuments()) {
        monument.setVolume(VolumeMapper.loadVolume(monument.getName(), warzone.getName(), world));
      }

      // team spawn blocks
      for (Team team : warzone.getTeams()) {
        team.setSpawnVolume(VolumeMapper.loadVolume(team.getName(), warzone.getName(), world));
        if (team.getTeamFlag() != null) {
          team.setFlagVolume(
              VolumeMapper.loadVolume(team.getName() + "flag", warzone.getName(), world));
        }
      }

      // lobby
      BlockFace lobbyFace = null;
      if (lobbyStr != null && !lobbyStr.equals("")) {
        String[] lobbyStrSplit = lobbyStr.split(",");
        if (lobbyStrSplit.length > 0) {
          // lobby orientation
          if (lobbyStrSplit[0].equals("south")) {
            lobbyFace = Direction.SOUTH();
          } else if (lobbyStrSplit[0].equals("east")) {
            lobbyFace = Direction.EAST();
          } else if (lobbyStrSplit[0].equals("north")) {
            lobbyFace = Direction.NORTH();
          } else if (lobbyStrSplit[0].equals("west")) {
            lobbyFace = Direction.WEST();
          }

          // lobby world
          World lobbyWorld = world; // by default, warzone world
          if (lobbyStrSplit.length > 1) {
            World strWorld = War.war.getServer().getWorld(lobbyStrSplit[1]);
            if (strWorld != null) {
              lobbyWorld = strWorld;
            }
          }

          // create the lobby
          Volume lobbyVolume = VolumeMapper.loadVolume("lobby", warzone.getName(), lobbyWorld);
          ZoneLobby lobby = new ZoneLobby(warzone, lobbyFace, lobbyVolume);
          warzone.setLobby(lobby);
        }
      }

      return warzone;
    }
    return null;
  }