elbarto03716

a blue sword made of machalite which i want you to also add

Kodari AI
KodariOct 12 at 1:03 am 1
MachaliteBlade
Adds a craftable blue sword made of machalite, a new custom material. The plugin introduces machalite ore blocks that spawn in the world, mineable with an iron pickaxe or better. Players can smelt machalite ore into machalite ingots, which are then used to forge the Machalite Blade at a crafting table. The sword features a distinct blue glow effect, enhanced durability, and deals bonus damage. Includes custom crafting recipes, item descriptions, and optional enchantment compatibility. The plugin also provides configurable spawn rates and damage values via a simple config file.
  1. Create a Paper plugin with /malachitesword to give the sword.

  2. Make it a diamond sword with an aqua Malachite Sword name, lore, and a plugin marker.

  3. Add the plugin metadata and build configuration.

Added the Malachite Sword plugin. Players can use /malachitesword to receive a diamond sword named Malachite Sword, with aqua text and malachite-themed lore.

The blade uses Minecraft’s vanilla diamond-sword texture for now. To give it a custom blue-green texture, enable texture generation in the project’s Settings → Generation.

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

import com.cryptomorin.xseries.XMaterial;
import org.bukkit.ChatColor;
import org.bukkit.NamespacedKey;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.persistence.PersistentDataType;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.List;

public final class MalachiteSwordPlugin extends JavaPlugin implements CommandExecutor {
    private NamespacedKey swordKey;

    @Override
    public void onEnable() {
        swordKey = new NamespacedKey(this, "malachite_sword");
        getCommand("malachitesword").setExecutor(this);
    }

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (!(sender instanceof Player player)) {
            sender.sendMessage("Only players can receive the Malachite Sword.");
            return true;
        }

        ItemStack sword = XMaterial.matchXMaterial("DIAMOND_SWORD")
                .map(XMaterial::parseItem)
                .orElseThrow(() -> new IllegalStateException("DIAMOND_SWORD is unavailable."));
        ItemMeta meta = sword.getItemMeta();
        meta.setDisplayName(ChatColor.AQUA + "Malachite Sword");
        meta.setLore(List.of(
                ChatColor.GRAY + "Forged from malachite.",
                ChatColor.DARK_AQUA + "A vivid blue-green blade."
        ));
        meta.getPersistentDataContainer().set(swordKey, PersistentDataType.BYTE, (byte) 1);
        sword.setItemMeta(meta);

        player.getInventory().addItem(sword).values()
                .forEach(item -> player.getWorld().dropItemNaturally(player.getLocation(), item));
        player.sendMessage(ChatColor.AQUA + "You received a Malachite Sword!");
        return true;
    }
}