📄
pasted-code-1790059301714.txt
txt
454 lines
▶
Create a complete, production-ready Minecraft plugin called CustomWeapons.
Goal
Build a highly configurable custom weapons system that allows server owners to create unique weapons with custom stats, abilities, effects, recipes, and upgrade systems.
Core Features
Support custom weapons such as:
Swords
Axes
Bows
Crossbows
Spears
Daggers
Hammers
Custom weapon types where possible
Every weapon should have:
Custom name
Custom lore
Custom material
Custom damage
Custom attack speed
Custom durability
Custom enchantments
Custom attributes
Custom model data
Custom permissions
Custom rarity
Support weapon rarities such as:
Common
Uncommon
Rare
Epic
Legendary
Mythic
Weapon Abilities
Create an ability system where each weapon can have one or multiple abilities.
Examples:
Lightning Strike
Fire Slash
Explosive Hit
Lifesteal
Dash
Teleport
Freeze
Poison
Knockback
Area Damage
Meteor Strike
Summon
Projectile abilities
Abilities should support:
Cooldowns
Mana/energy costs
Damage values
Radius
Duration
Particle effects
Sound effects
Permissions
Configurable messages
Passive Abilities
Weapons can also have passive effects.
Examples:
Increased movement speed
Strength
Resistance
Regeneration
Critical hit chance
Lifesteal
Fire resistance
Extra armor penetration
Custom Weapon Configuration
Make the entire weapon system configurable through YAML files.
Example:
weapons:
flame_sword:
material: DIAMOND_SWORD
name: "&cFlame Sword"
rarity: LEGENDARY
damage: 12
attack-speed: 1.6
lore:
- "&7A sword forged in eternal flames."
- ""
- "&6Abilities:"
- "&c• Fire Slash"
- "&c• Flame Burst"
abilities:
fire_slash:
type: FIRE_SLASH
damage: 10
cooldown: 5
radius: 4
flame_burst:
type: EXPLOSION
damage: 15
radius: 5
cooldown: 10
Commands
Add commands such as:
/customweapons
/cw give [amount]
/cw create
/cw delete
/cw reload
/cw list
/cw info
/cw giveall
Add proper tab completion for all commands.
Add permission nodes such as:
customweapons.admin
customweapons.give
customweapons.use.
customweapons.reload
GUI System
Create a GUI for managing weapons.
Admin GUI should allow administrators to:
View all weapons
Create weapons
Edit weapons
Delete weapons
Edit abilities
Edit stats
Edit lore
Edit rarity
Give weapons to players
Make the GUI configurable.
Weapon Upgrades
Add an upgrade system where weapons can be upgraded.
Support:
Damage upgrades
Ability upgrades
Durability upgrades
Critical chance upgrades
Custom upgrade costs
Maximum upgrade levels
Allow upgrade requirements to be configured.
Crafting
Allow custom weapons to have custom crafting recipes.
Recipes should be configurable and support normal Minecraft crafting materials.
Example:
recipe:
enabled: true
shape:
- "ABA"
- "CDC"
- "AEA"
ingredients:
A: NETHERITE_INGOT
B: BLAZE_ROD
C: DIAMOND
D: NETHER_STAR
E: STICK
Effects and Animations
Add configurable:
Particles
Sounds
Screen effects where possible
Hit effects
Projectile effects
Ability animations
Make effects configurable per weapon and per ability.
Data Storage
Use a reliable storage system for player-related data.
Support:
YAML
SQLite
Keep the storage system modular so additional databases can be added later.
Compatibility
Design the plugin for modern Paper/Spigot Minecraft servers.
Use clean, maintainable Java code and avoid unnecessary dependencies.
Make the plugin compatible with other common plugins where reasonably possible.
Performance
The plugin must be optimized for multiplayer servers.
Avoid unnecessary repeating tasks.
Avoid excessive event listeners.
Avoid memory leaks.
Properly clean up cooldowns and temporary data.
Do not create unnecessary objects every game tick.
Handle abilities asynchronously only when it is safe to do so.
Never perform unsafe Bukkit/Paper API operations asynchronously.
Configuration
Provide:
config.yml
weapons.yml
abilities.yml
messages.yml
Every important setting should be configurable.
Add comments explaining configuration options.
Messages
Make all player-facing messages configurable.
Support:
Color codes
Hex colors where supported
Prefixes
Success/error messages
Ability messages
Cooldown messages
Permission messages
API
Create a public API so other plugins can:
Register custom weapons
Register custom abilities
Check whether an item is a CustomWeapon
Get a weapon by ID
Give weapons to players
Trigger abilities
Listen for weapon events
Create clear JavaDoc for the public API.
Events
Create custom events such as:
WeaponUseEvent
WeaponHitEvent
WeaponAbilityEvent
WeaponUpgradeEvent
Allow other plugins to listen to and cancel appropriate events.
Project Structure
Use a clean modular architecture.
Separate systems into packages such as:
commands
config
weapons
abilities
listeners
gui
storage
api
utils
items
effects
upgrades
Use interfaces and managers where appropriate.
Error Handling
The plugin should handle invalid configuration gracefully.
If a weapon or ability is incorrectly configured:
Log a clear error.
Do not crash the server.
Skip only the invalid component when possible.
Provide useful information about the configuration error.
Documentation
Include:
README.md
Installation instructions
Configuration guide
Command documentation
Permission documentation
Weapon creation guide
Ability creation guide
API documentation
Example weapons
Example configurations
Final Requirements
Before considering the plugin complete:
Make sure the project compiles successfully.
Fix all compilation errors.
Check for deprecated API usage.
Check for obvious performance problems.
Check command permissions.
Check tab completion.
Check configuration loading.
Check weapon identification and persistence.
Check cooldown handling.
Check GUI interactions.
Check crafting recipes.
Check all example configurations.
Make sure the plugin does not conflict with normal Minecraft items.
Keep the code clean, modular, and easy to expand.
Do not create a simple prototype. Build the plugin as a complete, extensible foundation for a large Minecraft server.
If a feature cannot be implemented exactly because of Minecraft/Paper API limitations, implement the closest reliable alternative and clearly document the limitation instead of leaving the feature incomplete.
Create the Gradle project, plugin metadata, and configurable YAML resources.
Build the weapon/configuration, item, ability, cooldown, recipe, upgrade, and storage services.
Add commands, tab completion, admin GUI, listeners, public API, and cancellable custom events.
Add README documentation with installation, configuration, commands, permissions, and API examples.
Implemented the CustomWeapons foundation with:
Gradle Java 17 Paper project setup and plugin metadata.
Configurable
config.yml,weapons.yml,abilities.yml, andmessages.yml.Weapon definitions with names, lore, rarity, materials, damage, attack speed, enchantments, model data, permissions, recipes, and upgrades.
PersistentDataContainer-based weapon identification.
Ability system with cooldowns, permissions, particles, sounds, damage, area attacks, projectiles, teleportation, freeze, poison, lifesteal, knockback, explosions, lightning, summons, and passive effects.
YAML and SQLite player storage adapters.
Commands and tab completion for giving, creating, deleting, listing, inspecting, reloading, upgrading, and GUI access.
Admin weapon GUI.
Custom cancellable events:
WeaponUseEventWeaponHitEventWeaponAbilityEventWeaponUpgradeEvent
Public
CustomWeaponsAPI.Configurable recipes and upgrade levels.
README with installation, configuration, command, permission, API, and limitation documentation.
No files in this session