Shaun Siu

Crescent moon blade thats a sharp 5 sword and works like a mace with density and shoots out moon beams that deal 3 hearts per hit

Kodari AI
KodariYesterday at 11:17 pm 1
LunarCrescentBlade
A Minecraft plugin that adds a unique crescent moon blade weapon. The blade is a sharpness V sword with mace-like density mechanics, allowing players to slam down from heights for bonus damage. When swung, it periodically fires moon beams that travel forward, dealing 3 hearts (6 damage) per hit to any entity they strike. The plugin includes custom item crafting recipes, particle effects for the moon beams, cooldown management for the beam ability, and full configuration options for damage values, beam speed, and cooldown duration. Ideal for RPG servers seeking a distinctive celestial-themed weapon.

I’ll create the blade as a Sharpness V sword with Density V-style falling damage and a right-click moon beam that deals three hearts.

Created the Crescent Moon Blade. Use /moonblade to get one.

  • Sharpness V and Density V-style falling damage

  • Right-click moon beam deals 3 hearts before armor

  • 3-second beam cooldown

Shaun Siu

it will only stay on 1 person

Kodari AI
KodariYesterday at 11:17 pm 1

Do you mean only one player on the server can own the blade, or that the moon beam should hit only one player at a time?

Shaun Siu

only 1 person can own the blade so it can be dropped

Kodari AI
KodariYesterday at 11:18 pm 1

[Generation stopped]

Shaun Siu

cant be dropped

Kodari AI
KodariYesterday at 11:18 pm 1
  • Limit the blade to one persistent owner.

  • Prevent dropping or transferring it, and return it after death.

The first player to use /moonblade becomes its sole owner. The blade can’t be dropped or transferred, and it returns to its owner after death. Use a number key to move it to a hotbar slot.

Shaun Siu

make the sword called crecent eclipse and make the light beam ability have cooldown

Kodari AI
KodariYesterday at 11:27 pm 1
  • Rename the blade, including existing owners’ copies.

  • Keep the beam’s existing three-second cooldown and show it in the lore.

Renamed the sword Crecent Eclipse, including existing copies. Its light beam has a 3-second cooldown, now shown in the lore.

Shaun Siu

make it so only 1 person can have it

Kodari AI
KodariYesterday at 11:27 pm 1

The blade is already bound to one player: the first player to use /moonblade becomes its permanent owner, and others can’t use it.

The command won’t give out another blade, though this doesn’t remove copies created by external plugins or administrative tools.

Shaun Siu

does this mod work for single player

Kodari AI
KodariYesterday at 11:32 pm 1

This is a server plugin, so it won’t run directly in a normal single-player world. You can use it on a Paper or Spigot server that you play on alone.

Shaun Siu

make a custom texture for it and make it avaliable for bedrock

Kodari AI
KodariYesterday at 11:36 pm 1

Custom textures are available to all users, but Kodari Studio is disabled for this project. Enable it under Project Settings → Generation, or for all projects at https://kodari.ai/settings?tab=features.

Bedrock players can use the plugin by joining a Java server running Geyser; seeing the custom texture on Bedrock would also require a Bedrock resource pack.

Shaun Siu

make it never drop and that only 1 person can wield it

Kodari AI
KodariToday at 4:50 pm 2
  • Keep the blade bound to its one owner and block drops.

  • Preserve it through death, even if the owner’s inventory is full.

Crecent Eclipse can’t be dropped, and only its registered owner can wield it. It returns after death; if the inventory is full, the owner can make room and use /moonblade to reclaim it.

Shaun Siu

Can you make it not drop on death

Kodari AI
KodariToday at 8:08 pm 2

It already stays with its owner on death: it’s removed from the death drops and returned after respawn. If your inventory is full, make room and use /moonblade to reclaim it.

Shaun Siu

can you make the beam fire contiunously like a beacon for 4 seconds

Kodari AI
KodariToday at 9:20 pm 1

I’ll make the beam follow your aim for four seconds, with the existing three-second cooldown starting when it ends.

The beam now follows your aim continuously for 4 seconds, dealing 3 hearts every half-second to its target. The 3-second cooldown starts when the beam ends.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
4 302
src/main/java/com/kodari/crescentmoon/CrescentMoonPlugin.java
package com.kodari.crescentmoon;

import com.cryptomorin.xseries.XEnchantment;
import com.cryptomorin.xseries.XMaterial;
import com.cryptomorin.xseries.particles.XParticle;
import org.bukkit.ChatColor;
import org.bukkit.FluidCollisionMode;
import org.bukkit.Location;
import org.bukkit.NamespacedKey;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryDragEvent;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerRespawnEvent;
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.RayTraceResult;
import org.bukkit.util.Vector;

import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.UUID;

public final class CrescentMoonPlugin extends JavaPlugin implements Listener {
    private NamespacedKey bladeKey;
    private final Map<UUID, Long> cooldowns = new HashMap<>();
    private final Set<UUID> firingBeam = new HashSet<>();
    private final Set<UUID> activeBeams = new HashSet<>();

