karexayush
📎 1 file 61,166 chars
📄
pasted-code-1788663623724.txt
txt 3947 lines
▶
# MACE EVENT PLUGIN

## COMPLETE DEVELOPMENT SPECIFICATION

### Minecraft Java Edition 1.21.11

---

# 1. PROJECT OVERVIEW

Create a completely new Minecraft server plugin for a Lifesteal SMP running on Minecraft Java Edition 1.21.11.

This plugin is a custom Mace Event system.

The plugin must be written from scratch.

Do NOT reuse the broken logic of any previous implementation.

The primary goal is to create a reliable, exploit-resistant, duplication-proof Mace Event.

The plugin must correctly handle:

* Mace crafting
* Single-Mace ownership
* 15-minute event
* Player highlighting
* Real-time coordinates
* Mace transfer after PvP kills
* Full-inventory handling
* Death handling
* Respawn handling
* Disconnect/reconnect handling
* Server restart handling
* Chest protection
* Barrel protection
* Ender Chest protection
* Hopper protection
* Item duplication prevention
* Mace destruction prevention
* Enchantment restrictions
* BossBar countdown
* Action-bar coordinate display
* Craft announcement
* Sound effects
* Center-screen title
* Final event announcement

The implementation must prioritize correctness over simplicity.

---

# 2. TARGET VERSION

Target Minecraft version:

Minecraft Java Edition 1.21.11

The plugin must be compiled and tested specifically for 1.21.11.

Do not write the implementation for 1.20.x, 1.21.1, 1.21.4, 1.21.5 or another version and assume compatibility.

Use APIs and item/enchantment handling compatible with 1.21.11.

The plugin should be designed for Paper if Paper is the target server platform.

Avoid deprecated APIs wherever a modern 1.21.11 API exists.

---

# 3. CORE EVENT RULE

There can only be ONE legitimate Mace associated with the event.

The server must never create a second event Mace.

The plugin must maintain persistent state describing:

* Whether the event has been started
* Which Mace is the event Mace
* Current Mace holder
* Event start time
* Event end time
* Whether the event is active

The system must NOT simply trust the player's inventory.

Inventory contents can be manipulated.

Therefore the plugin must maintain its own authoritative event state.

---

# 4. FIRST MACE CRAFT

The event begins when a player successfully crafts the first valid Mace.

Example:

Player A crafts the Mace.

Immediately after successful crafting:

1. Event starts.
2. Player A becomes the current Mace holder.
3. Player A receives the holder highlighting effect.
4. Player A's coordinates begin displaying to all relevant players.
5. The 15-minute timer starts.
6. The BossBar appears.
7. The global sound plays.
8. The center-screen popup appears.
9. A chat announcement appears.

All of these actions must happen immediately.

There must not be a delay between crafting and event activation.

---

# 5. ONLY ONE EVENT

Once the first event has started, no second Mace event may be started through normal Mace crafting.

The plugin must prevent a second event Mace from being created.

If another player attempts to craft a Mace while the event is active:

The plugin must prevent the event Mace from being duplicated.

The exact behavior should be:

* Cancel the crafting result if it would create another event Mace.
* Do not allow the player to obtain another Mace.
* Optionally send a configurable message explaining that the event Mace already exists.

The important requirement is:

NEVER create a second event Mace.

---

# 6. EVENT DURATION

The event duration is exactly:

15 minutes

That equals:

900 seconds.

The timer must start at the exact moment the first Mace is successfully crafted.

The event must remain active for those 900 seconds.

The timer must be based on actual timestamps rather than repeatedly subtracting seconds from an integer.

Use:

eventEndTime - currentTime

for calculating remaining time.

This prevents timer drift.

---

# 7. EVENT COUNTDOWN

The event countdown must display:

15:00

immediately after activation.

Then:

14:59

14:58

14:57

and so on.

The countdown must reach:

00:01

and then:

00:00

The event must end immediately when the configured 15-minute duration expires.

Do not allow the event to continue for an additional few seconds because of scheduler delay.

The timestamp must be authoritative.

---

# 8. BOSSBAR

Immediately after Mace crafting, create a BossBar.

The BossBar must be visible to all online players.

The BossBar title must display the remaining event time.

Example:

Event Time Left: 14:59

Then:

Event Time Left: 14:58

Then:

Event Time Left: 14:57

etc.

The BossBar progress must decrease continuously according to the remaining event duration.

At event start:

100% progress.

At event end:

0% progress.

Do not calculate BossBar progress by simply subtracting a fixed amount every second.

Calculate it from:

remainingTime / totalEventDuration

This prevents drift.

---

# 9. BOSSBAR STYLE

Use a clear BossBar style.

Recommended:

Progress bar with segmented or solid style.

The BossBar must be visually readable.

The timer must remain clearly visible.

The BossBar must not continue existing after the event ends.

When the event ends:

REMOVE the BossBar from every player.

Do not merely hide it temporarily.

Completely remove it.

---

# 10. REAL-TIME COORDINATES

While the event is active, all online players must be able to see the current Mace holder's coordinates.

Display them in the Action Bar.

Position:

Above the hotbar.

Example:

Mace Location: X: 125 Y: 64 Z: -328

The coordinates must update in real time.

The displayed coordinates must always belong to the CURRENT Mace holder.

Do not keep displaying the original crafter's coordinates after the Mace transfers.

---

# 11. COORDINATE UPDATE

Suppose:

Player A crafts the Mace.

The Action Bar shows:

Mace Location: X: 100 Y: 65 Z: 200

Player A moves.

The coordinates must update.

For example:

Mace Location: X: 103 Y: 65 Z: 204

The system should update frequently enough that the coordinates feel real-time.

A practical update interval may be approximately every tick or a few ticks.

Avoid unnecessary expensive operations.

---

# 12. MACE HOLDER HIGHLIGHT

The current Mace holder must receive a visual highlighting effect.

Use Minecraft's Glowing status effect.

However, do NOT give it a long arbitrary duration such as several minutes.

Instead:

Give the holder Glowing with approximately 1 second duration.

Refresh the effect continuously while the event is active.

This creates the equivalent of an infinite effect while still allowing precise control.

The conceptual behavior is:

Glowing 1 second

refresh

Glowing 1 second

refresh

Glowing 1 second

refresh

and so on.

---

# 13. IMPORTANT HIGHLIGHT REQUIREMENT

The holder's Glowing effect must NOT continue after the event ends.

When the event ends:

Immediately remove the Glowing effect from the current holder.

The plugin must also clear any previous holder's Glowing effect if the holder changes.

---

# 14. HOLDER TRANSFER

This is one of the most important parts of the plugin.

Suppose:

Player A crafts the Mace.

Player A becomes the holder.

Player A is glowing.

Player A's coordinates are displayed.

Player B kills Player A.

Immediately:

Player A stops being the holder.

Player A loses the Glowing effect.

Player B becomes the new Mace holder.

Player B receives the Glowing effect.

The coordinates displayed in the Action Bar immediately switch from Player A to Player B.

The event timer DOES NOT RESET.

The original event end time remains unchanged.

---

# 15. EXAMPLE OF TRANSFER

Event starts:

15:00

Player A is holder.

After 5 minutes:

10:00 remains.

Player B kills Player A.

Player B becomes holder.

The timer remains:

10:00

NOT:

15:00

The event duration is based on the original craft time.

Every transfer uses the same original event end time.

---

# 16. MULTIPLE TRANSFERS

