white444dk01__62486
📎 1 file 17,741 chars
📄
pasted-code-1791612687671.txt
txt 953 lines
▶
Create a complete, production-ready Minecraft Paper plugin named **CROWNBREAKER**.

## SERVER / VERSION

The plugin must support:

- Paper Minecraft **1.21.1**
- Paper Minecraft **1.21.11**
- Java Edition
- No resource pack required
- No custom 3D model required

The plugin must compile and work without missing classes, methods, dependencies, or pseudocode.

---

# 1. CROWNBREAKER WEAPON

The weapon must use the **normal vanilla Minecraft Mace** as its base item.

Do NOT make a custom weapon model.

Do NOT make a custom texture.

Do NOT require a resource pack.

The item must be:

- Base material: `MACE`
- Display name: **CROWNBREAKER**
- Display-name color: **orange/gold**
- Damage: **10**
- Unbreakable: **true**
- Damage must NOT be displayed in the lore.
- Unbreakable must NOT be displayed in the lore.
- Use PersistentDataContainer (PDC) to identify the item as CROWNBREAKER.
- A normal vanilla Mace must NOT be recognized as CROWNBREAKER.
- The CROWNBREAKER must keep the normal upright vanilla Mace appearance when held.

The item must remain the exact same CROWNBREAKER when moved between inventories and players.

---

# 2. CROWNBREAKER HEAD

The crafting recipe must NOT directly create CROWNBREAKER.

It creates a special item:

**CROWNBREAKER HEAD**

Use a unique PDC value to identify the head.

The exact crafting recipe is:

```text
E E E
T M T
T _ T
```

Where:

- `E` = Echo Shard
- `T` = Totem of Undying
- `M` = Mace
- `_` = EMPTY

Therefore:

```text
Echo Shard | Echo Shard | Echo Shard
Totem      | Mace       | Totem
Totem      | EMPTY      | Totem
```

This recipe is extremely important and must be implemented exactly.

## Recipe restrictions

The recipe:

- Works ONLY in a normal Crafting Table.
- MUST NOT work in a Crafter.
- Must NOT be obtainable through a Crafter.
- Must NOT be duplicated through shift-click.
- Must NOT be duplicated through recipe-book behavior.
- Must NOT be duplicated by repeated inventory clicks.
- Must be craftable only once on the entire server.

After the CROWNBREAKER HEAD has been successfully crafted once:

**It can NEVER be crafted again.**

Save this state permanently so it survives:

- Server restart
- Server reload
- Plugin reload
- Player logout/login

Do not provide any command that can create another CROWNBREAKER HEAD unless explicitly configured as an admin testing command, and normal players must never have access to such a command.

---

# 3. PLACEMENT OF CROWNBREAKER HEAD

The CROWNBREAKER HEAD is used to start the awakening ritual.

When the player places the CROWNBREAKER HEAD anywhere:

1. Remove/consume the CROWNBREAKER HEAD.
2. Start the ritual at that exact location.
3. Save the world.
4. Save X, Y, Z.
5. Save the UUID of the player who placed it.
6. Save the player's name.
7. That player becomes the original CROWNBREAKER owner.
8. The ritual must be persistent.

The CROWNBREAKER HEAD must never be returned after successful placement.

Only one ritual can ever exist.

---

# 4. RITUAL START ANNOUNCEMENT

When the ritual starts, broadcast to all online players:

```text
⚡ CROWNBREAKER RITUAL HAS STARTED ⚡
Crafted by: 
Location: X:  Y:  Z: 
```

The ritual duration must be:

**45 seconds**

The timer must be persistent.

If the server restarts during the ritual:

- Do NOT start a new ritual.
- Do NOT create another CROWNBREAKER HEAD.
- Do NOT reset the ritual.
- Resume the existing ritual from its saved progress.

---

# 5. RITUAL VISUAL EFFECT

The ritual must look like a powerful dark/red energy awakening ritual.

It must be animated.

It must NOT simply be a static circle of particles.

The effect should contain:

- Large dark/black central area
- Bright red energy ring
- Rotating red energy
- Moving red energy
- Pulsing energy
- Dark particles
- Red particles
- Energy bursts
- Increasing intensity
- Strong final explosion/pulse

