56 lines
1.4 KiB
Java
56 lines
1.4 KiB
Java
|
package nautilus.game.arcade.kit.perks;
|
||
|
|
||
|
import java.util.HashSet;
|
||
|
|
||
|
import org.bukkit.Material;
|
||
|
import org.bukkit.entity.Item;
|
||
|
import org.bukkit.entity.Player;
|
||
|
import org.bukkit.event.EventHandler;
|
||
|
|
||
|
import mineplex.core.common.util.C;
|
||
|
import mineplex.core.itemstack.ItemStackFactory;
|
||
|
import mineplex.core.recharge.Recharge;
|
||
|
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||
|
import nautilus.game.arcade.kit.SmashPerk;
|
||
|
|
||
|
public class PerkDeadlyBones extends SmashPerk
|
||
|
{
|
||
|
private HashSet<Item> _active = new HashSet<Item>();
|
||
|
|
||
|
public PerkDeadlyBones()
|
||
|
{
|
||
|
super("Deadly Bones", new String[]
|
||
|
{
|
||
|
C.cGray + "Drop explosive bones when you take damage."
|
||
|
});
|
||
|
}
|
||
|
|
||
|
@EventHandler
|
||
|
public void damageActivate(CustomDamageEvent event)
|
||
|
{
|
||
|
if (event.IsCancelled())
|
||
|
return;
|
||
|
|
||
|
Player player = event.GetDamageePlayer();
|
||
|
if (player == null)
|
||
|
return;
|
||
|
|
||
|
if (!Kit.HasKit(player))
|
||
|
return;
|
||
|
|
||
|
if (!Recharge.Instance.use(player, GetName(), 400, true, true))
|
||
|
return;
|
||
|
|
||
|
_active.add(player.getWorld().dropItemNaturally(player.getLocation().add(0, 0.5, 0), ItemStackFactory.Instance.CreateStack(Material.BONE, (byte)0, 1, "Explosive Bone " + System.currentTimeMillis())));
|
||
|
}
|
||
|
|
||
|
@EventHandler
|
||
|
public void knockback(CustomDamageEvent event)
|
||
|
{
|
||
|
if (event.GetReason() == null || !event.GetReason().contains(GetName()))
|
||
|
return;
|
||
|
|
||
|
event.AddKnockback(GetName(), 1.5);
|
||
|
}
|
||
|
}
|