The system must support unlimited PvP transfers during the remaining event time.

Example:

A crafts Mace.

B kills A.

C kills B.

D kills C.

E kills D.

F kills E.

The Mace holder changes every time.

The event timer continues normally.

The coordinates always point to the latest holder.

The Glowing effect always belongs only to the latest holder.

---

# 17. MACE MUST NOT DROP DURING EVENT

During the 15-minute event, the Mace must never become a normal dropped item.

When the current holder dies:

DO NOT drop the event Mace on the ground.

Instead, transfer it directly to the killer.

Example:

Player A dies to Player B.

The event Mace is immediately transferred to Player B.

There must be no intermediate ground item.

This is important for preventing:

* theft
* item disappearance
* item duplication
* lava destruction
* fire destruction
* despawning
* accidental pickup by another player

---

# 18. KILLER DETECTION

The plugin must identify the actual player responsible for killing the current holder.

If Player B kills Player A through legitimate PvP:

Player B becomes the new holder.

Do not transfer the Mace to a random nearby player.

Do not transfer the Mace to the first player who picks something up.

Use the actual death/killer information.

The plugin should properly handle Bukkit/Paper death events.

---

# 19. FULL INVENTORY HANDLING

This is extremely important.

Suppose Player B kills Player A.

Player B's inventory is completely full.

The Mace must STILL be transferred to Player B.

Do NOT drop the Mace on the ground simply because the inventory is full.

Instead:

Find an appropriate occupied inventory slot.

Remove the existing item from that slot.

That removed item is dropped normally according to the configured behavior.

Then place the event Mace into that freed slot.

Example:

Player B has:

36/36 inventory slots occupied.

The plugin selects one valid player inventory slot.

The item currently occupying that slot is dropped.

The Mace is placed into that slot.

Player B becomes the holder.

---

# 20. FULL INVENTORY SAFETY

The plugin must never silently delete the displaced item.

If an item is removed from the inventory to make room for the Mace:

That item must be dropped safely into the world.

The dropped item should appear near Player B.

The item must not be duplicated.

The item must not be deleted without a reason.

The event Mace must occupy the freed slot.

---

# 21. CHOOSING THE SLOT

Implement a deterministic and safe method for selecting the inventory slot.

Prefer a normal player inventory slot.

Do not overwrite:

* armor slots
* offhand slot

unless explicitly required.

Do not silently destroy equipment.

The plugin should select a normal storage/hotbar slot.

If every normal storage slot is full:

Select one valid storage slot according to a deterministic strategy.

Drop that existing item.

Insert the Mace.

---

# 22. OFFHAND

During the event, the Mace must not be moved into the offhand in a way that bypasses restrictions.

The plugin must monitor inventory movement.

The event Mace must remain associated with the current holder.

If necessary, allow the player to hold it in normal hand/offhand only if the implementation safely maintains ownership.

The important requirement is that the Mace cannot be stored externally.

---

# 23. CHEST RESTRICTION

During the event:

The Mace cannot be placed inside a Chest.

If a player attempts to move the event Mace into a Chest:

Cancel the inventory action.

The Mace must remain with the holder.

---

# 24. BARREL RESTRICTION

During the event:

The Mace cannot be placed inside a Barrel.

Cancel attempts to insert the event Mace.

---

# 25. ENDER CHEST RESTRICTION

During the event:

The Mace cannot be placed inside an Ender Chest.

This must be explicitly protected.

The player must not be able to bypass the restriction through shift-clicking.

---

# 26. HOPPER RESTRICTION

During the event:

The Mace must not be inserted into a Hopper.

Cancel attempts to transfer it.

---

# 27. DISPENSER / DROPPER RESTRICTION

The Mace must not be placed into:

* Dispenser
* Dropper

during the event.

Cancel such inventory transfers.

---

# 28. SHULKER BOX RESTRICTION

The Mace must not be placed inside a Shulker Box during the event.

This includes attempts to put a Shulker Box containing the event Mace into another container.

The plugin must prevent storage bypasses.

---

# 29. BUNDLE / SPECIAL CONTAINER RESTRICTION

If Minecraft 1.21.11 provides any item/container mechanism capable of storing the Mace:

The event Mace must not be storable inside it.

The implementation must account for modern container mechanics rather than only checking traditional chests.

---

# 30. SHIFT-CLICK EXPLOIT

Shift-clicking must not bypass restrictions.

Example:

Player shift-clicks the Mace while a Chest is open.

The plugin must detect this.

The Mace must NOT move into the Chest.

---

# 31. DRAGGING EXPLOIT

Dragging the Mace into container slots must not bypass restrictions.

For example:

Click-and-drag Mace across multiple Chest slots.

The plugin must cancel the operation.

---

# 32. HOTBAR SWAP EXPLOIT

Number-key inventory swapping must not bypass restrictions.

Example:

Player opens a Chest.

Mace is in hotbar slot 1.

Player presses number key to swap it into the Chest.

This must be blocked.

---

# 33. DOUBLE-CLICK EXPLOIT

Double-click inventory collection must not move the Mace into a prohibited container.

Handle this safely.

---

# 34. CREATIVE MODE

If players can access Creative Mode:

The plugin must not allow Creative inventory actions to duplicate or bypass the event Mace.

If necessary, cancel suspicious Creative interactions involving the event Mace.

The plugin must never trust client inventory packets blindly.

---

# 35. MACE DROPPING

During the 15-minute event:

The current holder must NOT be able to drop the Mace manually.

Prevent:

Q drop.

Ctrl+Q drop.

Inventory drag/drop into the outside area.

Any equivalent dropping method.

---

# 36. DEATH HANDLING

Death handling must be designed carefully.

When the current holder dies during the event:

The Mace must not be duplicated.

The Mace must not remain in the dead player's inventory after respawn.

The Mace must not become an ordinary death-drop item.

The plugin must take ownership of the Mace during the death process.

---

# 37. DEATH TRANSFER

If a valid killer exists:

Current holder dies.

Killer receives the Mace.

Current holder loses the Mace.

Killer becomes the new holder.

Killer receives Glowing.

Old holder loses Glowing.

Coordinates switch to killer.

Timer continues.

---

# 38. NO KILLER CASE

If the holder dies without a valid player killer, do NOT randomly assign the Mace.

Examples:

* Fall damage
* Lava
* Fire
* Void
* Explosion
* Mob
* Environmental death

The plugin must have a deterministic policy.

Recommended behavior:

Keep the Mace associated with the event state and safely restore/transfer it to the holder according to a protected recovery mechanism.

It must never duplicate.

It must never permanently disappear.

It must never become freely obtainable by another player.

---

# 39. DISCONNECT HANDLING

If the current holder disconnects while the event is active:

Do not allow the Mace to be duplicated.

Do not allow the Mace to remain accessible in a way that allows bypassing the event.

The plugin should maintain the holder UUID and event state.

When the player reconnects:

Restore the correct state safely.

If the player disconnects and another server-specific rule is required for offline holders, use a configurable policy.

The default behavior should prioritize preventing duplication and loss.

---

# 40. RECONNECT

When the holder reconnects while the event is still active:

Check the authoritative event state.

Restore:

* Mace ownership
* Glowing
* coordinate tracking
* event participation

The timer must NOT reset.

---

# 41. SERVER RESTART

The event state must be persistent.

If the server restarts while the 15-minute event is active:

The event must NOT automatically reset.

Store:

* eventActive
* eventStartTime
* eventEndTime
* currentHolderUUID
* unique event Mace identity

When the server starts again:

Calculate remaining time using the saved timestamp.

If the event still has time remaining:

Resume it.

If the event has already expired:

Finalize the event immediately.

---

# 42. EVENT END

When the 15-minute timer reaches zero:

The event ends immediately.

Perform ALL cleanup.

Remove BossBar.

Remove coordinate Action Bar.

Remove Glowing from the current holder.

Stop event tracking.

Stop transfer logic.

Stop event-specific inventory restrictions.

Stop event-specific drop prevention.

Stop event-specific highlighting.

---

# 43. FINAL HOLDER

At the exact moment the event ends:

The player currently holding the Mace becomes the permanent Mace holder.

The event ends.

The Mace becomes a normal permanent item with the special post-event restrictions described below.

---

# 44. EVENT END POPUP

Immediately after the event ends:

Display a center-screen popup.

Format:

%player_name% is now the mace holder

Replace:

%player_name%

with the actual final holder's Minecraft username.

Example:

PlayerB is now the mace holder

---

# 45. FINAL POPUP DESIGN

The final popup should:

* Appear in the center of the screen.
* Use red text.
* Have a glowing/emphasized appearance.
* Be clearly visible.
* Not be excessively large.
* Stay visible long enough to read.
* Then disappear automatically.

Use a Minecraft Title/SubTitle-style presentation or equivalent.

Do not spam the popup.

It should happen once when the event ends.

---

# 46. CRAFT POPUP

Immediately when the first Mace is crafted:

Display a center-screen popup.

Exact conceptual text:

%player_name% Has Crafted The Mace

Replace %player_name% with the actual crafter's name.

The text must be:

RED

and visually emphasized/glowing.

---

# 47. CRAFT POPUP DURATION

The craft popup must remain visible for approximately:

2 seconds.

After 2 seconds:

It disappears.

Do not keep it permanently visible.

Do not repeat it every second.

---

# 48. CRAFT SOUND

When the Mace is successfully crafted:

Play a powerful server-wide sound.

Every online player should hear it.

The sound should resemble the dramatic sound used when defeating the Ender Dragon.

Use the appropriate Minecraft 1.21.11 sound event.

The sound must play exactly once per successful event start.

Do not repeatedly play the sound every second.

---

# 49. SOUND SCOPE

The craft sound must be broadcast to all online players.

It should not only play for the crafter.

Players joining after the sound has already played should NOT hear the old craft sound again.

---

# 50. CHAT ANNOUNCEMENT

When the Mace is crafted, send a server-wide chat message.

Example:

[ MACE EVENT ] PlayerA has crafted the Mace!

The message must be visible to all online players.

Use configurable formatting if possible.

---

# 51. CHAT AFTER EVENT

When the event ends, optionally send a global chat announcement such as:

[ MACE EVENT ] PlayerA is now the permanent Mace holder!

This should accompany the final popup.

---

# 52. MACE IDENTITY

The event Mace must have a reliable identity.

Do not identify it only by:

Material = MACE

because another normal Mace may exist.

Use persistent metadata such as:

PersistentDataContainer

with a unique key.

For example:

mace_event_item = true

and a unique event identifier.

The plugin must be able to distinguish:

Event Mace

from:

Normal Mace.

---

# 53. EVENT MACE VS NORMAL MACE

The plugin must only apply special event rules to the actual event Mace.

Do not accidentally block every Mace on the server.

Before applying restrictions, verify the item's event identity.

---

# 54. POST-EVENT MACE

After the 15-minute event ends:

The Mace becomes the permanent Mace holder's item.

The player is now the official permanent Mace holder.

The player may finally drop the Mace.

However:

The player still must NOT be able to store it inside:

* Chest
* Barrel
* Ender Chest
* Hopper
* Dropper
* Dispenser
* Shulker Box
* Any equivalent storage container

This storage restriction continues permanently.

---

# 55. POST-EVENT DROP

After the event ends:

Manual dropping of the Mace becomes allowed.

For example:

Q

and

Ctrl+Q

may drop the Mace.

This is intentional.

The player is now allowed to drop it.

---

# 56. POST-EVENT STORAGE

Even after the event:

The Mace cannot be placed into a Chest.

The plugin must continue checking storage restrictions permanently.

---

# 57. POST-EVENT ENDER CHEST

Even after the event:

The Mace cannot be placed inside an Ender Chest.

This restriction remains permanent.

---

# 58. POST-EVENT BARREL

Even after the event:

The Mace cannot be placed inside a Barrel.

---

# 59. POST-EVENT HOPPER

Even after the event:

The Mace cannot enter a Hopper.

---

# 60. POST-EVENT SHULKER

Even after the event:

The Mace cannot be stored inside a Shulker Box.

---

# 61. POST-EVENT DISPENSER/DROPPER

Even after the event:

The Mace cannot be inserted into:

* Dispenser
* Dropper

---

# 62. MACE DESTRUCTION PROTECTION

The event Mace must be extremely difficult to lose.

The Mace must not be destroyed by:

* Fire
* Lava
* Explosion
* TNT
* Creeper explosion
* Bed explosion
* Respawn-anchor explosion
* Other normal explosion sources
* Burning
* Fire damage
* Lava contact

---

# 63. ITEM ENTITY PROTECTION

If the Mace is dropped after the event:

It becomes an Item Entity.

The plugin must prevent the special Mace Item Entity from being destroyed by normal environmental destruction.

If it enters:

Fire

Lava

Explosion

the plugin must protect it.

---

# 64. TNT PROTECTION

If the Mace is on the ground and TNT explodes near it:

The Mace must survive.

The plugin must remove/prevent the Mace from the explosion's affected item entities.

---

# 65. FIRE PROTECTION

If the Mace is thrown into fire:

It must not burn.

---

# 66. LAVA PROTECTION

If the Mace enters lava:

It must not be destroyed.

---

# 67. DESPAWN PROTECTION

The Mace must not disappear because of normal item despawn.

If dropped:

It should have special protection against despawning.

Use a reliable persistent mechanism.

---

# 68. VOID SAFETY

The implementation should prevent the special Mace from being permanently lost through accidental environmental behavior where technically possible.

If the Mace enters the void:

The plugin must prioritize recovering the item rather than allowing permanent disappearance.

Implement a safe recovery mechanism.

---

# 69. ENCHANTMENT LIMITS

The event Mace must have custom enchantment restrictions.

The following maximum levels must be enforced.

---

# 70. BREACH

Maximum:

Breach II

Allowed:

Breach I

Breach II

Not allowed:

Breach III

Breach IV

Any higher level must be rejected.

---

# 71. WIND BURST

Maximum:

Wind Burst I

Allowed:

Wind Burst I

Not allowed:

Wind Burst II

Wind Burst III

Any higher level must be rejected.

---

# 72. DENSITY

Maximum:

Density III

Allowed:

Density I

Density II

Density III

Not allowed:

Density IV

Density V

Any higher level must be rejected.

---

# 73. UNBREAKING

Unbreaking III should remain the normal maximum/default enchantment level.

Do not impose an unnecessary custom restriction below the normal intended level.

Allowed:

Unbreaking I

Unbreaking II

Unbreaking III

---

# 74. MENDING

Mending must remain allowed.

Do not block Mending.

---

# 75. ENCHANTMENT ENFORCEMENT

The restrictions must work through:

