Ffgjyfdd Fdgji

You are an expert Minecraft Paper plugin developer. Build a COMPLETE, COMPILABLE Paper plugin project called "Spear & Mace SMP" and deliver it as a ZIP. Do not explain how to build it, do not give isolated snippets, do not use pseudocode, TODOs, placeholder methods, fake classes or missing dependencies. Create every file yourself, make everything internally consistent, compile it, fix all errors, and only then deliver.

1. OVERVIEW

Every player owns exactly one Spear and one Mace. Both are soulbound and always at the same level. Each PvP kill upgrades both together (Lunge for the spear, Wind Burst for the mace) up to level X. Each death downgrades both. Appearance changes by tier through a matching resource pack. Progress is stored per player UUID.

2. COMPATIBILITY (decisions made for you)

  • Target: Paper 1.21.11 (the first version with spears, Material *_SPEAR and Enchantment.LUNGE). Dependency io.papermc.paper:paper-api:1.21.11-R0.1-SNAPSHOT, compileOnly. Verify the dependency resolves and that spear materials and the Lunge enchantment exist in that API. If not, use the nearest Paper release that has them and document the change in the README.
  • Java 21. api-version: '1.21'. Paper only (no Spigot compatibility, folia-supported not declared).
  • Use Adventure and MiniMessage for all text. Avoid deprecated APIs (no legacy ChatColor, no setDisplayName(String)). Use PersistentDataContainer, ItemMeta#setItemModel, ItemMeta#setCustomModelDataComponent and attribute modifiers with NamespacedKeys.
  • No external plugin dependencies.

3. PROJECT STRUCTURE

