๐
pasted-code-1789285672917.txt
txt
997 lines
โถ
# 37. TARGET SERVER VERSION โ CRITICAL
This plugin is being developed specifically for my Minecraft server.
Server software:
**Leaf**
Server version:
**Leaf 26.2-45-ver/26.2@2d9e7eb**
Build date:
**2026-07-30**
Implementing API:
**26.2.build.45-alpha**
The plugin MUST be designed and compiled for **Leaf 26.2 / Minecraft 26.2 API compatibility**.
Leaf is a Paper-based high-performance server fork and supports Bukkit/Paper plugins, so use the Bukkit/Paper-compatible API wherever possible.
Use:
* Java 25
* Leaf/Paper API 26.2
* Adventure API where appropriate
* PersistentDataContainer
* Bukkit/Paper event system
* Bukkit scheduler / Paper scheduler
* Modern ItemMeta APIs
* Modern inventory APIs
Do NOT target an older Minecraft API as the primary implementation.
Do NOT use deprecated APIs when a modern 26.2-compatible alternative exists.
The final plugin must compile successfully against the target API.
Before delivering the plugin:
1. Compile it against the correct Leaf/Paper 26.2 API.
2. Fix all compilation errors.
3. Fix deprecated API usage where possible.
4. Verify all event listeners.
5. Verify all inventory interactions.
6. Verify item serialization.
7. Verify enchantment application.
8. Verify custom item identification.
9. Verify reload behavior.
10. Verify database compatibility.
---
# 38. COMPLETE ORIGINAL ENCHANTMENT LIBRARY
The plugin must ship with a **large ready-to-use enchantment library**.
Do not create only 10โ20 example enchantments.
Create a substantial collection covering:
* PvP
* PvE
* Weapons
* Armor
* Tools
* Mining
* Farming
* Fishing
* Bows
* Crossbows
* Tridents
* Elytra
* Utility
* Economy
* Souls
* Mobility
* Defensive abilities
* Offensive abilities
* Area effects
* Special abilities
The enchantments should be ORIGINAL implementations and names.
Do not copy proprietary source code, descriptions, exact configurations, assets, or protected implementation from another plugin.
The goal is to provide similar depth and functionality while creating an independent enchantment system.
---
# 39. ENCHANTMENT RARITIES
Create these default enchantment groups:
COMMON
UNCOMMON
RARE
EPIC
LEGENDARY
ULTIMATE
FABLED
MYTHIC
Administrators must be able to create additional groups.
Every group needs:
* Display name
* Color
* Prefix
* Book appearance
* Ball appearance
* GUI appearance
* Default success-rate range
* Default destroy-rate range
* Enchantment pool
* Minimum level
* Maximum level
Example:
COMMON
Simple beginner-friendly abilities.
LEGENDARY
Powerful abilities.
FABLED
Very rare high-power abilities.
MYTHIC
Extremely rare end-game abilities.
Do not hardcode the rarity system.
---
# 40. ENCHANTMENT BALLS
Create separate Enchantment Balls for every rarity.
Default balls:
Common Enchantment Ball
Uncommon Enchantment Ball
Rare Enchantment Ball
Epic Enchantment Ball
Legendary Enchantment Ball
Ultimate Enchantment Ball
Fabled Enchantment Ball
Mythic Enchantment Ball
Each ball must have its own enchantment pool.
Example:
COMMON BALL
Can contain:
* Miner IโIII
* Haste IโIII
* Farmer IโIII
* Experience IโIII
* Telepathy IโII
* Replenish IโII
* Speed IโII
LEGENDARY BALL
Can contain:
* Lifesteal IIIโV
* Thunderlord IIIโV
* Phoenix IโIII
* Berserker IIIโV
* Overload IโIII
* Critical IIIโV
* Vampire IIโIV
* Soulbound IโIII
FABLED BALL
Can contain:
* Phoenix IIโIII
* Soulbound IIโIII
* Rage IIIโV
* DivineShield IโIII
* Executioner IIIโV
* SoulReaper IIIโV
* VoidWalker IโIII
MYTHIC BALL
Can contain extremely rare end-game enchantments.
The exact enchantment pools MUST be configurable.
---
# 41. COMPLETE BALL CONTENT CONFIGURATION
Every ball must have an explicit configuration file.
Example:
balls/legendary.yml
```yaml
id: legendary
display-name: "&6&lLegendary Enchantment Ball"
item:
material: ENDER_EYE
custom-model-data: 0
glow: true
enchantments:
lifesteal:
levels:
3: 30
4: 20
5: 10
thunderlord:
levels:
3: 25
4: 15
5: 5
phoenix:
levels:
1: 15
2: 7
3: 3
```
The numbers represent weighted probabilities.
The system must perform a weighted random roll.
Do NOT simply select every enchantment with equal probability.
---
# 42. BALL OPENING ANIMATION
When a player opens a ball:
Create a custom inventory animation.
The GUI should:
* Show the ball rarity
* Show possible rewards
* Animate enchantment names
* Cycle through possible enchantments
* Randomly cycle levels
* Slow down before stopping
* Display the final result
* Play configurable sounds
* Spawn configurable particles
* Give the resulting book
Example:
LEGENDARY BALL
Rolling...
Lifesteal IV
Thunderlord III
Phoenix II
Critical IV
Thunderlord V
Lifesteal V
...
FINAL RESULT:
โก THUNDERLORD IV
The animation must be configurable or disableable.
The actual final result must be determined securely by the server rather than allowing the client to manipulate the result.
---
# 43. ENCHANTMENT DATABASE
Every enchantment must have a complete definition.
Each enchantment must include:
* ID
* Display name
* Description
* Rarity
* Maximum level
* Applicable items
* Trigger
* Effect
* Chance
* Cooldown
* Success rate
* Destroy rate
* Conflicts
* Required slots
* Soul cost if applicable
* Permissions if applicable
Example:
```yaml
id: lifesteal
display-name: "&cLifesteal"
rarity: LEGENDARY
max-level: 5
applies-to:
- SWORD
- AXE
levels:
1:
chance: 5
heal: 0.5
2:
chance: 7
heal: 1.0
3:
chance: 9
heal: 1.5
4:
chance: 11
heal: 2.0
5:
chance: 14
heal: 3.0
cooldown: 2
```
---
# 44. DIFFERENT ABILITIES PER LEVEL
Levels must not simply increase the displayed number.
Each level should be capable of changing:
* Activation chance
* Damage
* Healing
* Radius
* Duration
* Knockback
* Potion amplifier
* Potion duration
* Cooldown
* Number of targets
* Number of blocks
* Explosion strength
* Soul cost
* Range
* Mining area
* Drop multiplier
* Speed
* Strength
* Resistance
* Effect duration
For example:
Thunderlord I:
5% activation chance.
Thunderlord II:
7% activation chance.
Thunderlord III:
10% activation chance.
Thunderlord IV:
13% activation chance.
Thunderlord V:
17% activation chance.
This system must be configurable per level.
---
# 45. DEFAULT ENCHANTMENT CATEGORIES
Create a large original library distributed across these categories.
## Combat
Examples:
* Lifesteal
* Executioner
* Berserker
* Critical
* Rage
* Combo
* Bleed
* ArmorBreaker
* Duelist
* BloodRush
* Venom
* Decimator
* SoulStrike
* Ravager
Each needs a unique ability.
## Defensive
Examples:
* Guardian
* DivineShield
* DamageWard
* Reflect
* LastStand
* Regeneration
* Fortify
* IronSkin
* Dodge
* Phoenix
* AntiKnockback
## Mining
Examples:
* VeinMiner
* Excavator
* Smelting
* Telepathy
* FortunePlus
* AutoRepair
* Haste
* Prospector
* OreBurst
* Drill
## Farming
Examples:
* Harvester
* Replanter
* CropMaster
* Farmer
* DoubleCrop
* SeedCollector
* Growth
* AutoPlant
## Fishing
Examples:
* TreasureHunter
* DoubleCatch
* Fisherman
* FastReel
* LuckyCatch
* DeepSea
* MagnetFishing
## Bow
Examples:
* Sniper
* Explosive
* LightningArrow
* Piercing
* VenomArrow
* Multishot
* Homing
* FlameBurst
## Armor
Examples:
* Overload
* Guardian
* FireShield
* IceShield
* ThornsPlus
* Lifeline
* Recovery
* AntiCrit
* ArrowGuard
## Mobility
Examples:
* Speed
* Springs
* RocketEscape
* Dash
* Leap
* Blink
* ShadowStep
* WaterWalker
* LavaWalker
## Economy / Utility
Examples:
* Experience
* CoinFinder
* MobHunter
* Lucky
* DoubleDrop
* Merchant
* SoulCollector
* Treasure
Every enchantment must have a real implementation.
Do not create placeholder enchantments that only have descriptions.
---
# 46. ENCHANTMENT BOOK APPEARANCE
Books must visually communicate their rarity.
Example:
COMMON:
&f&lCOMMON ENCHANTMENT BOOK
UNCOMMON:
&a&lUNCOMMON ENCHANTMENT BOOK
RARE:
&9&lRARE ENCHANTMENT BOOK
EPIC:
&d&lEPIC ENCHANTMENT BOOK
LEGENDARY:
&6&lLEGENDARY ENCHANTMENT BOOK
ULTIMATE:
&b&lULTIMATE ENCHANTMENT BOOK
FABLED:
&5&lFABLED ENCHANTMENT BOOK
MYTHIC:
&c&lMYTHIC ENCHANTMENT BOOK
Allow HEX colors and MiniMessage.
Allow custom model data for every rarity and level.
---
# 47. BOOK LORE
Every book should display:
Enchantment
Level
Rarity
Ability
Success Rate
Destroy Rate
Applicable Items
Example:
```text
โฆ LEGENDARY ENCHANTMENT
โก Thunderlord V
Strike your enemy with lightning
after consecutive attacks.
Success Rate: 78%
Destroy Rate: 7%
Applies To:
Swords
Axes
```
The lore must be configurable.
Support per-level descriptions.
For example:
Thunderlord III can have a different description from Thunderlord V.
---
# 48. SUCCESS RATE + MAGIC DUST
Every generated book receives a random Success Rate within the configured rarity range.
Example:
Legendary book:
Success Rate:
64%
Destroy Rate:
8%
Another book:
Success Rate:
81%
Destroy Rate:
5%
Players can use Magic Dust to increase the Success Rate.
Example:
Magic Dust:
+7%
64% โ 71%
Never allow the configured maximum to be exceeded.
Example:
Maximum:
100%
95% + 10% Magic Dust = 100%
NOT 105%.
---
# 49. WHITE SCROLL
White Scroll must protect the target item from destruction.
The protection must be stored using PersistentDataContainer.
It must survive:
* Server restart
* Item movement
* Chest storage
* Player death where the item survives
* Trading
* GUI movement
White Scroll protection must not be removable by simply relogging.
When protection activates:
* Prevent destruction
* Consume protection
* Show message
* Play sound
* Spawn particles
---
# 50. BLACK SCROLL
Black Scroll randomly removes one compatible custom enchantment.
The removed enchantment becomes a book.
Preserve:
* Enchantment
* Level
* Rarity
* Configured book appearance
Allow configuration for whether the original Success/Destroy rates are preserved or randomized.
---
# 51. SLOT INCREASER
Every item has configurable custom-enchantment slots.
Example:
Diamond Sword:
Slots:
3/3
Using Slot Increaser:
4/4
Maximum:
6/6
Do not allow:
7/6
Slot Increaser must stop working at the maximum.
---
# 52. ITEM APPLICATION SYSTEM
The primary application system is:
**Drag Custom Enchantment Book onto the target item.**
Do NOT require an anvil.
Do NOT use the vanilla enchanting table.
Do NOT use villagers.
The plugin should listen for the correct inventory interaction and safely detect:
Book โ Item
The operation must be atomic.
Prevent:
* Duplication
* Double application
* Shift-click exploits
* Drag exploits
* Inventory desync
* Book duplication
* Item duplication
The book should only be consumed after the operation has been successfully processed.
---
# 53. VANILLA SOURCE RESTRICTIONS
By default, custom enchantments must NOT appear from:
* Villagers
* Enchantment Tables
* Vanilla enchanting
* Vanilla fishing
* Vanilla loot tables
* Vanilla mob drops
The ONLY default source should be configured custom systems such as:
* Enchantment Balls
* Commands
* Crates
* Custom rewards
* Custom mob drops
* Server events
* Admin rewards
Administrators may enable additional sources manually.
---
# 54. COMPLETE CONFIGURABLE BALL TABLE
Provide a default configuration showing exactly which books each ball contains.
At minimum provide:
### COMMON BALL
Include approximately 10โ15 beginner enchantments.
### UNCOMMON BALL
Include approximately 10โ15 enchantments.
### RARE BALL
Include approximately 10โ15 enchantments.
### EPIC BALL
Include approximately 10โ15 enchantments.
### LEGENDARY BALL
Include approximately 15โ20 powerful enchantments.
### ULTIMATE BALL
Include approximately 15โ20 high-tier enchantments.
### FABLED BALL
Include approximately 10โ15 extremely rare enchantments.
### MYTHIC BALL
Include approximately 8โ15 end-game enchantments.
Each entry MUST specify:
* Enchantment ID
* Minimum level
* Maximum level
* Level weights
* Roll weight
Do not leave the ball contents empty.
---
# 55. EXAMPLE BALL RESULT
If a player opens:
FABLED ENCHANTMENT BALL
The server might roll:
Enchant:
SoulReaper
Level:
IV
Success:
72%
Destroy:
6%
The player receives:
FABLED SOULREAPER IV ENCHANTMENT BOOK
The player can then:
1. Apply Magic Dust.
2. Add White Scroll protection to their item.
3. Drag the book onto their item.
4. Roll the Success Rate.
5. If successful, receive SoulReaper IV.
6. If failed, roll Destroy Rate.
7. White Scroll prevents destruction if activated.
8. The enchantment consumes one available slot.
This entire sequence must be implemented in the plugin.
---
# 56. CONFIGURATION FILE STRUCTURE
Use a clean structure such as:
```text
plugins/
โโโ DuneEnchantments/
โโโ config.yml
โโโ messages.yml
โโโ rarities.yml
โโโ balls/
โ โโโ common.yml
โ โโโ uncommon.yml
โ โโโ rare.yml
โ โโโ epic.yml
โ โโโ legendary.yml
โ โโโ ultimate.yml
โ โโโ fabled.yml
โ โโโ mythic.yml
โ
โโโ enchantments/
โ โโโ combat.yml
โ โโโ defense.yml
โ โโโ mining.yml
โ โโโ farming.yml
โ โโโ fishing.yml
โ โโโ weapons.yml
โ โโโ armor.yml
โ โโโ tools.yml
โ โโโ utility.yml
โ
โโโ items/
โ โโโ magic-dust.yml
โ โโโ white-scroll.yml
โ โโโ black-scroll.yml
โ โโโ slot-increaser.yml
โ
โโโ database/
```
---
# 57. FINAL IMPLEMENTATION REQUIREMENT
The AI must NOT respond with only configuration examples.
It must build the actual plugin.
Every enchantment included in the default configuration must have a functioning implementation.
Every ball must actually perform a random weighted roll.
Every book must actually apply to items.
Magic Dust must actually modify success rate.
White Scroll must actually prevent configured destruction.
Black Scroll must actually remove an enchantment and produce a book.
Slot Increaser must actually increase item slots.
The entire system must work on:
**Leaf 26.2-45-ver/26.2**
using the appropriate:
**26.2.build.45-alpha API**
and:
**Java 25**.
The final output must be a complete buildable plugin project, not pseudo-code or a design document.
Create the Gradle project and Leaf/Paper plugin metadata.
Add configurable rarities, enchantment definitions, balls, and utility-item defaults.
Implement the registry, PDC-backed item system, weighted ball rolls, animation, and book application flow.
Add event listeners and
/duneadministration/player commands for all required item operations.
Created the DuneEnchantments plugin project with:
Java 25 Gradle build targeting the Paper-compatible API.
Eight configurable rarities with success/destroy ranges.
45+ original enchantments across combat, defense, mining, farming, fishing, bows, mobility, armor, economy, and utility.
Eight weighted enchantment ball configurations with level probabilities and rolling animation.
PDC-backed enchantment books, success rates, destroy rates, item slots, and White Scroll protection.
Functional Magic Dust, White Scroll, Black Scroll, Slot Increaser, book application, weighted ball rewards, and inventory drag/click handling.
Combat, defensive, mining, fishing, projectile, farming, mobility, and passive enchantment effects.
/dune ball,/dune give, and/dune reloadcommands.Configurable YAML files for messages, rarities, balls, enchantments, and utility items.
package com.dune.enchantments;
import com.dune.enchantments.command.DuneCommand;
import com.dune.enchantments.item.CustomItems;
import com.dune.enchantments.listener.EnchantmentListener;
import com.dune.enchantments.registry.EnchantmentRegistry;
import com.dune.enchantments.service.BallManager;
import com.dune.enchantments.service.EnchantmentService;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.List;
public class DuneEnchantments extends JavaPlugin {
private EnchantmentRegistry registry;
private CustomItems items;
private EnchantmentService enchantmentService;
private BallManager ballManager;
@Override
public void onEnable() {
saveDefaultConfig();
for (String resource : List.of("rarities.yml", "enchantments/combat.yml", "enchantments/defense.yml", "enchantments/tools.yml", "enchantments/lifestyle.yml", "balls/common.yml", "balls/uncommon.yml", "balls/rare.yml", "balls/epic.yml", "balls/legendary.yml", "balls/ultimate.yml", "balls/fabled.yml", "balls/mythic.yml", "items/magic-dust.yml", "items/white-scroll.yml", "items/black-scroll.yml", "items/slot-increaser.yml")) saveResource(resource, false);
registry = new EnchantmentRegistry(this);
items = new CustomItems(this, registry);
enchantmentService = new EnchantmentService(this, registry, items);
ballManager = new BallManager(this, registry, items);
EnchantmentListener listener = new EnchantmentListener(this, registry, items, enchantmentService, ballManager);
Bukkit.getPluginManager().registerEvents(listener, this);
DuneCommand command = new DuneCommand(this, registry, items);
getCommand("dune").setExecutor(command);
getCommand("dune").setTabCompleter(command);
Bukkit.getScheduler().runTaskTimer(this, listener::tickEffects, 20L, 20L);
getLogger().info("Loaded " + registry.rarities().size() + " rarities and " + registry.balls().size() + " weighted enchantment balls.");
}
public EnchantmentRegistry registry() { return registry; }
public CustomItems items() { return items; }
}