VexyMcc

Create a Minecraft Java Edition Paper plugin called “Mettle SMP” for Minecraft 1.21.11.

The plugin should be written in Java and designed as a complete, organized, production-ready plugin. Use Paper API features where appropriate. Keep the code modular and easy to expand.

CORE METTLE SYSTEM:

  • Every player starts with 10 Mettle.
  • Maximum Mettle is 75.
  • When a player kills another player:

- Killer gains 1 Mettle. - Victim loses 1 Mettle.

  • A player reaching 0 Mettle is banned from the SMP.
  • Mettle must persist through server restarts.
  • Mettle should be stored safely using a persistent data system or database/file system.
  • Add a small HUD above the XP bar displaying: “Mettle: <amount>”.
  • Update the HUD whenever the player's Mettle changes.

METTLE LEVELS:

  • 1–20: No level ability system.
  • 21–30: Level 1.
  • 31–40: Level 2.
  • 41–50: Level 3.
  • 51–60: Level 4.
  • 61–75: Level 5.
  • When reaching 21, 31, 41, 51, or 61 Mettle, play a special level-up sound.

COMMANDS:

Implement a /mettle command with subcommands including:

  • /mettle beam
  • /mettle blade dash
  • /mettle blade dagga
  • /mettle withdraw <amount>
  • /mettle set_ability beam default
  • /mettle set_ability beam none

METTLE BEAM:

This is one of the two normal Mettle abilities.

Level 1:

  • Range: 7 blocks
  • Damage: 1.5 hearts
  • Cooldown: 25 seconds

Level 2:

  • Range: 10 blocks
  • Damage: 2 hearts
  • Cooldown: 30 seconds

Level 3:

  • Range: 13 blocks
  • Damage: 2.5 hearts
  • Cooldown: 40 seconds

Level 4:

  • Range: 15 blocks
  • Damage: 3.5 hearts
  • Cooldown: 45 seconds

Level 5:

  • Range: 20 blocks
  • Damage: 5 hearts
  • Cooldown: 55 seconds

The Beam should visually travel from the player toward the target direction and damage the first valid target within its range.

METTLE BLADE:

Mettle Blade is a custom inventory item specifically used for Dash and Dagga. It does NOT replace the normal sword.

Dash:

Level 1: 5 blocks, 20 sec cooldown Level 2: 7 blocks, 30 sec cooldown Level 3: 9 blocks, 35 sec cooldown Level 4: 12 blocks, 45 sec cooldown Level 5: 15 blocks, 50 sec cooldown

Dagga:

Level 1: 1 heart damage, 5 block range, 25 sec cooldown Level 2: 1.5 hearts damage, 7 block range, 35 sec cooldown Level 3: 2.5 hearts damage, 10 block range, 40 sec cooldown Level 4: 3 hearts damage, 13 block range, 50 sec cooldown Level 5: 4 hearts damage, 17 block range, 60 sec cooldown

Mettle Blade controls:

  • F + Shift + Left Click = Dash
  • F + Shift + Right Click = Dagga
  • /mettle blade dash = Dash
  • /mettle blade dagga = Dagga

Dash and Dagga must have separate cooldowns.

ABILITY SETTINGS: “default” and “none” only control whether the normal keybind activation is enabled.

The ability is still owned regardless of whether it is set to default or none.

PHYSICAL METTLE:

Implement:

  • /mettle withdraw <amount>
  • Players can withdraw up to 74 Mettle if they have enough.
  • The withdrawn Mettle becomes a physical custom item.
  • Right-clicking the physical Mettle adds its value back to the player's Mettle.
  • Never allow a player to exceed 75 Mettle.
  • If the player is already at 75, the physical Mettle must not be consumed.
  • Physical Mettle must be tradeable.
  • Give the item a unique persistent identifier so normal items cannot be used as fake Mettle.

DRAGON EGG SPECIAL ABILITY:

The Dragon Egg ability is separate from the two normal Mettle abilities.

