# LegacySMP Plugin β Fix & Complete (Paper/Bukkit)
You are working on an **existing Minecraft Paper plugin called LegacySMP**. Your job is to **inspect the current project source code first**, then fix, complete, and improve it β not recreate it from scratch.
## Ground Rules (do not violate)
- Inspect the existing code before changing anything. Preserve every feature that already works.
- Fix broken systems; do not rewrite unrelated working systems (e.g. the World Border system already works β only adjust the specific behaviors listed below).
- No TODOs, placeholders, pseudo-code, unfinished classes, or commands that do nothing. Every feature must actually function in-game.
- Keep the project compiling at every stage. Use modern Paper/Bukkit APIs for the project's MC version.
- Persist all important data (SQLite preferred) keyed by **player UUID**, never username.
- Do NOT add any Anti-Cheat, Anti-Xray, or Anti-Freecam system, or general movement/killaura detection. Only anti-exploit protections for LegacySMP's own custom systems (dupes, cooldown bypass, permission bypass, etc).
- Use a clean modular class structure (see "Code Structure" below) β no single giant class.
- Do not finish with just a written summary β implement directly in the project files, then verify against the checklist at the end.
## Top-Priority Fixes (things currently broken)
1. Custom Maces don't work β fix completely, must be real Minecraft Mace items with working abilities.
2. Custom Armor is incomplete (Helmet only) β must have 2 full sets (Helmet/Chestplate/Leggings/Boots = 8 pieces).
3. Starting World Border must be exactly 10x10 blocks.
4. Normal death must respawn the player at their exact death location (not world/bed spawn).
5. Exactly 3 collectible player Maces total: 1 Diamond + 2 Regular. The Admin Mace is separate and NEVER counts toward this limit.
6. Diamond Mace needs multiple real working abilities, each with its own cooldown.
7. Full Armor Set + Shift = Small Form, only during a Staff-controlled Event.
---
## 1. Lifesteal System
- Configurable: starting hearts, max hearts, hearts gained per kill, hearts lost per death, hearts restored on revive.
- On kill: killer +1 heart (configurable), victim -1 heart (configurable). Update actual max health correctly.
- Store by UUID. Persist through disconnect/reconnect/restart/reload/crash.
- Prevent: duplicate heart rewards/losses per kill/death, values going below 0 or above max, respawn/reconnect exploits.
## 2. Elimination at 0 Hearts
- At exactly 0 hearts: kick, permanently ban, save eliminated state, show configurable elimination message.
- Eliminated state and ban must survive restart; player can't reconnect until revived.
## 3. Revive System
- `/ls revive ` β removes ban + eliminated status, restores configurable hearts, works for offline players.
## 4. Death Location Respawn
- Real death occurs, but player respawns at the exact world/X/Y/Z/yaw/pitch of death β never world/bed/anchor spawn.
- If death drops hearts to 0, elimination/ban takes priority over the respawn-restore.
## 5. Six Custom Items
- Each: secure PDC identifier (never identify by name/lore alone), custom name/lore, correct material, enchantments, Custom Model Data support, unique ability, cooldown, particles, sounds, configurable values.
- 6 distinct mechanics (e.g. dash, shockwave, knockback, temp strength/speed, resistance, shield, area attack, PvP debuff, escape) β no duplicated mechanics.
## 6. Custom Swords
- Each: unique PDC ID, name, lore, damage, enchantments, ability (right/left click, shift+right click, or attack trigger β must not trigger accidentally), cooldown, particles, sounds.
## 7. Two Admin Swords
- Staff-only, permission `legacysmp.adminsword` checked on every activation.
- If a normal player somehow has one, the special ability must not work.
- Unique PDC ID, unique ability, strong configurable effects, cooldown, sounds, particles, staff-only lore.
## 8β19. Custom Mace System (critical fix)
- Real Minecraft Mace items with working custom abilities.
- Exactly 3 collectible/player Maces total: 1 Diamond Mace max, 2 Regular Custom Maces max. Admin Mace is separate and excluded from this count entirely.
- **Mace Registry**: persistent (SQLite), each Mace has unique PDC ID, unique serial number, type, creation record, status, owner (if any). Registry is the source of truth (not inventory scanning); must track Maces in inventory, ender chest, containers, shulkers, dropped, or owned by offline players. Survives restart.
- **Duplication protection**: reject creation past limits, no duplicate serials/records, no dupes via restart/reload/renaming.
- **Commands**: `/ls mace give diamond|regular|admin` (enforcing limits, admin excluded from count), `/ls mace list`, `/ls mace info `, `/ls mace remove ` β with tab completion and clear success/error messages.
- **Diamond Mace abilities** (each with independent cooldown, configurable values, particles/sounds, ActionBar cooldown feedback):
- Diamond Slam: area shockwave, damage, knockback, radius, particles, sound.
- Diamond Dash: controlled forward launch, safe velocity, configurable distance/velocity.
- Diamond Shield: temporary damage reduction, duration.
- Ground Impact: on landing, area damage + knockback, radius.
- Diamond Fury: temporary strength/speed/resistance combat mode, longer cooldown.
- Passive effect while held (configurable).
- **Admin Mace**: permission `legacysmp.adminmace`; abilities don't activate for non-staff; lore contains "STAFF ONLY"; unique powerful abilities (staff shockwave, strong knockback, target launch, area knockback, lightning visual, temp combat mode); fully excluded from all Mace count/registry limits.
## 20β27. Custom Armor (critical fix)
- 2 complete sets (SET_1 and SET_2), each with Helmet/Chestplate/Leggings/Boots = 8 pieces total.
- Each piece: unique PDC ID, set ID, slot ID, correct material, name, lore, enchantments, stats/effects, Custom Model Data support. Never identify by name alone.
- `/ls givearmor ` gives all 4 pieces; `/ls givearmor ` gives one. Tab completion.
- **Full Set Bonus**: only activates with all 4 correct pieces (same set, correct slots, PDC-validated). Removing any piece removes the bonus immediately. Mixed sets never trigger a bonus. Each set has a distinct bonus (speed/strength/resistance/regen/extra health/damage reduction/special ability).
- Detect armor changes via equip, shift-click, inventory click, drag, swap, removal, breaking, death, respawn β use multiple events/checks so nothing is missed.
## 28β30. Staff-Controlled Event + Small Form
- `/ls event start|stop|status`, permission `legacysmp.event.admin`. Start: broadcast + optional title/subtitle + sound + enable event-only mechanics. Stop: disable mechanics, restore affected players, broadcast ending message. Never auto-starts.
- During Event only: full correct 4-piece armor set + Shift toggles Small Form (normalβsmall) using the proper Paper scaling attribute. Configurable scale (e.g. `small-scale: 0.5`), cooldown, sound, particles, messages.
- Always reset to normal size on: event stop, armor piece removed, death, disconnect, world change (if required), plugin reload/disable, staff stop β never leave a player stuck small.
## 31β36. World Border (fix only the specified behavior β don't rewrite the working system)
- `/ls border start`: Overworld border = exactly 10x10 (`starting-border-size: 10`), using real WorldBorder API.
- `/ls border center [x z]`: set/persist center (defaults to Staff's position).
- `/ls border open`: Overworld = 10,000 (`open-overworld-border-size: 10000`); Nether and End get no restrictive border. One command updates all worlds.
- `/ls border restore`: back to 10x10. `/ls border status`: shows mode, size, center, state.
- Border state persists through restart (STARTING stays STARTING, OPEN stays OPEN).
- Configurable broadcasts/titles/subtitles/sounds for start/open/restore.
## 37β38. Ability & Cooldown System
- Centralized ability system supporting right/left click, shift, shift+right click, attack, mace interactions, armor conditions, event conditions β each with configurable damage/radius/duration/strength/knockback/cooldown/particles/sounds/messages.
- Centralized `CooldownManager` tracked per Player+Ability (independent per ability β using one ability must not cooldown another). ActionBar feedback showing remaining time or "ready".
## 39β40. Commands & Permissions
Main command `/legacysmp` (alias `/ls`) with subcommands: `hearts [|add|remove|set]`, `revive`, `give`, `givearmor`, `mace [give|list|info|remove]`, `event [start|stop|status]`, `border [start|open|restore|status|center]`, `reload`. Full tab completion, clear success/error messages (never silent failure).
Permissions (LuckPerms-compatible): `legacysmp.admin`, `.reload`, `.hearts`, `.give`, `.revive`, `.adminsword`, `.adminmace`, `.mace.admin`, `.event.admin`, `.border.admin`.
## 41β43. Config & Data
Split config across `config.yml`, `messages.yml`, `items.yml`, `swords.yml`, `maces.yml`, `armor.yml`, `events.yml`, `border.yml` β no hardcoded gameplay values. Use SQLite for player hearts/eliminated state, Mace registry, event state, border state β keyed by UUID.
## Code Structure (suggested classes)
`LegacySMPPlugin`, `LifestealManager`, `HeartManager`, `EliminationManager`, `ReviveManager`, `DeathLocationManager`, `CustomItemManager`, `SwordManager`, `AdminItemManager`, `MaceManager`, `MaceRegistry`, `DiamondMaceManager`, `AbilityManager`, `CooldownManager`, `ArmorManager`, `ArmorSetManager`, `PlayerScaleManager`, `EventManager`, `WorldBorderManager`, `DataManager`, `MessageManager`, `CommandManager`.
## Final Verification Checklist (confirm each before declaring done)
- Lifesteal correctly adjusts hearts both ways; max/min enforced.
- 0 hearts β permanent elimination/ban that survives restart; `/ls revive` fully works.
- Death respawn lands exactly at death coordinates; elimination still takes priority at 0 hearts.
- All 6 custom items, all custom swords, and both Admin Swords function correctly with permission checks.
- Maces: exactly 1 Diamond + 2 Regular possible (never more), Admin Mace fully excluded from that count and permission-gated; all 5 Diamond abilities (Slam/Dash/Shield/Ground Impact/Fury) work with independent cooldowns; registry persists and blocks duplication.
- 8 armor pieces across 2 full sets exist; `/ls givearmor` works fully and per-piece; Full Set Bonus only with all 4 correct matching pieces, breaks immediately on removal or mixing.
- Event start/stop/status work; Small Form only triggers with full correct armor during an active event, toggles on Shift, and always resets on every listed condition.
- Border start = 10x10, open = 10000 (Nether/End unrestricted), restore = 10x10, status accurate, state survives restart.
- All commands have tab completion and never fail silently; all permissions function; all data survives restart/reload.
- No anti-cheat/anti-xray/anti-freecam/movement-detection code has been added anywhere.