Examples of Team


Examples of com.tommytony.war.Team

    // pass pvp-damage
    if (event instanceof EntityDamageByEntityEvent) {     
      this.handlerAttackDefend((EntityDamageByEntityEvent) event);
    } else  {
      Team team = Team.getTeamByPlayerName(player.getName());
     
      if (zone != null && team != null) {
        LoadoutSelection playerLoadoutState = zone.getLoadoutSelections().get(player.getName());
        if (team.isSpawnLocation(player.getLocation())
            && playerLoadoutState != null && playerLoadoutState.isStillInSpawn()) {
          // don't let a player still in spawn get damaged
          event.setCancelled(true);
        } else if (event.getDamage() >= player.getHealth()) {
          if (zone.getReallyDeadFighters().contains(player.getName())) {
View Full Code Here

Examples of com.tommytony.war.Team

    }

    Player player = (Player) entity;
    Warzone zone = Warzone.getZoneByPlayerName(player.getName());
    if (zone != null) {
      Team team = Team.getTeamByPlayerName(player.getName());
      if ((event.getRegainReason() == RegainReason.EATING
          || event.getRegainReason() != RegainReason.SATIATED )
        && team.getTeamConfig().resolveBoolean(TeamConfig.NOHUNGER)) {
        // noHunger setting means you can't auto-heal with full hunger bar (use saturation instead to control how fast you get hungry)
        event.setCancelled(true);
      } else if (event.getRegainReason() == RegainReason.REGEN) {
        // disable peaceful mode regen
        event.setCancelled(true);
View Full Code Here

Examples of com.tommytony.war.Team

      return;
    }
   
    Player player = (Player) event.getEntity();
    Warzone zone = Warzone.getZoneByPlayerName(player.getName());
    Team team = Team.getTeamByPlayerName(player.getName());
    if (zone != null && team.getTeamConfig().resolveBoolean(TeamConfig.NOHUNGER)){
      event.setCancelled(true);
    }
  }
View Full Code Here

Examples of com.tommytony.war.Team

    if (zone != null) {
      event.getDrops().clear();
      if (!zone.getWarzoneConfig().getBoolean(WarzoneConfig.REALDEATHS)) {
        // catch the odd death that gets away from us when usually intercepting and preventing deaths
        zone.handleDeath(player);
        Team team = Team.getTeamByPlayerName(player.getName());
        if (zone.getWarzoneConfig().getBoolean(WarzoneConfig.DEATHMESSAGES)) {
          zone.broadcast("pvp.death.other", team.getKind().getColor() + player.getName());
        }
        War.war.getLogger().log(Level.WARNING, "We missed the death of player {0} - something went wrong.", player.getName());
      } else {
        event.setDeathMessage("");
      }
View Full Code Here

Examples of com.tommytony.war.Team

    if (event.getEntityType() == EntityType.EGG) {
      LivingEntity shooter = event.getEntity().getShooter();
      if (shooter instanceof Player) {
        Player player = (Player) shooter;
        Warzone zone = Warzone.getZoneByPlayerName(player.getName());
        Team team = Team.getTeamByPlayerName(player.getName());
        if (zone != null) {
          if (War.war.getKillstreakReward().getAirstrikePlayers().remove(player.getName())) {
            event.getEntity().setMetadata("warAirstrike", new FixedMetadataValue(War.war, true));
            zone.broadcast("zone.airstrike", team.getKind().getColor() + player.getName() + ChatColor.WHITE);
          }
        }
      }
    }
  }
View Full Code Here

Examples of com.tommytony.war.Team

    Block block = event.getBlock();
    if (player == null || block == null) {
      return;
    }

    Team team = Team.getTeamByPlayerName(player.getName());
    Warzone zone = Warzone.getZoneByLocation(player);
    // Monument capturing
    if (team != null && block != null && zone != null
        && zone.isMonumentCenterBlock(block)
        && team.getKind().isTeamBlock(block.getState())) {
      Monument monument = zone.getMonumentFromCenterBlock(block);
      if (monument != null && !monument.hasOwner()) {
        monument.capture(team);
        if (War.war.isSpoutServer()) {
          for (Player p : team.getPlayers()) {
            SpoutPlayer sp = SpoutManager.getPlayer(p);
            if (sp.isSpoutCraftEnabled()) {
                      sp.sendNotification(
                          SpoutDisplayer.cleanForNotification("Monument " + ChatColor.WHITE + monument.getName()),
                          SpoutDisplayer.cleanForNotification(ChatColor.YELLOW + "capped by " + team.getKind().getColor() + player.getName() + ChatColor.YELLOW + "!"),
                          team.getKind().getMaterial(),
                          team.getKind().getData(),
                          10000);
            }
          }
        }
        zone.broadcast("zone.monument.capture", monument.getName(), team.getName());
        event.setCancelled(false);
        return; // important otherwise cancelled down a few line by isImportantblock
      } else {
        War.war.badMsg(player, "zone.monument.badblock");
        cancelAndKeepItem(event);
        return;
      }
    }

    boolean isZoneMaker = War.war.isZoneMaker(player);
    // prevent build in important parts
    if (zone != null
        && (zone.isImportantBlock(block) || zone.isOpponentSpawnPeripheryBlock(team, block))
        && (!isZoneMaker || (isZoneMaker && team != null))) {
      War.war.badMsg(player, "build.denied.location");
      cancelAndKeepItem(event);
      return;
    }

    // protect warzone lobbies
    for (Warzone wz : War.war.getWarzones()) {
      if (wz.getLobby() != null && wz.getLobby().getVolume() != null && wz.getLobby().getVolume().contains(block)) {
        War.war.badMsg(player, "build.denied.location");
        cancelAndKeepItem(event);
        return;
      }
    }

    // protect the hub
    if (War.war.getWarHub() != null && War.war.getWarHub().getVolume().contains(block)) {
      War.war.badMsg(player, "build.denied.location");
      cancelAndKeepItem(event);
      return;
    }

    // buildInZonesOnly
    if (zone == null && War.war.getWarConfig().getBoolean(WarConfig.BUILDINZONESONLY) && !War.war.canBuildOutsideZone(player)) {
      if (!War.war.getWarConfig().getBoolean(WarConfig.DISABLEBUILDMESSAGE)) {
        War.war.badMsg(player, "build.denied.outside");
      }
      cancelAndKeepItem(event);
      return;
    }

    // can't place a block of your team's color
    if (team != null && block.getType() == team.getKind().getMaterial() && block.getState().getData() == team.getKind().getBlockData()) {
      War.war.badMsg(player, "build.denied.teamblock");
      cancelAndKeepItem(event);
      return;
    }

    // a flag thief can't drop his flag
    if (team != null && zone != null && zone.isFlagThief(player.getName())) {
      War.war.badMsg(player, "drop.flag.disabled");
      cancelAndKeepItem(event);
      return;
    }
   
    // a bomb thief can't drop his bomb
    if (team != null && zone != null && zone.isBombThief(player.getName())) {
      War.war.badMsg(player, "drop.bomb.disabled");
      cancelAndKeepItem(event);
      return;
    }
   
    // a cake thief can't drop his cake
    if (team != null && zone != null && zone.isCakeThief(player.getName())) {
      War.war.badMsg(player, "drop.cake.disabled");
      cancelAndKeepItem(event);
      return;
    }

    // unbreakableZoneBlocks
    if (zone != null && (zone.getWarzoneConfig().getBoolean(WarzoneConfig.UNBREAKABLE)
        || (team != null && !team.getTeamConfig().resolveBoolean(TeamConfig.PLACEBLOCK)))
        && (!isZoneMaker || (isZoneMaker && team != null))) {
      // if the zone is unbreakable, no one but zone makers can break blocks (even then, zone makers in a team can't break blocks)
      War.war.badMsg(player, "build.denied.zone.place");
      cancelAndKeepItem(event);
      return;
    }

    if (team != null && !team.canModify(block.getType())) {
      War.war.badMsg(player, "build.denied.zone.type");
      cancelAndKeepItem(event);
      return;
    }
  }
View Full Code Here

Examples of com.tommytony.war.Team

 
  @EventHandler
  public void onPlayerToggleSneak(PlayerToggleSneakEvent event) {
    if (War.war.isLoaded() && event.isSneaking()) {
      Warzone playerWarzone = Warzone.getZoneByLocation(event.getPlayer());
      Team playerTeam = Team.getTeamByPlayerName(event.getPlayer().getName());
      if (playerWarzone != null && playerTeam != null && playerTeam.getInventories().resolveLoadouts().keySet().size() > 1 && playerTeam.isSpawnLocation(event.getPlayer().getLocation())) {
        if (playerWarzone.getLoadoutSelections().keySet().contains(event.getPlayer().getName())
            && playerWarzone.getLoadoutSelections().get(event.getPlayer().getName()).isStillInSpawn()) {
          LoadoutSelection selection = playerWarzone.getLoadoutSelections().get(event.getPlayer().getName());
          List<Loadout> loadouts = new ArrayList<Loadout>(playerTeam.getInventories().resolveNewLoadouts());
          for (Iterator<Loadout> it = loadouts.iterator(); it.hasNext();) {
            Loadout ldt = it.next();
            if (ldt.getName().equals("first") ||
                (ldt.requiresPermission() && !event.getPlayer().hasPermission(ldt.getPermission()))) {
              it.remove();
View Full Code Here

Examples of com.tommytony.war.Team

      return;
    } else if (deadZone == null) {
      // Player is not a 'really' dead player, nothing to do here
      return;
    }
    Team team = playingZone.getPlayerTeam(event.getPlayer().getName());
    Validate.notNull(team, String.format(
        "Failed to find a team for player %s in warzone %s on respawn.",
        event.getPlayer().getName(), playingZone.getName()));
    playingZone.getReallyDeadFighters().remove(event.getPlayer().getName());
    event.setRespawnLocation(team.getRandomSpawn());
    playingZone.respawnPlayer(team, event.getPlayer());
  }
View Full Code Here

Examples of com.tommytony.war.Team

  @EventHandler
  public void onPlayerTeleport(final PlayerTeleportEvent event) {
    if (War.war.isLoaded()) {
      Warzone playerWarzone = Warzone.getZoneByPlayerName(event.getPlayer().getName());
      Team playerTeam = Team.getTeamByPlayerName(event.getPlayer().getName());
      if (playerWarzone != null) {
        if (!playerWarzone.getVolume().contains(event.getTo())) {
          // Prevent teleporting out of the warzone
          if (!playerWarzone.getWarzoneConfig().getBoolean(WarzoneConfig.REALDEATHS)) {
            War.war.badMsg(event.getPlayer(), "Use /leave (or /war leave) to exit the zone.");
View Full Code Here

Examples of com.tommytony.war.Team

  }
 
  @EventHandler
  public void onPlayerExpChange(PlayerExpChangeEvent event) {
    if (War.war.isLoaded()) {
      Team team = Team.getTeamByPlayerName(event.getPlayer().getName());
      if (team != null && team.getTeamConfig().resolveBoolean(TeamConfig.XPKILLMETER)) {
        event.setAmount(0);
      }
    }
  }
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.