Gradle (Kotlin DSL) project, group com.example.spearmacesmp (rename if you prefer), with the Gradle wrapper generated:

  • build.gradle.kts, settings.gradle.kts, gradlew, gradlew.bat, gradle/wrapper/*
  • src/main/java/.../ with packages commands, listeners, items, data, config, util, tasks, and a main class SpearMaceSMP
  • src/main/resources/plugin.yml and config.yml
  • resourcepack/ (source of the pack, see section 9)
  • tools/generate_textures.py (Pillow) that regenerates all textures
  • README.md (setup, config reference, texture guidelines, resource pack hosting, balance notes, permissions)
  • dist/SpearMaceSMP.jar and dist/SpearMaceSMP-ResourcePack.zip (built deliverables)
  • .gitignore

Exclude build/, .gradle/, .idea/, caches and temp files from the ZIP. Keep dist/ as the only compiled output.

4. plugin.yml

Complete and valid: name SpearMaceSMP, version from build, main class, api-version, author, description, command smp (description, usage, aliases spearmace), and all permissions below with descriptions, defaults and parent/children.

Permissions:

  • smp.use (default true): base /smp and /smp stats on self
  • smp.stats.others (default op): /smp stats <player>
  • smp.admin (default op): parent of smp.admin.setkills, smp.admin.reset, smp.admin.reload
  • smp.bypass.cooldown (default false): bypasses repeat-kill cooldown
  • smp.bypass.altcheck (default false): bypasses alt detection

5. CORE MECHANICS

5.1 Level / kill / tier model (ambiguity resolved)

  • Kills range 0 to 10 (constant max 10).
  • Enchant level of Lunge and Wind Burst = min(10, kills + 1). So kills 0 is level I, kills 1 is level II, kills 9 and kills 10 are both level X.
  • Kill 10 is the "full power" state: only when kills == 10 (config full_enchant_kills, default 10) are all the other enchantments also level X.
  • Tiers, set by kills_per_tier in config (a map of tier id to minimum kills): wood 0, stone 2, gold 4, diamond 6, god 9. Validate: the first must be 0, values strictly ascending, all five tiers present. On invalid config fall back to the defaults and log a warning.
  • Both weapons are always generated from the same kill count, so they can never desync. Always rebuild both from the stored kill count; never upgrade them independently.

5.2 Soulbound items

  • Identification only by PDC (never by name or lore): keys smp_weapon (STRING: spear or mace), smp_level (INT) and smp_soulbound (BYTE).
  • Items are Unbreakable, hide the vanilla attributes tooltip and the vanilla enchantment tooltip (render all enchantment levels in lore instead, because levels beyond vanilla caps would display incorrectly), and use a non-italic named display name per tier.
  • Spear material follows the tier for a sensible fallback without the pack: wooden, stone, golden, diamond, netherite for god. Mace is always MACE. When the tier changes, replace the item in the same slot (use ItemStack#withType or rebuild it), preserving the slot.
  • Appearance: set item_model to spearmace:<weapon>_<tier> (for example spearmace:spear_stone) AND set a custom model data float equal to the tier index (0 to 4) for compatibility.
  • Protections (all cancel with a short configurable message where it makes sense):

- Drop key, drop-by-click outside the window - Any click, drag, shift-click, number-key swap or hotbar swap that would move the item into a non-player inventory (chest, ender chest, shulker, barrel, hopper, dispenser, furnace, anvil, grindstone, smithing, stonecutter, loom, cartography, enchanting table, brewing stand, crafting grid and so on) - Placing it into bundles (cursor or clicked item) - InventoryMoveItemEvent and InventoryCreativeEvent (creative-mode quirks) - Item frames, glow frames, armor stands, allays, and other entity interactions while holding it - ItemSpawnEvent safety net: if a soulbound item entity ever appears, remove it and restore it to the owner - PlayerItemDamageEvent cancelled - Moving between the main hand, off hand and the player's own inventory slots stays allowed

  • Duplicates: on join and respawn, make sure the player has exactly one spear and one mace. Remove extras and fill in any that are missing (config restore_missing_on_join, default true).

5.3 Lifecycle

  • First join (no data file) and every respawn: give both weapons at the level for the stored kills (wood tier / level I for new players). Put them in the first free hotbar slots (spear slot 0, mace slot 1 if free), and otherwise anywhere free.
  • Death (PlayerDeathEvent), regardless of killer or cause, if downgrade_on_death is true:

1. Remove all soulbound items from getDrops(), from getItemsToKeep() and from the player's inventory (works with and without keepInventory). A killer can never take them. 2. kills = max(0, kills - levels_lost_per_death) (default 1). 3. On respawn (PlayerRespawnEvent plus a one-tick delayed task) give freshly built weapons for the new kill count. 4. If the player was already at kills 0, nothing is lost and they just respawn with the wooden weapons.

If downgrade_on_death is false, weapons are still removed and regiven at the same level (still never droppable).

  • Downgrade note: going 10 to 9 kills keeps Lunge X / Wind Burst X (level is min(10, kills + 1)) but removes the all-X extra enchantments. Messages must describe what actually changed.
  • Kill credit (PlayerDeathEvent with getKiller() being a Player), process the kill credit BEFORE the victim's downgrade so simultaneous mutual kills are handled correctly:

- Ignore self-kills and non-player killers. - If kills < 10, then kills++, update both weapons in the killer's inventory instantly (in place), then show feedback. - At 10 kills no further upgrade, but lifetime stats still count.

  • Anti-abuse:

- Repeat-kill cooldown: repeat_kill_cooldown (seconds, default 600) per killer-victim pair. A kill inside the cooldown gives no credit (a configurable message for the killer). Persist last-kill timestamps in the killer's data file (pruned to the cooldown window). Bypass with smp.bypass.cooldown. - Alt detection (alt_detection.enabled, default true): deny credit if killer and victim share an IP address (current IP), or if their stored IP-hash histories overlap. Store only salted SHA-256 hashes of IPs (random server salt generated once and stored in the data folder), up to 5 recent hashes per player, never raw IPs. alt_detection.ignore_local_addresses (default true) skips loopback and private LAN addresses so local testing works. Bypass with smp.bypass.altcheck. - A denied kill still counts toward nothing, but the victim still downgrades on death.

5.4 Levels above vanilla caps and balance

  • Apply the vanilla enchantments Lunge and Wind Burst at min(level, enchantment.getMaxLevel()) (use the real API max, do not hardcode 3). For levels beyond the vanilla cap, add custom supplemental behaviour scaled by damage_scaling config:

- Wind Burst: after a mace smash attack, add extra upward velocity of (level - vanillaMax) velocity_per_extra_level (default 0.12 per level) capped at max_extra_velocity (default 0.9), with a per-player internal cooldown that shrinks with level (default 4.0 s - 0.25 s level, minimum 1.5 s). Reset fall distance after the boost to avoid fall damage on landing. - Lunge: after a spear attack (EntityDamageByEntityEvent with a soulbound spear in the main hand), add a bounded forward impulse of (level - vanillaMax) * lunge_velocity_per_extra_level (default 0.10), capped, with a similar shrinking cooldown. Pick the most reliable Paper event for detecting the spear's lunge or attack and document the choice in the README.

  • Attribute scaling: set explicit item attribute modifiers for attack damage and attack speed that fully override defaults, computed as base + (level - 1) * per_level:

- Spear: base damage 3.0, +0.6 per level. Attack speed 1.4 + 0.05 per level, max 2.2. - Mace: base damage 6.0, +0.5 per level. Attack speed 0.6 + 0.04 per level, max 1.0. - All values configurable under damage_scaling.spear and damage_scaling.mace.

  • At kills == 10, additionally apply as unsafe enchantments at level X (10): spear gets Sharpness, Unbreaking, Mending, Looting, Fire Aspect, Knockback; mace gets Sharpness, Density, Breach, Unbreaking, Mending, Fire Aspect, Knockback. The list per weapon is configurable (full_enchants.spear and full_enchants.mace, using namespaced enchantment keys; skip unknown keys with a warning).
  • Damage cap so level X is strong but not unbeatable: clamp the raw damage (before armor) in EntityDamageByEntityEvent when the damager holds a soulbound weapon: max_damage_per_hit.spear default 18.0, max_damage_per_hit.mace default 30.0 (Density X would otherwise one-shot from small falls). Optionally cap the fall distance counted for smash bonus (max_counted_fall_blocks, default 20). Implement the clamp without breaking vanilla armor and protection calculations.
  • Keep all of the above numbers configurable in config.yml with comments.

5.5 Feedback

  • On upgrade: send a Title with MiniMessage (title "Spear upgraded to Lunge V!", subtitle "Mace upgraded to Wind Burst V!"), a level-up sound (default entity.player.levelup, pitch rising with level), and for reaching the god tier (kills 9 or more) a firework-style particle burst plus a special sound.
  • On downgrade: a different title ("Spear downgraded to Lunge IV!" and "Mace downgraded to Wind Burst IV!") and a dull sound (default entity.item.break). If nothing was lost at kills 0, send a short chat message instead of a title.
  • Titles, subtitles, sounds (name, volume, pitch), fade times and every chat message are configurable in config.yml under messages and feedback, using MiniMessage placeholders such as <level>, <roman>, <kills>, <tier>, <player>.
  • God-tier particles: a single repeating task (config particles.period_ticks, default 10) that only iterates online players holding a god-tier weapon in the main hand. Spawn a small, cheap particle effect (for example END_ROD, DUST in gold, white and red-stone red). Toggle in particles.enabled. Cancel the task cleanly in onDisable.

6. PERSISTENCE

  • One YAML file per player: plugins/SpearMaceSMP/data/<uuid>.yml with name, kills, lifetime_kills, deaths, last_kills (victim UUID to epoch millis), ip_hashes.
  • Load asynchronously on AsyncPlayerPreLoginEvent into a ConcurrentHashMap cache; unload on quit after saving. Save on a quit, on every kill-count change, on a periodic autosave (config autosave_minutes, default 5), and flush everything synchronously on onDisable. All file I/O off the main thread (single-thread executor, shut down cleanly). Write atomically (temp file then move). Handle corrupt or missing files gracefully (back up the corrupt file, start fresh, log a warning).
  • Offline players for admin commands: load from disk (async), modify and save without caching forever. If the player is online, update live items immediately.

7. COMMANDS (/smp, with tab completion for all)

  • /smp or /smp help: show help, filtered by the sender's permissions.
  • /smp stats [player]: smp.use for self, smp.stats.others for others. Shows kills, level (roman numerals), tier, kills until the next tier, lifetime kills, deaths. Console must supply a player. Unknown player gives a clear error. Offline known players are allowed.
  • /smp setkills <player> <0-10>: smp.admin.setkills. Validates an integer in 0 to 10 (a clear error otherwise). Sets the kills and rebuilds both weapons (if online), saves, and sends the player an update title. Confirmation to the sender.
  • /smp reset <player>: smp.admin.reset. Sets kills to 0 (and clears kill cooldown history), rebuilds the weapons at wood tier, confirmation to the sender and a message to the player.
  • /smp reload: smp.admin.reload. Reloads config.yml safely (validate first, keep the old config if invalid), then refreshes all online players' weapons so they match the new settings.
  • Tab completion: subcommands the sender can use, online player names, and 0 to 10 for setkills.
  • Wrong or missing arguments: show a usage message. Insufficient permission: configurable no-permission message.

8. CONFIGURATION (config.yml, fully commented)

Must include at least: levels_lost_per_death (1), kills_per_tier (map), repeat_kill_cooldown (600), damage_scaling (sections above), downgrade_on_death (true), full_enchant_kills (10), full_enchants, max_damage_per_hit, alt_detection, restore_missing_on_join, autosave_minutes, particles, feedback (sounds and titles), messages (every player-facing string in MiniMessage), resource_pack (url, sha1, required, prompt; if url is non-empty, send the pack on join with the proper API, otherwise do nothing), and tier display names and colors. Validate values (clamp or fall back with a logged warning); never crash on a missing key.

9. RESOURCE PACK (resourcepack/)

  • Structure: pack.mcmeta (set the correct pack_format / supported format range for Minecraft 1.21.11; verify the number, and use a range such as min_format/max_format if unsure so it also loads on adjacent versions), pack.png, assets/spearmace/items/<weapon>_<tier>.json (10 item model definitions), assets/spearmace/models/item/.json, assets/spearmace/textures/item/.png.
  • Base the models on the vanilla 1.21.11 spear and mace models and display transforms so the weapons look correct in hand, in GUI and on the ground; if the exact vanilla parent is not available, use minecraft:item/handheld with documented display adjustments and make the spear look long and thin.
  • Textures: 32x32 PNG (16x16 is acceptable, documented in the README), transparent background, a consistent outline, 3 to 4 shades per material. Palettes: wood light brown (#C8A06A, #A67C45, #7A5530), stone grey (#B0B0B0, #8A8A8A, #5E5E5E), gold golden shine (#FFE45C, #F2B91B, #B8860B plus white highlight pixels), diamond shining blue glow (#6FF2E6, #2FC4D8, #1B7FA8 plus a pale blue glow halo), god: gold shaft and head with white highlights, redstone red inlays (#E02424, #8A0F0F) and diamond cyan gems.
  • God tier is animated: a vertical frame strip (8 frames, 32x256) with a .png.mcmeta animation (frametime 3, interpolate true) producing a pulsing glow, and set enchantment_glint_override to true on god-tier items.
  • Generate all PNGs with tools/generate_textures.py (Pillow) and commit the generated files. If Pillow is unavailable, write an equivalent Java generator and use that instead. Build dist/SpearMaceSMP-ResourcePack.zip with pack.mcmeta at the zip root.
  • The model updates instantly on every upgrade and downgrade because the plugin swaps item_model and custom model data in place.

10. EVENTS TO HANDLE (register all explicitly)

AsyncPlayerPreLoginEvent, PlayerJoinEvent, PlayerQuitEvent, PlayerDeathEvent, PlayerRespawnEvent, PlayerDropItemEvent, InventoryClickEvent, InventoryDragEvent, InventoryMoveItemEvent, InventoryCreativeEvent, PlayerInteractEntityEvent, PlayerInteractAtEntityEvent, ItemSpawnEvent, PlayerItemDamageEvent, EntityDamageByEntityEvent (damage cap and custom lunge or wind burst), plus whichever preparation events (anvil, grindstone, smithing, enchanting) are needed as a belt-and-braces block.

11. PERFORMANCE AND ERROR HANDLING

  • No per-tick scanning of all players. Only the particle task (period configurable) and autosave run repeatedly. No blocking I/O on the main thread. Cache NamespacedKeys, MiniMessage instances and parsed config values. Clean up per-player maps on quit and purge expired cooldown entries. Cancel all tasks and flush data in onDisable.
  • Handle gracefully: invalid command input, missing config keys, offline or never-seen players, dead or disconnected players when rebuilding items, full inventories (place items in the first free slot; if none free, replace the existing soulbound item or hold the delivery until space exists, never drop it), reloads, server restarts, unknown enchantment keys, corrupt data files.

12. CODE QUALITY

Clean architecture with separate classes (config manager, data store, weapon factory, level and tier service, kill-credit service, anti-abuse service, listeners, command handler, tasks). Meaningful names, no duplicated logic, Javadoc on public classes, no TODOs, no stubs, no unused code.

13. BUILD, VERIFY, DELIVER

  1. Build with ./gradlew build (or the equivalent). If compilation fails, diagnose, fix and rebuild until it succeeds. If the environment has no network access for Gradle, say so clearly, still produce the complete project, and report exactly what could not be verified.
  2. Verify and report: plugin.yml is valid YAML and inside the built jar, the main class exists and matches, the command and all permissions are registered, config.yml parses and every key referenced in code exists, all listeners are registered in onEnable, the jar contains no missing classes, the resource pack JSON files are valid JSON and every referenced texture and model file exists, and the resource pack zip has pack.mcmeta at its root.
  3. Deliver ONE ZIP of the whole project in the structure from section 3 (with dist/ containing the jar and pack zip), with no IDE files, caches or temporary files.
  4. In your final message give a short summary: the ZIP location, Paper and Java versions, how to install the jar and host the resource pack, and any decision you had to adapt from this spec (with the reason).
Kodari AI
KodariToday at 3:02 pm 1
SpearMaceSMP
A Paper plugin where every player owns soulbound Spear and Mace weapons that level up together through PvP kills. Both weapons upgrade simultaneously with Lunge and Wind Burst enchantments, changing visual tiers from wood to god through a bundled resource pack. Features configurable damage scaling, anti-abuse protections including repeat-kill cooldowns and alt detection, full persistence per player UUID, admin commands for managing kill counts, and comprehensive MiniMessage-based feedback with titles, sounds, and particle effects.

This is a Java plugin project, but Kodari cannot build the requested resource pack; texture generation can be enabled under Settings → Generation or at https://kodari.ai/settings?tab=features.

Kodari can make mistakes. Review important code before using.
Files

No files in this session

Code