* Enchanting
* Anvil
* Loot/generated items
* Commands where possible
* Plugin-based modifications
* Book application
* Item merging
* Other normal server mechanisms

The final event Mace must never be allowed to permanently contain:

Breach III+

Wind Burst II+

Density IV+

---

# 76. ANVIL EXPLOIT

If a player attempts to use an enchanted book containing an illegal enchantment on the Mace:

Prevent the illegal enchantment from being applied.

Example:

Breach III book

must NOT produce:

Breach III Mace.

---

# 77. EXISTING ILLEGAL MACE

If the plugin detects an event Mace containing an illegal enchantment:

It must sanitize the item.

Remove enchantments above the configured maximum.

Do not create another Mace during this process.

---

# 78. COMMAND EXPLOIT

If an administrator uses a command such as:

/give

to create a modified Mace with illegal enchantments:

The plugin should recognize the event Mace by its persistent identity.

If the illegal item is marked as the event Mace:

sanitize it.

Do not allow an illegal event Mace to bypass the rules.

---

# 79. DUPLICATION PREVENTION

Duplication prevention is one of the highest priorities.

The plugin must be designed against:

* Death duplication
* Respawn duplication
* Inventory duplication
* Container duplication
* Shift-click duplication
* Hopper duplication
* Drop duplication
* Pickup duplication
* Disconnect duplication
* Reconnect duplication
* Server restart duplication
* Chunk unload duplication
* Chunk reload duplication
* Plugin reload duplication
* Anvil duplication
* Item merge duplication
* Creative duplication
* Death-drop duplication

---

# 80. AUTHORITATIVE STATE

The plugin must maintain a single authoritative event Mace state.

For example:

Event State:

ACTIVE / FINISHED

Current Holder UUID:

xxxxxxxx

Event Start:

timestamp

Event End:

timestamp

Mace Unique ID:

xxxxxxxx

The item itself must also contain its persistent unique metadata.

---

# 81. NO MULTIPLE MACE STATE

If multiple items somehow claim to have the same event Mace identity:

The plugin must detect the situation.

There must still only be one legitimate Mace.

Do not allow the duplicate to become a second permanent Mace.

Implement safe duplicate invalidation/reconciliation logic.

---

# 82. ITEM MOVEMENT TRACKING

The plugin must monitor relevant inventory events.

At minimum consider:

InventoryClickEvent

InventoryDragEvent

InventoryMoveItemEvent

InventoryPickupItemEvent

PlayerDropItemEvent

EntityPickupItemEvent

PlayerDeathEvent

PlayerRespawnEvent

CraftItemEvent

PrepareItemCraftEvent

InventoryOpenEvent where necessary

BlockPlaceEvent if needed for container bypasses

Explosion events

EntityCombustEvent / relevant fire behavior

PlayerQuitEvent

PlayerJoinEvent

Server startup/shutdown

Use the appropriate modern Paper/Bukkit APIs for 1.21.11.

---

# 83. CRAFT VALIDATION

Do not activate the event merely because a player opens the crafting interface.

Only activate after the player actually successfully obtains the first Mace.

The plugin must distinguish:

Prepare Craft

from:

Actual Craft

The event must not start if the player only previews the Mace.

---

# 84. CRAFT RACE CONDITION

Two players may attempt to craft a Mace nearly simultaneously.

The plugin must handle this safely.

Only one player can win.

The first successful craft must atomically claim the event.

The second player must not receive another Mace.

Use synchronized/atomic logic where required.

---

# 85. RECIPE VALIDATION

The plugin must not accidentally block unrelated crafting recipes.

Only the event Mace behavior should be modified.

---

# 86. HOLDER VALIDATION

Every scheduled update must verify:

Is the event active?

Is there a current holder?

Does the holder still exist?

Is the event time expired?

If the holder changes:

Stop applying effects to the old holder.

Apply effects to the new holder.

---

# 87. GLOWING EFFECT CLEANUP

Never leave Glowing permanently active because the event ended.

At event end:

Remove Glowing from holder.

At transfer:

Remove from old holder.

At plugin disable:

Remove event-applied Glowing where appropriate.

Do not remove a player's unrelated custom effect if the plugin did not apply it.

Track whether the plugin applied the effect.

---

# 88. COORDINATE CLEANUP

When the event ends:

The Action Bar showing:

Mace Location: ...

must disappear.

Do not leave the last coordinate frozen on the screen.

Send a blank Action Bar or equivalent cleanup packet.

---

# 89. BOSSBAR CLEANUP

When the event ends:

Remove every player from the BossBar.

Then remove/discard the BossBar instance.

Do not leave orphan BossBars.

---

# 90. NEW PLAYERS DURING EVENT

If a new player joins while the event is active:

They should receive the current BossBar.

They should see the current Mace holder's coordinates.

They should know that the event is currently active.

They should NOT receive the original craft sound again.

They should NOT receive the original craft popup again.

The event state must be synchronized for them.

---

# 91. WORLD CHANGE

If the holder changes world during the event:

Coordinates must update to the correct world/location.

The plugin should display world information if useful.

Recommended format:

Mace Location: X: 100 Y: 65 Z: 200

Optionally include:

World: world_nether

The coordinate system must correctly reflect the holder's current world.

---

# 92. TELEPORTATION

If the holder teleports:

Update the coordinates immediately.

Do not rely only on movement events.

Teleportation can change position without normal movement.

---

# 93. NETHER/OVERWORLD

The event must work correctly across:

Overworld

Nether

End

The current holder's actual location must always be used.

---

# 94. HOLDER DEATH + RESPAWN

When the holder dies:

Do not wait until respawn to decide ownership if a valid killer exists.

The transfer should be associated with the death event.

The Mace must not exist simultaneously in:

dead player's inventory

death drops

killer inventory

That would be a duplication.

There must be exactly one copy.

---

# 95. DEATH DROPS

When the holder dies during the event:

Remove the event Mace from the normal death-drop list.

Do not allow Minecraft's default death-drop mechanism to create a second accessible copy.

---

# 96. KILLER FULL INVENTORY DURING DEATH

If the killer has a full inventory:

Use the previously described safe slot replacement mechanism.

Drop one existing item.

Insert the Mace.

Do not drop the Mace itself.

---

# 97. KILLER IS OFFLINE

Normally a killer is online.

If unusual server mechanics result in no valid online killer:

Do not lose the Mace.

Store/recover it safely according to the event state.

---

# 98. EVENT TIMER AFTER DEATH

A death must never restart the timer.

If:

08:43

was remaining before the kill,

then after transfer:

08:43

must remain approximately the same.

Only natural passage of time may reduce it.

---

# 99. EVENT TIMER AFTER SERVER RESTART

Suppose:

12:30

remains.

Server restarts.

After restart:

The timer should continue from the actual remaining time.

It must NOT become:

15:00.

---

# 100. EVENT FINALIZATION

Create a dedicated finalization method.

Conceptually:

endEvent()

This method must be idempotent.

Calling it twice must not:

* duplicate messages
* duplicate rewards
* duplicate Mace
* create extra BossBars
* produce repeated popups

---

# 101. TRANSFER METHOD

Create a dedicated safe method for:

transferMace(oldHolder, newHolder)

This method should:

1. Validate event state.
2. Validate old holder.
3. Validate new holder.
4. Remove old ownership.
5. Remove old Glowing.
6. Remove Mace from death drops/inventory as required.
7. Safely place Mace into new holder inventory.
8. Handle full inventory.
9. Update authoritative holder UUID.
10. Apply new Glowing.
11. Update coordinates.
12. Persist state.