The animation should feel similar to the supplied reference/video.

## 0–15 seconds

Create:

- Dark central energy area
- Smaller red ring
- Slow rotation
- Slow-moving particles
- Low/medium intensity
- Small energy pulses

## 15–30 seconds

Increase intensity:

- Larger red ring
- Faster rotation
- More red particles
- More dark particles
- Flowing energy
- Stronger center pulses
- Occasional energy bursts

## 30–44 seconds

Maximum build-up:

- Large black/red energy area
- Very fast rotating energy
- High particle density
- Strong center pulses
- Frequent energy bursts
- Strong red energy movement

## 44–45 seconds

Final stage:

- Maximum intensity
- Large black/red burst
- Strong center pulse
- Powerful completion sound
- Final energy explosion

After completion:

- Stop all ritual particles.
- Stop all ritual sounds/tasks.
- Clean up all temporary ritual effects.

---

# 6. RITUAL COMPLETION

After exactly 45 seconds:

1. Stop the ritual.
2. Create exactly ONE CROWNBREAKER.
3. Give that CROWNBREAKER to the original ritual owner.
4. Mark the weapon as the unique server CROWNBREAKER.
5. Save the state permanently.
6. Never create another CROWNBREAKER.

Broadcast:

```text
⚡ CROWNBREAKER RITUAL COMPLETE ⚡
CROWNBREAKER has been awakened by: 
Location: X:  Y:  Z: 
```

If the player's inventory is full, handle the item safely without creating duplicates.

The plugin must never create a second CROWNBREAKER because of a full inventory.

---

# 7. ABSOLUTE ONE-CROWNBREAKER RULE

THIS IS THE MOST IMPORTANT RULE.

There must be **ONLY ONE CROWNBREAKER WEAPON EVER CREATED ON THE ENTIRE SERVER.**

Not one per player.

Not one per world.

Not one per ritual.

Not one per restart.

Not one per server reload.

There is exactly ONE possible CROWNBREAKER.

Use a persistent server-wide state such as:

```text
CROWNBREAKER_CREATED = true
```

Once the CROWNBREAKER is created:

**NEVER CREATE ANOTHER ONE.**

There must be NO replacement system.

If the original CROWNBREAKER is:

- Dropped
- Lost
- Destroyed
- Burned
- Thrown into lava
- Deleted
- Removed
- Lost after death
- Removed from an inventory
- Permanently destroyed
- Somehow disappears

DO NOT CREATE A REPLACEMENT.

The server may have:

**0 CROWNBREAKERS** if the original is permanently lost.

OR

**1 CROWNBREAKER** if it still exists.

It must NEVER have:

**2+ CROWNBREAKERS.**

---

# 8. DUPLICATION PROTECTION

The plugin must prevent every possible plugin-side duplication path.

Protect against:

- Repeated crafting
- Crafter crafting
- Shift-click crafting
- Recipe-book duplication
- Inventory click duplication
- Double-click duplication
- Repeated ritual completion
- Ritual completion after restart
- Plugin reload
- Server reload
- Server restart
- Reconnect during ritual
- Multiple event firing
- Multiple interaction events
- Death/drop duplication
- Pickup duplication
- Full-inventory duplication
- Async/race-condition duplication
- Multiple players triggering the same ritual
- Multiple completion tasks
- Duplicate scheduled tasks

Before creating CROWNBREAKER, always verify the persistent global state.

If:

```text
CROWNBREAKER_CREATED = true
```

the plugin must refuse to create another CROWNBREAKER.

No exception.

---

# 9. ORIGINAL OWNER PICKUP PROTECTION

Immediately after ritual completion, the newly created CROWNBREAKER must have the state:

```text
FRESH_RITUAL_REWARD
```

Only the original ritual owner can pick up this fresh reward.

If another player attempts to pick it up:

- Cancel the pickup.
- Do NOT delete the weapon.
- Do NOT duplicate the weapon.
- Do NOT transfer it.
- Leave the exact same item where it is.

The original owner can pick it up normally.

---

# 10. PUBLIC DROP RULE

The moment the CROWNBREAKER is dropped by ANY player, it becomes public.

