Улар

An add-on that introduces magic to the world. It includes staves and spell pages; by using a spell page followed by a staff, you can cast magic. There are five spells in total: the first creates a fireball, the second summons a black hole that disappears after 15 seconds, the third is lightning magic that lets you shoot bolts of lightning, the fourth grants you wings for flight, and the fifth summons "Hermet Purple" (reminiscent of Gojo from Jujutsu Kaisen

Kodari AI
KodariToday at 10:35 am 2
ArcaneCaster
An immersive magic plugin that adds staves and spell pages to Minecraft. Players combine a spell page with a staff to unlock casting abilities. Five unique spells are available: Fireball launches explosive projectiles, Black Hole creates a temporary gravitational vortex lasting 15 seconds, Lightning Bolt strikes enemies with electric fury, Wings grants temporary flight, and Hermit Purple summons a spectral guardian that shields the caster. Each spell has distinct visual effects and cooldowns, encouraging strategic gameplay. The plugin includes intuitive item crafting, a spell selection GUI, and configurable balance settings for server administrators.

I’ll create the five spells, spell pages and staff, plus a command for obtaining the items. Black holes and flight will expire automatically.

Created the magic plugin with all five spells. Use /magic all to obtain the staff and pages, right-click a page to select its spell, then right-click the staff to cast.

Black holes last 15 seconds; wings grant flight for 30 seconds. The item command is available to operators by default.

Kodari can make mistakes. Review important code before using.
Files
src
Code
2 312
src/main/java/com/kodari/magic/MagicPlugin.java
package com.kodari.magic;

import com.cryptomorin.xseries.XMaterial;
import com.cryptomorin.xseries.particles.XParticle;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.NamespacedKey;
import org.bukkit.World;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Fireball;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Snowball;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.persistence.PersistentDataType;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.Vector;

public final class MagicPlugin extends JavaPlugin implements Listener {
    private NamespacedKey itemKey;
    private final Map<UUID, Spell> selected = new HashMap<>();
    private final Map<UUID, Long> cooldowns = new HashMap<>();
    private final Map<UUID, Boolean> flight = new HashMap<>();

    private enum Spell {
        FIREBALL("Fireball"), BLACK_HOLE("Black Hole"), LIGHTNING("Lightning"),
        WINGS("Wings"), HERMET_PURPLE("Hermet Purple");

        private final String display;

        Spell(String display) {
            this.display = display;
        }
    }

    @Override
    public void onEnable() {
        itemKey = new NamespacedKey(this, "magic_item");
        getServer().getPluginManager().registerEvents(this, this);
    }

    @Override
    public void onDisable() {
        for (UUID id : flight.keySet()) {
            Player player = Bukkit.getPlayer(id);
            if (player != null) {
                restoreFlight(player);
            }
        }
        flight.clear();
    }

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (!sender.hasPermission("magic.items")) {
            sender.sendMessage(ChatColor.RED + "You do not have permission to obtain magic items.");
            return true;
        }
        if (!(sender instanceof Player)) {
            sender.sendMessage("Only players can receive magic items.");
            return true;
        }
        Player player = (Player) sender;
        if (args.length != 1) {
            player.sendMessage(ChatColor.YELLOW + "Usage: /magic <staff|fireball|black_hole|lightning|wings|hermet_purple|all>");
            return true;
        }
        String choice = args[0].toUpperCase(Locale.ROOT);
        if (choice.equals("ALL")) {
            give(player, createItem("STAFF", "BLAZE_ROD", "Magic Staff"));
            for (Spell spell : Spell.values()) {
                give(player, createItem(spell.name(), "PAPER", spell.display + " Spell Page"));
            }
        } else if (choice.equals("STAFF")) {
            give(player, createItem("STAFF", "BLAZE_ROD", "Magic Staff"));
        } else {
            try {
                Spell spell = Spell.valueOf(choice);
                give(player, createItem(spell.name(), "PAPER", spell.display + " Spell Page"));
            } catch (IllegalArgumentException ex) {
                player.sendMessage(ChatColor.RED + "Unknown item. Use /magic for the list.");
            }
        }
        return true;
    }

    private ItemStack createItem(String id, String material, String name) {
        ItemStack item = XMaterial.matchXMaterial(material).map(XMaterial::parseItem)
                .orElseThrow(() -> new IllegalStateException("Missing material: " + material));
        ItemMeta meta = item.getItemMeta();
        meta.setDisplayName(ChatColor.LIGHT_PURPLE + name);
        meta.getPersistentDataContainer().set(itemKey, PersistentDataType.STRING, id);
        item.setItemMeta(meta);
        return item;
    }

    private void give(Player player, ItemStack item) {
        for (ItemStack overflow : player.getInventory().addItem(item).values()) {
            player.getWorld().dropItemNaturally(player.getLocation(), overflow);
        }
    }

    @EventHandler(ignoreCancelled = true)
    public void onInteract(PlayerInteractEvent event) {
        if (event.getHand() != EquipmentSlot.HAND || (event.getAction() != Action.RIGHT_CLICK_AIR
                && event.getAction() != Action.RIGHT_CLICK_BLOCK)) {
            return;
        }
        ItemStack item = event.getItem();
        if (item == null || !item.hasItemMeta()) return;
        String id = item.getItemMeta().getPersistentDataContainer().get(itemKey, PersistentDataType.STRING);
        if (id == null) return;
        event.setCancelled(true);
        Player player = event.getPlayer();
        if (!id.equals("STAFF")) {
            try {
                Spell spell = Spell.valueOf(id);
                selected.put(player.getUniqueId(), spell);
                player.sendMessage(ChatColor.LIGHT_PURPLE + "Selected " + spell.display + ". Use your staff to cast it.");
            } catch (IllegalArgumentException ignored) {
                player.sendMessage(ChatColor.RED + "This spell page is invalid.");
            }
            return;
        }
        Spell spell = selected.get(player.getUniqueId());
        if (spell == null) {
            player.sendMessage(ChatColor.RED + "Use a spell page first.");
            return;
        }
        long now = System.currentTimeMillis();
        long ready = cooldowns.getOrDefault(player.getUniqueId(), 0L);
        if (now < ready) {
            player.sendMessage(ChatColor.RED + "Your staff is recharging.");
            return;
        }
        cooldowns.put(player.getUniqueId(), now + 2000L);
        cast(player, spell);
    }

    private void cast(Player player, Spell spell) {
        switch (spell) {
            case FIREBALL:
                Fireball fireball = player.launchProjectile(Fireball.class);
                fireball.setYield(2.0f);
                break;
            case BLACK_HOLE:
                blackHole(player);
                break;
            case LIGHTNING:
                Location target = targetLocation(player, 40);
                player.getWorld().strikeLightning(target);
                break;
            case WINGS:
                wings(player);
                break;
            case HERMET_PURPLE:
                Snowball projectile = player.launchProjectile(Snowball.class);
                projectile.setVelocity(player.getEyeLocation().getDirection().multiply(2));
                projectile.setMetadata("kodari_hermet_purple", new org.bukkit.metadata.FixedMetadataValue(this, true));
                new BukkitRunnable() {
                    @Override
                    public void run() {
                        if (!projectile.isValid() || projectile.isDead()) {
                            cancel();
                            return;
                        }
                        particles("PORTAL", projectile.getLocation(), 18, 0.25);
                    }
                }.runTaskTimer(this, 0L, 1L);
                break;
            default:
                break;
        }
    }

    private Location targetLocation(Player player, int range) {
        org.bukkit.block.Block block = player.getTargetBlockExact(range);
        return block == null ? player.getEyeLocation().add(player.getEyeLocation().getDirection().multiply(range))
                : block.getLocation().add(0.5, 1, 0.5);
    }

    private void blackHole(Player caster) {
        Location center = targetLocation(caster, 15);
        World world = center.getWorld();