Exemplo n.º 1
0
  @Override
  public void destroyed() {
    for (Iterator<ArenaPlayer> iterator = arenaGame.getRedTeam().iterator(); iterator.hasNext(); ) {
      ArenaPlayer arenaPlayer = iterator.next();
      arenaPlayer.getPlayer().getInventory().clear();
    }

    for (Iterator<ArenaPlayer> iterator = arenaGame.getBlueTeam().iterator();
        iterator.hasNext(); ) {
      ArenaPlayer arenaPlayer = iterator.next();
      arenaPlayer.getPlayer().getInventory().clear();
    }
  }
Exemplo n.º 2
0
 public void onPlayerQuit_removePlayerOffTeam(ArenaPlayer arenaPlayer, PlayerQuitEvent event) {
   Server server = arenaPlayer.getPlayer().getServer();
   if (arenaGame.isOnRedTeam(arenaPlayer)) {
     arenaGame.getRedTeam().remove(arenaPlayer);
     server.broadcastMessage(
         ChatColor.RED
             + "Player "
             + arenaPlayer.getPlayer().getName()
             + " has been removed from RED team");
   } else {
     arenaGame.getBlueTeam().remove(arenaPlayer);
     server.broadcastMessage(
         ChatColor.BLUE
             + "Player "
             + arenaPlayer.getPlayer().getName()
             + " has been removed from BLUE team");
   }
 }
Exemplo n.º 3
0
  public boolean onEntityDamage_proceedDamage(ArenaPlayer arenaPlayer, EntityDamageEvent event) {
    boolean willDie = false;

    int damage = event.getDamage();
    int oldHealth = arenaPlayer.getPlayer().getHealth();
    int newHealth = oldHealth - damage;

    if (newHealth < 0) {
      event.setDamage(999);
      willDie = true;
    }

    return willDie;
  }
Exemplo n.º 4
0
  /*
   * UTIL FUNCTION
   */
  private void giveMaxHealtAndPlayerInventory(ArenaPlayer arenaPlayer) {
    Player player = arenaPlayer.getPlayer();

    player.setHealth(20);

    player.getInventory().clear();
    player.getInventory().addItem(new ItemStack(Material.WOOD_SWORD, 1));
    player.getInventory().addItem(new ItemStack(Material.IRON_PICKAXE, 1));
    player.getInventory().addItem(new ItemStack(Material.BOW, 1));
    player.getInventory().addItem(new ItemStack(Material.ARROW, 10));
    player.getInventory().addItem(new ItemStack(Material.LADDER, 6));
    player.getInventory().addItem(new ItemStack(Material.COOKED_FISH, 1));
    player.getInventory().addItem(new ItemStack(Material.BREAD, 1));
  }
Exemplo n.º 5
0
 public boolean onPlayerRespawn_isPlayerDied(ArenaPlayer arenaPlayer) {
   return arenaPlayer.isDead();
 }
Exemplo n.º 6
0
 public void onPlayerQuit_markDead(ArenaPlayer arenaPlayer, PlayerQuitEvent event) {
   arenaPlayer.setDead(true);
 }
Exemplo n.º 7
0
 private void setAlivePlayerInTeam(List<ArenaPlayer> team) {
   for (Iterator<ArenaPlayer> iterator = team.iterator(); iterator.hasNext(); ) {
     ArenaPlayer arenaPlayer = (ArenaPlayer) iterator.next();
     arenaPlayer.setDead(false);
   }
 }
Exemplo n.º 8
0
 public void onEntityDeath_playerDied(ArenaPlayer arenaPlayer) {
   arenaPlayer.setDead(true);
 }