When activated:

  • Launch the player 30 blocks upward.
  • Keep the player airborne for 3 seconds.
  • The player can move normally while airborne.
  • When the player lands, create a huge purple/magenta Dragon-style shockwave.
  • Shockwave radius: 7 blocks.

Damage:

  • 0–1 blocks: 7 hearts
  • 1–3 blocks: 4 hearts
  • 3–5 blocks: 3 hearts
  • 5–7 blocks: 2 hearts

Special execution mechanic:

If a target has 4 hearts or less when the Dragon Impact hits them, the attack kills them even if they have a Totem of Undying. The Totem should activate/pop, but the player still dies.

Cooldown: 5 minutes.

Use strong purple/magenta particles and an expanding shockwave effect.

REVIVE TOTEM:

A Revive Totem can revive a player who has been banned because they reached 0 Mettle.

To revive someone:

  • The player using the Revive Totem sacrifices 1 Mettle.
  • That 1 Mettle is permanently destroyed and is NOT transferred to the revived player.
  • The revived player returns with exactly 5 Mettle.
  • The Revive Totem is consumed.
  • The revived player is removed from the SMP ban state and can play again.

The exact acquisition and user interface for the Revive Totem should be designed separately and kept configurable.

ENCHANTMENT RESTRICTIONS:

Server-wide maximum enchantment levels:

  • Sharpness IV maximum.
  • Protection IV maximum.

Prevent players from bypassing this through:

  • Enchanting tables
  • Anvils
  • Enchanted books
  • Combining items
  • Loot
  • Villager trades
  • Other normal gameplay methods

Admin/testing commands may have a separate permission-based bypass.

RESTRICTED ITEMS:

The following are restricted during normal gameplay:

  • End Crystals
  • Respawn Anchors
  • Beds for PvP
  • Ender Pearls
  • Chorus Fruit
  • Elytra

The Mace is NOT simply a restricted item. It must be obtained through a special Mettle SMP server event and should not be obtainable through normal gameplay.

STARTER KIT:

Create a configurable Mettle SMP starter kit containing the server's intended starter equipment. The exact final kit contents should be configurable rather than hard-coded.

SPAWN RULES:

Prevent or punish:

  • Spawn killing
  • Spawn trapping
  • Destroying spawn
  • Griefing spawn

Spawn must remain accessible and usable.

FAIR PLAY:

Prohibit:

  • Hacked clients
  • Cheats
  • X-ray
  • Minimap mods
  • Macros/scripts that automate gameplay or provide unfair advantages
  • Exploiting bugs or glitches
  • Exploiting plugin/server vulnerabilities
  • Bypassing server restrictions
  • Unauthorized PvP advantage mods

RESOURCE PACK SUPPORT:

The plugin must support a custom Mettle SMP resource pack.

Custom items should have unique identifiers/data so the resource pack can give them custom models/textures.

The resource pack will eventually contain custom designs for:

  • Physical Mettle
  • Mettle Blade
  • Revive Totem
  • Other custom Mettle SMP items
  • Custom sounds/effects where needed

PLUGIN STRUCTURE:

Organize the project into clean classes/packages, for example:

  • Main plugin class
  • MettleManager
  • LevelManager
  • AbilityManager
  • BeamAbility
  • DashAbility
  • DaggaAbility
  • DragonEggAbility
  • ReviveManager
  • PhysicalMettleManager
  • EnchantmentRestrictionListener
  • RestrictedItemListener
  • SpawnProtectionListener
  • CommandManager
  • CooldownManager
  • ItemManager
  • DataManager

Use permissions for admin/debug functionality.

Do not make unnecessary systems or mechanics that were not requested. Keep important values easy to modify later.

First provide the complete project structure and explain what each class does. Then provide all required Java files and configuration files needed to compile the plugin.

