veryunspecialperson12513
๐Ÿ“Ž 1 file 2,631 chars
๐Ÿ“„
pasted-code-1774751858003.txt
txt 81 lines
โ–ถ
package me.yourname.abilities;

import org.bukkit.*;
import org.bukkit.command.*;
import org.bukkit.entity.*;
import org.bukkit.event.*;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;

import java.util.*;

public class AbilityPlugin extends JavaPlugin implements Listener, CommandExecutor {

    private final Map playerAbilities = new HashMap<>();
    private final Random random = new Random();

    public enum AbilityType {
        FIREBALL,
        ICE
    }

    @Override
    public void onEnable() {
        getServer().getPluginManager().registerEvents(this, this);
        getCommand("ability").setExecutor(this);
        getLogger().info("Ability plugin enabled!");
    }

    @EventHandler
    public void onJoin(PlayerJoinEvent event) {
        Player player = event.getPlayer();

        if (!playerAbilities.containsKey(player.getUniqueId())) {
            AbilityType ability = AbilityType.values()[random.nextInt(AbilityType.values().length)];
            playerAbilities.put(player.getUniqueId(), ability);

            player.sendMessage(ChatColor.GREEN + "You got the ability: " + ability.name());
        }
    }

    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        if (!(sender instanceof Player player)) return true;

        AbilityType ability = playerAbilities.get(player.getUniqueId());

        if (ability == null) {
            player.sendMessage(ChatColor.RED + "You have no ability!");
            return true;
        }

        switch (ability) {
            case FIREBALL -> useFireball(player);
            case ICE -> useIce(player);
        }

        return true;
    }

    // ๐Ÿ”ฅ FIREBALL ABILITY
    private void useFireball(Player player) {
        Fireball fireball = player.launchProjectile(Fireball.class);
        fireball.setVelocity(player.getLocation().getDirection().multiply(1.5));
        fireball.setYield(2F);

        player.sendMessage(ChatColor.GOLD + "๐Ÿ”ฅ Fireball launched!");
    }

    // โ„๏ธ ICE ABILITY
    private void useIce(Player player) {
        for (Entity entity : player.getNearbyEntities(5, 5, 5)) {
            if (entity instanceof LivingEntity target && entity != player) {
                target.setFreezeTicks(200);
                target.getWorld().spawnParticle(Particle.SNOWFLAKE, target.getLocation(), 20);
            }
        }

        player.sendMessage(ChatColor.AQUA + "โ„๏ธ Nearby enemies frozen!");
    }
}
Kodari AI
KodariMar 29 at 2:38 am 4,540 (v2)

I can see youโ€™ve shared a Bukkit ability plugin with Fireball and Ice abilities. This appears to be example code for a new project.

What would you like me to do with this?

Options:

  1. Create a proper project structure - Transform this into a well-organized plugin with managers, configuration, proper XSeries usage, and GUI-based ability selection

  2. Fix/improve the existing code - Address the direct enum usage (Particle.SNOWFLAKE), add cooldowns, permissions, configuration

  3. Extend functionality - Add more abilities, particle effects, sound effects, GUI menus

  4. Start fresh - Create a different ability plugin from scratch with your requirements

Please let me know what youโ€™d like, and Iโ€™ll help you build it properly! If you want me to transform this code into a complete project, Iโ€™ll:

  • Set up proper project structure with managers

  • Replace direct Material/Particle enums with XSeries

  • Add configuration system

  • Create GUI for ability selection

  • Add cooldown system

  • Include proper commands and permissions

What direction would you like to go?

Kodari can make mistakes. Review important code before using.
Files

No files in this session

Code