Tygo Boot

manepear spear armor

Kodari AI
KodariOct 23 at 1:03 pm 1
SpearArmorSystem
SpearArmorSystem is a Minecraft plugin that introduces a unique armor system where players can forge and equip spears as protective gear. The plugin adds custom spear armor pieces with distinct defensive stats, durability mechanics, and visual effects. Players can craft spear armor using specialized materials, upgrade their gear through progression tiers, and activate special defensive abilities when wielding spears. The system integrates with existing Minecraft armor mechanics while providing unique bonuses such as increased melee resistance, spear-throw deflection, and enhanced mobility when equipped. Includes configurable settings for armor values, crafting recipes, and ability cooldowns.
  1. Create the Gradle project and plugin metadata for a Paper plugin named Manepear.

  2. Add /manepear to give players a custom-named trident spear and full netherite armor set.

Created the Manepear plugin. Players with permission can use /manepear to receive a custom-named trident spear and full netherite armor set.

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

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

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public final class ManepearPlugin extends JavaPlugin {
    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (!(sender instanceof Player player)) {
            sender.sendMessage(ChatColor.RED + "Only players can use this command.");
            return true;
        }

        List<ItemStack> kit = List.of(
                createItem("TRIDENT", "&6Manepear Spear"),
                createItem("NETHERITE_HELMET", "&6Manepear Helmet"),
                createItem("NETHERITE_CHESTPLATE", "&6Manepear Chestplate"),
                createItem("NETHERITE_LEGGINGS", "&6Manepear Leggings"),
                createItem("NETHERITE_BOOTS", "&6Manepear Boots")
        );

        for (ItemStack item : kit) {
            Map<Integer, ItemStack> leftovers = player.getInventory().addItem(item);
            leftovers.values().forEach(leftover -> player.getWorld().dropItemNaturally(player.getLocation(), leftover));
        }

        player.sendMessage(ChatColor.GREEN + "You received the Manepear set.");
        return true;
    }

    private ItemStack createItem(String materialName, String displayName) {
        ItemStack item = XMaterial.matchXMaterial(materialName)
                .map(XMaterial::parseItem)
                .orElseThrow(() -> new IllegalStateException("Unsupported item: " + materialName));
        ItemMeta meta = item.getItemMeta();
        if (meta != null) {
            meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', displayName));
            List<String> lore = new ArrayList<>();
            lore.add(ChatColor.GRAY + "Part of the Manepear set");
            meta.setLore(lore);
            item.setItemMeta(meta);
        }
        return item;
    }
}