π
pasted-code-1788401348897.txt
txt
1905 lines
βΆ
# π± SPEARSMP β COMPLETE MASTER PLUGIN PROMPT
You are an expert Minecraft Paper plugin developer.
Build a complete, production-ready Minecraft plugin called:
**SpearSMP**
The plugin must be clean, secure, configurable, optimized and ready to compile and run on a production Minecraft server.
---
# 1. SERVER ENVIRONMENT
Target:
* Minecraft: Paper 1.21.x
* Java: 21
* Plugin name: SpearSMP
* Main package: `com.spearsmp`
* Plugin main class: `com.spearsmp.SpearSMP`
Use modern Paper APIs where possible.
The plugin must NOT recreate systems that already exist on the server.
Existing external plugins will handle:
* Economy / Balance
* Shop
* Auction House
* Orders
* Kits
* Permissions / Ranks
The SpearSMP plugin should integrate with these systems through configurable commands/hooks.
---
# 2. MAIN CONCEPT
SpearSMP is a spear progression server.
There are exactly:
**10 Spear Levels**
Players progress through these levels by:
1. Kills
2. Coins
3. Admin/OP command
Spears are NOT craftable.
Every player receives a configurable starter spear when joining the server for the first time.
Default starter spear:
**Wooden Spear β Level 1**
---
# 3. THE 10 SPEARS
Default progression:
| Level | Spear | Rank | Ability |
| ----- | --------------- | ---------- | ------------ |
| 1 | Wooden Spear | Recruit | Dash |
| 2 | Stone Spear | Fighter | Knockback |
| 3 | Iron Spear | Warrior | Bleed |
| 4 | Golden Spear | Knight | Regeneration |
| 5 | Diamond Spear | Elite | Freeze |
| 6 | Inferno Spear | Infernal | Inferno |
| 7 | Storm Spear | Stormborn | Thunder |
| 8 | Void Spear | Voidwalker | Void Step |
| 9 | Demon Spear | Demon | Soul Drain |
| 10 | Sovereign Spear | Sovereign | Overlord |
Everything must be configurable.
---
# 4. DEFAULT KILL REQUIREMENTS
Use cumulative kill requirements:
Level 1:
0 kills
Level 2:
5 kills
Level 3:
10 kills
Level 4:
20 kills
Level 5:
30 kills
Level 6:
40 kills
Level 7:
50 kills
Level 8:
65 kills
Level 9:
80 kills
Level 10:
100 kills
These values must be configurable.
---
# 5. DEFAULT COIN REQUIREMENTS
Use cumulative coin requirements:
Level 1:
0 coins
Level 2:
500 coins
Level 3:
1,000 coins
Level 4:
2,000 coins
Level 5:
3,500 coins
Level 6:
5,000 coins
Level 7:
7,500 coins
Level 8:
10,000 coins
Level 9:
15,000 coins
Level 10:
25,000 coins
These values must be configurable.
---
# 6. PLAYER PROGRESSION
Each player must have persistent data:
* UUID
* Username
* Current spear level
* Current spear ID
* Kills
* Coins
* First join status
* IP/account tracking data
* Upgrade history
* Relevant timestamps
Store data in SQLite by default.
Design the storage layer so MySQL can be added later.
Never lose player progression after restart/reload.
---
# 7. SPEAR ITEM IDENTIFICATION
Do NOT identify Spears only by:
* Name
* Lore
* Material
* CustomModelData
Use PersistentDataContainer.
Every Spear must contain metadata such as:
`spearsmp:item_type = spear`
`spearsmp:spear_level = 1`
`spearsmp:spear_id = wooden`
Also store relevant metadata needed for validation.
This prevents players from creating fake Spears simply by renaming items.
---
# 8. TEMPORARY SPEAR VISUAL SYSTEM
Initially, all Spears may use ONE normal Minecraft base item.
The plugin must support different names, colors, enchantments and abilities even without a resource pack.
Example:
Wooden Spear
Stone Spear
Iron Spear
Golden Spear
Diamond Spear
Inferno Spear
Storm Spear
Void Spear
Demon Spear
Sovereign Spear
Later, a resource pack can be added.
The plugin must therefore support:
* CustomModelData
* Modern item-model system where appropriate
* Configurable model ID/value per spear
Default mapping:
Model 1 = Wooden
Model 2 = Stone
Model 3 = Iron
Model 4 = Golden
Model 5 = Diamond
Model 6 = Inferno
Model 7 = Storm
Model 8 = Void
Model 9 = Demon
Model 10 = Sovereign
Do not require the resource pack for the plugin to function.
---
# 9. SPEAR NAMES AND COLORS
Every spear must have a configurable display name and color.
Example:
Level 1:
`&fWooden Spear`
Level 2:
`&7Stone Spear`
Level 3:
`&fIron Spear`
Level 4:
`&6Golden Spear`
Level 5:
`&bDiamond Spear`
Level 6:
`&cInferno Spear`
Level 7:
`&9Storm Spear`
Level 8:
`&5Void Spear`
Level 9:
`&4Demon Spear`
Level 10:
`&6Sovereign Spear`
Colors must be configurable.
---
# 10. IN-HAND SPEAR INSTANT UPGRADE
This is extremely important.
When a player upgrades their spear, the spear currently being held in their hand must immediately become the new spear.
Example:
Player is holding:
Wooden Spear
Level 1
Dash
Player upgrades to Level 2.
The SAME spear in the player's hand must instantly become:
Stone Spear
Level 2
Knockback
Do NOT require the player to:
* Drop the spear
* Re-equip the spear
* Relog
* Restart the server
Do NOT create a second spear.
Do NOT duplicate the item.
Modify/replace the item in the same inventory slot safely.
---
# 11. AUTOMATIC ENCHANTMENTS ON UPGRADE
Every spear level has its own enchantment configuration.
When upgrading:
1. Detect current spear.
2. Remove/replace old configured enchantments.
3. Apply ALL enchantments for the new level.
4. Change the spear name.
5. Change the name color.
6. Update lore.
7. Update spear metadata.
8. Update ability.
9. Update model/custom model value if configured.
Example:
Level 1:
Sharpness X
Unbreaking X
Mending I
Level 2:
Sharpness XII
Unbreaking X
Mending I
Knockback II
The exact enchantments must be configurable.
Allow high enchantment levels where supported by Paper/Minecraft.
Do not hard-code the enchantment list.
---
# 12. ABILITY SYSTEM
Every spear has one primary ability.
Abilities:
### Level 1 β Dash
Short forward dash.
Configurable:
* Distance
* Cooldown
* Sound
* Particles
### Level 2 β Knockback
Attacks apply increased knockback.
Configurable:
* Knockback strength
* Chance
* Cooldown
### Level 3 β Bleed
Attack applies temporary damage-over-time effect.
Configurable:
* Damage
* Duration
* Interval
* Chance
* Cooldown
### Level 4 β Regeneration
Player receives regeneration after a successful kill.
Configurable:
* Duration
* Amplifier
* Cooldown
### Level 5 β Freeze
Attack temporarily slows/freezes the enemy.
Configurable:
* Duration
* Slowness level
* Range
* Cooldown
### Level 6 β Inferno
Attack can ignite/burn the enemy.
Configurable:
* Fire duration
* Chance
* Damage
* Cooldown
### Level 7 β Thunder
Chance to summon lightning on attack.
Configurable:
* Chance
* Range
* Damage
* Visual lightning
* Sound
* Cooldown
### Level 8 β Void Step
Short teleport/dash ability.
Configurable:
* Distance
* Cooldown
* Particles
* Sound
### Level 9 β Soul Drain
A percentage of damage dealt heals the attacker.
Configurable:
* Healing percentage
* Maximum healing
* Cooldown
### Level 10 β Overlord
Temporarily grants powerful combat effects.
Example:
* Strength
* Speed
* Resistance
Configurable:
* Effects
* Duration
* Amplifiers
* Cooldown
---
# 13. ABILITY SECURITY
Abilities must ONLY activate if:
* Player is holding a valid SpearSMP spear.
* PDC metadata is valid.
* Spear level matches the configured item.
* Ability is enabled.
* Ability is not on cooldown.
Fake renamed items must NOT activate abilities.
All cooldowns must be server-safe and persistent where appropriate.
---
# 14. RANK SYSTEM
Every spear level has a corresponding rank.
Default:
Level 1 = Recruit
Level 2 = Fighter
Level 3 = Warrior
Level 4 = Knight
Level 5 = Elite
Level 6 = Infernal
Level 7 = Stormborn
Level 8 = Voidwalker
Level 9 = Demon
Level 10 = Sovereign
Ranks are NOT hard-coded into LuckPerms.
Instead, each level must have a configurable command.
---
# 15. THREE COMMANDS PER LEVEL
This is a CORE requirement.
Every spear level must have THREE separate configurable commands:
1. Rank Command
2. Coins Command
3. Money Command
There are:
10 Levels Γ 3 Commands = 30 configurable commands.
Example:
Level 2:
Rank Command:
`lp user {player} parent set fighter`
Coins Command:
`coins give {player} 500`
Money Command:
`eco give {player} 1000`
These are examples only.
The administrator can change them.
The plugin must NOT assume LuckPerms, Essentials Economy, PlayerPoints, etc.
The admin manually configures the commands.
Commands should execute from console by default.
Supported placeholders:
`{player}`
`{uuid}`
`{level}`
`{spear}`
`{rank}`
Empty command = skip execution.
---
# 16. UPGRADE COMMAND EXECUTION
After successful upgrade validation:
1. Verify player has the correct spear.
2. Verify requirements.
3. Prevent duplicate upgrade execution.
4. Update player level.
5. Update the in-hand spear.
6. Apply new enchantments.
7. Activate new ability.
8. Execute Rank Command.
9. Execute Coins Command.
10. Execute Money Command.
11. Execute configured kit integration.
12. Send success message.
13. Play sound/effects.
Commands must NEVER execute twice because of:
* Double-click
* GUI lag
* Packet duplication
* Reconnect
* Multiple inventory events
* Server lag
Use transaction/locking protection.
---
# 17. KIT SYSTEM
Every rank has a corresponding kit.
Default:
Recruit Kit
Fighter Kit
Warrior Kit
Knight Kit
Elite Kit
Infernal Kit
Storm Kit
Void Kit
Demon Kit
Sovereign Kit
The plugin must NOT create a new kit system.
Instead, allow an admin-configurable command for kit delivery.
Example:
`kit give {player} fighter`
The command must be configurable.
---
# 18. STARTER SPEAR
First-time players automatically receive the configured Starter Spear.
Default:
Wooden Spear.
Starter Spear must be configurable from:
`/spear setting`
IMPORTANT:
The admin should be able to drag an existing valid Spear into a designated Starter Spear slot inside the settings GUI.
Example:
Admin opens:
`/spear setting`
There is a slot:
**STARTER SPEAR**
Admin drags any valid Spear into that slot.
The plugin reads:
* Spear ID
* Spear level
* Metadata
and saves it as the new starter spear.
No config file editing should be required for this setting.
---
# 19. ADMIN SPEAR MENU
Command:
`/spear menu`
Admin-only.
Open a GUI containing all 10 Spears.
Each spear should display:
* Actual configured spear name
* Level
* Rank
* Ability
* Enchantments
Clicking a spear gives that exact spear to the admin.
Similar convenience to ItemAdder `/ia` style item retrieval.
Prevent:
* Duplication
* Shift-click exploits
* Drag exploits
* Number-key exploits
Only authorized admins can use it.
---
# 20. UPGRADE GUI
Command:
`/spear upgrade`
The first GUI must contain ONLY TWO options:
### KILLS
Shows kill progression.
### COINS
Shows coin progression.
No unnecessary options.
---
# 21. KILLS GUI
When the player clicks KILLS:
Show all 10 spear levels.
Each level displays:
* Spear name
* Level
* Required kills
* Player current kills
* Status
Examples:
`β Unlocked`
`β Locked`
`Current Level`
Player can click a valid level to upgrade.
---
# 22. COINS GUI
When the player clicks COINS:
Show all 10 levels.
Each level displays:
* Spear name
* Level
* Required coins
* Player current coins
* Status
Examples:
`β Unlocked`
`β Locked`
`Current Level`
Player can click a valid level.
---
# 23. UPGRADE VALIDATION
Before upgrading:
Check:
* Player current level
* Target level
* Kill requirement
* Coin requirement if applicable
* Current spear validity
* Player permissions
* Any other configured conditions
Never allow skipping levels unless an admin explicitly uses an admin command.
Normal player progression should be sequential.
---
# 24. UPGRADE CONFIRMATION
After selecting an upgrade, open a confirmation GUI.
Display:
`Level 1 β Level 2`
`Wooden Spear β Stone Spear`
Requirements:
`Kills: 5`
`Coins: 500`
Buttons:
`CONFIRM`
`CANCEL`
On CANCEL:
Close/return to previous GUI.
On CONFIRM:
Perform the upgrade.
---
# 25. SUCCESS MESSAGE
After a successful upgrade, send a message such as:
`{IGN} upgraded Level 1 to Level 2`
Make all messages configurable.
Example:
`&a{player} upgraded &eLevel {old_level} &ato &eLevel {new_level}&a!`
---
# 26. STATS GUI
Command:
`/spear stats`
Open a separate GUI.
Show:
* Player name
* Current spear
* Current level
* Rank
* Kills
* Coins
* Ability
* Ability cooldown/status
* Next spear
* Next level
* Required kills
* Required coins
* Progress
Use clean and attractive GUI design.
---
# 27. PUBLIC `/SPEAR` COMMAND
Command:
`/spear`
Open the player's main Spear GUI.
It may show:
* Current Spear
* Level
* Rank
* Kills
* Coins
* Ability
* Upgrade button
* Stats button
---
# 28. ADMIN COMMANDS
Implement:
`/spear allow `
`/spear decline `
`/spear ip `
`/spear iplist`
`/spear reload`
`/spear give `
`/spear upgrade `
`/spear coins `
`/spear reset `
`/spear setspawn`
`/spear menu`
`/spear setting`
`/spear stats`
`/spear upgrade`
`/spear`
Add proper tab completion.
---
# 29. ADMIN GIVE
Command:
`/spear give `
Examples:
`/spear give Player Wooden`
`/spear give Player Sovereign`
The generated item must contain valid PDC metadata.
Prevent fake spear creation.
---
# 30. ADMIN UPGRADE
Command:
`/spear upgrade `
Admin can directly set/upgrade a player's spear level.
It must also:
* Update the player's spear.
* Apply correct name.
* Apply correct enchantments.
* Apply ability.
* Update metadata.
* Execute configured commands if appropriate.
Add a safe confirmation or permission check for destructive/admin actions where appropriate.
---
# 31. COINS ADMIN COMMAND
Command:
`/spear coins `
This manages the SpearSMP internal progression coin value.
If an external economy is used, integration must be configurable.
Do not create an unnecessary duplicate economy plugin.
---
# 32. RESET COMMAND
Command:
`/spear reset `
Reset player SpearSMP progression.
Depending on configuration, reset:
* Level
* Kills
* Coins
* Spear
* Upgrade history
Do not automatically undo external rank/money commands unless explicitly configured.
---
# 33. IP ACCOUNT LIMIT
Implement IP-based account limiting.
Default:
**Maximum 2 accounts per IP.**
Example:
IP has:
Account 1
Account 2
A third account is blocked unless additional slots are granted.
---
# 34. ALLOW COMMAND
Command:
`/spear allow `
This adds extra account slots to the player's IP allowance.
Example:
Default:
2 accounts
Run:
`/spear allow Player 5`
Total allowed:
7 accounts.
---
# 35. DECLINE COMMAND
Command:
`/spear decline `
Removes previously granted extra slots.
Example:
Current allowed:
7
Run:
`/spear decline Player 2`
New allowed:
5
Never reduce below the configured default limit.
---
# 36. IP ADMIN COMMANDS
`/spear ip `
Show IP/account information to authorized staff.
`/spear iplist`
Show stored IP/account associations.
IP information must NEVER be visible to normal players.
Only users with proper permissions can access it.
Do not expose IPs in public chat.
---
# 37. IP BYPASS
OP/admin or configured permission users must bypass the account limit.
Permission:
`spearsmp.bypass`
---
# 38. IP SECURITY
Use IP tracking according to the desired server rules.
Be aware that IP-based detection can be affected by:
* VPNs
* Proxies
* NAT
* Shared networks
Do not claim IP detection is perfect.
Store only the minimum information required for the feature.
---
# 39. ADMIN SETTINGS GUI
Command:
`/spear setting`
Open a complete admin settings GUI.
Allow configuration of:
* Starter Spear
* Spear levels
* Kill requirements
* Coin requirements
* Spear names
* Name colors
* Enchantments
* Abilities
* Ability settings
* Rank names
* Rank commands
* Coins commands
* Money commands
* Kit commands
* Model IDs
* Messages
* Sounds
* Particles
* IP limits
---
# 40. LEVEL COMMAND SETTINGS
Inside `/spear setting`:
Select:
Level 1
Level 2
Level 3
...
Level 10
For every level show:
**Rank Command**
**Coins Command**
**Money Command**
**Kit Command**
Allow admin to edit/save/test each command.
Example:
Level 4
Rank Command:
`lp user {player} parent set knight`
Coins Command:
`coins give {player} 3500`
Money Command:
`eco give {player} 5000`
Kit Command:
`kit give {player} knight`
---
# 41. COMMAND TEST BUTTON
Admin settings should include a TEST option.
The admin should be able to test a configured command safely.
Do not accidentally execute commands against the wrong player.
Require an appropriate target/player when necessary.
---
# 42. ARMOR KITS
Every rank has its own armor kit.
Higher spear levels should correspond to stronger/heavier armor.
Example progression:
Recruit β basic armor
Fighter β stronger armor
Warrior β upgraded armor
Knight β heavy armor
Elite β diamond-tier armor
Infernal β powerful fire-themed armor
Stormborn β powerful storm-themed armor
Voidwalker β powerful void-themed armor
Demon β very powerful armor
Sovereign β strongest armor
Armor enchantment levels may be configured above normal Minecraft values, including values such as Protection X where supported.
The actual kit contents should be provided through the external kit system/configurable commands.
---
# 43. NON-CRAFTABLE SPEARS
Spears must not be craftable.
Do not add crafting recipes.
Prevent users from obtaining fake/invalid progression Spears through:
* Crafting
* Smithing
* Other item transformations
Normal Minecraft items should continue functioning normally.
---
# 44. GUI SECURITY
All GUIs must be secure.
Prevent:
* Item stealing
* Shift-click exploits
* Drag exploits
* Number-key swaps
* Double-click exploits
* Hotbar swaps
* Creative inventory exploits where applicable
* Duplication
The only intentional drag-and-drop GUI action should be the admin Starter Spear configuration slot.
---
# 45. RELOAD
Command:
`/spear reload`
Reload all configurable files safely.
Do not break active player data.
Do not duplicate items.
Do not reset cooldowns unnecessarily.
Do not disconnect players.
---
# 46. FILE STRUCTURE
Use clean configuration files:
`config.yml`
`messages.yml`
`spears.yml`
`settings.yml`
Possible structure:
```text
SpearSMP/
βββ config.yml
βββ messages.yml
βββ spears.yml
βββ settings.yml
βββ data/
β βββ spearsmp.db
βββ README.md
```
---
# 47. JAVA PACKAGE STRUCTURE
Use a clean architecture similar to:
```text
com.spearsmp
βββ SpearSMP.java
βββ command
βββ spear
βββ ability
βββ player
βββ gui
βββ listener
βββ integration
βββ ip
βββ storage
βββ config
βββ util
```
Use proper separation of responsibilities.
---
# 48. EXTERNAL PLUGIN INTEGRATION
The plugin must be able to work with existing:
* Economy plugin
* Coins plugin
* LuckPerms
* Kit plugin
* Shop
* Auction House
* Orders
Do NOT recreate:
* Auction
* Shop
* Orders
* Economy
The plugin only manages SpearSMP progression and integrations.
---
# 49. CONFIGURABILITY
Avoid hard-coded gameplay values.
Admin must be able to change:
* Spear names
* Spear levels
* Kill requirements
* Coin requirements
* Enchantments
* Abilities
* Cooldowns
* Ability damage
* Ability duration
* Rank names
* Rank commands
* Coin commands
* Money commands
* Kit commands
* Model IDs
* Starter spear
* IP limit
* Messages
* Sounds
* Particles
---
# 50. PLACEHOLDERS
Support at minimum:
`{player}`
`{uuid}`
`{level}`
`{old_level}`
`{spear}`
`{rank}`
`{kills}`
`{coins}`
`{next_level}`
`{required_kills}`
`{required_coins}`
---
# 51. PERFORMANCE
The plugin must be optimized.
Do NOT:
* Run unnecessary repeating tasks.
* Perform database operations synchronously on every event.
* Scan entire inventories unnecessarily.
* Create excessive particles/entities.
* Spam console.
Use asynchronous database operations where safe.
Keep Bukkit/Paper API calls on the correct server thread.
---
# 52. DATA SAFETY
Player progression is extremely important.
Prevent data loss during:
* Server restart
* Plugin reload
* Player quit
* Player join
* Upgrade
* Server crash where reasonably possible
Save important data safely.
---
# 53. DUPLICATION PROTECTION
The plugin must have strong anti-duplication logic.
Especially during:
* `/spear give`
* Upgrades
* GUI clicks
* Starter spear delivery
* Admin menu
* Reconnects
* Lag
* Double clicks
A player must never receive two Spears accidentally because of one operation.
---
# 54. ABILITY COOLDOWN GUI/Lore
The spear lore can show:
`Ability: Dash`
`Cooldown: 10s`
`Status: Ready`
or:
`Status: Cooldown 5s`
Make this configurable.
---
# 55. SPEAR LORE
Each spear should have clean configurable lore.
Example:
```text
&7Spear Level: &f2
&7Rank: &fFighter
&7Ability: &fKnockback
&7Kills Required: &f5
&7Coins Required: &f500
```
Allow administrators to completely customize the lore.
---
# 56. KILL DETECTION
Count valid player kills.
Do not count:
* Self-kills
* Fake damage
* Invalid entities
* Plugin-generated fake kills
Make kill counting configurable if needed.
When a player gets a valid kill:
* Increase SpearSMP kill counter.
* Save/update progression safely.
* Trigger any configured kill-based effects.
---
# 57. CURRENT SPEAR VALIDATION
Whenever progression matters, verify the player's actual spear.
Do not trust only database level.
If the player is holding a Level 2 spear but database says Level 1:
Handle according to configuration.
Prevent players from bypassing progression by obtaining a higher-level item.
---
# 58. ADMIN PERMISSIONS
Recommended permissions:
`spearsmp.admin`
`spearsmp.ip.allow`
`spearsmp.ip.decline`
`spearsmp.ip.view`
`spearsmp.spear.give`
`spearsmp.spear.upgrade`
`spearsmp.coins`
`spearsmp.bypass`
Use granular permissions.
---
# 59. TAB COMPLETION
Implement tab completion for:
* Commands
* Player names
* Spear names
* Levels
* Relevant subcommands
---
# 60. MESSAGES
All messages must be configurable.
Examples:
First join:
`&aWelcome to SpearSMP! You received the {spear}.`
Upgrade success:
`&a{player} upgraded Level {old_level} to Level {new_level}!`
Not enough kills:
`&cYou need {required_kills} kills.`
Not enough coins:
`&cYou need {required_coins} coins.`
Cooldown:
`&cAbility is on cooldown for {time}s.`
No permission:
`&cYou don't have permission.`
---
# 61. SOUNDS AND EFFECTS
Upgrade can trigger configurable:
* Sound
* Particles
* Title
* Action bar
* Chat message
Ability effects should also be configurable.
---
# 62. RESOURCE PACK FUTURE SUPPORT
The plugin must be designed so that later we can add a resource pack containing custom 3D spear models.
Do not redesign the progression system when textures are added.
The only future change should normally be:
* Resource pack
* Model mapping
* CustomModelData/item-model values
The underlying PDC spear identification must remain the same.
---
# 63. FUTURE 3D MODEL MAPPING
Prepare the system for:
```text
wooden -> model 1
stone -> model 2
iron -> model 3
golden -> model 4
diamond -> model 5
inferno -> model 6
storm -> model 7
void -> model 8
demon -> model 9
sovereign -> model 10
```
The plugin must not require actual PNG/model files to compile.
Provide documentation explaining where the resource pack model files should be connected.
---
# 64. ADMIN EXPERIENCE
The plugin should be simple for a server owner to manage.
An admin should be able to:
1. Open `/spear setting`
2. Select a level.
3. Configure rank command.
4. Configure coins command.
5. Configure money command.
6. Configure kit command.
7. Configure enchantments.
8. Configure ability.
9. Configure requirements.
10. Save.
11. Test.
Starter spear should be selectable by dragging an existing Spear into the Starter Spear slot.
---
# 65. PLAYER EXPERIENCE
New player:
1. Joins.
2. Receives Starter Spear.
3. Starts at Level 1.
4. Gets required rank/kit according to configuration.
5. Gets kills.
6. Earns coins.
7. Opens `/spear upgrade`.
8. Chooses Kills or Coins.
9. Views all 10 levels.
10. Selects available upgrade.
11. Confirms.
12. Current held spear instantly transforms into the next spear.
13. New name/color appears.
14. New enchantments automatically apply.
15. New ability becomes active.
16. Configured Rank/Coins/Money/Kit commands execute.
17. Success message appears.
---
# 66. IMPORTANT UPGRADE EXAMPLE
Player currently holds:
`Wooden Spear`
Level:
`1`
Ability:
`Dash`
Player has:
`5 kills`
and enough required resources.
Player opens:
`/spear upgrade`
Selects:
`Kills`
Selects:
`Level 2`
Confirms.
Immediately:
Old:
`Wooden Spear`
`Level 1`
`Dash`
becomes:
New:
`Stone Spear`
`Level 2`
`Knockback`
The SAME inventory item is updated.
Automatically:
* Name changes
* Name color changes
* Lore changes
* PDC changes
* Enchantments change
* Ability changes
* Model value changes if configured
* Rank command executes
* Coins command executes
* Money command executes
* Kit command executes
* Upgrade effects play
No duplicate item is created.
---
# 67. CODE QUALITY
Write clean production-ready Java.
Requirements:
* No unnecessary dependencies.
* Proper null checks.
* Proper exception handling.
* No deprecated APIs where modern alternatives exist.
* Avoid memory leaks.
* Avoid excessive event listeners.
* Use interfaces for integrations where practical.
* Use services/managers for progression.
* Use enums/classes for spear definitions.
* Use a proper repository/storage layer.
* Use secure GUI handlers.
---
# 68. BUILD SYSTEM
Provide a complete Maven or Gradle project.
Include:
* `pom.xml` or `build.gradle`
* `plugin.yml`
* Java source
* Config files
* README
* Default database initialization
* Permissions
* Commands
* Dependencies/documentation
The project must compile successfully.
---
# 69. README
Create a complete README explaining:
* Installation
* Dependencies
* Commands
* Permissions
* Configuration
* Spear setup
* Enchantments
* Abilities
* Rank commands
* Coins commands
* Money commands
* Kit commands
* Starter spear setup
* IP limit system
* Resource pack/model setup
* Troubleshooting
---
# 70. FINAL REQUIREMENT
Do not provide a half-finished prototype.
Build the COMPLETE SpearSMP plugin architecture and implementation.
All systems described above must be implemented.
Do not replace requested systems with placeholders unless technically impossible.
Do not create separate Auction, Shop, Orders or Economy systems.
Integrate with existing server plugins through configurable commands.
The plugin must be:
**Secure**
**Optimized**
**Configurable**
**Production-ready**
**Duplicate-safe**
**GUI-based**
**Persistent**
**Future-proof for custom 3D textures**
Most importantly:
### THE PLAYER'S CURRENTLY HELD SPEAR MUST INSTANTLY UPDATE WHEN THEY UPGRADE.
Its:
* Name
* Color
* Level
* Lore
* Enchantments
* Ability
* Metadata
* Model value
must all update immediately.
And every successful level upgrade must execute the administrator-configured:
**Rank Command + Coins Command + Money Command + Kit Command**
exactly once.
Iβll create the complete Paper 1.21/Java 21 project in dependency order:
Build metadata, plugin manifest, and default configuration files.
Persistence, configuration, spear definitions/items, and player progression services.
Abilities, secure GUI flows, listeners, and command/tab-completion handling.
README documentation covering installation, configuration, permissions, and resource-pack mapping.
not working make it for latest version 26.2
Target Paper API
26.2.build.121-stableand Java 25.Update XSeries and SQLite to current releases compatible with the new build.
Update the plugin declaration/documentation and fix the invalid upgrade particle setting.
Updated SpearSMP for Paper/Minecraft 26.2:
Paper API:
26.2.build.121-stableJava target: Java 25
XSeries:
13.7.1SQLite JDBC:
3.53.4.0plugin.ymlAPI version:26.2Fixed invalid particle name:
TOTEM_OF_UNDYINGUpdated README installation requirements
The server must run on Java 25 or newer.
π
pasted-code-1788427266924.txt
txt
772 lines
βΆ
# π± SPEARSMP β IMPORTANT UPGRADE & SPEAR SYSTEM UPDATE
Update the existing SpearSMP plugin with the following requirements. These requirements are mandatory.
---
## 1. CONFIRM BUTTON MUST ACTUALLY UPGRADE
The `CONFIRM` button in the upgrade confirmation GUI must perform the complete upgrade.
When the player clicks:
**CONFIRM**
the plugin must:
1. Re-check all requirements server-side.
2. Verify the player is upgrading from the correct current level.
3. Verify the player has the required kills if using the Kills upgrade path.
4. Verify the player has enough Coins if using the Coins upgrade path.
5. Deduct the required Coins when the upgrade is being performed through the Coins path.
6. Update the player's Spear level.
7. Update the Spear currently held by the player.
8. Change its name.
9. Change its name color.
10. Update its lore.
11. Replace/apply all configured enchantments.
12. Update its ability set.
13. Update PDC metadata.
14. Update CustomModelData/item-model value if configured.
15. Execute the configured Rank Command.
16. Execute the configured Coins Command if configured.
17. Execute the configured Money Command if configured.
18. Execute the configured Kit Command if configured.
19. Send the success message.
20. Play upgrade sound/effects.
The operation must be atomic and protected against double-clicks.
A player must NEVER be upgraded twice from one click.
---
# 2. KILLS UPGRADE PATH
When the player opens:
`/spear upgrade`
and selects:
**KILLS**
the GUI must show all 10 spear levels.
For this GUI, the requirement information must show ONLY:
### Kills
Example:
```text
Level 1
Wooden Spear
Kills Required: 0
```
```text
Level 2
Stone Spear
Kills Required: 5
```
```text
Level 3
Iron Spear
Kills Required: 10
```
Do NOT show Coins in the Kills GUI.
The lore of the level items must contain only the Kills requirement.
---
# 3. COINS UPGRADE PATH
When the player selects:
**COINS**
the GUI must show all 10 spear levels.
For this GUI, the requirement information must show ONLY:
### Coins
Example:
```text
Level 1
Wooden Spear
Coins Required: 0
```
```text
Level 2
Stone Spear
Coins Required: 500
```
```text
Level 3
Iron Spear
Coins Required: 1000
```
Do NOT show Kills in the Coins GUI.
The lore of the level items must contain only the Coins requirement.
---
# 4. IMPORTANT β DO NOT MIX REQUIREMENTS
Kills GUI:
```text
Kills Required: X
```
ONLY.
Coins GUI:
```text
Coins Required: X
```
ONLY.
Do not display:
```text
Kills Required
Coins Required
```
together inside the same upgrade-path GUI.
The player must clearly understand which requirement they are using.
---
# 5. COINS MUST BE DEDUCTED
If the player chooses:
`/spear upgrade β COINS β Level X β CONFIRM`
the required Coins must be deducted from the player's SpearSMP Coins balance.
Example:
Player has:
`2500 Coins`
Level 4 requires:
`2000 Coins`
After clicking CONFIRM:
Player has:
`500 Coins`
The upgrade must then succeed.
If the player does not have enough Coins:
* Do not upgrade.
* Do not change the Spear.
* Do not execute reward commands.
* Do not deduct anything.
* Show an error message.
---
# 6. KILLS MUST NOT BE DEDUCTED
Kills are progression statistics.
If the player upgrades using the Kills path:
* Required kills are checked.
* Kills are NOT removed.
Example:
Player has:
`25 Kills`
Level 4 requires:
`20 Kills`
After upgrading:
Player still has:
`25 Kills`
---
# 7. IMPORTANT β USE A REAL SPEAR ITEM
Do NOT use a Trident as the player's Spear.
The plugin must use a dedicated/custom Spear item implementation.
The item must be treated as:
**SPEAR**
not:
**TRIDENT**
The player-facing item must always be called:
`Spear`
and must have SpearSMP metadata.
Do not display:
`Trident`
anywhere in the normal player-facing GUI, lore or messages.
---
# 8. SPEAR THROWING AND RETURN
The Spear must support a throwing mechanic similar to the behavior players expect from a Minecraft spear.
When the player throws the Spear:
1. The Spear travels toward the target.
2. It can damage valid targets according to configuration.
3. After hitting the target/block or reaching its configured behavior point, the Spear must return to its owner.
4. The return behavior should feel similar to a Loyalty-style returning weapon.
5. The player should be able to retrieve/receive the same Spear safely.
6. Never duplicate the Spear.
7. Never permanently lose the Spear because of a normal throw.
8. The returned item must retain all:
* PDC metadata
* Level
* Name
* Color
* Enchantments
* Ability data
* Model data
The return mechanic must be implemented specifically for the custom Spear.
Do NOT simply convert the Spear into a normal Trident.
---
# 9. SPEAR THROW ENCHANTMENT
Create a configurable Spear throwing/return system.
If a Loyalty-style enchantment is enabled/configured, the Spear should return automatically after being thrown.
Example:
```text
Sovereign Spear
Sharpness XV
Unbreaking X
Loyalty III
```
The Spear should return to its owner after hitting/finishing its throw.
The exact return speed, delay and behavior should be configurable.
---
# 10. CUMULATIVE ABILITY SYSTEM
This is a CORE requirement.
Abilities must be cumulative.
A higher-level Spear does NOT lose the abilities from previous levels.
Instead:
### Level 1
Gets:
**Ability 1 β Dash**
### Level 2
Gets:
**Ability 1 β Dash**
+
**Ability 2 β Knockback**
### Level 3
Gets:
**Ability 1 β Dash**
+
**Ability 2 β Knockback**
+
**Ability 3 β Bleed**
### Level 4
Gets:
**Dash**
+
**Knockback**
+
**Bleed**
+
**Regeneration**
### Level 5
Gets:
**Dash**
+
**Knockback**
+
**Bleed**
+
**Regeneration**
+
**Freeze**
Continue this pattern until Level 10.
---
# 11. COMPLETE ABILITY PROGRESSION
## Level 1 β Wooden Spear
Abilities:
1. Dash
---
## Level 2 β Stone Spear
Abilities:
1. Dash
2. Knockback
---
## Level 3 β Iron Spear
Abilities:
1. Dash
2. Knockback
3. Bleed
---
## Level 4 β Golden Spear
Abilities:
1. Dash
2. Knockback
3. Bleed
4. Regeneration
---
## Level 5 β Diamond Spear
Abilities:
1. Dash
2. Knockback
3. Bleed
4. Regeneration
5. Freeze
---
## Level 6 β Inferno Spear
Abilities:
1. Dash
2. Knockback
3. Bleed
4. Regeneration
5. Freeze
6. Inferno
---
## Level 7 β Storm Spear
Abilities:
1. Dash
2. Knockback
3. Bleed
4. Regeneration
5. Freeze
6. Inferno
7. Thunder
---
## Level 8 β Void Spear
Abilities:
1. Dash
2. Knockback
3. Bleed
4. Regeneration
5. Freeze
6. Inferno
7. Thunder
8. Void Step
---
## Level 9 β Demon Spear
Abilities:
1. Dash
2. Knockback
3. Bleed
4. Regeneration
5. Freeze
6. Inferno
7. Thunder
8. Void Step
9. Soul Drain
---
## Level 10 β Sovereign Spear
Abilities:
1. Dash
2. Knockback
3. Bleed
4. Regeneration
5. Freeze
6. Inferno
7. Thunder
8. Void Step
9. Soul Drain
10. Overlord
---
# 12. ABILITY LORE
The current Spear's lore should show ALL abilities unlocked for its level.
Example Level 3:
```text
Abilities:
β Dash
β Knockback
β Bleed
```
Level 7:
```text
Abilities:
β Dash
β Knockback
β Bleed
β Regeneration
β Freeze
β Inferno
β Thunder
```
Level 10:
```text
Abilities:
β Dash
β Knockback
β Bleed
β Regeneration
β Freeze
β Inferno
β Thunder
β Void Step
β Soul Drain
β Overlord
```
Make lore formatting configurable.
---
# 13. ABILITY TRIGGER DESIGN
The plugin must intelligently handle multiple abilities.
Do not make every ability activate at the exact same time if that would create an unusable/overpowered combat experience.
Each ability should have its own configurable trigger.
Example:
* Dash β right-click
* Knockback β attack
* Bleed β attack
* Regeneration β kill
* Freeze β attack
* Inferno β attack
* Thunder β attack/chance
* Void Step β right-click
* Soul Drain β attack
* Overlord β right-click
Allow admins to configure the trigger type.
---
# 14. ABILITY COOLDOWNS
Each ability must have its own cooldown.
Example:
```text
Dash: 10s
Void Step: 15s
Overlord: 60s
Thunder: 8s
```
Cooldowns must be configurable.
The plugin must prevent cooldown bypass through:
* Re-equipping
* Dropping
* Picking up
* Throwing
* Reconnecting
* GUI actions
---
# 15. HIGHER SPEARS MUST BE STRICTLY BETTER
Every upgrade must add the new ability while preserving all previous abilities.
Therefore:
**Level 2 > Level 1**
**Level 3 > Level 2**
**Level 4 > Level 3**
...
**Level 10 > Level 9**
Each higher Spear contains every previous ability plus its own new ability.
---
# 16. SPEAR ENCHANTMENT LORE
The Spear's normal item lore should contain its configured enchantments where appropriate.
Example:
```text
Sovereign Spear
Sharpness XV
Unbreaking X
Loyalty III
Abilities:
β Dash
β Knockback
β Bleed
β Regeneration
β Freeze
β Inferno
β Thunder
β Void Step
β Soul Drain
β Overlord
```
The progression requirement text should NOT unnecessarily appear on the actual combat Spear unless enabled in configuration.
The Kills/Coins requirement belongs in the respective upgrade GUI.
---
# 17. UPGRADE CONFIRMATION EXAMPLE
Player selects:
`Coins`
then:
`Level 3`
Confirmation GUI displays:
```text
UPGRADE SPEAR
Iron Spear
Level 3
Coins Required:
1,000
Your Coins:
2,500
New Abilities:
Dash
Knockback
Bleed
[ CONFIRM ]
[ CANCEL ]
```
When CONFIRM is clicked:
* Deduct 1,000 Coins.
* Upgrade to Level 3.
* Update held Spear.
* Apply Level 3 enchantments.
* Apply Levels 1β3 abilities.
* Execute configured commands once.
* Show success message.
---
# 18. IMPORTANT TRANSACTION SAFETY
The upgrade operation must be transactional.
Before changing anything:
Verify all requirements.
Then lock the upgrade operation for that player.
Perform:
**Check β Deduct β Upgrade β Commands β Complete**
If a second click occurs while the first operation is processing:
Ignore it.
Never allow:
* Double Coins deduction
* Double rank command
* Double money command
* Double kit
* Double Spear
* Double level increase
---
# 19. FINAL SPEAR BEHAVIOR
The final Level 10 Sovereign Spear should contain:
* Strongest configured enchantments
* All 10 abilities
* Strongest configured stats
* Spear throwing
* Return mechanic
* Correct Sovereign name/color
* Sovereign metadata
* Sovereign rank
* Sovereign kit integration
* Sovereign model value for future resource pack
It must be the ultimate progression Spear.
---
# 20. DO NOT BREAK EXISTING SYSTEM
These changes must be added to the existing SpearSMP architecture.
Do NOT remove:
* IP system
* Starter Spear
* Admin settings
* Admin Spear menu
* Stats GUI
* Kills GUI
* Coins GUI
* Rank commands
* Coins commands
* Money commands
* Kit commands
* SQLite storage
* PDC identification
* Future CustomModelData support
Only improve/extend the existing system.
---
# 21. FINAL IMPLEMENTATION RULE
The final plugin should feel like a true custom **SpearSMP progression system**, not a Trident renamed to Spear.
The player should experience:
**Spear β Throw β Hit β Return β Upgrade β More Enchants β More Abilities β Stronger Spear**
with each level being a genuine progression.
The system must remain configurable so the server owner can change all values later.
Upgrade transaction: repair the confirmation flow with server-side validation, locking, deduction, item updates, metadata, abilities, and commands.
Path-specific GUIs: ensure Kills and Coins menus show only their selected requirement.
Custom spear behavior: replace any trident-based handling with a dedicated spear throw/return implementation.
Progression and abilities: make levels cumulative, configurable, and reflected in lore/triggers/cooldowns.
Compatibility pass: resolve remaining Paper 26.2/API issues without removing existing systems.
Upgrade transaction: the confirmation failure is caused by the level GUI creating a holder without its currency, then
Currency.valueOf("")aborting before the service runs. Iβm fixing that handoff, making CONFIRM execute synchronously under the existing lock, deducting Coins only for the Coins path, and applying configured upgrade effects.
Path-specific GUIs: next Iβm removing the mixed requirement lines from progression menus and confirmation, while also removing the trident icon from the player-facing level menu.3. Custom spear behavior: Iβm tracing the current interaction and combat listeners before replacing the trident-based item/throw path with a projectile that returns the same custom item safely.
Progression and abilities: the current model stores one ability per level and only activates the current one. Iβm changing runtime resolution to include every ability up to the held level, adding per-ability trigger/cooldown lookup, persisting cooldown timestamps on the player, and writing cumulative ability/enchantment lore.
The custom projectile now preserves the exact ItemStack and lifecycle state, but projectile hits also need to feed the cumulative combat abilities. Iβm wiring thrown-hit damage through the same per-level ability rules so throwing does not silently bypass progression.5. Compatibility pass: Iβm checking the configuration parser and manifest/build targets now, then Iβll add only the Paper 26.2-safe metadata/config support still missing from the requested spear update.
A thrown spear was being removed from the ownerβs hand during flight, so the existing βcount only spear killsβ check would reject kills made by the custom throw. Iβm correcting that attribution and separating normal right-click abilities from the configurable sneak-right-click throw trigger.
The compatibility review found two remaining gaps: an old server config could still select a trident material, and cumulative abilities were derived at runtime but not recorded in spear metadata. Iβm enforcing the non-trident fallback, storing the resolved ability set in PDC, and making the generated lore labels configurable.The implementation is now functionally complete across the requested paths: synchronous locked upgrades, Coins deduction, cumulative abilities, persisted cooldowns, configurable triggers/lore, non-trident item identity, and a tracked custom throw/return entity. Iβm doing a final consistency check for dangling constructors/references and whitespace only.
One compatibility edge remained: upgrading an old valid spear could preserve its old trident material because item updates cloned the held stack. Iβm forcing every generated or upgraded spear through the configured non-trident base material so legacy items are converted too.
Implemented the SpearSMP upgrade for Paper/Minecraft 26.2.
Fixed the
CONFIRMbutton currency bug and made upgrades synchronous, validated, locked against double-clicks, and transactional.Coins are deducted only on the Coins path; kills remain unchanged.
Kills and Coins progression GUIs now display only their selected requirement.
Added cumulative abilities from Level 1 through Level 10, configurable triggers, cooldowns, and persistent cooldown storage.
Added cumulative ability and enchantment lore, configurable lore formatting, PDC ability metadata, CustomModelData, and
item-modelsupport.Replaced trident-based spear behavior with a custom non-trident
ItemDisplayprojectile.Added configurable throwing, damage, maximum distance, return speed, return delay, and Loyalty-style return handling.
Thrown spears preserve their full item metadata and safely return without duplication or loss.
Changed the default spear material to
STICKand forcibly converts legacy trident-based spears.Added projectile kill attribution so thrown-spear kills count toward progression.
Added per-level trigger defaults in
spears.yml.
Throwing defaults to sneak + right-click, while normal right-click abilities such as Dash and Void Step remain usable. Configure it with:
throw:
trigger: SNEAK_RIGHT_CLICK
package com.spearsmp;
import com.spearsmp.ability.AbilityManager;
import com.spearsmp.command.SpearCommand;
import com.spearsmp.config.SpearConfig;
import com.spearsmp.gui.GuiManager;
import com.spearsmp.listener.PlayerListener;
import com.spearsmp.player.PlayerManager;
import com.spearsmp.progression.ProgressionService;
import com.spearsmp.spear.SpearManager;
import com.spearsmp.spear.SpearThrowManager;
import com.spearsmp.storage.SQLiteRepository;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
public final class SpearSMP extends JavaPlugin {
private SpearConfig spearConfig;
private SQLiteRepository repository;
private SpearManager spearManager;
private SpearThrowManager spearThrowManager;
private PlayerManager playerManager;
private AbilityManager abilityManager;
private ProgressionService progressionService;
private GuiManager guiManager;
@Override
public void onEnable() {
saveDefaultConfig();
saveResource("messages.yml", false);
saveResource("spears.yml", false);
saveResource("settings.yml", false);
spearConfig = new SpearConfig(this);
spearConfig.reload();
repository = new SQLiteRepository(this);
repository.initialize();
spearManager = new SpearManager(this);
spearThrowManager = new SpearThrowManager(this);
playerManager = new PlayerManager(this);
abilityManager = new AbilityManager(this);
progressionService = new ProgressionService(this);
guiManager = new GuiManager(this);
Bukkit.getPluginManager().registerEvents(new PlayerListener(this), this);
Bukkit.getPluginManager().registerEvents(guiManager, this);
SpearCommand command = new SpearCommand(this);
getCommand("spear").setExecutor(command);
getCommand("spear").setTabCompleter(command);
}
@Override
public void onDisable() {
if (spearThrowManager != null) spearThrowManager.shutdown();
if (playerManager != null) playerManager.saveAll();
if (repository != null) repository.close();
}
public void reloadPlugin() {
reloadConfig();
spearConfig.reload();
spearManager.reload();
}
public SpearConfig getSpearConfig() { return spearConfig; }
public SQLiteRepository getRepository() { return repository; }
public SpearManager getSpearManager() { return spearManager; }
public SpearThrowManager getSpearThrowManager() { return spearThrowManager; }
public PlayerManager getPlayerManager() { return playerManager; }
public AbilityManager getAbilityManager() { return abilityManager; }
public ProgressionService getProgressionService() { return progressionService; }
public GuiManager getGuiManager() { return guiManager; }
}