Mineplex2018-withcommit/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBoneExplosion.java
Chiss aa45f031ac 3 new achievement Kits
SSM Balance patch
Champs balance
tons of bug fixes
2014-10-31 10:35:47 +11:00

88 lines
2.4 KiB
Java

package nautilus.game.arcade.kit.perks;
import java.util.HashMap;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.recharge.Recharge;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.kit.Perk;
public class PerkBoneExplosion extends Perk
{
public PerkBoneExplosion()
{
super("Bone Explosion", new String[]
{
C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Bone Explosion"
});
}
@EventHandler
public void Skill(PlayerInteractEvent event)
{
if (event.isCancelled())
return;
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
return;
if (UtilBlock.usable(event.getClickedBlock()))
return;
if (event.getPlayer().getItemInHand() == null)
return;
if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE"))
return;
Player player = event.getPlayer();
if (!Kit.HasKit(player))
return;
if (!Recharge.Instance.use(player, GetName(), 10000, true, true))
return;
HashMap<Player, Double> nearby = UtilPlayer.getInRadius(player.getLocation(), 10);
for (Player other : nearby.keySet())
{
if (player.equals(other))
continue;
//Inform
UtilPlayer.message(player, F.main("Game", F.elem(Manager.GetColor(player) + player.getName()) + " used " + F.skill(GetName()) + "."));
//Damage Event
Manager.GetDamage().NewDamageEvent(other, player, null,
DamageCause.CUSTOM, 6 * nearby.get(other), true, true, false,
player.getName(), GetName());
}
//Inform
UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + "."));
//Effect
Manager.GetBlood().Effects(player.getLocation().add(0, 0.5, 0), 48, 0.8, Sound.SKELETON_HURT, 2f, 1.2f, Material.BONE, (byte)0, 40, false);
}
@EventHandler
public void Knockback(CustomDamageEvent event)
{
if (event.GetReason() == null || !event.GetReason().contains(GetName()))
return;
event.AddKnockback(GetName(), 2.5);
}
}