Mineplex2018-withcommit/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkKnockbackArrow.java
2013-08-29 16:20:36 +10:00

47 lines
1016 B
Java

package nautilus.game.arcade.kit.perks;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.core.common.util.C;
import nautilus.game.arcade.kit.Perk;
public class PerkKnockbackArrow extends Perk
{
private double _power;
public PerkKnockbackArrow(double power)
{
super("Arrow Knockback", new String[]
{
C.cGray + "Arrows deal " + (int)(power*100) + "% Knockback.",
});
_power = power;
}
@EventHandler(priority = EventPriority.HIGH)
public void Knockback(CustomDamageEvent event)
{
if (event.GetProjectile() == null)
return;
if (!(event.GetProjectile() instanceof Arrow))
return;
Player damager = event.GetDamagerPlayer(true);
if (damager == null) return;
if (!Kit.HasKit(damager))
return;
if (!Manager.IsAlive(damager))
return;
event.AddKnockback("Knockback Arrow", _power);
}
}