@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(); } }
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"); } }
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; }
/* * 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)); }
public boolean onPlayerRespawn_isPlayerDied(ArenaPlayer arenaPlayer) { return arenaPlayer.isDead(); }
public void onPlayerQuit_markDead(ArenaPlayer arenaPlayer, PlayerQuitEvent event) { arenaPlayer.setDead(true); }
private void setAlivePlayerInTeam(List<ArenaPlayer> team) { for (Iterator<ArenaPlayer> iterator = team.iterator(); iterator.hasNext(); ) { ArenaPlayer arenaPlayer = (ArenaPlayer) iterator.next(); arenaPlayer.setDead(false); } }
public void onEntityDeath_playerDied(ArenaPlayer arenaPlayer) { arenaPlayer.setDead(true); }