Carl Morell

A craftable minecraft mace called "Super Mace", it does double normal mace damage and still multiply damage calculated of how long you fall before hitting an entety, if you right click your mouse while holding the mace you will get launched 15 blocks in the air and fall down again, this ability have a 15 seconds cooldown. The crafting recipe is a mace in the middle of the 3 by 3 crafting square with a wind charge in every of the four corners and netherrite ingots in the last four places.

[Viewing 1 image]

1 image attached
Kodari AI
KodariAug 31 at 2:37 pm 1
SuperMace
SuperMace is a Minecraft plugin that adds a craftable, powerful mace weapon. The Super Mace deals double the base mace damage and retains the vanilla fall-damage multiplier, scaling damage with fall distance. Right-clicking while holding the Super Mace launches the player 15 blocks into the air, enabling a devastating slam attack, with a 15-second cooldown between launches. The custom crafting recipe places a mace in the center, wind charges in all four corners, and netherite ingots in the remaining four slots, creating a unique and powerful endgame weapon.
  1. Create the Gradle project and plugin metadata.

  2. Implement the Super Mace item, recipe, damage multiplier, launch ability, and cooldown.

Created the Super Mace plugin with:

  • Crafting recipe using a mace, four wind charges, and four netherite ingots.

  • Custom “Super Mace” item identity and lore.

  • Double damage, including fall-based mace damage.

  • Right-click launch ability with approximately 15-block launch height.

  • 15-second cooldown with player feedback.

  • Paper 1.21.4 Gradle setup and plugin metadata.

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

import com.cryptomorin.xseries.XMaterial;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.inventory.CraftItemEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.RecipeChoice;
import org.bukkit.inventory.ShapedRecipe;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.persistence.PersistentDataType;
import org.bukkit.util.Vector;
import org.bukkit.plugin.java.JavaPlugin;

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

public final class SuperMacePlugin extends JavaPlugin implements Listener {

    private static final long COOLDOWN_MILLIS = 15_000L;
    private static final double LAUNCH_VELOCITY = 1.7D;
    private static final double DAMAGE_MULTIPLIER = 2.0D;

    private final Map<UUID, Long> cooldowns = new HashMap<>();
    private NamespacedKey itemKey;
    private NamespacedKey recipeKey;
    private Material maceMaterial;
    private Material windChargeMaterial;
    private Material netheriteIngotMaterial;

    @Override
    public void onEnable() {
        itemKey = new NamespacedKey(this, "super_mace");
        recipeKey = new NamespacedKey(this, "super_mace_recipe");
        maceMaterial = requireMaterial("MACE");
        windChargeMaterial = requireMaterial("WIND_CHARGE");
        netheriteIngotMaterial = requireMaterial("NETHERITE_INGOT");

        registerRecipe();
        getServer().getPluginManager().registerEvents(this, this);
    }

    @Override
    public void onDisable() {
        cooldowns.clear();
    }

    private void registerRecipe() {
        Bukkit.removeRecipe(recipeKey);

        ShapedRecipe recipe = new ShapedRecipe(recipeKey, createSuperMace());
        recipe.shape("WNW", "NMN", "WNW");
        recipe.setIngredient('W', new RecipeChoice.MaterialChoice(windChargeMaterial));
        recipe.setIngredient('N', new RecipeChoice.MaterialChoice(netheriteIngotMaterial));
        recipe.setIngredient('M', new RecipeChoice.MaterialChoice(maceMaterial));
        Bukkit.addRecipe(recipe);
    }

    private ItemStack createSuperMace() {
        ItemStack mace = requireItem("MACE");
        ItemMeta meta = mace.getItemMeta();
        meta.setDisplayName(ChatColor.GOLD + "Super Mace");
        meta.setLore(Arrays.asList(
                ChatColor.GRAY + "Double mace damage",
                ChatColor.GRAY + "Right-click to launch yourself",
                ChatColor.DARK_GRAY + "Ability cooldown: 15 seconds"
        ));
        meta.getPersistentDataContainer().set(itemKey, PersistentDataType.BYTE, (byte) 1);
        mace.setItemMeta(meta);
        return mace;
    }

    @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
    public void onMaceDamage(EntityDamageByEntityEvent event) {
        if (!(event.getDamager() instanceof Player player)) {
            return;
        }

        if (isSuperMace(player.getInventory().getItemInMainHand())) {
            event.setDamage(event.getDamage() * DAMAGE_MULTIPLIER);
        }
    }

    @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
    public void onRightClick(PlayerInteractEvent event) {
        if (event.getHand() == null || !event.getHand().isHand()) {
            return;
        }

        Action action = event.getAction();
        if (action != Action.RIGHT_CLICK_AIR && action != Action.RIGHT_CLICK_BLOCK) {
            return;
        }

        Player player = event.getPlayer();
        if (!isSuperMace(event.getItem())) {
            return;
        }

        event.setCancelled(true);

        long now = System.currentTimeMillis();
        long availableAt = cooldowns.getOrDefault(player.getUniqueId(), 0L);
        if (availableAt > now) {
            long seconds = (availableAt - now + 999L) / 1_000L;
            player.sendMessage(ChatColor.RED + "Super Mace is on cooldown for " + seconds + "s.");
            return;
        }

        Vector velocity = player.getVelocity().clone();
        velocity.setY(LAUNCH_VELOCITY);
        player.setVelocity(velocity);
        cooldowns.put(player.getUniqueId(), now + COOLDOWN_MILLIS);
        player.sendMessage(ChatColor.GOLD + "Super Mace launched you into the air!");
    }

    private boolean isSuperMace(ItemStack item) {
        if (item == null || item.getType() != maceMaterial || !item.hasItemMeta()) {
            return false;
        }

        ItemMeta meta = item.getItemMeta();
        return meta.getPersistentDataContainer().has(itemKey, PersistentDataType.BYTE);
    }

    private Material requireMaterial(String name) {
        return XMaterial.matchXMaterial(name)
                .map(XMaterial::parseMaterial)
                .orElseThrow(() -> new IllegalStateException("Missing required material: " + name));
    }

    private ItemStack requireItem(String name) {
        return XMaterial.matchXMaterial(name)
                .map(XMaterial::parseItem)
                .orElseThrow(() -> new IllegalStateException("Missing required item: " + name));
    }
}