Kodari AI
KodariSep 27 at 1:30 pm 3
MettleSMP
MettleSMP is a comprehensive Paper plugin for Minecraft 1.21.11 that implements a Mettle-based progression system. Players start with 10 Mettle (max 75), gaining 1 for kills and losing 1 when killed. Reaching 0 results in a ban. The plugin features level-based abilities including Mettle Beam (ranged damage), Mettle Blade (dash and dagga attacks), and a Dragon Egg special ability with shockwave damage. It includes physical Mettle items for trading, a Revive Totem system, enchantment restrictions (Sharpness/Protection IV max), restricted items, spawn protection, starter kit, and fair play enforcement. Custom items have unique identifiers for resource pack support.

Project structure

Plain Text
mettle-smp/
├── build.gradle
├── settings.gradle
└── src/main/
    ├── java/com/mettlesmp/
    │   ├── MettleSMP.java
    │   ├── ability/
    │   │   ├── BeamAbility.java
    │   │   ├── DashAbility.java
    │   │   ├── DaggaAbility.java
    │   │   └── DragonEggAbility.java
    │   ├── command/CommandManager.java
    │   ├── data/DataManager.java
    │   ├── listener/
    │   │   ├── BladeInputListener.java
    │   │   ├── CustomItemListener.java
    │   │   ├── EnchantmentRestrictionListener.java
    │   │   ├── PlayerLifecycleListener.java
    │   │   ├── RestrictedItemListener.java
    │   │   └── SpawnProtectionListener.java
    │   └── manager/
    │       ├── AbilityManager.java
    │       ├── CooldownManager.java
    │       ├── ItemManager.java
    │       ├── LevelManager.java
    │       ├── MettleManager.java
    │       ├── PhysicalMettleManager.java
    │       └── ReviveManager.java
    └── resources/
        ├── config.yml
        └── plugin.yml
  • MettleSMP wires managers, listeners, the command, and repeating HUD/inventory checks.

  • DataManager, MettleManager, and LevelManager handle persistent player state, elimination, level thresholds, and HUD updates.

  • AbilityManager, CooldownManager, and the four ability classes implement the beam, blade dash/dagga, and Dragon Egg impact.

  • ItemManager, PhysicalMettleManager, and ReviveManager create PDC-tagged custom items, handle physical Mettle redemption, and revive eliminated players.

  • The listeners implement input handling, join/kit/resource-pack behavior, enchantment/item restrictions, and spawn protection. config.yml exposes tuning, starter equipment, spawn settings, and resource-pack URL; plugin.yml declares commands and permissions.

Implementation plan

  1. Create the Paper/Java project and configurable plugin metadata.

  2. Add persistence, Mettle/level/item managers, and abilities.

  3. Add commands and gameplay listeners for input, restrictions, spawn, and lifecycle.

  4. Wire everything together and schedule HUD/state maintenance.

Created the Mettle SMP Paper plugin project with the Java classes and configuration files. Player Mettle is stored in plugins/MettleSMP/data.yml; ability values, starter kit, spawn protection, item restrictions, enchantment caps, custom-model-data values, and resource-pack URL are configurable.

The implementation includes the beam and blade abilities, Dragon Egg shockwave, custom physical Mettle and Revive Totem items, /mettle commands, HUD updates, and gameplay protection listeners. The particle helper is in util/Visuals.java.

Two limits to note:

  • Paper plugins cannot reliably detect hacked clients, minimaps, or automation running client-side. The rules are published through /mettle rules; actual detection requires a compatible anti-cheat or server-side review.

  • Revive Totems and event Maces are issued through /mettle admin give <player> revive|event_mace; Dragon Egg items can also be issued with that command. The revive acquisition note is configurable.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
25 1,775
src/main/java/com/mettlesmp/MettleSMP.java
package com.mettlesmp;