    @Override
    public void onEnable() {
        bladeKey = new NamespacedKey(this, "crescent_moon_blade");
        getServer().getPluginManager().registerEvents(this, this);
        for (Player player : getServer().getOnlinePlayers()) updateBladeNames(player);
    }

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (!(sender instanceof Player)) {
            sender.sendMessage("Only players can receive the blade.");
            return true;
        }
        Player player = (Player) sender;
        if (getConfig().contains("blade-owner")) {
            if (isOwner(player) && getConfig().getBoolean("blade-pending")) {
                restoreBlade(player);
                return true;
            }
            player.sendMessage(ChatColor.RED + "Crecent Eclipse already has an owner.");
            return true;
        }
        if (player.getInventory().firstEmpty() == -1) {
            player.sendMessage(ChatColor.RED + "You need an empty inventory slot.");
            return true;
        }
        ItemStack blade = createBlade();
        if (blade == null) {
            player.sendMessage(ChatColor.RED + "The blade material is unavailable on this server.");
            return true;
        }
        getConfig().set("blade-owner", player.getUniqueId().toString());
        saveConfig();
        player.getInventory().addItem(blade);
        player.sendMessage(ChatColor.AQUA + "You received Crecent Eclipse.");
        return true;
    }

    private ItemStack createBlade() {
        ItemStack item = XMaterial.matchXMaterial("NETHERITE_SWORD").map(XMaterial::parseItem).orElse(null);
        if (item == null) return null;
        ItemMeta meta = item.getItemMeta();
        meta.setDisplayName(ChatColor.AQUA + "Crecent Eclipse");
        meta.setLore(Arrays.asList(
                ChatColor.GRAY + "Density V",
                ChatColor.DARK_PURPLE + "Fall upon your enemies with lunar force.",
                ChatColor.AQUA + "Right-click to unleash a moon beam.",
                ChatColor.GRAY + "Beam duration: 4 seconds",
                ChatColor.GRAY + "Cooldown: 3 seconds"));
        meta.getPersistentDataContainer().set(bladeKey, PersistentDataType.BYTE, (byte) 1);
        XEnchantment.matchXEnchantment("SHARPNESS").ifPresent(enchantment ->
                meta.addEnchant(enchantment.getEnchant(), 5, true));
        item.setItemMeta(meta);
        return item;
    }

    private boolean isBlade(ItemStack item) {
        return item != null && item.hasItemMeta()
                && item.getItemMeta().getPersistentDataContainer().has(bladeKey, PersistentDataType.BYTE);
    }

    private void updateBladeNames(Player player) {
        ItemStack[] contents = player.getInventory().getContents();
        for (ItemStack item : contents) {
            if (!isBlade(item)) continue;
            ItemMeta meta = item.getItemMeta();
            meta.setDisplayName(ChatColor.AQUA + "Crecent Eclipse");
            meta.setLore(Arrays.asList(
                    ChatColor.GRAY + "Density V",
                    ChatColor.DARK_PURPLE + "Fall upon your enemies with lunar force.",
                    ChatColor.AQUA + "Right-click to unleash a moon beam.",
                    ChatColor.GRAY + "Beam duration: 4 seconds",
                    ChatColor.GRAY + "Cooldown: 3 seconds"));
            item.setItemMeta(meta);
        }
        player.getInventory().setContents(contents);
    }

    @EventHandler
    public void onJoin(PlayerJoinEvent event) {
        updateBladeNames(event.getPlayer());
        if (isOwner(event.getPlayer()) && getConfig().getBoolean("blade-pending")) {
            restoreBlade(event.getPlayer());
        }
    }

    private boolean isOwner(Player player) {
        return player.getUniqueId().toString().equals(getConfig().getString("blade-owner"));
    }

    private void restoreBlade(Player player) {
        if (player.getInventory().firstEmpty() == -1) {
            player.sendMessage(ChatColor.RED + "Make room in your inventory and use /moonblade to reclaim Crecent Eclipse.");
            return;
        }
        ItemStack blade = createBlade();
        if (blade == null) return;
        player.getInventory().addItem(blade);
        getConfig().set("blade-pending", false);
        saveConfig();
    }

    @EventHandler(ignoreCancelled = true)
    public void onDrop(PlayerDropItemEvent event) {
        if (isBlade(event.getItemDrop().getItemStack())) event.setCancelled(true);
    }

    @EventHandler(ignoreCancelled = true)
    public void onInventoryClick(InventoryClickEvent event) {
        if (event.getHotbarButton() >= 0 && event.getClickedInventory() == event.getWhoClicked().getInventory()
                && event.getWhoClicked() instanceof Player && isOwner((Player) event.getWhoClicked())) return;
        if (isBlade(event.getCurrentItem()) || isBlade(event.getCursor())
                || (event.getHotbarButton() >= 0 && isBlade(event.getWhoClicked().getInventory().getItem(event.getHotbarButton())))) {
            event.setCancelled(true);
        }
    }

    @EventHandler(ignoreCancelled = true)
    public void onInventoryDrag(InventoryDragEvent event) {
        if (isBlade(event.getOldCursor())) event.setCancelled(true);
    }

    @EventHandler
    public void onDeath(PlayerDeathEvent event) {
        if (event.getKeepInventory()) return;
        Player player = event.getEntity();
        event.getDrops().removeIf(item -> {
            if (!isBlade(item)) return false;
            if (isOwner(player)) {
                getConfig().set("blade-pending", true);
                saveConfig();
            }
            return true;
        });
    }

    @EventHandler
    public void onRespawn(PlayerRespawnEvent event) {
        Player player = event.getPlayer();
        if (isOwner(player) && getConfig().getBoolean("blade-pending")) {
            getServer().getScheduler().runTask(this, () -> restoreBlade(player));
        }
    }

    @EventHandler(ignoreCancelled = true)
    public void onAttack(EntityDamageByEntityEvent event) {
        if (!(event.getDamager() instanceof Player)) return;
        Player player = (Player) event.getDamager();
        if (firingBeam.contains(player.getUniqueId())) return;
        if (!isBlade(player.getInventory().getItemInMainHand())) return;
        if (!isOwner(player)) {
            event.setCancelled(true);
            return;
        }