This includes:

- Manual item drop
- Death drop

Change its state permanently to:

```text
PUBLIC_DROPPED_WEAPON
```

After that:

**ANY PLAYER CAN PICK IT UP.**

This includes:

- Original owner
- Other players
- Players who were never involved in the ritual

There are no ownership restrictions after the first drop.

The same original CROWNBREAKER must be transferred.

Do NOT create a new CROWNBREAKER when:

- Another player picks it up.
- Another player drops it.
- Another player dies with it.
- Ownership changes.

Once public, it remains public permanently.

---

# 11. CROWNBREAKER LORE

The weapon should display:

```text
⚡ ABILITIES

☁ Sky Launcher
Launches the wielder upward
Cooldown: 10s

💧 Water Dash
Dash forward
Cooldown: 5s

⚡ Ultimate Strike
Requires 25 Souls
Shift + Left Click

Souls: 0/25
```

The Souls number must update dynamically.

Example:

```text
Souls: 12/25
```

Do NOT show:

- Damage 10
- Unbreakable

in the lore.

---

# 12. SKY LAUNCHER

Ability name:

**Sky Launcher**

Trigger:

**RIGHT CLICK**

Requirements:

- Player must hold CROWNBREAKER in the main hand.
- Ability must not be on cooldown.

Effect:

- Launch the wielder upward.
- Approximate launch height: **30 blocks**.
- Launch the player using velocity/appropriate physics.
- Do NOT launch an enemy.
- Do NOT damage the wielder.

Cooldown:

**10 seconds**

Visual:

- Cloud particles

Sound:

- Firework-launch sound

Sky Launcher must not activate Water Dash or Ultimate Strike at the same time.

---

# 13. WATER DASH

Ability name:

**Water Dash**

Trigger:

**NORMAL LEFT CLICK**

Requirements:

- Player holds CROWNBREAKER in the main hand.
- Player is NOT sneaking.
- Ability is not on cooldown.

Effect:

- Dash the wielder forward.
- Strength: **2.4**

Cooldown:

**5 seconds**

Visual:

- Splash/water particles

Sound:

- Dolphin splash sound

A normal left click must NOT activate Ultimate Strike.

---

# 14. SOUL SYSTEM

CROWNBREAKER has a Soul system.

Maximum:

**25 Souls**

Every successful hit using CROWNBREAKER gives:

**+1 Soul**

Make Soul gain configurable in `config.yml`.

Souls must be stored separately for each player.

Soul data must survive:

- Logout
- Login
- Server restart
- Server reload

When the player reaches:

**25/25 Souls**

announce:

```text
⚡ ULTIMATE STRIKE READY ⚡
```

Only announce this once when Souls reach 25.

Do NOT spam the announcement every tick.

Do NOT repeatedly announce it while the player remains at 25/25.

---

# 15. ULTIMATE STRIKE

Ability name:

**Ultimate Strike**

Trigger:

**SHIFT + LEFT CLICK**

Requirements:

- Player holds CROWNBREAKER in the main hand.
- Player is sneaking.
- Player has 25/25 Souls.
- A valid target is available within 20 blocks.

Priority system:

### Priority 1
Shift + Left Click + 25 Souls:

**Ultimate Strike**

### Priority 2
Shift + Left Click + less than 25 Souls:

**Do nothing.**

Do NOT activate Water Dash.

### Priority 3
Normal Left Click + not sneaking:

**Water Dash**

### Priority 4
Right Click:

**Sky Launcher**

One click must never activate multiple abilities.

---

# 16. ULTIMATE TARGET SYSTEM

Ultimate Strike must target the closest valid living entity directly in the player's line of sight.

Maximum range:

**20 blocks**

Valid targets:

- Players
- Hostile mobs
- Passive mobs
- Other living entities

Exclude:

- Caster
- Dropped items
- Armor stands
- Projectiles
- Particles
- Non-living entities

The target must actually be in front of the player's view.

Select the closest valid living entity in the player's line of sight.

If there is no valid target within 20 blocks:

- Do NOT activate Ultimate Strike.
- Do NOT consume Souls.
- Do NOT reset Souls.
- Do NOT spawn the falling Mace.
- Keep Souls at 25/25.

