Throw Axe icon

Throw Axe -----

Throw axe for killing players and mobs



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

Code (Text):
axeMaterial: IRON_AXE
axeVector: 1.5
killRadius: 0.6
 
Code (Text):
@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) {}
    }
}
Resource Information
Author:
----------
Total Downloads: 139
First Release: Feb 28, 2022
Last Update: Feb 28, 2022
Category: ---------------
All-Time Rating:
0 ratings
Version -----
Released: --------------------
Downloads: ------
Version Rating:
----------------------
-- ratings