Exemplo n.º 1
0
  @Override
  public void onPlayerDeath(ArenaPlayer pl) {
    super.onPlayerDeath(pl);

    pl.getPlayer().getWorld().strikeLightningEffect(pl.getPlayer().getLocation());
    tellPlayers("&3Tribute &e{0} &3has fallen!", pl.getName());
  }
Exemplo n.º 2
0
 private final void chooseInfected(int tries) {
   if (tries < 16) {
     ArenaPlayer ap = active.get(Util.random(active.size()));
     if (ap != null && ap.isOnline()) {
       ap.setTeam(Team.BLUE);
       ap.sendMessage(getMessage("patientZero"));
       onSpawn(ap);
       tellPlayers(getMessage("zombie"), ap.getName());
     } else {
       chooseInfected(tries++);
     }
   } else {
     // Shouldn't happen...
     tellPlayers(getMessage("couldntFindZombie"));
     stop();
   }
 }
Exemplo n.º 3
0
  @EventHandler(priority = EventPriority.MONITOR)
  public void onEntityDamageByEntityMonitor(EntityDamageByEntityEvent event) {
    Player player = getPlayer(event.getDamager());
    if (player == null) return;

    ArenaPlayer ap = plugin.getArenaPlayer(player);
    if (ap != null) {
      // Repair in-hand item
      ItemStack inHand = player.getItemInHand();
      if (inHand != null && inHand.getType() != Material.AIR) {
        if (inHand.getType().getMaxDurability() != 0) {
          inHand.setDurability((short) 0);
        }
      }

      // Repair armor
      for (ItemStack armor : player.getInventory().getArmorContents()) {
        if (armor != null && armor.getType() != Material.AIR) {
          armor.setDurability((short) 0);
        }
      }

      // Healer class
      if (inHand != null && inHand.getType() == Material.GOLD_AXE) {
        Player damaged = getPlayer(event.getEntity());
        if (damaged != null) {
          ArenaPlayer dp = plugin.getArenaPlayer(damaged);
          if (dp != null) {
            if (ap.getTeam() == dp.getTeam()) {
              ArenaClass ac = ap.getArenaClass();
              if (ac != null && ac.getName().equalsIgnoreCase("healer")) {
                Player heal = dp.getPlayer();
                double health = heal.getHealth();
                double maxHealth = heal.getMaxHealth();
                if (health > 0.0D && health < maxHealth) {
                  heal.setHealth(Math.min(health + 2.0D, maxHealth));
                  ap.sendMessage("&3You have healed &e{0} &3for &e1 &3heart!", dp.getName());
                }
              }
            }
          }
        }
      }
    }
  }
Exemplo n.º 4
0
 @Override
 public void announceWinner() {
   if (winner != null) tellAllPlayers("&e{0} &3is the victor!", winner.getName());
 }