📄
pasted-code-1793443288930.txt
txt
661 lines
▶
# MIDAS MACE — COMPLETE PLUGIN DEVELOPMENT PROMPT
## 1. PROJECT OVERVIEW
Create a custom Minecraft Paper plugin for **Minecraft 1.21.11** that adds a unique custom weapon called the Midas Mace.
The Midas Mace is a custom Breach mace themed around gold, wealth, and powerful smash attacks.
The plugin must be:
- Compatible with Paper 1.21.11.
- Written in Java 21.
- Lightweight and optimized.
- Fully server-side.
- Compatible with other plugins wherever possible.
- Persistent across server restarts.
Do not modify ordinary vanilla maces.
## 2. CUSTOM ITEM IDENTIFICATION
Create a permanent custom item ID:
`cinder:midas_mace`
Requirements:
- Use Minecraft PersistentDataContainer (PDC).
- Give each Midas Mace a unique UUID.
- All abilities must identify the weapon through its PDC identifier.
- Never identify the weapon through its display name or lore.
- Preserve its identity when dropped, picked up, traded, stored, or moved between inventories.
- Prevent crafting, smithing, anvils, and other inventory operations from accidentally removing its identity.
- Maximum stack size: 1.
## 3. ITEM PROPERTIES
**Material:** MACE
**Name:** Midas Mace
**Name gradient:**
- Start with bright yellow `#FFFF55`.
- Gradually transition into rich metallic gold `#D4AF37`.
- Apply the gradient individually across the characters.
- Use Adventure Components or a compatible Paper implementation.
**Unbreakable:**
- Set the item to unbreakable.
- Durability must never decrease.
**Anvil protection:**
- Players cannot rename the weapon.
- Its name must always remain Midas Mace.
- Preserve the original gradient.
- Prevent anvil operations from removing or changing its custom identity.
- Do not consume the original item when an invalid anvil operation is attempted.
## 4. ABILITY: MIDAS CURSE
**Activation:** Successfully landing a genuine vanilla mace smash attack against another player.
When triggered, apply the following effects to the player hit.
### Utility Lockout
Disable the target's utility items for exactly 3 seconds.
Default blocked items:
- Ender Pearls.
- Wind Charges.
- Shields.
- Firework Rockets.
- Chorus Fruit.
- Snowballs.
- Eggs.
- Other configurable utility items.
Requirements:
- Prevent activation and use of blocked utility items.
- Do not delete, consume, or remove items.
- Do not prevent normal movement or ordinary attacks.
- Handle relevant interaction, projectile launch, consumption, shield blocking, and other item activation events.
- Make the blocked item list configurable.
### Vanilla Cooldown Visual
Display the vanilla Minecraft item cooldown overlay, similar to the visual displayed when using a Goat Horn.
- Duration: 3 seconds.
- Synchronize the visual with the actual utility restriction.
- Use native item cooldown functionality where supported.
- Server-side restrictions must remain authoritative.
### Jump Suppression
- Significantly reduce the affected player's jump height.
- Target approximately 25% of normal jump impulse.
- Duration: 3 seconds.
- Do not accidentally reduce ordinary falling or smash knockback.
### Slowness
- Apply Slowness II.
- Duration: 3 seconds.
### Golden Particles
- Spawn golden and bright yellow particles around the affected player.
- Include a burst at the original impact location.
- Add a short upward scattering effect.
- Keep the effect lightweight.
### Custom Sound
Play a unique Midas impact sound at the affected player's location.
Sound direction:
- Deep metallic impact.
- Subtle magical golden ringing.
- Audible to nearby players.
- Play only once per activation.
Support a configurable resource-pack sound event and a vanilla sound fallback.
### Restrictions
- Only successful player smash attacks activate Midas Curse.
- Normal mace attacks must not activate it.
- Mob attacks must not activate it.
- Do not activate multiple times from one smash.
- All effects must expire cleanly after 3 seconds.
## 5. ABILITY: IMPACT
**Cooldown: 15 seconds per player.**
When a successful mace smash attack hits a player, create a golden shockwave.
### Shockwave
- Center the shockwave at the original smash impact location.
- Radius: 5 blocks.
- Affect all other nearby players.
- Exclude the Midas Mace holder.
- Exclude the player directly hit by the original smash.
### Damage
Deal additional damage to every other affected player equal to **25% of the actual damage dealt to the original target**.
Example:
If the original smash deals 20 damage, every other affected player receives 5 additional damage.
Requirements:
- Calculate damage after applicable vanilla damage reductions.
- Do not damage the original target twice.
- Never damage the mace holder.
- Respect PvP protection and cancelled damage events.
### Knockback
- Knock affected players away from the shockwave center.
- Apply consistent outward knockback.
### Visual Effects
- Create an expanding golden and yellow particle ring.
- Play a subtle golden impact sound.
- Keep the visual effect compact.
### Cooldown
- 15 seconds.
- Tracked individually per player.
- Only successful player smash attacks can trigger it.
- Ordinary mace hits cannot activate it.
## 6. ABILITY: GOLD RUSH
**Activation: Every 6 successful player smash attacks.**
Gold Rush has its own independent smash counter.
### Smash Counter
Every successful mace smash against a player increments the counter by 1.
The counter must be displayed directly in the Midas Mace tooltip.
Examples:
`Gold Rush Progress`
`0/6`
`1/6`
`2/6`
Continue until `6/6`.
When the counter reaches 6:
- Immediately activate Gold Rush.
- Reset the counter to `0/6`.
### Golden Explosion
When the sixth smash successfully lands:
- Create a burst of golden lightning-like particles.
- Center the explosion at the sixth smash impact location.
- Create a 6-block radius damage circle.
- Affect all other nearby players.
- Exclude the Midas Mace holder.
- Exclude the player directly hit by the sixth smash.
### Damage Calculation
Deal additional damage equal to **50% of the actual damage dealt to the sixth target**.
Example:
If the sixth smash deals 20 damage, every other affected player receives 10 additional damage.
Requirements:
- Calculate damage after applicable vanilla damage reductions.
- Do not damage the original target twice.
- Do not damage the attacker.
- Respect PvP protection and cancelled damage events.
### Visual Effects
- Golden lightning-like particle burst.
- Expanding circular golden particle effect.
- Bright yellow and rich gold particles.
- A distinct golden activation sound.
Use visual lightning particles only. Do not summon actual lightning entities that cause unintended damage or fire.
### Counter Persistence
- Counter increases only on confirmed successful player smash attacks.
- Normal hits do not count.
- Splash damage does not count.
- Reset immediately after reaching 6.
- Progress must survive relogs and server restarts.
- Store progress on the actual Midas Mace using PDC.
- Update the item tooltip immediately after each qualifying smash.
There is no additional Gold Rush cooldown. It activates every six qualifying smash attacks.
## 7. ABILITY: MASS FORTUNE
**Passive ability: Killing mobs rewards gold.**
When a player kills a mob using Midas Mace:
- Drop between 1 and 5 gold ingots.
- Every amount must have an equal probability.
- Gold drops naturally at the mob's death location.
- Works on all living mobs except players.
- Only activate when Midas Mace is responsible for the killing blow.
- Prevent duplicate rewards from multiple death events.
Use a server-side random integer between 1 and 5 inclusive.
## 8. ABILITY: MIDAS BLESSING
**Passive ability: Luck 255.**
While a genuine Midas Mace exists anywhere in the player's inventory:
- Grant Luck 255.
- Maintain the effect continuously.
- Refresh the effect before expiration.
- Do not require the player to hold the mace.
Check:
- Main inventory.
- Hotbar.
- Offhand.
- Armor slots.
When the player no longer has Midas Mace:
- Remove the plugin-provided Luck effect.
- Do not accidentally remove an unrelated pre-existing effect from another plugin.
Use the correct Minecraft potion effect amplifier to represent Luck 255, verifying the target Paper API's effect-level conventions.
## 9. ABILITY: PIGLIN ROYALTY
While a player has Midas Mace anywhere in their inventory, all Piglin-type mobs must remain neutral toward them.
Include:
- Piglins.
- Piglin Brutes.
- Zombified Piglins.
Requirements:
- Prevent these mobs from targeting the Midas Mace holder.
- Clear existing hostile targets against the holder.
- Prevent retaliation and group anger from causing them to attack the holder.
- Work even when the mace is stored in the inventory.
- Restore normal behavior when the player no longer has Midas Mace.
Do not globally disable Piglin aggression toward other players.
## 10. ABILITY: MIDAS AURA
**Passive ability: Golden particle trail.**
While a player has Midas Mace anywhere in their inventory:
- Spawn a subtle trail of golden and yellow particles around them as they move.
- Particles should appear around their feet and lower body.
- Mix bright yellow and rich gold particles.
- Only spawn particles while moving.
- Keep the effect compact and lightweight.
### Invisibility Interaction
If the player has Invisibility:
- Completely disable Midas Aura particles.
- Do not spawn any trail particles.
- Automatically restore the trail when Invisibility expires or is removed.
### Restrictions
- Stop spawning particles immediately when the mace leaves the inventory.
- Do not spawn particles for spectators or offline players.
- Use an optimized repeating task.
- Avoid creating individual permanent tasks for every player or particle.
## 11. FINAL ITEM TOOLTIP
The item tooltip MUST follow this exact structure.
Do not add long explanations, extra ability descriptions, or unnecessary information.
The layout should be compact and readable.
**Required tooltip text:**
Midas Mace
ABILITIES
Midas Curse
Strike players to disable utilities for 3 seconds.
Impact
5-block shockwave dealing 25% splash damage.
Gold Rush
Every 6 smashes triggers a golden explosion.
Mass Fortune
Mob kills drop 1–5 gold ingots.
Piglins will not attack you.
Gold Rush Progress
3/6
The `3/6` above is an example. The actual number must update dynamically based on the mace's current stored progress.
### Tooltip Styling
- Midas Mace name uses the yellow-to-rich-gold gradient.
- Use compact spacing.
- Use clear, readable descriptions.
- Keep Gold Rush Progress at the bottom.
- Use gold/yellow formatting where appropriate.
- Avoid unnecessary symbols and decorative clutter.
- Preserve the tooltip through drops, trades, inventory movement, and restarts.
- Do not duplicate lore when updating progress.
**Important:** Midas Blessing and Midas Aura must still function even though they do not need separate descriptions in this compact tooltip.
## 12. ADMIN COMMANDS
Create the main command:
`/midasmace`
This opens the Midas Mace administration GUI.
### Required Commands
`/midasmace`
Open the admin GUI.
`/midasmace give`
Give the command executor a genuine Midas Mace.
`/midasmace give `
Give a genuine Midas Mace to the specified player.
`/midasmace remove`
Remove Midas Maces from the command executor's inventory.
`/midasmace remove `
Remove all genuine Midas Maces from the specified player's inventory, including their main inventory, hotbar, offhand, and armor slots.
`/midasmace info`
Display information about the weapon, custom ID, and abilities.
`/midasmace reload`
Reload the plugin configuration.
### Command Requirements
- All commands must have appropriate permission checks.
- Give and remove commands must identify items through PDC.
- Never remove ordinary vanilla maces.
- Give commands must create fully initialized items with all required PDC data and tooltip information.
- Support tab completion for player names and subcommands.
- Provide clear success and error messages.
- Prevent unauthorized players from accessing administrative commands.
### Permissions
`midasmace.admin` — Full administrative access.
`midasmace.give` — Give command.
`midasmace.remove` — Remove command.
`midasmace.info` — Information command.
`midasmace.reload` — Reload configuration.
## 13. ADMIN GUI
Create a compact, clean administrative inventory GUI.
Opening command:
`/midasmace`
### Main GUI
Title:
`MIDAS MACE`
Use a dark inventory background with gold accents.
Include the following buttons:
**Give Midas Mace**
- Gold Ingot icon.
- Clicking gives the administrator a genuine Midas Mace.
**Remove Midas Mace**
- Barrier icon.
- Opens a player-selection menu or removes the administrator's own Midas Mace with confirmation.
**Midas Mace Information**
- Book icon.
- Displays the custom item ID and ability information.
### GUI Requirements
- Only authorized administrators can open the GUI.
- Prevent item movement, removal, or insertion inside the GUI.
- Prevent players from exploiting GUI clicks to obtain decorative icons.
- Give and remove actions must use the same safe item-handling methods as the commands.
- Provide confirmation for potentially destructive remove actions.
- Keep the interface lightweight.
The GUI is administrative only. Ordinary players do not need access to it.
## 14. CONFIGURATION
Create a clean `config.yml`.
Allow administrators to configure:
- Midas Curse duration.
- Blocked utility item list.
- Jump reduction strength.
- Slowness level.
- Impact radius.
- Impact damage percentage.
- Impact cooldown.
- Gold Rush required smash count.
- Gold Rush radius.
- Gold Rush damage percentage.
- Mass Fortune minimum gold drops.
- Mass Fortune maximum gold drops.
- Midas Aura particle frequency.
- Particle counts.
- Custom sound events.
- Individual ability enable/disable switches.
Default values must match this specification.
Do not require configuration editing for the default Midas Mace to work.
## 15. EVENT HANDLING AND DAMAGE ACCURACY
This is one of the most important parts of the plugin.
### Smash Detection
The plugin must distinguish genuine vanilla mace smash attacks from ordinary mace hits.
Requirements:
- Target Paper 1.21.11 specifically.
- Inspect the actual Paper API for the correct damage source and damage type information.
- Do not rely solely on fall distance, attack animation, weapon material, or player movement.
- Do not treat ordinary falling attacks as smash attacks unless Minecraft identifies them as genuine mace smash attacks.
- Confirm the attack actually damages a player.
- Respect cancelled damage events.
If the target API requires a different supported method, inspect the actual 1.21.11 API and implement the correct method.
### Damage Calculation
For Impact and Gold Rush:
- Calculate original smash damage after applicable vanilla damage reductions.
- Account for armor, resistance, enchantments, and other damage modifiers.
- Use actual applied damage rather than theoretical base damage.
- Apply splash damage only after the original damage has been processed.
### Recursive Activation Prevention
Splash damage must never:
- Trigger Midas Curse.
- Trigger Impact.
- Increment Gold Rush.
- Trigger another Gold Rush.
- Count as another successful smash.
Use an explicit internal damage context or another reliable mechanism to prevent recursive ability activation.
### PvP Compatibility
- Respect cancelled damage events.
- Respect protected regions.
- Respect server PvP restrictions.
- Do not bypass other plugins' damage cancellation.
- Never damage the attacker.
- Never damage the original smash target a second time.
## 16. PERFORMANCE REQUIREMENTS
The plugin must be lightweight.
- Avoid unnecessary repeating tasks.
- Prefer event-driven checks.
- Avoid scanning every player's inventory every tick.
- Cache relevant player state where appropriate.
- Clean up cooldowns and temporary effects.
- Avoid excessive particle spawning.
- Avoid repeatedly modifying item lore unless progress changes.
- Prevent memory leaks.
- Support multiple players using Midas Mace simultaneously.
- Ensure abilities do not interfere with one another.
## 17. TESTING REQUIREMENTS
Test every feature on an actual Paper 1.21.11 server.
### Item Testing
- Correct gradient name.
- Unbreakable.
- Anvil renaming blocked.
- Custom ID survives dropping and picking up.
- Custom ID survives relogging and server restarts.
- Ordinary maces never activate abilities.
### Midas Curse
- Successful smash activates all effects.
- Normal hits do not activate it.
- Utility items are blocked for 3 seconds.
- Cooldown visual matches the lockout.
- Jump height is reduced.
- Slowness II is applied.
- Particles and sound play once.
### Impact
- 5-block radius works.
- 25% damage calculation is correct.
- Original target excluded.
- Attacker excluded.
- Knockback works.
- 15-second cooldown works.
### Gold Rush
- Counter increments only on successful player smash attacks.
- Tooltip updates from 0/6 through 6/6.
- Sixth smash triggers the explosion.
- Splash damage equals 50% of original smash damage.
- Attacker and original target excluded.
- Counter resets to 0/6.
- Progress survives relogs and restarts.
### Mass Fortune
- Mob kills drop 1–5 gold ingots.
- Random distribution is correct.
- Player kills do not generate gold.
- Duplicate rewards are prevented.
### Midas Blessing
- Luck 255 remains active while carrying the mace.
- Works from all inventory locations.
- Effect is removed appropriately when the mace is removed.
### Piglin Royalty
- Piglins do not attack the holder.
- Piglin Brutes do not attack the holder.
- Zombified Piglins do not attack the holder.
- Other players are unaffected.
### Midas Aura
- Golden trail works while moving.
- No trail while stationary.
- Invisibility disables all trail particles.
- Removing the mace stops the trail.
### Admin Commands and GUI
- All commands work.
- Permissions are enforced.
- Give creates a genuine Midas Mace.
- Remove only removes genuine Midas Maces.
- GUI actions work.
- Decorative GUI items cannot be exploited.
- Configuration reload works.
## 18. FINAL DELIVERY REQUIREMENTS
Deliver:
1. Complete Java source code.
2. Complete Maven or Gradle project.
3. `plugin.yml`.
4. `config.yml`.
5. Any required resource-pack sound documentation.
6. Compiled plugin JAR.
7. Installation instructions.
8. List of implemented and tested abilities.
Do not deliver pseudocode or incomplete example classes.
Do not use outdated Bukkit or Paper APIs.
Do not guess method names, event classes, packet classes, or mappings.
Verify the actual Paper 1.21.11 API and dependencies before implementation.
If a requested feature requires a lower-level implementation, use a documented compatible approach and explain any limitations.
The final plugin must compile cleanly, load without errors, and work on Paper 1.21.11.
**FINAL PRIORITIES:**
1. Accurate vanilla smash detection.
2. Correct damage calculations.
3. Reliable item identification and persistence.
4. Correct ability activation and cooldowns.
5. Reliable inventory and anvil protection.
6. Lightweight performance.
7. Clean, compact item tooltip and admin GUI.
Do not add any unrequested abilities.
Golden Dash is explicitly NOT part of this plugin. Do not implement dash mechanics, offhand-key activation, dash cooldowns, dash particles, or offhand swap interception.
Create the Paper 1.21.11 / Java 21 project and configuration.
Implement the PDC-backed item, smash abilities, passive effects, and protections.
Add permissioned commands and the protected admin GUI.
Created the Java 21 Paper 1.21.11 project with the plugin descriptor, configuration, source, and resource-pack sound instructions.
Implemented the PDC-identified Midas Mace, item protections and tooltip, smash abilities, passive effects, admin commands, and confirmation-based admin GUI. Smash activation checks Paper’s DamageType.MACE_SMASH and ignores cancelled damage events.
I haven’t tested this on a live Paper server, so I can’t claim runtime verification. To build and download the JAR, click Compile in Kodari, then click Compile in the window; when it succeeds, choose Download. If the build fails, use Auto-fix in the chat or Fix in the build window.
📄
pasted-code-1793480099886.txt
txt
133 lines
▶
# Midas Mace — Fix Hotbar, Inventory, and Drop Behavior
**Target:** Minecraft Paper 1.21.11
**Language:** Java 21
**Project:** Existing Midas Mace plugin
## Problem
The Midas Mace currently has an inventory bug: when a player takes the mace out of a slot or tries to move it into their hotbar, it gets stuck in the slot it was originally placed in. It does not behave like a normal Minecraft item.
Fix this without changing the Midas Mace's abilities, identity, appearance, or other existing functionality.
## 1. Restore Normal Inventory Behavior
The Midas Mace must behave exactly like a normal vanilla mace when interacting with inventories.
Players must be able to:
- Move the Midas Mace between any inventory slots.
- Place it into any hotbar slot (1–9).
- Move it from their inventory into their hotbar and back.
- Swap it between hotbar slots using number keys.
- Move it using shift-click.
- Pick it up and move it using normal cursor interactions.
- Swap it with another item.
- Move it into and out of their offhand.
- Store it in chests, shulker boxes, ender chests, and other normal containers.
- Retrieve it from containers without it snapping back to its previous slot.
- Drop it naturally from their inventory.
- Pick it back up after dropping it.
**There must be no slot locking, forced slot restoration, inventory rollback, or automatic repositioning.**
## 2. Preserve Normal Drop and Pickup Properties
The Midas Mace must support normal vanilla item dropping behavior.
- Q drops the mace normally.
- Ctrl + Q drops the mace normally.
- Dropped mace entities can be picked up normally.
- The mace retains its unique UUID and all PDC data after being dropped and picked up.
- Its abilities continue working after pickup.
- Dropping the mace must not duplicate it or create another mace.
- Do not prevent dropping through inventory event cancellation.
## 3. Preserve Item Identity Without Restricting Movement
The plugin must identify the Midas Mace exclusively through its existing PersistentDataContainer identifiers.
Do not use:
- Display name checks.
- Lore checks.
- Inventory slot numbers.
- Original slot tracking.
- Forced hotbar selection.
- Inventory resynchronization to force the mace back into a previous slot.
The unique mace UUID and all existing PDC data must remain attached to the item through every normal inventory operation.
## 4. Audit and Remove the Cause
Inspect the entire existing plugin for code that interferes with inventory movement.
Pay particular attention to:
- `InventoryClickEvent`
- `InventoryDragEvent`
- `PlayerSwapHandItemsEvent`
- `PlayerDropItemEvent`
- `EntityPickupItemEvent`
- `PlayerItemHeldEvent`
- Any inventory update or synchronization tasks.
- Any code that stores or restores the mace's original slot.
- Any code that cancels inventory interactions involving the Midas Mace.
- Any repeating task that moves the mace back to a specific slot.
Remove or rewrite the conflicting logic instead of adding another workaround on top of it.
Do not cancel inventory events involving the mace unless a specific, necessary security restriction exists. The mace must remain freely movable.
## 5. Preserve Existing Features
Do not remove, rewrite, weaken, or break any existing Midas Mace functionality:
- Midas Curse
- Impact
- Gold Rush
- Mass Fortune
- Midas Blessing
- Piglin Royalty
- Midas Aura
- Dynamic Gold Rush Progress tooltip
- Gold-gradient item name
- Unbreakable property
- Anvil rename protection
- Unique UUID and PDC identification
- Admin commands
- Admin GUI
- Configuration options
Golden Dash must remain completely removed.
## 6. Required Testing
Test the actual compiled plugin on Paper 1.21.11.
Verify all of these cases:
1. Give a player a Midas Mace.
2. Move it from its original inventory slot into hotbar slot 1.
3. Move it from hotbar slot 1 into slot 9.
4. Swap it between hotbar slots using number keys.
5. Move it into the offhand.
6. Move it into a chest and retrieve it.
7. Drop it with Q and pick it back up.
8. Drop it with Ctrl + Q and pick it back up.
9. Relog while the mace is in a different slot.
10. Restart the server while the mace is stored in a container.
11. Verify the mace retains its identity and all abilities after every operation.
12. Verify ordinary vanilla maces remain completely unaffected.
## Final Requirements
- Make the fix directly in the existing project.
- Identify the exact code responsible for the inventory bug.
- Remove the underlying cause rather than masking the symptom.
- Do not introduce slot locks or inventory restrictions.
- Do not create duplicate maces or lose PDC data.
- Compile against the exact Paper 1.21.11 API using Java 21.
- Verify that the finished plugin builds successfully.
- Report which files were changed, what caused the bug, and which tests passed.
**The most important requirement: the Midas Mace must behave exactly like a normal vanilla mace in the hotbar, inventory, containers, offhand, and when dropped. Its custom abilities and identity must work independently of where the player stores it.**
Trace the mace’s inventory, drop/pickup, and slot-tracking logic to identify the exact cause.
Remove only the conflicting behavior while preserving PDC identity and existing abilities.
Review the affected paths and report what could and could not be verified here.
Removed the inventory cancellation in MidasListener. The cause was the click handler treating the player’s own CRAFTING inventory view as protected and canceling clicks involving the mace; the drag handler also canceled drags when the mace was on the cursor. That prevented normal movement and made the mace appear locked in place.
Anvil rename protection and the existing crafting/smithing result restrictions remain. The fix does not change the mace item or its PDC data.
I couldn’t run the requested Paper 1.21.11 server tests here, so hotbar, offhand, container, drop/pickup, relog, and restart behavior still needs in-game verification.
📄
pasted-code-1793480290932.txt
txt
90 lines
▶
# Midas Mace — Ability and Item Property Updates
Make the following changes to the existing Minecraft Paper 1.21.11 Midas Mace plugin.
## 1. Midas Curse — Remove Shield Disabling
Midas Curse must no longer disable shields.
- Remove shields from the blocked utility items list.
- Players affected by Midas Curse must still be able to raise and use shields normally.
- Keep all other Midas Curse effects unchanged:
- 3-second utility lockout for the remaining configured items.
- Reduced jump height.
- Slowness II.
- Gold particle effects.
- Custom impact sound.
- Make sure no other ability or mechanic accidentally prevents shield usage.
## 2. Completely Remove Impact
Remove the Impact ability entirely.
This includes:
- Its shockwave mechanic.
- Its 5-block radius.
- Its 25% splash damage.
- Its independent 15-second cooldown.
- Its particles and sound effects.
- Its configuration options.
- Its tooltip entry.
- All related event handlers, timers, and internal state.
Do not leave unused or partially functioning Impact code behind.
Make sure Gold Rush continues working independently and does not rely on Impact's code.
## 3. Hide the Unbreakable Tooltip Tag
The Midas Mace must remain unbreakable, but the visible `Unbreakable` tooltip tag must disappear.
Requirements:
- Preserve the actual unbreakable item property.
- Use the correct Paper 1.21.11-compatible item metadata or item component API to hide the unbreakable tooltip.
- Do not make the mace breakable.
- Do not remove other intended tooltip information.
- Do not hide the entire tooltip.
## 4. Updated Tooltip
Remove Impact completely. The tooltip should now follow this structure:
Midas Mace
ABILITIES
Midas Curse
Strike players to disable utilities for 3 seconds.
Gold Rush
Every 6 smashes triggers a golden explosion.
Mass Fortune
Mob kills drop 1–5 gold ingots.
Piglins will not attack you.
Gold Rush Progress
3/6
The `3/6` value is an example. Keep it dynamically updated.
Do not display Impact anywhere in the tooltip.
## 5. Compatibility and Testing
- Target Paper 1.21.11 and Java 21.
- Use APIs that actually exist in the target version.
- Preserve all other Midas Mace functionality.
- Ensure the mace remains genuinely unbreakable while its unbreakable tag is hidden.
- Test that shields work normally against Midas Curse.
- Verify Impact cannot trigger and has no remaining cooldown or damage logic.
- Verify Gold Rush still activates every 6 qualifying smashes.
- Verify the hotbar, inventory, container, offhand, and drop behavior fix remains intact.
- Build the finished plugin successfully.
Do not redesign the item or change unrelated mechanics.
Remove shield disabling from Midas Curse while retaining its other effects.
Remove Impact completely, including config, state, and tooltip references.
Hide only the Unbreakable tooltip tag while keeping the mace unbreakable.
Update the tooltip and preserve its dynamic Gold Rush progress.
Shield: removed
SHIELDfrom Midas Curse’s configured blocked items.Next: trace all Impact code and remove it without affecting Gold Rush.
Impact is removed from smash handling, cooldown state, shared-ability call sites, configuration, tooltip, and admin info; the shared shockwave helpers remain for Gold Rush.
Next: hide only the unbreakable tooltip tag while preserving the mace’s unbreakable property.
The mace stays unbreakable; its metadata now hides only the Unbreakable tag. The tooltip retains the dynamic Gold Rush progress line. I’m checking for stale Impact references before wrapping up.
Midas Curse: Removed shields from the default blocked-items list and made the listener ignore
SHIELDeven if an existing config still lists it. Other curse effects are unchanged.Impact: Removed its trigger, cooldown state and cleanup, configuration, tooltip entry, and admin descriptions. Gold Rush keeps its own blast behavior and shared effects.
Item tooltip: The mace remains unbreakable, with only the Unbreakable tag hidden. Gold Rush progress remains dynamic, and the tooltip no longer lists Impact.
Changed files: config.yml, MidasListener.java, MidasItemFactory.java, AdminGui.java, and MidasCommand.java.
I couldn’t run a Paper 1.21.11 build or the requested in-game tests here, so those results remain unverified.
📄
pasted-code-1793480431081.txt
txt
399 lines
▶
# Midas Mace — Complete Gold Rush Sixth-Hit Upgrade
**Target:** Minecraft Paper 1.21.11
**Java:** 21
**Language:** Java
**Project:** Existing Midas Mace plugin
## Main Objective
Upgrade the existing Gold Rush ability. Every 6 successful qualifying mace smashes must trigger one powerful Gold Rush event with four effects:
1. The sixth hit deals double damage to the original target.
2. Enhanced golden lightning strikes the original target and deals additional configurable damage.
3. All other enemies within a 6-block radius are stunned for 2 seconds.
4. Golden particles surround every stunned enemy.
All four effects must activate as part of the same sixth-hit event.
**Important:** Only modify Gold Rush and the code strictly necessary to support it. Preserve every other Midas Mace ability, inventory fix, item property, command, GUI, and configuration option.
---
## 1. Gold Rush Counter
Maintain the existing Gold Rush counter.
- Each successful qualifying mace smash against another player adds exactly 1.
- Hits 1–5 increment the counter normally.
- The sixth successful smash activates Gold Rush.
- After activation, immediately reset the counter to 0/6.
- The next qualifying smash starts a new cycle.
- Display the current progress dynamically in the item's tooltip.
- Store progress using the existing PDC system so it survives relogs, server restarts, and inventory movement.
- Only genuine successful Midas Mace smash attacks against players count.
- Ordinary attacks, mob attacks, cancelled attacks, bonus damage, lightning damage, and stun effects must never increment the counter.
The counter must be associated with the correct Midas Mace UUID.
## 2. Sixth-Hit Double Damage
On the sixth qualifying hit, the original target must receive double the normal final damage from the mace smash.
**Requirements:**
- Determine the damage the original smash would normally deal after applicable vanilla damage calculations and reductions.
- Make the final smash damage exactly 2 times the normal final smash damage.
- Apply only the additional damage needed to reach that total.
- Do not simply multiply an already-modified damage value multiple times.
- Do not accidentally double the damage through multiple event listeners.
- Do not count the additional damage as another mace attack.
- Do not trigger Midas Curse or Gold Rush again from the additional damage.
**Example:**
| Normal final damage | Sixth-hit final damage |
|---:|---:|
| 5 | 10 |
| 10 | 20 |
| 15 | 30 |
| 20 | 40 |
The double-damage multiplier must be configurable.
Default:
```yaml
gold-rush:
sixth-hit:
enabled: true
damage-multiplier: 2.0
```
If another plugin cancels the original attack, Gold Rush must not activate.
## 3. Enhanced Golden Lightning
When the sixth hit activates Gold Rush, strike the original target with a powerful golden lightning effect.
### Visual effect
- Create a highly visible golden lightning effect at the original target's location.
- Make it visually distinct from ordinary vanilla lightning.
- Include bright golden particles and a noticeable lightning strike animation.
- Add a powerful metallic thunder-like sound.
- Keep the effect centered on the target's location when activated.
### Damage
The lightning must deal additional configurable bonus damage to the original target.
- The bonus damage is separate from the double-damage smash.
- Apply it exactly once.
- It must be stronger than ordinary vanilla lightning damage.
- Never damage the attacker.
- Do not damage unrelated entities with the lightning effect.
- Do not count lightning damage as a mace smash.
- Lightning damage must not trigger Midas Curse, Gold Rush, or any other mace ability.
### Absolutely no fire
The lightning must never:
- Create fire blocks.
- Ignite entities.
- Set the ground on fire.
- Cause environmental fire damage.
- Spread fire to nearby blocks.
Do not use normal damaging vanilla lightning as the implementation.
Use a visual-only lightning effect and a separate controlled damage application. The implementation must guarantee that no fire is created.
### Configuration
```yaml
gold-rush:
lightning:
enabled: true
bonus-damage: 8.0
fire: false
```
The bonus damage should be configurable. Fire must remain disabled.
---
## 4. Golden Stun Shockwave
When Gold Rush activates on the sixth hit, create a stun shockwave centered on the original target's location at the moment of impact.
6-block radius · 2-second stun
### Target selection
- Affect all enemies within a 6-block radius of the original target.
- Include the original target if they are still within the radius.
- Include other players and hostile mobs.
- Never affect the Midas Mace holder.
- Never stun the attacker, even if they are inside the radius.
- Do not affect friendly or unrelated entities unless they qualify as enemies under the plugin's existing targeting rules.
- Do not accidentally apply the stun outside the radius.
Calculate the radius from the target's location when the sixth hit occurs.
### Stun duration
Every affected enemy must be stunned for exactly 2 seconds.
During the stun:
- Prevent normal movement.
- Prevent jumping.
- Prevent sprinting.
- Prevent attacking.
- Prevent item usage.
- Prevent the affected player from changing equipment or using inventory actions that would bypass the stun.
- Prevent hostile mobs from moving or attacking.
- Do not affect the attacker's movement, attacks, or item usage.
For players, use appropriate event handling to enforce the stun. For mobs, use an appropriate temporary AI or movement restriction.
Do not assume that applying Slowness or another potion effect creates a true stun.
### Restoration
When the 2-second stun expires:
- Restore normal movement and actions immediately.
- Restore the mob's previous AI state.
- Restore any temporary settings changed by the plugin.
- Do not permanently modify attributes, movement speed, AI, or other entity properties.
- Do not remove unrelated potion effects.
- Clean up all temporary stun state when an entity becomes invalid, dies, disconnects, or the plugin disables.
If an entity was already stunned by another source, do not accidentally overwrite or remove that separate effect.
### Stun stacking
- Track each affected entity independently using its UUID.
- Prevent duplicate stun applications from stacking unintentionally.
- Do not repeatedly extend the duration from the same Gold Rush activation.
- Handle multiple Midas Mace holders safely.
- Clean up expired stun records to prevent memory leaks.
---
## 5. Golden Particle Effects
Every stunned enemy must be surrounded by golden particles for the full 2-second stun.
### Appearance
- Use bright gold and yellow particles.
- Create a visible circular particle ring around the affected entity.
- Add particles surrounding the entity's body.
- Keep particles following the entity's current location.
- Make the effect noticeable without creating excessive particle spam.
- Stop all stun particles immediately when the stun expires.
Each affected enemy must receive their own particle effect.
The attacker must not receive the stun particles.
---
## 6. Damage Handling and Event Safety
This section is critical.
Implement a reliable internal damage context or equivalent system to distinguish:
- Original vanilla mace smash damage.
- Additional sixth-hit damage.
- Golden lightning bonus damage.
- Any other secondary damage.
Requirements:
1. Process the original smash only once.
2. Determine its final applicable damage correctly.
3. Apply the extra damage required to reach the configured multiplier.
4. Apply lightning bonus damage exactly once.
5. Prevent secondary damage from triggering Gold Rush or other Midas Mace abilities.
6. Prevent recursive damage-event handling.
7. Ensure the stun does not cause additional damage.
8. Respect cancelled damage events and existing PvP protection.
9. Respect protected regions and other plugins' restrictions.
10. Do not damage the attacker.
11. Do not accidentally damage nearby players through the lightning effect.
Use the correct Paper 1.21.11 damage-event handling and damage APIs.
Do not guess API methods or rely on outdated Bukkit/Paper examples.
If damage is modified or cancelled by another plugin, handle it safely without duplicating or bypassing that plugin's protections.
Do not assume that an event's initial damage value is always the final damage. Inspect the actual Paper 1.21.11 event behavior and choose an implementation that correctly accounts for damage reductions and other plugins.
---
## 7. Configuration
Add or update the following configuration structure while preserving existing settings:
```yaml
gold-rush:
enabled: true
required-hits: 6
sixth-hit:
enabled: true
damage-multiplier: 2.0
lightning:
enabled: true
bonus-damage: 8.0
fire: false
stun:
enabled: true
radius: 6.0
duration-ticks: 40
affect-players: true
affect-hostile-mobs: true
particles:
enabled: true
follow-stunned-entities: true
duration-ticks: 40
```
All values must be configurable and validated when the configuration loads.
The default stun duration of 40 ticks equals 2 seconds.
Changing these settings must not require recompiling the plugin.
---
## 8. Performance Requirements
Keep the implementation lightweight.
- Avoid unnecessary repeating tasks.
- Do not scan every entity in every world every tick.
- Only search for nearby entities when Gold Rush activates.
- Use efficient nearby-entity queries.
- Track active stuns using UUIDs.
- Remove expired data and temporary tasks.
- Avoid unnecessary particle spawning.
- Ensure multiple players using Midas Maces do not interfere with each other.
- Do not introduce memory leaks or persistent unnecessary entity references.
---
## 9. Preserve All Existing Midas Mace Features
Do not modify or remove unrelated features.
Preserve:
- Midas Curse.
- Mass Fortune.
- Midas Blessing.
- Piglin Royalty.
- Midas Aura.
- Gold Rush tooltip progress.
- Gold-gradient item name.
- Unique mace UUID.
- PersistentDataContainer identity.
- Unbreakable functionality with its tooltip tag hidden.
- Anvil rename protection.
- Normal hotbar and inventory movement.
- Normal container storage.
- Normal dropping and pickup behavior.
- Admin commands.
- Admin GUI.
- Existing configuration options.
**Impact must remain completely removed.**
**Golden Dash must remain completely removed.**
Midas Curse must not disable shields.
Do not reintroduce any previously removed functionality.
---
## 10. Required Testing
Test the finished plugin on Paper 1.21.11 using Java 21.
Verify every case:
### Counter
1. First five successful smashes increment the counter.
2. The sixth successful smash activates Gold Rush.
3. Counter resets to 0/6.
4. The next cycle works correctly.
5. Bonus damage never increments the counter.
### Double damage
6. The sixth smash deals exactly twice its normal final damage.
7. Damage reductions are handled correctly.
8. The additional damage is applied exactly once.
9. Cancelled attacks do not activate Gold Rush.
### Lightning
10. Golden lightning appears at the original target.
11. Configured bonus damage applies exactly once.
12. Lightning damage does not trigger other abilities.
13. No fire blocks are created.
14. No entities are ignited.
15. The attacker never receives lightning damage.
### Stun
16. All qualifying enemies within 6 blocks are stunned.
17. The original target is included if still within range.
18. The attacker is never stunned.
19. Players cannot move, attack, jump, sprint, or use items during the stun.
20. Hostile mobs cannot move or attack during the stun.
21. Stun ends after exactly 2 seconds.
22. Normal movement and AI are restored.
23. Golden particles follow every affected enemy.
24. Particles stop when the stun expires.
25. Multiple simultaneous stuns do not interfere with one another.
### Compatibility
26. Existing Midas Mace abilities still work.
27. Inventory and hotbar movement remain normal.
28. Dropping and picking up the mace preserves its identity.
29. Ordinary vanilla maces remain unaffected.
30. No errors or memory leaks occur.
---
## 11. Final Delivery Requirements
- Make the changes directly in the existing project.
- Inspect the existing Gold Rush implementation before modifying it.
- Reuse the existing architecture where appropriate.
- Do not create duplicate listeners or competing damage systems.
- Use only APIs verified to exist in Paper 1.21.11.
- Compile successfully using Java 21.
- Fix all compilation errors.
- Test the finished implementation rather than assuming it works.
At completion, report:
1. Which files were changed.
2. How the sixth-hit damage calculation works.
3. How the visual-only lightning and bonus damage work.
4. How the stun is enforced and safely restored.
5. Which tests passed.
6. Any remaining limitations.
**FINAL EXPECTED RESULT:** Every sixth successful Midas Mace smash triggers one coordinated Gold Rush event: the original target receives double smash damage plus additional golden lightning damage, while every other qualifying enemy within 6 blocks is stunned for 2 seconds and surrounded by golden particles. The attacker remains completely unaffected by their own Gold Rush effects. No fire is ever created.
Inspect the existing Gold Rush counter, damage handling, configuration, and stun-related infrastructure.
Implement the sixth-hit effects while preserving removed abilities and existing item behavior.
Check the relevant Paper API details and project references, then report what could and could not be verified.
Implemented the Gold Rush upgrade in MidasListener.java, MidasMacePlugin.java, MidasCommand.java, and config.yml.
Sixth-hit damage: At
HIGHEST, the listener reads the smash’s current post-reduction final damage and adjusts the event’s raw damage untilgetFinalDamage()reaches the configured multiplier. The counter and activation still run only for uncancelled qualifying smashes; existing splash damage remains based on the pre-multiplier hit.Golden lightning: Uses Paper’s visual-only lightning effect, gold particles, and a configurable sound. A separate scheduled damage call targets only the original player and goes through normal damage events; no damaging lightning entity or fire-producing API is used.
Stun: Tracks affected entities by UUID, blocks stunned players’ movement, attacks, sprinting, item use, and inventory actions, and disables hostile mobs’ awareness. It restores mobs’ prior awareness and cleans up stun state on expiry, death, disconnect, chunk unload, or plugin shutdown.
Configuration: Added configurable multiplier, lightning, stun, and particle settings, with validation at startup and
/midasmace reload. Lightning fire is forced off.
I did not run live Paper 1.21.11 gameplay tests, so the requested runtime cases—and a successful build result—are not verified here.
📄
pasted-code-1793480774674.txt
txt
112 lines
▶
# Midas Mace — Final Item Tooltip Redesign
**Target:** Minecraft Paper 1.21.11
**Java:** 21
Update the existing Midas Mace item name and tooltip. This is a visual-only change. Do not modify any gameplay mechanics or abilities.
## 1. Item Name — Bold Gold Gradient
The item name must be:
**Midas Mace**
Style requirements:
- Use bold formatting.
- Use a rich, bright yellow-to-metallic-gold gradient.
- Start with a bold, vibrant rich yellow (`#FFFF35`).
- Gradually transition through golden yellow (`#FFD700`).
- Finish with rich metallic gold (`#D4AF37`).
- Make the gradient smooth across the individual characters.
- Keep the name visually bold, premium, and easy to read.
- Do not use plain yellow or a single flat gold color.
The gradient must apply to the actual item display name.
## 2. Exact Tooltip Layout
Remove `✦ ROYAL WEAPON ✦` completely.
The tooltip must follow this exact structure and wording:
```text
Midas Mace
Midas Curse
Strikes a enemy with the power of greed.
Gold Rush
Every 6 smashes unleashes gold storm.
Fortune
Mob kills grant 1–5 gold ingots.
GOLD RUSH PROGRESS
III / VI
3 of 6 smashes
```
## 3. Tooltip Styling
- **Midas Mace:** Bold rich yellow-to-gold gradient.
- **Midas Curse:** Bold gold text.
- **Description:** Smaller, muted gray text.
- **Gold Rush:** Bold gold text.
- **Description:** Smaller, muted gray text.
- **Fortune:** Bold gold text.
- **Description:** Smaller, muted gray text.
- **GOLD RUSH PROGRESS:** Bold uppercase gold text.
- **III / VI:** Prominent rich gold text.
- **3 of 6 smashes:** Smaller muted gray text.
Keep the tooltip clean, compact, and symmetrical.
## 4. Dynamic Progress
The Roman numeral and description must update automatically.
| Progress | Roman numeral | Description |
|---|---|---|
| 0/6 | 0 / VI | 0 of 6 smashes |
| 1/6 | I / VI | 1 of 6 smashes |
| 2/6 | II / VI | 2 of 6 smashes |
| 3/6 | III / VI | 3 of 6 smashes |
| 4/6 | IV / VI | 4 of 6 smashes |
| 5/6 | V / VI | 5 of 6 smashes |
At 6/6, Gold Rush activates and progress resets to 0/6.
## 5. Restrictions
- Completely remove the Royal Weapon subtitle.
- Do not add replacement subtitles.
- Do not add extra ability descriptions.
- Do not display Impact.
- Do not display the Unbreakable tooltip tag.
- Keep the mace genuinely unbreakable.
- Preserve the unique UUID and PDC data.
- Preserve all existing abilities and mechanics.
- Preserve normal inventory, hotbar, container, and dropping behavior.
- Do not change admin commands or GUI functionality.
## 6. Final Verification
Test on Paper 1.21.11 with Java 21.
Verify:
1. The item name is bold.
2. The name has a smooth rich yellow-to-gold gradient.
3. The Royal Weapon subtitle is completely gone.
4. Tooltip wording and spacing match the supplied example.
5. Gold Rush progress updates dynamically.
6. The mace remains unbreakable.
7. All existing gameplay mechanics still work.
8. The plugin builds successfully.
**Final goal:** A bold, rich yellow-to-gold gradient Midas Mace name with a clean, minimal gold-themed ability tooltip. No Royal Weapon subtitle and no unnecessary text.
Replace the mace tooltip with the requested wording and spacing, retaining configured ability thresholds and gold range.
Apply a bold three-stop yellow-to-gold gradient to the actual item name and show progress as Roman numerals.
Leave mechanics, unbreakable state, UUID, and PDC data unchanged.
Updated MidasItemFactory with the bold three-stop gradient name, requested tooltip wording and spacing, and Roman-numeral progress display. The mace remains unbreakable, and its UUID, PDC data, and gameplay mechanics are unchanged.
I haven’t run a Paper 1.21.11 build or in-game verification.
📄
pasted-code-1793510774618.txt
txt
65 lines
▶
# Midas Mace — Duration Adjustments
**Target:** Minecraft Paper 1.21.11
**Java:** 21
**Project:** Existing Midas Mace plugin
Update only the following two durations. Preserve all other mechanics, effects, damage values, visuals, and configurations.
## 1. Midas Curse — Utility Disable
Change the utility disable duration from **3 seconds to exactly 1 second**.
- Utility restrictions last 1 second after a successful qualifying mace smash.
- All configured blocked utility items remain unchanged.
- Shields must remain usable and must not be disabled.
- Slowness II lasts 1 second.
- Reduced jump height lasts 1 second.
- Existing particles and sounds remain unchanged.
- Restore normal utility usage and movement immediately after expiration.
## 2. Gold Rush — Stun Duration
Change the Golden Stun Shockwave duration from **2 seconds to exactly 1 second**.
- Keep the existing 6-block radius.
- Keep all existing enemy-targeting rules.
- Never stun the attacker.
- Players and qualifying hostile mobs remain stunned for 1 second.
- Golden particles surround affected enemies for the same 1-second duration.
- Restore movement, attacks, item usage, and mob AI immediately after expiration.
- Do not change the sixth-hit damage or lightning effects.
## 3. Configuration Updates
Update the defaults:
```yaml
midas-curse:
duration-ticks: 20
gold-rush:
stun:
duration-ticks: 20
particles:
duration-ticks: 20
```
20 ticks = exactly 1 second at normal Minecraft tick speed.
Make sure any existing configuration files are migrated or updated appropriately so old 3-second and 2-second values do not override the new defaults.
## 4. Testing
Verify:
1. Midas Curse utility disable lasts 1 second.
2. Slowness II lasts 1 second.
3. Reduced jump height lasts 1 second.
4. Gold Rush stun lasts 1 second.
5. Golden particles stop after 1 second.
6. Normal player movement and mob AI are restored.
7. No other abilities or mechanics have changed.
8. Plugin compiles successfully on Paper 1.21.11 with Java 21.
**Important:** Change durations only. Do not redesign, remove, or weaken any other Midas Mace functionality.
Locate both duration settings and the code that applies curse restrictions, stun, and particles.
Update only their defaults and runtime values, including migration so old saved values do not persist.
Check the changed paths for preserved targeting and restore behavior.
Updated the Midas Curse, stun, and stun-particle defaults to 20 ticks. Existing configs migrate the old 3-second curse default to 20 ticks and old 40-tick stun/particle defaults to 20; other saved duration values are retained. The old curse seconds setting is converted to ticks and removed.
No Paper server was available for in-game verification.
Midas Mace — Midas Curse Slowness Update
Update only the Slowness effect applied by Midas Curse.
- Change Slowness II to Slowness III.
- Set the duration to exactly 2 seconds (40 ticks).
- Apply it only when Midas Curse successfully activates against another player.
- Keep the 1-second utility disable duration unchanged.
- Keep the reduced jump duration at 1 second.
- Do not change Gold Rush's 1-second stun.
- Preserve all existing particles, sounds, damage, and other abilities.
Important: Verify the correct Bukkit/Paper potion amplifier. Slowness III corresponds to amplifier 2 because potion amplifiers are zero-indexed.
Test on Paper 1.21.11 with Java 21 and confirm the plugin compiles successfully.
Separate the Slowness duration from the 1-second Curse lockout and set its default to 40 ticks.
Set the default Slowness level to III (amplifier 2) and migrate saved default-level configs from II to III.
Leave Gold Rush and all other effects unchanged.
Updated Midas Curse Slowness to 40 ticks at level III (amplifier 2). Its duration is independent of the 20-tick utility disable, so the Curse lockout and reduced-jump duration remain 1 second. Existing configs with the old level-II setting migrate to level III; Gold Rush is unchanged.
I can’t confirm a Paper 1.21.11 in-game test or successful compilation from the available results.
package com.cinder.midasmace;
import java.util.Map;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
public final class MidasMacePlugin extends JavaPlugin {
private MidasItemFactory itemFactory;
private MidasListener listener;
private AdminGui adminGui;
@Override
public void onEnable() {
saveDefaultConfig();
validateGoldRushConfig();
itemFactory = new MidasItemFactory(this);
adminGui = new AdminGui(this);
listener = new MidasListener(this, itemFactory);
Bukkit.getPluginManager().registerEvents(listener, this);
MidasCommand command = new MidasCommand(this);
getCommand("midasmace").setExecutor(command);
getCommand("midasmace").setTabCompleter(command);
listener.startTasks();
}
@Override
public void onDisable() {
if (listener != null) {
listener.shutdown();
}
}
public MidasItemFactory getItemFactory() {
return itemFactory;
}
public AdminGui getAdminGui() {
return adminGui;
}
public void validateGoldRushConfig() {
migrateDurationConfig();
validateBoolean("abilities.gold-rush.enabled", true);
validateInt("abilities.gold-rush.required-smashes", 6, 1, 1000);
validateDouble("abilities.gold-rush.radius", 6.0, 0.0, 64.0);
validateDouble("abilities.gold-rush.damage-percentage", 0.50, 0.0, 10.0);
validateBoolean("abilities.gold-rush.sixth-hit.enabled", true);
validateDouble("abilities.gold-rush.sixth-hit.damage-multiplier", 2.0, 1.0, 10.0);
validateBoolean("abilities.gold-rush.lightning.enabled", true);
validateDouble("abilities.gold-rush.lightning.bonus-damage", 8.0, 0.0, 2048.0);
getConfig().set("abilities.gold-rush.lightning.fire", false);
validateBoolean("abilities.gold-rush.stun.enabled", true);
validateDouble("abilities.gold-rush.stun.radius", 6.0, 0.0, 64.0);
validateInt("abilities.gold-rush.stun.duration-ticks", 20, 1, 12000);
validateBoolean("abilities.gold-rush.stun.affect-players", true);
validateBoolean("abilities.gold-rush.stun.affect-hostile-mobs", true);
validateBoolean("abilities.gold-rush.particles.enabled", true);
validateBoolean("abilities.gold-rush.particles.follow-stunned-entities", true);
validateInt("abilities.gold-rush.particles.duration-ticks", 20, 0, 12000);
}
private void migrateDurationConfig() {
boolean changed = false;
String curseTicksPath = "abilities.midas-curse.duration-ticks";
String oldCurseSecondsPath = "abilities.midas-curse.duration-seconds";
if (getConfig().isSet(oldCurseSecondsPath)) {
if (!getConfig().isSet(curseTicksPath)) {
double oldDurationSeconds = getConfig().getDouble(oldCurseSecondsPath, 3.0);
int durationTicks = oldDurationSeconds == 3.0
? 20 : Math.max(1, (int) Math.round(oldDurationSeconds * 20.0));
getConfig().set(curseTicksPath, durationTicks);
}
getConfig().set(oldCurseSecondsPath, null);
changed = true;
}
String slownessLevelPath = "abilities.midas-curse.slowness-level";
if (getConfig().isSet(slownessLevelPath) && getConfig().getInt(slownessLevelPath) == 2) {
getConfig().set(slownessLevelPath, 3);
changed = true;
}
String slownessDurationPath = "abilities.midas-curse.slowness-duration-ticks";
if (!getConfig().isSet(slownessDurationPath)) {
getConfig().set(slownessDurationPath, 40);
changed = true;
}
changed |= migrateOldDuration("abilities.gold-rush.stun.duration-ticks", 40, 20);
changed |= migrateOldDuration("abilities.gold-rush.particles.duration-ticks", 40, 20);
if (changed) saveConfig();
}
private boolean migrateOldDuration(String path, int oldDefault, int newDefault) {
if (!getConfig().isSet(path) || getConfig().getInt(path, newDefault) != oldDefault) return false;
getConfig().set(path, newDefault);
return true;
}
private void validateBoolean(String path, boolean fallback) {
if (!getConfig().isBoolean(path)) getConfig().set(path, fallback);
}
private void validateInt(String path, int fallback, int minimum, int maximum) {
int value = getConfig().getInt(path, fallback);
if (value < minimum || value > maximum) value = fallback;
getConfig().set(path, value);
}
private void validateDouble(String path, double fallback, double minimum, double maximum) {
double value = getConfig().getDouble(path, fallback);
if (!Double.isFinite(value) || value < minimum || value > maximum) value = fallback;
getConfig().set(path, value);
}
public void giveMace(Player player) {
ItemStack mace = itemFactory.createMace();
Map<Integer, ItemStack> leftovers = player.getInventory().addItem(mace);
leftovers.values().forEach(item -> player.getWorld().dropItemNaturally(player.getLocation(), item));
}
public int removeMaces(Player player) {
int removed = 0;
ItemStack[] contents = player.getInventory().getContents();
for (int slot = 0; slot < contents.length; slot++) {
ItemStack item = player.getInventory().getItem(slot);
if (itemFactory.isMidas(item)) {
removed += item.getAmount();
player.getInventory().setItem(slot, null);
}
}
ItemStack[] armor = player.getInventory().getArmorContents();
for (int slot = 0; slot < armor.length; slot++) {
if (itemFactory.isMidas(armor[slot])) {
removed += armor[slot].getAmount();
armor[slot] = null;
}
}
player.getInventory().setArmorContents(armor);
ItemStack offhand = player.getInventory().getItemInOffHand();
if (itemFactory.isMidas(offhand)) {
removed += offhand.getAmount();
player.getInventory().setItemInOffHand(null);
}
return removed;
}
}