silky_playzz

Create a Minecraft Java Edition Paper/Spigot plugin for Minecraft 1.21.11 called Skill Mace.

Custom Weapon

  • Weapon name: Skill Mace
  • It must be a custom mace weapon.
  • Give it a unique dark-green colored name: Skill Mace.
  • Add a dark-green visual/particle effect when its abilities are activated.
  • Add a custom lore explaining its abilities.

Ability 1 — Launch

  • The player holding the Skill Mace crouches/sneaks and right-clicks.
  • Launch the player upward by approximately 10 blocks.
  • Add a dark-green particle effect around the player during the launch.
  • Add a suitable cooldown so the ability cannot be spammed.
  • The launch should work reliably without accidentally triggering normal mace behavior.

Ability 2 — Knockback Strike

  • When the player holding the Skill Mace left-clicks/hits another player, launch/knock the target backward approximately 4–5 blocks.
  • Add a dark-green particle effect when the hit ability activates.
  • Do not damage or affect the attacker.
  • Add a cooldown if necessary to prevent abuse.
  • Make the knockback direction follow the attacker's facing direction.

Give Command

Create a custom command:

/givecustomweapon <playername> <customweapon>

Example:

/givecustomweapon Steve SkillMace

Only players with OP/operator permission can use this command.

If a non-operator tries to use it, show a dark-red message saying they do not have permission.

The command should give the specified player the Skill Mace.

Technical Requirements

  • Minecraft version: 1.21.11
  • Platform: Paper/Spigot
  • Java plugin.
  • Use the correct APIs for Minecraft 1.21.11.
  • Do not use deprecated APIs when an appropriate modern API exists.
  • Prevent players from obtaining the Skill Mace through unauthorized commands.
  • The plugin should recognize the custom mace reliably using PersistentDataContainer, not only the item's display name.
  • Prevent the abilities from triggering with normal vanilla maces.
  • Include configurable cooldowns and launch/knockback strength in "config.yml".
  • Include "plugin.yml".
  • Include all required Java source files.
  • Include clear installation instructions.
  • Make the project compile successfully with Maven or Gradle.
  • Handle player disconnects/reloads safely.
  • Add helpful console messages for plugin startup and errors.

Suggested Messages

Use Minecraft color codes or Adventure/MiniMessage where appropriate.

Success: "Skill Mace given to <player>!"

No permission: "You don't have permission to use this command."

Launch:

Show a dark-green particle burst and subtle sound.

Hit:

Show a dark-green particle trail/burst around the target and play a suitable impact sound.

Make the plugin clean, optimized, and ready to place into the server's "plugins" folder.

Kodari AI
KodariOct 2 at 6:10 am 1
SkillMacePlugin
A Paper plugin adding a custom Skill Mace weapon with two abilities. The Launch ability propels the player upward 10 blocks with dark-green particles when sneaking and right-clicking, with configurable cooldown. The Knockback Strike ability launches hit targets backward 4-5 blocks in the attacker's facing direction with particle effects. The plugin uses PersistentDataContainer for reliable weapon identification, includes a /givecustomweapon command restricted to operators, and features configurable cooldowns and strengths in config.yml. Built for Minecraft 1.21.11 with modern Paper APIs, MiniMessage formatting, and proper event handling.
  1. Set up a Java 21 Gradle project against Paper 1.21.11.

  2. Add the tagged mace, configurable abilities/cooldowns, and operator-only command.

  3. Add plugin/config resources and installation instructions.

Created Skill Mace with configurable launch and knockback abilities, PDC-based item recognition, dark-green effects, and an operator-only /givecustomweapon command.

Build with Java 21 and gradle build, then place build/libs/skill-mace-1.0.0.jar in the server’s plugins folder. Installation steps and configuration details are in README.md.

silky_playzz

How to download plugin

Kodari AI
KodariOct 2 at 6:18 am 1

Build the project to create the plugin .jar:

  1. Download/export the SkillMacePlugin project files from Kodari to your computer.

  2. With Java 21 and Gradle installed, open a terminal in the project folder and run:

    Shell
    gradle build
    
  3. The plugin jar will be at:

    Plain Text
    build/libs/skill-mace-1.0.0.jar
    
  4. Copy that jar into your server’s plugins folder, then restart the server.

I haven’t provided a compiled jar attachment here; the jar is generated by the build.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
README.md
settings.gradle
Code
6 368
src/main/java/com/kodari/skillmace/SkillMacePlugin.java
package com.kodari.skillmace;

import com.cryptomorin.xseries.XMaterial;
import com.cryptomorin.xseries.XSound;
import com.cryptomorin.xseries.particles.XParticle;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
import org.bukkit.Bukkit;
import org.bukkit.Color;
import org.bukkit.Location;
import org.bukkit.NamespacedKey;
import org.bukkit.Particle;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter;
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.inventory.InventoryCloseEvent;
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.util.Vector;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.plugin.java.JavaPlugin;

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

public final class SkillMacePlugin extends JavaPlugin implements Listener, CommandExecutor, TabCompleter {
    private static final String WEAPON_NAME = "SkillMace";
    private static final long NANOS_PER_SECOND = 1_000_000_000L;

    private final Map<UUID, Long> launchCooldowns = new HashMap<>();
    private final Map<UUID, Long> knockbackCooldowns = new HashMap<>();

    private NamespacedKey weaponKey;
    private XMaterial maceMaterial;
    private Particle dustParticle;
    private Particle.DustOptions dustOptions;
    private long launchCooldownNanos;
    private long knockbackCooldownNanos;
    private double launchStrength;
    private double knockbackStrength;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        weaponKey = new NamespacedKey(this, "skill_mace");
        maceMaterial = XMaterial.matchXMaterial("MACE").orElse(null);
        dustParticle = XParticle.of("DUST").map(XParticle::get).orElse(null);
        dustOptions = new Particle.DustOptions(Color.fromRGB(0, 100, 0), 1.2F);

