Hey,
I want to present you my throw axe plugin.
This is just a fun plugin, where you can throw an axe at mobs or players to kill them. You might know this from shooter games like cod.
Apparently, this plugin contains a little config, where you can manage some settings for the axe.
Feel free to download :)
Features:
- plug and play
- instant kill with axe
- few configurations
Config
axeMaterial: IRON_AXE
axeVector: 1.5
killRadius: 0.6Code
@EventHandler
public void onInteract(PlayerInteractEvent e) {
if(e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK) {
Player p = e.getPlayer();
try {
if(p.getInventory().getItemInHand().getType() == Material.valueOf(getConfig().getString("axeMaterial"))) {
Item axe = p.getWorld().dropItem(p.getEyeLocation(), p.getItemInHand());
axe.setVelocity(p.getEyeLocation().getDirection().multiply(getConfig().getDouble("axeVector")));
p.getItemInHand().setAmount(0);
new BukkitRunnable() {
@Override
public void run() {
for(Entity ent : axe.getNearbyEntities(getConfig().getDouble("killRadius"), getConfig().getDouble("killRadius"), getConfig().getDouble("killRadius"))) {
if(ent instanceof LivingEntity) {
LivingEntity target = (LivingEntity) ent;
if(ent == p) continue;
target.setHealth(0);
axe.setVelocity(new Vector(0, 0, 0));
cancel();
}
}
if(axe.isOnGround()) {
axe.setVelocity(new Vector(0, 0, 0));
cancel();
}
}
}.runTaskTimer(this, 0, 1);
}
}catch(Exception ex) {
}catch(AssertionError ex) {}
}
}Similar projects
Plugin →Let Me Despawn
Improves performance by tweaking mob despawn rules. Say bye to pesky unintentional persistent mobs.
25MSueta
JourneyMap
Real-time map used for mapping in-game or your browser as you explore.
14.7MSueta
Emotecraft
Create your own emotes in Minecraft.
7.5MSueta
Simple Tpa
A simple tpa plugin which sends requests
5.4MSueta
Common Network
Forge and Fabric Unified Networking Solution
3.9MSueta
Set Home
A lightweight plugin for players to set their homes.
3.8MSueta