Jatin Boiii

Create a Minecraft plugin for me that contains 12 custom elemental bows. Every player should receive one of these bows when they join the server.

The bow should start at Level 1. Once a player gets 5 kills, their bow should automatically level up to Level 2, and the bow should unlock its special ability at Level 2.

All 12 bows should be elemental bows, with each bow having its own unique element and special ability.

Kodari AI
KodariSep 14 at 2:48 pm 1
ElementalBowProgression
A Minecraft plugin that grants every joining player a random elemental bow at Level 1. Each of the 12 unique bows represents a distinct element with its own special ability. Bows automatically level up to Level 2 after the player achieves 5 kills, unlocking the bow's unique elemental ability. The plugin tracks player kills, manages bow levels, and applies elemental effects on arrow hits, providing a progression-based combat experience for all server players.

I’ll create the Gradle project, plugin metadata, and the complete elemental-bow implementation with kill progression, persistent item data, join rewards, and level-2 abilities.

Created the complete ElementalBows Minecraft plugin.

  • Added Gradle project setup and plugin.yml.

  • Added 12 elemental bow types, each with a unique ability.

  • Players receive a random Level 1 elemental bow when joining.

  • Bow kills are tracked using persistent item data.

  • At 5 kills, the bow reaches Level 2 and unlocks its ability.

  • Added cooldown handling and ability activation through right-click.

  • Added elemental effects including fire, water, earth, air, ice, nature, light, shadow, arcane, storm, poison, and void.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
7 489
src/main/java/com/kodari/elementalbows/BowAbilityManager.java
package com.kodari.elementalbows;

import com.cryptomorin.xseries.XPotion;
import com.cryptomorin.xseries.XSound;
import com.cryptomorin.xseries.particles.XParticle;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;

public class BowAbilityManager {
    private static final long COOLDOWN_MILLIS = 5000L;
    private final BowManager bowManager;
    private final Map<UUID, Long> cooldowns = new HashMap<>();

    public BowAbilityManager(BowManager bowManager) {
        this.bowManager = bowManager;
    }

    public void activate(Player player, ItemStack bow) {
        ElementalBowType type = bowManager.getType(bow);
        if (type == null) {
            return;
        }

        long now = System.currentTimeMillis();
        long availableAt = cooldowns.getOrDefault(player.getUniqueId(), 0L);
        if (availableAt > now) {
            long seconds = (availableAt - now + 999L) / 1000L;
            player.sendMessage(ChatColor.RED + "Ability cooldown: " + seconds + "s");
            return;
        }

        cooldowns.put(player.getUniqueId(), now + COOLDOWN_MILLIS);
        switch (type) {
            case FIRE -> fire(player);
            case WATER -> water(player);
            case EARTH -> earth(player);
            case AIR -> air(player);
            case ICE -> ice(player);
            case NATURE -> nature(player);
            case LIGHT -> light(player);
            case SHADOW -> shadow(player);
            case ARCANE -> arcane(player);
            case STORM -> storm(player);
            case POISON -> poison(player);
            case VOID -> voidStep(player);
        }
        player.sendMessage(type.getColor() + type.getAbilityName() + ChatColor.GRAY + " activated.");
    }

    private void fire(Player player) {
        for (LivingEntity entity : nearbyLiving(player, 5)) {
            entity.setFireTicks(100);
            entity.damage(4.0, player);
        }
        particle(player, "FLAME", 30);
        sound(player, "ENTITY_GENERIC_EXPLODE");
    }

    private void water(Player player) {
        player.setFireTicks(0);
        player.setHealth(Math.min(player.getMaxHealth(), player.getHealth() + 6.0));
        for (LivingEntity entity : nearbyLiving(player, 5)) {
            entity.setFireTicks(0);
        }
        particle(player, "WATER_SPLASH", 30);
        sound(player, "ENTITY_PLAYER_SPLASH");
    }

    private void earth(Player player) {
        for (LivingEntity entity : nearbyLiving(player, 5)) {
            entity.damage(3.0, player);
            potion(entity, "SLOWNESS", 100, 1);
        }
        particle(player, "BLOCK", 20);
        sound(player, "BLOCK_STONE_BREAK");
    }