---

# 102. ATOMIC TRANSFER

Mace transfer should be treated as one logical transaction.

Do not update the holder UUID before safely securing the Mace.

Do not give the Mace to the new holder while leaving another copy with the old holder.

The state should always represent reality.

---

# 103. LOGGING

Add useful console logging.

Examples:

[MaceEvent] Event started by PlayerA.

[MaceEvent] Holder changed: PlayerA -> PlayerB.

[MaceEvent] Event ended. Final holder: PlayerB.

[MaceEvent] Duplicate event item detected.

Do not spam the console every tick.

---

# 104. DEBUG MODE

Add an optional debug mode in configuration.

Example:

debug: false

When true:

Log important state transitions.

When false:

Keep console clean.

---

# 105. CONFIGURATION

Create a config.yml.

Configurable values should include:

event-duration-seconds: 900

craft-popup-duration-ticks: 40

glow-refresh-ticks: 10

coordinate-update-ticks: 2

messages

sounds

BossBar title

BossBar color

BossBar style

Whether debug logging is enabled

Do not hard-code every user-facing string.

---

# 106. DEFAULT EVENT DURATION

Default:

900 seconds

which equals:

15 minutes.

---

# 107. DEFAULT POPUP DURATION

Default:

40 ticks

which equals:

2 seconds.

---

# 108. GLOW REFRESH

Use a short duration and refresh it regularly.

Example:

1-second effect

refreshed every few ticks.

Do not wait until it expires before refreshing.

This prevents visible flickering.

---

# 109. PLAYER VISIBILITY

Glowing should use the normal Minecraft glowing effect.

It should allow the holder to be visually identified through blocks as Minecraft's Glowing effect normally works.

Do not implement a fake custom outline unless required.

---

# 110. COORDINATE VISIBILITY

The Action Bar should be visible to all online players while the event is active.

If the holder is not available temporarily:

Do not display stale coordinates.

Display an appropriate temporary message or blank action bar.

---

# 111. FINAL HOLDER STATE

After event completion:

The final holder remains the official Mace owner.

No event highlight.

No event coordinates.

No event BossBar.

No event countdown.

No transfer system.

No forced holder effect.

The Mace becomes their permanent special Mace.

---

# 112. POST-EVENT STORAGE RULE

Permanent Mace storage restriction must remain active indefinitely.

The Mace may be:

* Held
* Dropped
* Picked up

But may NOT be stored in protected containers.

---

# 113. POST-EVENT PICKUP

After being dropped:

The permanent Mace may be picked up normally.

The plugin must recognize it as the special Mace.

---

# 114. POST-EVENT PICKUP BY ANOTHER PLAYER

If another player picks up the permanent Mace after the event:

The plugin must decide ownership based on the permanent-holder rule.

The preferred behavior is:

The Mace remains the official permanent Mace and may not be duplicated.

If ownership transfer is intended after the event, it must be explicitly configured.

Do not accidentally create a second Mace.

---

# 115. PERMANENT HOLDER DATA

Store the final holder UUID persistently.

Example:

finalHolderUUID

This allows the plugin to remember who originally won the Mace.

---

# 116. NO EVENT RESET

Once the 15-minute event has ended:

Do not automatically start another event.

The plugin must remain in finished state.

Restarting the server must not create another Mace event.

---

# 117. COMMANDS

Provide administrative commands.

Recommended:

/maceevent status

/maceevent reset

/maceevent forceend

/maceevent give

/maceevent debug

These commands must have permissions.

Example:

maceevent.admin

---

# 118. STATUS COMMAND

/maceevent status

Should show:

Event status

Remaining time

Current holder

Event start time

Event end time

Permanent holder if finished

Whether event Mace exists

---

# 119. RESET COMMAND

/maceevent reset

Must be protected by admin permission.

Because resetting an event can potentially cause duplication, the reset implementation must be extremely careful.

It should not simply delete the state and leave an old Mace in circulation.

Before allowing a reset:

Safely invalidate/reconcile the existing event Mace.

---

# 120. FORCE END

/maceevent forceend

Should end the event safely.

The current holder becomes final holder.

All normal event cleanup occurs.

---

# 121. ADMIN GIVE

If an admin command creates the special Mace:

It must NOT accidentally create a duplicate.

Only allow this if the event system is currently empty/reset.

Otherwise refuse.

---

# 122. PERMISSIONS

Use permissions such as:

maceevent.admin

maceevent.status

maceevent.reset

maceevent.forceend

maceevent.give

---

# 123. ERROR HANDLING

Never allow an exception during:

death

crafting

inventory movement

join

quit

restart

to create a duplicate Mace.

Catch and safely handle unexpected edge cases.

Log useful information.

---

# 124. PERFORMANCE

Do not scan every player's entire inventory every tick.

Do not create unnecessary tasks per player.

Prefer one central event task.

Use efficient state tracking.

The event has a maximum duration of 900 seconds.

---

# 125. CENTRAL SCHEDULER

Use a central repeating task for:

* countdown
* BossBar update
* coordinate update
* holder Glowing refresh
* event expiration check

Do not create dozens of independent repeating tasks.

---

# 126. TICK TIMING

Minecraft:

20 ticks = 1 second.

Use this correctly.

Do not confuse milliseconds with ticks.

Do not accidentally make the event 15 seconds or 15 hours.

---

# 127. TIME CALCULATION

Use real timestamps.

Concept:

remainingMillis = eventEndTime - System.currentTimeMillis()

Convert to seconds for display.

Clamp remaining time between:

0

and

900.

---

# 128. DISPLAY FORMAT

Use:

MM:SS

Examples:

15:00

14:59

10:05

01:09

00:10

00:01

00:00

Do not display decimals.

---

# 129. BOSSBAR TITLE FORMAT

Default:

Event Time Left: 14:59

At the end:

Event Time Left: 00:00

Immediately afterward:

Remove BossBar.

---

# 130. CRAFT TITLE FORMAT

Default:

%player_name% Has Crafted The Mace

Color:

RED

Emphasis:

bold/glowing-style visual emphasis where supported.

Duration:

2 seconds.

---

# 131. FINAL TITLE FORMAT

Default:

%player_name% is now the mace holder

Color:

RED

Emphasis:

strong visual emphasis.

Duration:

configurable, recommended 2-3 seconds.

---

# 132. CHAT FORMAT

Default:

§c[MACE EVENT] §f%player_name% has crafted the Mace!

The exact formatting should be configurable.

---

# 133. COORDINATE FORMAT

Default:

Mace Location: X: %x% Y: %y% Z: %z%

Coordinates should be integer block coordinates.

---

# 134. WORLD COORDINATES

Use the holder's actual location.

Do not use the location where the Mace was originally crafted after ownership changes.

---

# 135. TRANSFER EXAMPLE

Initial:

Player A crafts Mace.

Holder:

A

Glow:

A

Coordinates:

A

Time:

15:00

Then B kills A.

Result:

Holder:

B

Glow:

B

Coordinates:

B

Time:

whatever remains

Mace:

B inventory

A:

no Mace

---

# 136. SECOND TRANSFER EXAMPLE

B is now holder.

C kills B.

Result:

Holder:

C

Glow:

C

Coordinates:

C

Mace:

C inventory

Timer:

continues

---

# 137. THIRD TRANSFER EXAMPLE