---

# 17. ULTIMATE FALLING MACE EFFECT

After a successful Ultimate Strike:

Create a separate **visual copy of the normal vanilla Mace** approximately:

**15 blocks above the selected target.**

The visual Mace must:

- Fall vertically toward the target.
- Look like the normal vanilla Mace.
- Be purely visual.
- Not be collectible.
- Not become an inventory item.
- Not be a real CROWNBREAKER.
- Not affect the one-CROWNBREAKER count.
- Not create another weapon.

When the visual Mace reaches the target:

- Create a powerful impact effect.
- Create suitable particles.
- Play a strong impact sound.
- Apply configurable Ultimate damage to the selected target.

Default target behavior:

**Single target only.**

No AoE unless explicitly configured.

Respect normal Minecraft damage/protection mechanics.

Do not bypass normal death-protection mechanics.

After a successful Ultimate Strike:

```text
Souls: 0/25
```

Broadcast:

```text
☠ SOUL REAPER IS READY ☠
```

The actual CROWNBREAKER in the player's inventory/hand must remain untouched.

---

# 18. CROWNBREAKER MUST NEVER BE CONSUMED

Using abilities must NEVER:

- Consume CROWNBREAKER.
- Remove CROWNBREAKER.
- Replace CROWNBREAKER.
- Turn it into a normal Mace.
- Spawn another CROWNBREAKER.
- Duplicate CROWNBREAKER.
- Create a replacement.

The exact same unique CROWNBREAKER item must remain the only CROWNBREAKER.

---

# 19. CONFIG.YML

Create a clean configurable `config.yml`.

Include settings for:

```yaml
weapon:
  damage: 10
  unbreakable: true

souls:
  max: 25
  gain-per-hit: 1

sky-launcher:
  cooldown: 10
  strength: 30.0

water-dash:
  cooldown: 5
  strength: 2.4

ultimate:
  required-souls: 25
  range: 20.0
  damage: 

ritual:
  duration: 45

messages:
  ritual-start: ...
  ritual-complete: ...
  ultimate-ready: ...
  soul-reaper: ...
```

Also make ritual particle intensity and sounds configurable where practical.

The one-only CROWNBREAKER rule must NOT be configurable.

It must always be enabled.

---

# 20. PERSISTENT DATA

The plugin must persist all important information.

Save:

- CROWNBREAKER HEAD crafted state
- CROWNBREAKER created state
- Active ritual state
- Ritual world
- Ritual X/Y/Z
- Ritual owner UUID
- Ritual owner name
- Ritual progress
- Player Souls
- CROWNBREAKER PDC
- Fresh reward state
- Public dropped state

Data must survive:

- Server restart
- Server reload
- Plugin reload
- Player reconnect

---

# 21. RITUAL RESTART SAFETY

If the server stops during the 45-second ritual:

- Save the current ritual progress.
- On startup, detect the active ritual.
- Resume the same ritual.
- Do not create a new CROWNBREAKER HEAD.
- Do not start another ritual.
- Do not complete it twice.

If the ritual has already completed and CROWNBREAKER was created:

```text
CROWNBREAKER_CREATED = true
```

No further completion is allowed.

---

# 22. ITEM IDENTIFICATION

Use PDC keys to uniquely identify:

```text
CROWNBREAKER_HEAD
CROWNBREAKER
FRESH_RITUAL_REWARD
PUBLIC_DROPPED_WEAPON
```

Do not rely only on:

- Item name
- Lore
- Material

A normal vanilla Mace must never accidentally become CROWNBREAKER.

---

# 23. COMMANDS

Create useful admin commands if needed, but normal players must not be able to use them to create duplicate weapons.

For example:

```text
/crownbreaker reload
/crownbreaker status
```

Optional debug commands may exist for testing, but they must be permission-protected.

Do NOT create a normal player command such as:

```text
/crownbreaker give
```

that can generate another CROWNBREAKER.

The one-only rule must still be enforced even for plugin commands unless an explicitly documented developer/debug override is used.

---

# 24. EVENT HANDLING

Properly handle:

