public TouchOfEvil(final Player player) { final BendingPlayer bPlayer = GeneralMethods.getBendingPlayer(player.getName()); if (bPlayer.effects != null) { for (final Effect e : bPlayer.effects.keySet()) { if (bPlayer.effects.get(e) == "Helix") { found = true; this.effect = (HelixEffect) e; } else { player.sendMessage("Didn't find Helix but found:" + bPlayer.effects.get(e)); } } } if (!found) { final HelixEffect effect = new HelixEffect(MegaBending.getEM()); bPlayer.effects.put(effect, "Helix"); this.start = true; } if (TouchOfEvil.instances.containsKey(player)) { // instances.get(player).revert(); bPlayer.eviltouch = false; TouchOfEvil.instances.remove(player); } else { if (bPlayer.isOnCooldown("TouchOfEvil") && !bPlayer.isOnCooldown("EvilAura")) { player.sendMessage( ChatColor.DARK_GRAY + "You must wait a while before activating the Touch of Evil ability again."); return; } if (bPlayer.isOnCooldown("EvilAura")) { player.sendMessage(ChatColor.DARK_GRAY + "That ability is already active!"); return; } if (bPlayer.isOnCooldown("DrainAura")) { player.sendMessage( ChatColor.DARK_GRAY + "You may only have one aura ability active at a time!"); return; } if (MegaBendingScarecrowMethods.isChiBlocked(player.getName())) { player.sendMessage(ChatColor.DARK_GRAY + "Your abilities have been temporarily blocked!"); return; } set(); TouchOfEvil.instances.put(player, this); bPlayer.addCooldown("TouchOfEvil", 90000); bPlayer.addCooldown("EvilAura", 9000); player.sendMessage( ChatColor.DARK_GRAY + "The dark spirit swirls around your body looking for prey."); bPlayer.eviltouch = true; } }
public void manage(final Server server) { for (final Player player : server.getOnlinePlayers()) { if (TouchOfEvil.instances.containsKey(player)) { final BendingPlayer bPlayer = GeneralMethods.getBendingPlayer(player.getName()); if (bPlayer.effects != null) { for (final Effect e : bPlayer.effects.keySet()) { if (bPlayer.effects.get(e) == "Helix") { // this.effect = (HelixEffect) e; break; } } } else { this.effect = new HelixEffect(MegaBending.getEM()); this.start = true; bPlayer.addCooldown("EvilAura", 9000); } if (!GeneralMethods.canBend(player.getName(), "TouchOfEvil") || (GeneralMethods.getBendingPlayer(player.getName()).eviltouch == false)) { // instances.get(player); TouchOfEvil.instances.remove(player); if (this.effect != null) { bPlayer.effects.remove(this.effect); this.effect.cancel(); } } else { TouchOfEvil.instances.get(player).set(); this.effect.setDynamicOrigin(new DynamicLocation(player.getEyeLocation().add(0, -1, 0))); // effect.setTargetEntity(player); this.effect.radius = 6; this.effect.particle = ParticleEffect.PORTAL; this.effect.iterations = 40; // effect.infinite(); // effect.infinite(); if (this.start == true) { this.effect.start(); this.start = false; } for (final Entity e : GeneralMethods.getEntitiesAroundPoint(player.getLocation(), 5)) { if (e instanceof LivingEntity) { if (e instanceof Player) { if ((Player) e == player) { continue; } } if (!((LivingEntity) e).hasPotionEffect(PotionEffectType.POISON)) { new TempPotionEffect((LivingEntity) e, TouchOfEvil.poison); } if (!((LivingEntity) e).hasPotionEffect(PotionEffectType.WEAKNESS)) { new TempPotionEffect((LivingEntity) e, TouchOfEvil.weak); } } } } } } for (final Player player : TouchOfEvil.instances.keySet()) { if (!player.isOnline() || player.isDead() || !GeneralMethods.getBendingPlayer(player.getName()).isOnCooldown("EvilAura")) { // instances.get(player).revert(); final BendingPlayer bPlayer = GeneralMethods.getBendingPlayer(player.getName()); if (bPlayer.effects != null) { for (final Effect e : bPlayer.effects.keySet()) { if (bPlayer.effects.get(e) == "Helix") { bPlayer.eviltouch = false; this.effect = (HelixEffect) e; bPlayer.effects.remove(this.effect); player.sendMessage(ChatColor.DARK_GRAY + "The dark spirit returns to your body."); break; } } } TouchOfEvil.instances.remove(player); this.effect.cancel(); } } }