C is holder.

D kills C.

Result:

Holder:

D

Glow:

D

Coordinates:

D

Mace:

D inventory

Timer:

continues

This can repeat indefinitely until the original 15-minute timer expires.

---

# 138. FULL INVENTORY EXAMPLE

A is holder.

B kills A.

B's inventory:

36/36 full.

The plugin:

1. Selects valid storage slot.
2. Takes the existing item.
3. Drops that item safely.
4. Places Mace in that slot.
5. Sets B as holder.
6. Removes A's Glow.
7. Applies B's Glow.
8. Changes coordinates to B.

Never drop the Mace.

---

# 139. DEATH DUPLICATION EXAMPLE

A dies.

Minecraft prepares drops.

The plugin detects the event Mace.

The event Mace is removed from normal drops.

The plugin transfers one authoritative Mace to B.

A cannot retain the Mace after respawn.

Only one Mace exists.

---

# 140. RESPAWN TEST

After A respawns:

Check A inventory.

There must NOT be an event Mace.

Check B inventory.

There must be exactly one event Mace.

---

# 141. CHEST TEST

A opens Chest.

Attempts to shift-click Mace.

Result:

Cancelled.

---

# 142. DRAG TEST

A opens Chest.

Drags Mace across Chest slots.

Result:

Cancelled.

---

# 143. HOTBAR TEST

A has Mace in hotbar.

A opens Chest.

A presses number key corresponding to Chest slot.

Result:

Mace remains outside the Chest.

---

# 144. ENDER CHEST TEST

A opens Ender Chest.

Attempts to insert Mace.

Result:

Cancelled.

---

# 145. BARREL TEST

A opens Barrel.

Attempts to insert Mace.

Result:

Cancelled.

---

# 146. HOPPER TEST

A attempts to place Mace into Hopper.

Result:

Cancelled.

---

# 147. FIRE TEST

Drop Mace into fire.

Result:

Mace survives.

---

# 148. LAVA TEST

Drop Mace into lava.

Result:

Mace survives.

---

# 149. TNT TEST

Drop Mace near TNT.

Explode TNT.

Result:

Mace survives.

---

# 150. DESPAWN TEST

Drop Mace.

Wait beyond normal item lifetime.

Result:

Mace does not disappear.

---

# 151. RESTART TEST

Start event.

Wait until a few minutes remain.

Restart server.

Result:

Event resumes from correct remaining time.

Not 15:00.

---

# 152. RECONNECT TEST

Holder disconnects.

Reconnects.

Result:

No duplication.

No second Mace.

Correct event state restored.

---

# 153. NEW PLAYER TEST

Player joins during event.

Result:

Player sees:

BossBar

Current holder coordinates

Current event state

But does not receive old craft sound.

---

# 154. EVENT END TEST

Timer reaches:

00:00

Immediately:

BossBar removed.

Coordinates removed.

Glow removed.

Event transfer logic disabled.

Final popup appears.

Chat announcement appears.

Final holder remains the permanent Mace holder.

---

# 155. AFTER EVENT TEST

Final holder presses Q.

Result:

Mace drops normally.

This is allowed.

---

# 156. AFTER EVENT CHEST TEST

Final holder attempts to put Mace into Chest.

Result:

Blocked.

---

# 157. AFTER EVENT ENDER CHEST TEST

Final holder attempts to put Mace into Ender Chest.

Result:

Blocked.

---

# 158. AFTER EVENT LAVA TEST

Permanent Mace enters lava.

Result:

Mace survives.

---

# 159. ENCHANTMENT TEST

Try:

Breach I

Result:

Allowed.

Try:

Breach II

Result:

Allowed.

Try:

Breach III

Result:

Blocked.

Try:

Breach IV

Result:

Blocked.

---

# 160. WIND BURST TEST

Wind Burst I:

Allowed.

Wind Burst II:

Blocked.

---

# 161. DENSITY TEST

Density I:

Allowed.

Density II:

Allowed.

Density III:

Allowed.

Density IV:

Blocked.

Density V:

Blocked.

---

# 162. UNBREAKING TEST

Unbreaking III:

Allowed.

---

# 163. MENDING TEST

Mending:

Allowed.

---

# 164. ITEM NBT / PDC

Use PersistentDataContainer or equivalent supported persistent metadata.

Suggested keys:

mace_event_item

mace_event_id

mace_event_version

Do not rely solely on display name or lore.

Players can rename items.

---

# 165. DISPLAY NAME

The Mace may have a custom display name if desired.

However, identity must NOT depend on the name.

Changing the name must not remove its special identity.

---

# 166. LORE

Optional lore can explain:

This is the Mace Event weapon.

But lore must not be the authoritative identification mechanism.

---

# 167. DATA FILE

Store persistent state in a safe file.

For example:

plugins/MaceEvent/data.yml

Store:

eventActive

eventStarted

eventEnd

currentHolder

finalHolder

eventMaceId

version

---

# 168. SAVE FREQUENCY

Persist important state when:

event starts

holder changes

event ends

server shuts down

important recovery occurs

Do not write to disk every tick.

---

# 169. CRASH SAFETY

If the server crashes after a transfer:

The state should be as recoverable as possible.

Avoid updating only half of the transfer state.

Save after successful ownership transfer.

---

# 170. PLUGIN DISABLE

When plugin disables:

Cancel scheduler.

Remove BossBar.

Clean event-applied effects if appropriate.

Save state.

Do NOT delete the Mace.

Do NOT reset the event.

---

# 171. PLUGIN ENABLE

When plugin enables:

Load state.

Validate saved state.

Find current holder.

Check event time.

Resume or finalize appropriately.

---

# 172. INVALID HOLDER UUID

If saved holder UUID no longer resolves:

Do not crash.

Recover safely.

Do not generate another Mace.

---

# 173. INVALID STATE

If data file is corrupted:

Log the problem.

Attempt safe recovery.

Never blindly create another Mace.

---

# 174. DUPLICATE DETECTION

If the plugin finds multiple items carrying the same event Mace ID:

Only one may remain authoritative.

The implementation must reconcile duplicates safely.

Do not simply allow both items to exist.

---

# 175. INVENTORY SCANNING

Only scan inventories when necessary.

Do not continuously scan all players every tick.

When a holder changes or recovery occurs, targeted scanning is acceptable.

---

# 176. SECURITY PRINCIPLE

Never trust:

* item name
* lore
* client inventory state
* visual appearance

Use server-side authoritative metadata.

---

# 177. EVENT STATE MACHINE

Implement the event conceptually as:

IDLE

→ ACTIVE

→ FINISHED

Do not allow:

ACTIVE → ACTIVE

through a second craft.

Do not allow:

FINISHED → ACTIVE

through normal crafting.

---

# 178. IDLE

Before the first Mace:

No event.

No BossBar.

No coordinate display.

No Glow.

Normal Mace crafting behavior can start the event.

---

# 179. ACTIVE

During event:

Exactly one holder.

Exactly one event Mace.

BossBar active.

Coordinates active.

Glow active.

Transfers enabled.

Mace dropping disabled.

Storage restrictions active.

---

# 180. FINISHED

After 15 minutes:

Final holder fixed.

BossBar removed.

Coordinates removed.

Glow removed.

Transfer system disabled.

Dropping enabled.

Storage restrictions remain.

Destruction protection remains.

---

# 181. IMPORTANT: NO RESET ON TRANSFER

Never reset:

eventStartTime

