Package com.tommytony.war.structure

Examples of com.tommytony.war.structure.WarHub


      }
    }
    World world = War.war.getServer().getWorld(worldName);
    if (world != null) {
      Location hubLocation = new Location(world, hubX, hubY, hubZ);
      WarHub hub = new WarHub(hubLocation, hubOrientation);
      War.war.setWarHub(hub);
      Volume vol;
      try {
        vol = VolumeMapper.loadVolume("warhub", "", world);
      } catch (SQLException e) {
        throw new RuntimeException(e);
      }
      hub.setVolume(vol);
      hub.getVolume().resetBlocks();
      hub.initialize();

      // In the previous job started by the mapper, warzones were created, but their lobbies are missing the war hub gate (because it didn't exist yet)
      for (Warzone zone : War.war.getWarzones()) {
        if (zone.getLobby() != null) {
          zone.getLobby().getVolume().resetBlocks();
View Full Code Here


      worldName = "DEFAULT";
      world = War.war.getServer().getWorlds().get(0); // default to first world
    }
    if (world != null) {
      Location hubLocation = new Location(world, hubX, hubY, hubZ);
      WarHub hub = new WarHub(hubLocation, hubOrientation);
      War.war.setWarHub(hub);
      Volume vol;
      try {
        vol = VolumeMapper.loadVolume("warhub", "", world);
      } catch (SQLException e) {
        throw new RuntimeException(e);
      }
      hub.setVolume(vol);
      hub.getVolume().resetBlocks();
      hub.initialize();

      // In the previous job started by the mapper, warzones were created, but their lobbies are missing the war hub gate (because it didn't exist yet)
      for (Warzone zone : War.war.getWarzones()) {
        if (zone.getLobby() != null) {
          zone.getLobby().getVolume().resetBlocks();
View Full Code Here

        War.war.getWarHub().setLocation(player.getLocation());
        War.war.getWarHub().initialize();
        this.msg("War hub moved.");
        War.war.log(this.getSender().getName() + " moved the warhub", Level.INFO);
      } else {
        War.war.setWarHub(new WarHub(player.getLocation()));
        War.war.getWarHub().initialize();
        for (Warzone zone : War.war.getWarzones()) {
          if (zone.getLobby() != null) {
            zone.getLobby().getVolume().resetBlocks();
            zone.getLobby().initialize();
View Full Code Here

   
    // whitelisted commands during a game
    warInfoSection.set("commandwhitelist", War.war.getCommandWhitelist());
   
    // warhub
    WarHub hub = War.war.getWarHub();
    if (hub != null) {
      String orientationStr = "";
      switch (hub.getOrientation()) {
        case SOUTH:
          if (Direction.isLegacy) orientationStr = "south";
          else orientationStr = "west"// temp fix for rotating warhub
          break;
        case EAST:
          if (Direction.isLegacy) orientationStr = "east";
          else orientationStr = "south";
          break;
        case NORTH:
          if (Direction.isLegacy) orientationStr = "north";
          else orientationStr = "east";
          break;
        case WEST:
        default:
          if (Direction.isLegacy) orientationStr = "west";
          else orientationStr = "north";
          break;
      }
     
      ConfigurationSection hubConfigSection = warInfoSection.createSection("warhub");
      hubConfigSection.set("x", hub.getLocation().getBlockX());
      hubConfigSection.set("y", hub.getLocation().getBlockY());
      hubConfigSection.set("z", hub.getLocation().getBlockZ());
      hubConfigSection.set("world", hub.getLocation().getWorld().getName());
      hubConfigSection.set("orientation", orientationStr);
     
      hubConfigSection.set("materials.floor", War.war.getWarhubMaterials().getFloorBlock());
      hubConfigSection.set("materials.outline", War.war.getWarhubMaterials().getOutlineBlock());
      hubConfigSection.set("materials.gate", War.war.getWarhubMaterials().getGateBlock());
      hubConfigSection.set("materials.light", War.war.getWarhubMaterials().getLightBlock());

      try {
        VolumeMapper.save(hub.getVolume(), "");
      } catch (SQLException e) {
        // who really even cares
        War.war.getLogger().log(Level.WARNING, "Failed to save warhub volume blocks", e);
      }
    }
View Full Code Here

      event.setTo(War.war.getWarHub().getLocation());
      return;
    }

    // Warhub zone gates
    WarHub hub = War.war.getWarHub();
    if (hub != null && hub.getVolume().contains(player.getLocation())) {
      Warzone zone = hub.getDestinationWarzoneForLocation(playerLoc);
      if (zone != null && zone.getTeleport() != null) {
        if (zone.getWarzoneConfig().getBoolean(WarzoneConfig.AUTOJOIN)
            && zone.getTeams().size() >= 1 && currentTeam == null) {
          if (zone.getWarzoneConfig().getBoolean(WarzoneConfig.DISABLED) || zone.isReinitializing()) {
            War.war.badMsg(player, "join.disabled");
            event.setTo(hub.getLocation());
          } else if (!zone.getWarzoneConfig().getBoolean(WarzoneConfig.JOINMIDBATTLE) && zone.isEnoughPlayers()) {
            War.war.badMsg(player, "join.progress");
            event.setTo(hub.getLocation());
          } else if (zone.isFull()) {
            War.war.badMsg(player, "join.full.all");
            event.setTo(hub.getLocation());
          } else if (zone.isFull(player)) {
            War.war.badMsg(player, "join.permission.all");
            event.setTo(hub.getLocation());
          } else {
            zone.autoAssign(player);
          }
          return;
        }
View Full Code Here

TOP

Related Classes of com.tommytony.war.structure.WarHub

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.