import com.mettlesmp.ability.DragonEggAbility;
import com.mettlesmp.command.CommandManager;
import com.mettlesmp.data.DataManager;
import com.mettlesmp.listener.BladeInputListener;
import com.mettlesmp.listener.CustomItemListener;
import com.mettlesmp.listener.EnchantmentRestrictionListener;
import com.mettlesmp.listener.PlayerLifecycleListener;
import com.mettlesmp.listener.RestrictedItemListener;
import com.mettlesmp.listener.SpawnProtectionListener;
import com.mettlesmp.manager.AbilityManager;
import com.mettlesmp.manager.CooldownManager;
import com.mettlesmp.manager.ItemManager;
import com.mettlesmp.manager.LevelManager;
import com.mettlesmp.manager.MettleManager;
import com.mettlesmp.manager.PhysicalMettleManager;
import com.mettlesmp.manager.ReviveManager;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

public final class MettleSMP extends JavaPlugin {
    private DataManager dataManager;
    private LevelManager levelManager;
    private MettleManager mettleManager;
    private ItemManager itemManager;
    private PhysicalMettleManager physicalMettleManager;
    private AbilityManager abilityManager;
    private ReviveManager reviveManager;
    private SpawnProtectionListener spawnProtectionListener;
    private RestrictedItemListener restrictedItemListener;
    private EnchantmentRestrictionListener enchantmentRestrictionListener;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        dataManager = new DataManager(this);
        dataManager.load();
        levelManager = new LevelManager(this);
        mettleManager = new MettleManager(this, dataManager, levelManager);
        itemManager = new ItemManager(this);
        CooldownManager cooldownManager = new CooldownManager();
        physicalMettleManager = new PhysicalMettleManager(this, mettleManager, itemManager);
        abilityManager = new AbilityManager(this, mettleManager, dataManager, itemManager, cooldownManager);
        reviveManager = new ReviveManager(this, dataManager, mettleManager, itemManager);

        spawnProtectionListener = new SpawnProtectionListener(this);
        restrictedItemListener = new RestrictedItemListener(this);
        enchantmentRestrictionListener = new EnchantmentRestrictionListener(this);
        Bukkit.getPluginManager().registerEvents(new PlayerLifecycleListener(this), this);
        Bukkit.getPluginManager().registerEvents(new BladeInputListener(this), this);
        Bukkit.getPluginManager().registerEvents(new CustomItemListener(this), this);
        Bukkit.getPluginManager().registerEvents(enchantmentRestrictionListener, this);
        Bukkit.getPluginManager().registerEvents(restrictedItemListener, this);
        Bukkit.getPluginManager().registerEvents(spawnProtectionListener, this);
        DragonEggAbility dragonEggAbility = abilityManager.getDragonEggAbility();
        Bukkit.getPluginManager().registerEvents(dragonEggAbility, this);

        CommandManager commandManager = new CommandManager(this);
        if (getCommand("mettle") != null) {
            getCommand("mettle").setExecutor(commandManager);
            getCommand("mettle").setTabCompleter(commandManager);
        }

        long refreshTicks = Math.max(1, getConfig().getLong("hud.refresh-ticks", 20));
        Bukkit.getScheduler().runTaskTimer(this, () -> {
            restrictedItemListener.sanitizeOnlinePlayers();
            for (Player player : Bukkit.getOnlinePlayers()) {
                levelManager.updateHud(player, mettleManager.getMettle(player));
                enchantmentRestrictionListener.sanitizeInventory(player);
            }
        }, 1L, refreshTicks);
        getLogger().info("Mettle SMP enabled.");
    }

    @Override
    public void onDisable() {
        if (dataManager != null) dataManager.save();
    }

    public DataManager getDataManager() {
        return dataManager;
    }

    public LevelManager getLevelManager() {
        return levelManager;
    }

    public MettleManager getMettleManager() {
        return mettleManager;
    }

    public ItemManager getItemManager() {
        return itemManager;
    }

    public PhysicalMettleManager getPhysicalMettleManager() {
        return physicalMettleManager;
    }

    public AbilityManager getAbilityManager() {
        return abilityManager;
    }

    public ReviveManager getReviveManager() {
        return reviveManager;
    }

    public SpawnProtectionListener getSpawnProtectionListener() {
        return spawnProtectionListener;
    }
}