62 lines
1.6 KiB
Java
62 lines
1.6 KiB
Java
|
package nautilus.game.arcade.kit.perks;
|
||
|
|
||
|
import java.util.HashMap;
|
||
|
|
||
|
import org.bukkit.entity.Player;
|
||
|
import org.bukkit.entity.ThrownPotion;
|
||
|
import org.bukkit.event.EventHandler;
|
||
|
import org.bukkit.event.block.Action;
|
||
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||
|
|
||
|
import mineplex.core.common.util.C;
|
||
|
import mineplex.core.common.util.F;
|
||
|
import mineplex.core.common.util.UtilAction;
|
||
|
import mineplex.core.common.util.UtilBlock;
|
||
|
import mineplex.core.common.util.UtilPlayer;
|
||
|
import mineplex.core.recharge.Recharge;
|
||
|
|
||
|
import nautilus.game.arcade.kit.Perk;
|
||
|
|
||
|
public class PerkWitchPotion extends Perk
|
||
|
{
|
||
|
public PerkWitchPotion()
|
||
|
{
|
||
|
super("Throw Potion", new String[]
|
||
|
{
|
||
|
C.cYellow + "Right-Click" + C.cGray + " to use " + C.cGreen + "Throw Potion"
|
||
|
});
|
||
|
}
|
||
|
|
||
|
|
||
|
@EventHandler
|
||
|
public void Activate(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().getType().toString().contains("_SPADE"))
|
||
|
return;
|
||
|
|
||
|
Player player = event.getPlayer();
|
||
|
|
||
|
if (!Kit.HasKit(player))
|
||
|
return;
|
||
|
|
||
|
if (!Recharge.Instance.use(player, GetName(), 2000, true))
|
||
|
return;
|
||
|
|
||
|
//Start
|
||
|
ThrownPotion potion = player.launchProjectile(ThrownPotion.class);
|
||
|
UtilAction.velocity(potion, player.getLocation().getDirection(), 1.2, false, 0, 0.2, 10, false);
|
||
|
|
||
|
//Inform
|
||
|
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + "."));
|
||
|
}
|
||
|
}
|