- PlayerInteractEvent
- EntityDamageByEntityEvent
- PlayerDropItemEvent
- EntityPickupItemEvent
- PlayerDeathEvent
- InventoryClickEvent
- PrepareItemCraftEvent
- CraftItemEvent
- InventoryOpenEvent if necessary
- BlockPlaceEvent
- PlayerQuitEvent
- PlayerJoinEvent
- Server/plugin enable/disable

Prevent event conflicts and duplicate ability activation.

Cancel or handle the appropriate events so one action cannot trigger multiple abilities.

---

# 25. PERFORMANCE

The ritual and abilities must be optimized.

Do not create unnecessary infinite tasks.

Cancel scheduled tasks correctly.

Clean up all tasks when:

- Ritual completes
- Ritual is cancelled
- Plugin disables
- Server shuts down

Do not cause severe server lag.

Avoid scanning every entity on the entire server unnecessarily.

Ultimate target detection should only search the required area and line of sight.

---

# 26. FINAL ABSOLUTE RULE

The plugin must enforce this rule above everything else:

## THERE CAN ONLY EVER BE ONE CROWNBREAKER ON THE ENTIRE SERVER.

The CROWNBREAKER HEAD is crafted once.

The ritual happens once.

The CROWNBREAKER is created once.

After that:

**NO REPLACEMENT.**

If it is lost:

**NO NEW CROWNBREAKER.**

If it is destroyed:

**NO NEW CROWNBREAKER.**

If the owner dies:

**NO NEW CROWNBREAKER.**

If another player picks it up:

**SAME CROWNBREAKER.**

If another player drops it:

**SAME CROWNBREAKER.**

If the server restarts:

**SAME CROWNBREAKER / OR ZERO IF IT WAS ALREADY LOST.**

Never create CROWNBREAKER #2.

The plugin must guarantee that the number of CROWNBREAKER weapons can never exceed **1**.
Kodari AI
KodariOct 10 at 6:28 am 4
CrownbreakerRitual
Implements a unique one-time Mace weapon with a persistent crafting ritual. Players craft a special head via an exact recipe, then place it to start a 45-second animated dark/red energy ritual that creates the sole CROWNBREAKER. The weapon features Sky Launcher, Water Dash, and a Soul-powered Ultimate Strike. Enforces strict one-weapon-per-server rules with persistent state, duplication protection, and ownership pickup mechanics.
  1. Create the Paper 1.21.1/1.21.11 project scaffold and configuration.

  2. Implement persistent one-time crafting, ritual state/animation, and guarded reward delivery.

  3. Add soul tracking, abilities, pickup/drop rules, and admin status/reload commands.

Created the CROWNBREAKER Paper plugin project with a one-time crafting recipe, persistent 45-second ritual, PDC-identified mace, saved souls, abilities, and admin-only /crownbreaker status and /crownbreaker reload commands. The weapon-created state is permanent; there is no replacement or give command.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
12 1,387
src/main/java/com/kodari/crownbreaker/CrownBreakerPlugin.java
package com.kodari.crownbreaker;

import org.bukkit.Bukkit;
import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.Objects;

public final class CrownBreakerPlugin extends JavaPlugin {
    private PluginState state;
    private CrownItems items;
    private RitualManager ritualManager;
    private AbilityManager abilityManager;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        state = new PluginState(this);
        items = new CrownItems(this);
        ritualManager = new RitualManager(this, state, items);
        abilityManager = new AbilityManager(this, state, items);
        RecipeManager recipeManager = new RecipeManager(this, state, items);

        recipeManager.registerIfAvailable();
        Bukkit.getPluginManager().registerEvents(
                new CrownBreakerListener(this, state, items, ritualManager, abilityManager, recipeManager), this);

        PluginCommand command = Objects.requireNonNull(getCommand("crownbreaker"));
        CrownBreakerCommand executor = new CrownBreakerCommand(this, state);
        command.setExecutor(executor);
        command.setTabCompleter(executor);
        ritualManager.resume();
    }

    @Override
    public void onDisable() {
        if (abilityManager != null) {
            abilityManager.shutdown();
        }
        if (ritualManager != null) {
            ritualManager.shutdown();
        }
        if (state != null) {
            state.save();
        }
    }
}