        if (maceMaterial == null || dustParticle == null) {
            getLogger().severe("Could not initialize the mace material or dark-green particle. Check the XSeries dependency.");
            getServer().getPluginManager().disablePlugin(this);
            return;
        }

        loadSettings();
        getServer().getPluginManager().registerEvents(this, this);

        if (getCommand("givecustomweapon") == null) {
            getLogger().severe("Command givecustomweapon is missing from plugin.yml; disabling SkillMace.");
            getServer().getPluginManager().disablePlugin(this);
            return;
        }
        getCommand("givecustomweapon").setExecutor(this);
        getCommand("givecustomweapon").setTabCompleter(this);

        getLogger().info("SkillMace enabled. Launch cooldown: " + getConfig().getLong("abilities.launch.cooldown-seconds")
                + "s; knockback cooldown: " + getConfig().getLong("abilities.knockback.cooldown-seconds") + "s.");
    }

    @Override
    public void onDisable() {
        launchCooldowns.clear();
        knockbackCooldowns.clear();
        getLogger().info("SkillMace disabled; active cooldowns cleared.");
    }

    private void loadSettings() {
        long launchSeconds = positiveLong("abilities.launch.cooldown-seconds", 6L);
        long knockbackSeconds = positiveLong("abilities.knockback.cooldown-seconds", 2L);
        launchCooldownNanos = launchSeconds * NANOS_PER_SECOND;
        knockbackCooldownNanos = knockbackSeconds * NANOS_PER_SECOND;
        launchStrength = positiveDouble("abilities.launch.strength", 1.35D);
        knockbackStrength = positiveDouble("abilities.knockback.strength", 1.35D);
    }

    private long positiveLong(String path, long fallback) {
        long value = getConfig().getLong(path, fallback);
        return value > 0 && value <= 86_400L ? value : fallback;
    }

    private double positiveDouble(String path, double fallback) {
        double value = getConfig().getDouble(path, fallback);
        return Double.isFinite(value) && value > 0.0D ? value : fallback;
    }

    private ItemStack createSkillMace() {
        ItemStack item = maceMaterial.parseItem();
        if (item == null) {
            getLogger().severe("XSeries could not create a mace item.");
            return null;
        }

        ItemMeta meta = item.getItemMeta();
        meta.displayName(Component.text("Skill Mace", NamedTextColor.DARK_GREEN));
        meta.lore(List.of(
                Component.text("Sneak + right-click to launch upward.", NamedTextColor.GRAY),
                Component.text("Hit a player to knock them backward.", NamedTextColor.GRAY),
                Component.text("Abilities have individual cooldowns.", NamedTextColor.DARK_GRAY)
        ));
        meta.getPersistentDataContainer().set(weaponKey, PersistentDataType.BYTE, (byte) 1);
        item.setItemMeta(meta);
        return item;
    }

    private boolean isSkillMace(ItemStack item) {
        if (item == null || item.getType().isAir() || XMaterial.matchXMaterial(item.getType()) != maceMaterial) {
            return false;
        }
        if (!item.hasItemMeta()) {
            return false;
        }
        Byte marker = item.getItemMeta().getPersistentDataContainer().get(weaponKey, PersistentDataType.BYTE);
        return marker != null && marker == (byte) 1;
    }

    @EventHandler
    public void onInteract(PlayerInteractEvent event) {
        if (event.getHand() != EquipmentSlot.HAND || !event.getPlayer().isSneaking()) {
            return;
        }
        Action action = event.getAction();
        if (action != Action.RIGHT_CLICK_AIR && action != Action.RIGHT_CLICK_BLOCK) {
            return;
        }

        Player player = event.getPlayer();
        if (!isSkillMace(player.getInventory().getItemInMainHand())) {
            return;
        }

        event.setCancelled(true);
        if (!tryStartCooldown(launchCooldowns, player.getUniqueId(), launchCooldownNanos)) {
            player.sendMessage(Component.text("Skill Mace launch is on cooldown.", NamedTextColor.RED));
            return;
        }

        Vector velocity = player.getVelocity();
        velocity.setY(launchStrength);
        player.setVelocity(velocity);
        playSound(player, "ENTITY_FIREWORK_ROCKET_LAUNCH");
        startParticleEffect(player, 12, 0.55D);
    }

    @EventHandler
    public void onPlayerDamage(EntityDamageByEntityEvent event) {
        if (!(event.getDamager() instanceof Player attacker)
                || !(event.getEntity() instanceof Player target)
                || !isSkillMace(attacker.getInventory().getItemInMainHand())) {
            return;
        }

        event.setCancelled(true);
        if (!tryStartCooldown(knockbackCooldowns, attacker.getUniqueId(), knockbackCooldownNanos)) {
            attacker.sendMessage(Component.text("Skill Mace strike is on cooldown.", NamedTextColor.RED));
            return;
        }

        Vector direction = attacker.getLocation().getDirection().setY(0.0D);
        if (direction.lengthSquared() == 0.0D) {
            return;
        }
        direction.normalize().multiply(knockbackStrength).setY(0.25D);
        target.setVelocity(direction);
        playSound(target, "ENTITY_IRON_GOLEM_HURT");
        startParticleEffect(target, 8, 0.7D);
    }

    @EventHandler
    public void onQuit(PlayerQuitEvent event) {
        UUID playerId = event.getPlayer().getUniqueId();
        launchCooldowns.remove(playerId);
        knockbackCooldowns.remove(playerId);
    }

    private boolean tryStartCooldown(Map<UUID, Long> cooldowns, UUID playerId, long cooldownNanos) {
        long now = System.nanoTime();