@Override public void onPlayerDeath(ArenaPlayer pl) { super.onPlayerDeath(pl); pl.getPlayer().getWorld().strikeLightningEffect(pl.getPlayer().getLocation()); tellPlayers("&3Tribute &e{0} &3has fallen!", pl.getName()); }
@Override public void onSpawn(ArenaPlayer ap) { if (ap.getTeam() == Team.BLUE) { ap.clearInventory(); spawn(ap, true); ap.getPlayer() .addPotionEffect( new PotionEffect(PotionEffectType.INCREASE_DAMAGE, Integer.MAX_VALUE, 10)); ap.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.JUMP, Integer.MAX_VALUE, 3)); ap.getPlayer() .addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, Integer.MAX_VALUE, 1)); ap.getPlayer() .addPotionEffect(new PotionEffect(PotionEffectType.SPEED, Integer.MAX_VALUE, 2)); ap.clearInventory(); ap.decideHat(false); } }
@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()); } } } } } } } }