eventEndTime

because of a kill.

Only holder UUID changes.

---

# 182. IMPORTANT: NO RESET ON DEATH

Never reset event duration because holder died.

---

# 183. IMPORTANT: NO RESET ON DISCONNECT

Never reset event duration because holder disconnected.

---

# 184. IMPORTANT: NO RESET ON SERVER RESTART

Never reset event duration because server restarted.

---

# 185. IMPORTANT: NO RESET ON WORLD CHANGE

Never reset event duration because holder changed worlds.

---

# 186. EVENT END PRECISION

The event must end based on timestamp.

Do not depend solely on the number of scheduler executions.

If a tick is delayed:

The event should still recognize that the deadline has passed.

---

# 187. POPUP PRECISION

The craft popup must trigger only once.

Use an event-start flag or state transition.

Do not accidentally trigger it again after restart.

---

# 188. SOUND PRECISION

The craft sound must trigger only once.

Do not play it after every reload/reconnect.

---

# 189. FINAL POPUP PRECISION

The final popup must trigger only once.

Even if:

endEvent()

is called multiple times,

the final announcement must not duplicate.

---

# 190. CHAT PRECISION

Avoid repeated event-end chat messages.

---

# 191. PLAYER EFFECT PRECISION

Only the current holder should glow.

Never allow:

Player A glowing

AND

Player B glowing

simultaneously.

Unless Minecraft internally delays removal by a tick, the plugin should ensure the old effect is removed immediately.

---

# 192. TRANSFER VISUAL ORDER

When transfer occurs:

First remove old holder state.

Then assign new holder.

Then apply new holder state.

This minimizes situations where two players appear highlighted.

---

# 193. COORDINATE TRANSFER ORDER

Immediately after holder assignment:

Coordinate display should reference the new holder.

Never display the old holder after transfer.

---

# 194. BOSSBAR PLAYER LIST

BossBar should contain every online player.

When players join:

Add them.

When players leave:

Remove them or allow the API to handle it safely.

---

# 195. PERFORMANCE OF COORDINATES

Do not send unnecessary Action Bar updates if the coordinates have not changed.

An optimization may compare:

lastX

lastY

lastZ

lastWorld

before sending a new message.

---

# 196. HOLDER MOVEMENT

When holder moves one block:

Update coordinates.

When holder teleports:

Update coordinates.

When holder changes world:

Update coordinates.

---

# 197. DEATH LOCATION

Do not continue displaying dead holder coordinates.

Once ownership transfers:

Display new holder coordinates.

---

# 198. HOLDER NOT ONLINE

If the current holder becomes temporarily unavailable:

Do not assign a random player.

Keep authoritative UUID.

Recover according to configured disconnect policy.

---

# 199. ADMIN SAFETY

Administrative commands must use permission checks.

Do not expose destructive reset commands to normal players.

---

# 200. CODE QUALITY

Write clean, maintainable Java.

Use separate classes for major systems.

Suggested architecture:

MaceEventPlugin

MaceEventManager

MaceItemManager

MaceTransferManager

MaceInventoryListener

MaceCraftListener

MaceDeathListener

MaceProtectionListener

MaceCommand

MaceStorage

MaceDisplayManager

MaceTask

This is only a suggested architecture.

Use a better architecture if appropriate.

---

# 201. SINGLE RESPONSIBILITY

Avoid putting the entire plugin inside one enormous class.

Separate:

event state

item identity

inventory restrictions

visual effects

persistence

commands

listeners

---

# 202. NULL SAFETY

Handle:

null player

null item

null inventory

null killer

null world

null location

safely.

Never let a missing killer crash the death handler.

---

# 203. OFFLINE PLAYER SAFETY

Use UUIDs for persistent ownership.

Do not store ownership only by player name.

Names can change.

UUID is authoritative.

---

# 204. NAME DISPLAY

When displaying holder name:

Resolve current name from UUID where possible.

Fallback gracefully if unavailable.

---

# 205. COORDINATE ROUNDING

Display block coordinates as integers.

Do not show excessive decimal places.

---

# 206. NEGATIVE COORDINATES

Correctly display negative coordinates.

Example:

X: -125

Z: -340

---

# 207. ZERO COORDINATES

Correctly display:

X: 0 Y: 64 Z: 0

---

# 208. NETHER COORDINATES

Use actual player coordinates.

Do not automatically convert Nether coordinates to Overworld coordinates.

---

# 209. EVENT MACE ITEM STACK

Maintain a single authoritative ItemStack representation where practical.

When moving it:

Do not accidentally clone it.

Use safe copying only where required by the API.

---

# 210. INVENTORY TRANSACTION SAFETY

After cancelling an inventory event:

Do not manually perform conflicting inventory operations in the same event unless absolutely necessary.

Avoid double-processing.

---

# 211. DROP EVENT

During active event:

If the player attempts to drop the event Mace:

Cancel PlayerDropItemEvent.

After event:

Allow PlayerDropItemEvent.

But maintain destruction protection.

---

# 212. ITEM PICKUP

The permanent Mace may be picked up after event.

During event:

Only the current holder should be able to possess it.

Do not allow random pickup.

---

# 213. EVENT MACE GROUND STATE

During active event, preferably there should be no normal ground state for the Mace.

If an unexpected ground item exists:

Detect it.

Remove/recover it safely.

Restore it to the authoritative holder.

---

# 214. CHUNK UNLOAD

If a special Mace Item Entity somehow exists in a chunk that unloads:

Do not allow it to disappear.

Use authoritative state and recovery.

---

# 215. ENTITY LOAD

If the special Mace Item Entity loads:

Validate it.

Do not duplicate it.

---

# 216. EXPLOSION EVENT

Protect special Mace Item Entities from explosion removal.

Do not cancel every explosion on the server.

Only protect the Mace.

---

# 217. FIRE EVENT

Protect only the special Mace.

Do not globally disable item burning.

---

# 218. LAVA EVENT

Protect only the special Mace.

Do not globally modify lava.

---

# 219. NORMAL ITEMS

Normal Maces and normal items must continue behaving normally.

The plugin should have minimal impact on unrelated gameplay.

---

# 220. ENCHANTMENT COMPATIBILITY

Use the correct 1.21.11 enchantment APIs.

Do not hard-code outdated Material/Enchantment assumptions from older Minecraft versions.

---

# 221. BREACH MAXIMUM

Explicit rule:

Breach I = allowed

Breach II = allowed

Breach III = blocked

Breach IV = blocked

---

# 222. DENSITY MAXIMUM

Explicit rule:

Density I = allowed

Density II = allowed

Density III = allowed

Density IV = blocked

Density V = blocked

---

# 223. WIND BURST MAXIMUM

Explicit rule:

Wind Burst I = allowed

Wind Burst II = blocked

---

# 224. NORMAL ENCHANTMENTS

Do not unnecessarily restrict normal enchantments such as:

Unbreaking III

Mending

unless another explicit rule requires it.

---

# 225. ENCHANTMENT COMBINATION

If the Mace already has maximum legal enchantments:

Do not allow an anvil operation to increase them beyond the limit.

---

# 226. BOOK MERGING

If two books/items would result in an illegal enchantment level:

Block or sanitize the result.

---

# 227. PREPARE ANVIL

Use the appropriate preparation event to detect illegal output before the player takes it.

Do not allow the player to bypass the restriction by clicking the output.

---

# 228. CRAFT OUTPUT

If the event Mace is being crafted:

Only the first valid craft should trigger the event.

---

# 229. SIMULTANEOUS CRAFTING

Use synchronization if required to avoid:

Player A gets Mace

Player B gets Mace

from two simultaneous transactions.

There must be one winner.

---

# 230. SERVER-SIDE AUTHORITY

The client must never be able to determine:

who owns the Mace

whether event is active

whether the Mace can be stored

whether the Mace can be dropped

whether enchantments are legal

The server decides all of these.

---

# 231. FINAL ACCEPTANCE CRITERIA

The plugin will be considered correct only if all of the following work:

1. First Mace starts event.
2. Event lasts exactly 15 minutes.
3. Only one event Mace exists.
4. Craft popup appears.
5. Craft popup is red.
6. Craft popup lasts approximately 2 seconds.
7. Craft sound plays server-wide.
8. Chat announcement appears.
9. BossBar appears.
10. BossBar shows remaining time.
11. BossBar decreases correctly.
12. Coordinates appear above hotbar.
13. Coordinates update in real time.
14. Crafter glows.
15. Glow is refreshed using short duration.
16. Crafter dies to another player.
17. Crafter loses Glow.
18. Killer receives Mace.
19. Killer becomes glowing.
20. Coordinates switch to killer.
21. Timer does not reset.
22. Killer's full inventory is handled.
23. Existing item is dropped safely.
24. Mace occupies a valid slot.
25. Mace never drops during event.
26. Mace cannot enter Chest.
27. Mace cannot enter Barrel.
28. Mace cannot enter Ender Chest.
29. Mace cannot enter Hopper.
30. Mace cannot enter Dropper.
31. Mace cannot enter Dispenser.
32. Mace cannot enter Shulker Box.
33. Shift-click cannot bypass.
34. Drag cannot bypass.
35. Number-key swap cannot bypass.
36. Death drops cannot duplicate.
37. Respawn cannot duplicate.
38. Disconnect cannot duplicate.
39. Reconnect cannot duplicate.
40. Restart cannot duplicate.
41. Fire cannot destroy Mace.
42. Lava cannot destroy Mace.
43. TNT cannot destroy Mace.
44. Explosion cannot destroy Mace.
45. Normal despawn cannot destroy Mace.
46. Breach III cannot be applied.
47. Breach IV cannot be applied.
48. Wind Burst II cannot be applied.
49. Density IV cannot be applied.
50. Density V cannot be applied.
51. Unbreaking III works.
52. Mending works.
53. Event ends at 15 minutes.
54. BossBar disappears.
55. Coordinates disappear.
56. Glow disappears.
57. Event tracking stops.
58. Final popup appears.
59. Final popup says the player is now the Mace holder.
60. Final popup is red and emphasized.
61. Final holder remains permanent holder.
62. Mace can finally be dropped.
63. Mace still cannot enter Chest.
64. Mace still cannot enter Ender Chest.
65. Mace still cannot enter Barrel.
66. Mace still cannot enter Hopper.
67. Mace remains protected from destruction.
68. No second Mace can be created.
69. Server restart preserves final state.
70. Plugin reload does not create another Mace.

---

# 232. MOST IMPORTANT RULE

At every point in the plugin lifecycle:

THERE MUST BE EXACTLY ONE AUTHORITATIVE EVENT MACE.

Never solve an inventory problem by simply creating another Mace.

Never solve a death problem by giving both players a Mace.

Never solve a restart problem by recreating the Mace.

Never solve a full inventory problem by dropping the Mace.

Never solve a transfer problem by cloning the Mace.

The Mace must be transferred, recovered, or preserved.

It must never be duplicated.

---

# 233. FINAL DEVELOPMENT REQUIREMENT

Before delivering the plugin:

Test every major scenario listed above.

Do not simply compile the plugin and assume it works.

Perform actual server-side tests for:

Craft

PvP kill

Multiple PvP transfers

Full inventory

Death

Respawn

Disconnect

Reconnect

Restart

Chest

Ender Chest

Barrel

Hopper

Dropper

Dispenser

Shulker Box

Shift-click

Drag

Number-key swap

Fire

Lava

TNT

Explosion

Despawn

Anvil

Enchantments

Event expiration

Final holder

Post-event dropping

Post-event storage

The final implementation must be stable enough for a live Lifesteal SMP.

Do not leave known duplication bugs or incomplete placeholder methods.

Do not provide pseudocode in place of required implementation.

Deliver the complete working plugin source code and build configuration compatible with Minecraft 1.21.11.

# END OF SPECIFICATION
Kodari AI
KodariSep 6 at 3:07 am 4
MaceEvent
A Minecraft 1.21.11 Paper plugin implementing a single-Mace PvP event. The event starts when the first Mace is crafted, lasts exactly 15 minutes, and tracks the Mace holder through PvP kills. Features include a BossBar countdown, real-time holder coordinates in the action bar, glowing holder highlighting, and persistent state across disconnects and server restarts. The plugin enforces strict anti-duplication measures, prevents the Mace from being stored in any container, protects it from destruction by fire, lava, explosions, and despawn, and enforces enchantment level caps (Breach II, Wind Burst I, Density III). After the event ends, the final holder keeps the Mace permanently, with storage restrictions remaining active.
  1. Build the Gradle/Paper plugin scaffold and persistent event state.

  2. Implement authoritative mace identity, crafting, transfer, death/recovery, and restart handling.

  3. Add display systems, inventory/container restrictions, environmental protection, and enchantment sanitization.

  4. Add administrative commands and configuration for the complete lifecycle.

Created the complete Paper 1.21.11 Mace Event plugin from scratch.

Implemented:

  • Persistent IDLE → ACTIVE → FINISHED event state

  • Unique PDC-based event Mace identity

  • First-craft event activation with title, sound, chat, BossBar, glow, and coordinates

  • Timestamp-based 15-minute countdown

  • PvP death transfers with full-inventory displacement handling

  • Environmental death recovery

  • Restart, reconnect, respawn, and disconnect persistence

  • Chest, barrel, hopper, dispenser, dropper, Ender Chest, and shulker restrictions

  • Shift-click, drag, hotbar swap, creative, and anvil protections

  • Fire, lava, explosion, despawn, and item-entity protection

  • Breach, Wind Burst, and Density enchantment limits

  • Administrative commands:

    • /maceevent status

    • /maceevent forceend

    • /maceevent reset

    • /maceevent give <player>

    • /maceevent debug

  • Gradle build configuration targeting Java 21 and Paper 1.21.11

  • Configurable messages, BossBar, durations, sounds, and debug logging

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

import org.bukkit.scheduler.BukkitTask;
import org.bukkit.plugin.java.JavaPlugin;

public final class MaceEventPlugin extends JavaPlugin {
    private MaceEventManager manager;
    private BukkitTask task;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        MaceStorage storage = new MaceStorage(this);
        MaceItemService items = new MaceItemService(this);
        MaceDisplayManager display = new MaceDisplayManager(this);
        manager = new MaceEventManager(this, storage, items, display);
        getServer().getPluginManager().registerEvents(new MaceListener(manager), this);
        getCommand("maceevent").setExecutor(new MaceCommand(manager));
        manager.enable();
        task = getServer().getScheduler().runTaskTimer(this, manager::tick, 1L, 2L);
    }

    @Override
    public void onDisable() {
        if (task != null) {
            task.cancel();
        }
        if (manager != null) {
            manager.disable();
        }
    }
}