Examples of Warzone


Examples of com.tommytony.war.Warzone

  public void setSoutheast_whenChangingVolumeWithCorner1NeCorner2Sw_shouldMoveCorner1ZAndCorner2X()
      throws NotSoutheastException, TooSmallException, TooBigException {
    // Arrange

    World worldMock = mock(World.class);
    Warzone zoneMock = mock(Warzone.class);
    when(zoneMock.getTeams()).thenReturn(new ArrayList<Team>());
    when(zoneMock.getMonuments()).thenReturn(new ArrayList<Monument>());
    ZoneVolume volume = new ZoneVolume("test", worldMock, zoneMock);
    Location se = new Location(worldMock, 64, 64, -64);

    // Act
    Location existingCorner1 = new Location(worldMock, -32, 32, -32); // ne
View Full Code Here

Examples of com.tommytony.war.Warzone

  public void setSoutheast_whenChangingVolumeWithCorner1SwCorner2Ne_shouldMoveCorner1XAndCorner2Z()
      throws NotSoutheastException, TooSmallException, TooBigException {
    // Arrange

    World worldMock = mock(World.class);
    Warzone zoneMock = mock(Warzone.class);
    when(zoneMock.getTeams()).thenReturn(new ArrayList<Team>());
    when(zoneMock.getMonuments()).thenReturn(new ArrayList<Monument>());
    ZoneVolume volume = new ZoneVolume("test", worldMock, zoneMock);
    Location se = new Location(worldMock, 64, 64, -64);

    // Act
    Location existingCorner1 = new Location(worldMock, 32, 32, 32); // sw
View Full Code Here

Examples of com.tommytony.war.Warzone

  public void updateStats(Player player) {
    SpoutPlayer sp = SpoutManager.getPlayer(player);
    if (sp.isSpoutCraftEnabled()) {
      List<Integer> statsOffset = new ArrayList<Integer>();
      Warzone zone = Warzone.getZoneByPlayerName(player.getName());
      List<GenericLabel> statsLines = getStatsLines(zone, statsOffset);
      drawMessages(sp.getName(), statsLines, statsOffset);
    }
  }
View Full Code Here

Examples of com.tommytony.war.Warzone

      // update stats panel
      drawStats(player, statsLines);
     
      // finally messages
      if (messages != null && messages.size() > 0) {
        Warzone zone = Warzone.getZoneByPlayerName(playerName);     
        int verticalOffset = statsOffset.get(1) + 4;
       
        for (PlayerMessage message : messages) {
          int horizontalOffset = 2;
         
View Full Code Here

Examples of com.tommytony.war.Warzone

       * no settings for killstreaks and have neglected to add any. Heck,
       * they shouldn't have enabled killstreaks in the warzone anyway.
       */
      return;
    }
    final Warzone zone = Warzone.getZoneByPlayerName(player.getName());
    final Team playerTeam = Team.getTeamByPlayerName(player.getName());
    Validate.notNull(zone, "Cannot reward player if they are not in a warzone");
    Validate.notNull(playerTeam, "Cannot reward player if they are not in a team");
    if (section.contains(Integer.toString(kills))) {
      ConfigurationSection killSection = section.getConfigurationSection(Integer.toString(kills));
      if (killSection.contains("message")) {
        final String playerName = playerTeam.getKind().getColor() + player.getName() + ChatColor.WHITE;
        final String message = ChatColor.translateAlternateColorCodes('&', MessageFormat.format(killSection.getString("message"), playerName));
        for (Team team : zone.getTeams()) {
          team.teamcast(message);
        }
      }
      if (killSection.contains("privmsg")) {
        War.war.msg(player, ChatColor.translateAlternateColorCodes('&', killSection.getString("privmsg")));
      }
      if (killSection.contains("reward.health")) {
        double health = player.getHealth() + killSection.getInt("reward.health");
        player.setHealth(health > 20 ? 20 : health); // Grant up to full health only
      }
      if (killSection.contains("reward.items")) {
        for (Object obj : killSection.getList("reward.items")) {
          if (obj instanceof ItemStack) {
            player.getInventory().addItem((ItemStack) obj);
          }
        }
      }
      if (killSection.contains("reward.xp") && !playerTeam.getTeamConfig().resolveBoolean(TeamConfig.XPKILLMETER)) {
        // Will not work if XPKILLMETER is enabled
        player.setLevel(player.getLevel() + killSection.getInt("reward.xp"));
      }
      if (killSection.contains("reward.points")) {
        for (int i = 0; i < killSection.getInt("reward.points"); i++) {
          playerTeam.addPoint();
        }
        // Detect win conditions
        if (playerTeam.getPoints() >= playerTeam.getTeamConfig().resolveInt(TeamConfig.MAXSCORE)) {
          player.getServer().getScheduler().runTaskLater(War.war, new Runnable() {
            public void run() {
              zone.handleScoreCapReached(playerTeam.getName());
            }
          }, 1L);
        } else {
          // just added a point
          playerTeam.resetSign();
          zone.getLobby().resetTeamGateSign(playerTeam);
        }
      }
      if (killSection.getBoolean("reward.airstrike")) {
        this.airstrikePlayers.add(player.getName());
      }
View Full Code Here

Examples of com.tommytony.war.Warzone

    if (this.args.length != 1) {
      return false;
    }

    Warzone zone = Warzone.getZoneByLocation(player);

    if (zone == null) {
      return false;
    } else if (!this.isSenderAuthorOfZone(zone)) {
      return true;
    }
   
    if (this.args[0].equals(zone.getName())) {
      return false;
    }

    if (zone.hasMonument(this.args[0])) {
      // move the existing monument
      Monument monument = zone.getMonument(this.args[0]);
      monument.getVolume().resetBlocks();
      monument.setLocation(player.getLocation());
      this.msg("Monument " + monument.getName() + " was moved.");
      War.war.log(this.getSender().getName() + " moved monument " + monument.getName() + " in warzone " + zone.getName(), Level.INFO);
    } else {
      // create a new monument
      Monument monument = new Monument(this.args[0], zone, player.getLocation());
      zone.getMonuments().add(monument);
      War.war.log(this.getSender().getName() + " created monument " + monument.getName() + " in warzone " + zone.getName(), Level.INFO);
    }

    WarzoneYmlMapper.save(zone);

    return true;
View Full Code Here

Examples of com.tommytony.war.Warzone

    super(handler, sender, args);
  }

  @Override
  public boolean handle() {
    Warzone zone;

    if (this.args.length == 1) {
      zone = Warzone.getZoneByName(this.args[0]);
    } else if (this.args.length == 0) {
      if (!(this.getSender() instanceof Player)) {
        return false;
      }
      zone = Warzone.getZoneByLocation((Player) this.getSender());
      if (zone == null) {
        ZoneLobby lobby = ZoneLobby.getLobbyByLocation((Player) this.getSender());
        if (lobby == null) {
          return false;
        }
        zone = lobby.getZone();
      }
    } else {
      return false;
    }

    if (zone == null) {
      return false;
    } else if (!this.isSenderAuthorOfZone(zone)) {
      return true;
    }

    War.war.getWarzones().remove(zone);
    WarYmlMapper.save();
   
    WarzoneYmlMapper.delete(zone);
   
    if (War.war.getWarHub() != null) { // warhub has to change
      War.war.getWarHub().getVolume().resetBlocks();
      War.war.getWarHub().initialize();
    }
   
    String msg = "Warzone " + zone.getName() + " removed by " + this.getSender().getName() + ".";
    War.war.log(msg, Level.INFO);
    this.msg(msg);

    return true;
  }
View Full Code Here

Examples of com.tommytony.war.Warzone

    super(handler, sender, args);
  }

  @Override
  public boolean handle() {
    Warzone zone;

    if (this.args.length == 0) {
      return false;
    } else if (this.args.length == 2) {
      zone = Warzone.getZoneByName(this.args[0]);
      this.args[0] = this.args[1];
    } else if (this.args.length == 1) {
      if (!(this.getSender() instanceof Player)) {
        return false;
      }
      zone = Warzone.getZoneByLocation((Player) this.getSender());
      if (zone == null) {
        ZoneLobby lobby = ZoneLobby.getLobbyByLocation((Player) this.getSender());
        if (lobby == null) {
          return false;
        }
        zone = lobby.getZone();
      }
    } else {
      return false;
    }

    if (zone == null) {
      return false;
    } else if (!this.isSenderAuthorOfZone(zone)) {
      return true;
    }

    Cake cake = zone.getCake(this.args[0]);
    if (cake != null) {
      cake.getVolume().resetBlocks();
      zone.getCakes().remove(cake);
      WarzoneYmlMapper.save(zone);
      this.msg("Cake " + cake.getName() + " removed.");
      War.war.log(this.getSender().getName() + " deleted cake " + cake.getName() + " in warzone " + zone.getName(), Level.INFO);
    } else {
      this.badMsg("No such cake.");
    }

    return true;
View Full Code Here

Examples of com.tommytony.war.Warzone

    super(handler, sender, args);
  }

  @Override
  public boolean handle() {
    Warzone zone;

    if (this.args.length == 0) {
      return false;
    } else if (this.args.length == 2) {
      zone = Warzone.getZoneByName(this.args[0]);
      this.args[0] = this.args[1];
    } else if (this.args.length == 1) {
      if (!(this.getSender() instanceof Player)) {
        return false;
      }
      zone = Warzone.getZoneByLocation((Player) this.getSender());
      if (zone == null) {
        ZoneLobby lobby = ZoneLobby.getLobbyByLocation((Player) this.getSender());
        if (lobby == null) {
          return false;
        }
        zone = lobby.getZone();
      }
    } else {
      return false;
    }

    if (zone == null) {
      return false;
    } else if (!this.isSenderAuthorOfZone(zone)) {
      return true;
    }

    Bomb bomb = zone.getBomb(this.args[0]);
    if (bomb != null) {
      bomb.getVolume().resetBlocks();
      zone.getBombs().remove(bomb);
      WarzoneYmlMapper.save(zone);
      this.msg("Bomb " + bomb.getName() + " removed.");
      War.war.log(this.getSender().getName() + " deleted bomb " + bomb.getName() + " in warzone " + zone.getName(), Level.INFO);
    } else {
      this.badMsg("No such bomb.");
    }

    return true;
View Full Code Here

Examples of com.tommytony.war.Warzone

    if (this.args.length != 1) {
      return false;
    }

    Warzone zone = Warzone.getZoneByLocation(player);

    if (zone == null) {
      return false;
    } else if (!this.isSenderAuthorOfZone(zone)) {
      return true;
    }
   
    if (this.args[0].equals(zone.getName())) {
      return false;
    }

    if (zone.hasCake(this.args[0])) {
      // move the existing cake
      Cake cake = zone.getCake(this.args[0]);
      cake.getVolume().resetBlocks();
      cake.setLocation(player.getLocation());
      this.msg("Cake " + cake.getName() + " was moved.");
      War.war.log(this.getSender().getName() + " moved cake " + cake.getName() + " in warzone " + zone.getName(), Level.INFO);
    } else {
      // create a new cake
      Cake cake = new Cake(this.args[0], zone, player.getLocation());
      zone.getCakes().add(cake);
      this.msg("Cake " + cake.getName() + " created.");
      War.war.log(this.getSender().getName() + " created cake " + cake.getName() + " in warzone " + zone.getName(), Level.INFO);
    }

    WarzoneYmlMapper.save(zone);

    return true;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.