    private void air(Player player) {
        for (LivingEntity entity : nearbyLiving(player, 6)) {
            entity.setVelocity(new Vector(0, 1.15, 0));
        }
        particle(player, "CLOUD", 35);
        sound(player, "ENTITY_ENDER_DRAGON_FLAP");
    }

    private void ice(Player player) {
        for (LivingEntity entity : nearbyLiving(player, 5)) {
            entity.setFreezeTicks(Math.max(entity.getFreezeTicks(), 100));
            entity.damage(2.0, player);
        }
        particle(player, "SNOWFLAKE", 30);
        sound(player, "BLOCK_GLASS_BREAK");
    }

    private void nature(Player player) {
        player.setHealth(Math.min(player.getMaxHealth(), player.getHealth() + 4.0));
        potion(player, "REGENERATION", 120, 1);
        potion(player, "SPEED", 120, 1);
        particle(player, "VILLAGER_HAPPY", 25);
        sound(player, "BLOCK_GRASS_BREAK");
    }

    private void light(Player player) {
        for (LivingEntity entity : nearbyLiving(player, 8)) {
            entity.setGlowing(true);
        }
        particle(player, "END_ROD", 35);
        sound(player, "ENTITY_PLAYER_LEVELUP");
    }

    private void shadow(Player player) {
        potion(player, "INVISIBILITY", 120, 1);
        particle(player, "SMOKE_LARGE", 25);
        sound(player, "ENTITY_ENDERMAN_AMBIENT");
    }

    private void arcane(Player player) {
        Location target = targetLocation(player);
        if (target != null) {
            for (Entity entity : target.getWorld().getNearbyEntities(target, 3, 3, 3)) {
                if (entity instanceof LivingEntity living && entity != player) {
                    living.damage(7.0, player);
                }
            }
            particleAt(target, "ENCHANT", 45);
        }
        sound(player, "BLOCK_ENCHANTMENT_TABLE_USE");
    }

    private void storm(Player player) {
        Location target = targetLocation(player);
        if (target != null) {
            target.getWorld().strikeLightning(target);
            particleAt(target, "ELECTRIC_SPARK", 25);
        }
        sound(player, "ENTITY_LIGHTNING_BOLT_THUNDER");
    }

    private void poison(Player player) {
        for (LivingEntity entity : nearbyLiving(player, 6)) {
            potion(entity, "POISON", 100, 1);
        }
        particle(player, "WITCH", 35);
        sound(player, "ENTITY_WITCH_THROW");
    }

    private void voidStep(Player player) {
        Location destination = player.getLocation().clone().add(player.getLocation().getDirection().normalize().multiply(6));
        player.teleport(destination);
        for (LivingEntity entity : nearbyLiving(player, 3)) {
            entity.damage(5.0, player);
        }
        particle(player, "PORTAL", 40);
        sound(player, "ENTITY_ENDERMAN_TELEPORT");
    }

    private java.util.List<LivingEntity> nearbyLiving(Player player, double radius) {
        java.util.List<LivingEntity> result = new java.util.ArrayList<>();
        for (Entity entity : player.getNearbyEntities(radius, radius, radius)) {
            if (entity instanceof LivingEntity living && entity != player) {
                result.add(living);
            }
        }
        return result;
    }

    private Location targetLocation(Player player) {
        Block target = player.getTargetBlock(null, 30);
        return target == null ? null : target.getLocation().add(0.5, 1.0, 0.5);
    }

    private void potion(LivingEntity entity, String name, int duration, int amplifier) {
        XPotion.matchXPotion(name)
                .map(potion -> potion.buildPotionEffect(duration, amplifier))
                .ifPresent(entity::addPotionEffect);
    }

    private void particle(Player player, String name, int count) {
        particleAt(player.getLocation(), name, count);
    }

    private void particleAt(Location location, String name, int count) {
        XParticle.of(name).ifPresent(particle -> location.getWorld().spawnParticle(particle.get(), location, count));
    }

    private void sound(Player player, String name) {
        XSound.matchXSound(name).ifPresent(sound -> sound.play(player));
    }
}