Aaron Johnson
📎 1 file 13,097 chars
📄
pasted-code-1789326951305.txt
txt 527 lines
▶
Build a fully functional Minecraft Paper plugin called **Death Note** for:

- Minecraft/Paper: **26.2**
- Java: **25**
- Package: `me.Felzoh.deathnote`
- The plugin must be production-quality, persistent across server restarts, and compile without errors.
- Do not create pseudocode or placeholder implementations. Implement the actual mechanics.
- Prefer Paper/Bukkit APIs and proper event handling rather than console commands wherever possible.
- Do not add dependencies unless absolutely necessary.

# 1. CORE CONCEPT

The plugin recreates the rules and mechanics of the Death Note inside Minecraft.

A Death Note is a special black written book/notebook that has an owner.

The owner can write player usernames and optionally specify a cause of death and scheduled time.

The plugin must validate the rules before a death occurs.

The Death Note must NOT become an unrestricted command-execution system. Written natural-language causes/actions must be parsed into a controlled set of supported actions and causes.

# 2. FIRST DEATH NOTE EVENT

When the plugin/server is first initialized:

1. Record a persistent server initialization timestamp.
2. Exactly 24 real-world hours after initialization, trigger the first Death Note event.
3. Check which players are online at that moment.
4. If multiple players are online, randomly select exactly one.
5. Give that player a Death Note.
6. Make that player the owner.
7. Spawn/render their private Death Note Vex.
8. Save all ownership information persistently.
9. This automatic event must happen only once.

If nobody is online when the 24-hour timer expires, do NOT permanently skip the event. Wait until an eligible player is online and assign the notebook according to the configured rules.

# 3. DEBUG COMMAND

Implement:

`/deathnote give `

This immediately gives the specified player a functional Death Note and makes them its owner.

Add appropriate permission protection for administrative/debug commands.

Also implement:

`/deathnote status`

which displays useful plugin state for debugging.

Optionally implement:

`/deathnote reset`

to reset the automatic first-event timer and testing state.

# 4. DEATH NOTE ITEM

The Death Note must be identifiable as a unique plugin item.

It must not be possible to create a fake vanilla book that behaves as a Death Note simply by giving it the same display name.

Use persistent item data/PersistentDataContainer to identify the item.

The Death Note should contain:

- A black/dark visual appearance where possible.
- A skull at the top of the first page.
- Instructions explaining how the Death Note works.
- Writable pages after the instruction page.

The instructions should explain the actual server rules.

# 5. WRITING NAMES

The owner can write a Minecraft username into the Death Note.

Pressing Enter/submitting the written entry causes the plugin to process it.

The plugin must:

1. Extract the target username.
2. Validate the username.
3. Check all Death Note rules.
4. Determine the cause.
5. Determine the schedule.
6. Validate whether the requested fate is possible.
7. Either schedule/execute it or apply the appropriate failure rule.

Do NOT execute arbitrary commands from text written by the player.

# 6. DEFAULT DEATH

If no cause is specified, the victim dies from a simulated heart attack.

Heart attack sequence:

- Registration occurs.
- Wait 40 seconds.
- Apply Blindness.
- Apply Wither.
- Wait 10 seconds.
- If the player is still alive, force the death through the plugin's death/damage system.
- Milk buckets or effect removal must not permanently prevent the scheduled death.

The sequence must work for online victims.

For offline victims, store the pending death and execute it when they next join.

# 7. CAUSES OF DEATH

Support realistic Minecraft-compatible causes.

Examples include:

- drowning
- fall
- burning
- lava
- explosion
- suffocation
- heart attack

The cause must actually correspond to a plausible Minecraft event.

For example:

`Steve by drowning`

must NOT simply teleport Steve to an arbitrary ocean and kill him.

The plugin should attempt to create a legitimate drowning scenario.

Do not allow impossible or arbitrary causes to execute.

# 8. VICTIM CONTROL

A Death Note may specify actions that the victim performs before dying.

Examples:

`Steve walks to the nearest ocean and drowns.`

The plugin should parse this into a controlled sequence such as:

- locate nearest valid ocean
- navigate victim toward it
- enter water
- perform the required action
- execute drowning

Supported actions should come from a controlled whitelist rather than arbitrary commands.

Potential supported actions:

- WALK_TO
- RUN_TO
- LOOK_AT
- JUMP
- SNEAK
- OPEN_DOOR
- ENTER_WATER
- CLIMB
- ATTACK_ENTITY
- USE_ITEM
- DROP_ITEM
- WAIT
- SLEEP
- EAT
- MOVE_TO_COORDINATES

Only implement actions that can be reliably executed by Paper/Minecraft.

The victim's movement may be temporarily controlled during a Death Note sequence.

# 9. IMPOSSIBLE FATES

Before executing a multi-step fate, validate the entire sequence.

If the requested fate is impossible for that specific player, the entire sequence must fail.

Example:

`Steve flies to the moon and dies.`

This is impossible and must NOT partially execute.

Result:

**Steve dies from the default heart attack instead.**

Another example:

If the victim does not have the ability/item required for a requested action, determine whether the action is possible under the current game state.

Do not execute half of an impossible sequence.

# 10. SCHEDULED DEATHS

The owner may specify a future time for the death.

The maximum scheduling distance is:

**23 real-world days.**

Anything beyond 23 days must be rejected.

Use persistent absolute timestamps internally, not server ticks, so scheduled deaths survive restarts without drifting.

The displayed scheduling time must use:

**US Eastern Time / America/New_York**

Use the proper timezone implementation so EST/EDT daylight-saving changes are handled correctly.

If the victim is online at the scheduled time:

→ execute the death.

If the victim is offline:

→ mark the death as pending.

When the victim next joins:

→ execute the pending death.

# 11. REPEATED NAME / L: CHANGE THE WORLD RULE

If a victim already has a scheduled Death Note death and the same victim's name is subsequently written into another Death Note before the existing scheduled death occurs:

**Nothing happens.**

The original scheduled death remains unchanged.

The second entry must NOT:

- change the time
- change the cause
- cancel the original death
- create a second death

Example:

Death Note A:

`Steve — dies in 10 days.`

Then Death Note B:

`Steve — dies in 5 days.`

Result:

The second entry does nothing.

The original 10-day death remains.

# 12. SAME-TICK COLLISION

Minecraft server ticks are approximately 50 milliseconds.

Use the server's actual tick number for this rule.

If the same victim's name is successfully submitted in two or more Death Notes during the exact same server tick:

**NONE OF THE ENTRIES TAKE EFFECT.**

No death.
No scheduled death.
No cause.
No action.

Example:

Tick 18420:

Death Note A → Steve  
Death Note B → Steve

Result:

Nothing happens.

If they are submitted on different ticks, process them normally according to all other rules.

This comparison must happen server-side.

# 13. MISSPELLING RULE

If the owner intentionally misspells the same victim's username four times according to the Death Note's rules:

→ the Death Note owner dies.

Do not count random unrelated text as a misspelling.

Track failed name submissions appropriately per owner/notebook.

Accidental interface mistakes should not instantly trigger the rule.

# 14. MINECRAFT ACCOUNT AGE RULE

The Death Note does not work on players whose Minecraft accounts are:

- less than **780 days old**
- OR more than **125 years old**

These targets are invalid.

If a target fails this rule, their name has no effect.

Use reliable account creation information where technically available.

Do not fake account-age information.

If reliable account creation information cannot be obtained, handle this safely according to a clearly documented fallback rather than assuming an age.

# 15. PRIVATE TALKING VEX

Every Death Note owner receives a special talking Vex.

The Vex must be visible/audible only to that owner.

Other players must NOT see the Vex.

The Vex:

- follows the owner
- can fly around the owner
- does not damage players
- does not interact with the world
- disappears when the player loses ownership
- returns when ownership is restored

The Vex should have personality/dialogue.

Examples:

When a name is written:

"You really spelled that wrong?"

When an impossible fate is attempted:

"Yeah... that's not happening."

When a scheduled victim is written again:

"Didn't you already write their name?"

When the owner loses the notebook:

"...Well, this is awkward."

Do not spam dialogue.

The Vex must be client/private where possible. If true client-only entity rendering is not possible with the available Paper API, implement the closest reliable per-player visual alternative and document the limitation.

# 16. RELINQUISHING OWNERSHIP

Implement:

`/relinquish`

Only the current Death Note owner can use it.

When executed:

- Remove their ownership.
- Remove their owner permissions.
- Remove their private Vex.
- Mark the notebook as unowned.
- Preserve persistent Death Note state.
- Existing scheduled deaths should remain active unless explicitly cancelled by another rule.

After **7 in-game Minecraft days**, the unowned Death Note is assigned to a new eligible player.

The reassignment should choose randomly from eligible online players.

If nobody eligible is online when the 7-day period finishes, wait until an eligible player becomes available.

The new owner receives the notebook and private Vex.

# 17. OWNERSHIP PERSISTENCE

Ownership must survive:

- server restarts
- player logout
- player death
- dropping the notebook
- putting the notebook in a chest

The notebook's owner must be stored using a persistent identifier such as UUID.

Do not rely only on the player's current username.

# 18. DEATH NOTE DUPLICATES

Multiple Death Notes may exist simultaneously.

Each Death Note must track its own owner.

However, global Death Note rules such as same-tick collisions must work across ALL Death Notes.

# 19. PLAYER DEATH MESSAGES

Do not expose the Death Note owner in the death message.

For example, avoid:

`Steve was killed by Felzoh's Death Note.`

Use a normal or appropriate custom Minecraft death message instead.

The Death Note should remain mysterious.

# 20. PERSISTENCE

All important state must survive server restarts.

Persist at minimum:

- first-event timestamp
- whether first event has occurred
- notebook ownership
- notebook identity
- scheduled deaths
- pending offline deaths
- death causes
- scheduled timestamps
- misspelling counts
- relinquishment state
- reassignment timers

Use a reliable persistent storage mechanism appropriate for the plugin.

# 21. RESTART SAFETY

When the server restarts:

- reload all Death Note data
- restore ownership
- restore scheduled deaths
- restore pending deaths
- restore relinquishment timers
- restore first-event timer
- do not duplicate deaths
- do not duplicate Vexes
- do not reset timers

Every scheduled event must have a unique persistent identifier so it cannot accidentally execute twice.

# 22. COMMANDS

Implement at minimum:

`/deathnote give `
`/deathnote status`
`/relinquish`

Add tab completion.

Use permissions for administrative commands.

# 23. SECURITY

This plugin must NOT:

- execute arbitrary commands from notebook text
- allow ordinary players to create fake functional Death Notes
- expose another owner's private Death Note information
- allow players to modify another player's scheduled death
- duplicate scheduled deaths through server restarts
- trust client-side timestamps
- permanently lock the server through malformed notebook text

Validate all user input.

# 24. CODE QUALITY

Organize the plugin into sensible classes, for example:

- DeathNotePlugin
- DeathNoteManager
- DeathNoteItem
- DeathNoteParser
- DeathEntry
- DeathScheduler
- VictimController
- CauseManager
- OwnershipManager
- VexManager
- PersistenceManager
- DeathNoteCommand
- RelinquishCommand

Use clean object-oriented Java.

Do not put the entire plugin into one enormous class.

Add comments around complicated logic.

# 25. IMPORTANT IMPLEMENTATION REQUIREMENT

Before writing code, reason through the interactions between:

- scheduling
- offline players
- server restarts
- same-tick collisions
- duplicate names
- relinquishment
- ownership
- impossible actions
- victim control
- multiple Death Notes

Avoid race conditions and duplicate execution.

The final result should be an actually compilable and runnable Paper 26.2 plugin, not a conceptual demonstration.

After implementation, check the project for compilation errors and fix them before presenting the final result.
Kodari AI
KodariSep 13 at 7:30 pm 3
DeathNotePlugin
A Minecraft Paper plugin recreating the Death Note mechanics. Players receive a unique black notebook with PersistentDataContainer identification. Owners write usernames to trigger validated deaths with causes like drowning, burning, or heart attacks. The plugin parses natural language into controlled actions, schedules deaths up to 23 days using persistent timestamps, handles offline victims, and enforces rules like same-tick collisions, misspelling penalties, and account age restrictions. A private talking Vex follows each owner with contextual dialogue. Ownership persists across restarts and can be relinquished, triggering reassignment after 7 in-game days. The plugin uses a GUI framework for the notebook interface and includes debug commands with permissions.
  1. Create the Gradle/Paper plugin project and manifest.

  2. Add persistent models and YAML storage for notebooks, ownership, deaths, and timers.

  3. Implement item identity, parsing, controlled causes, scheduling, offline handling, and collision rules.

  4. Add commands, event listeners, private-owner Vex handling, and configuration.

Implemented the Death Note Paper plugin project with:

  • Persistent YAML state for ownership, notebooks, scheduled deaths, first-event timing, and misspellings.

  • /deathnote give <player>, /deathnote status, /deathnote reset, and /relinquish.

  • PersistentDataContainer-based Death Note identity.

  • First-event assignment after 24 real-world hours.

  • Owner-only Death Note writing and controlled parsing.

  • Same-tick collision handling and repeated-name protection.

  • Offline pending deaths and restart-safe scheduling.

  • Heart attack, drowning, burning, lava, explosion, fall, and suffocation causes.

  • 23-day scheduling limit with America/New_York timestamps.

  • Private owner Vex behavior using entity visibility controls.

  • Tab completion, permissions, plugin configuration, Gradle setup, and Paper plugin metadata.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
manifest.kod
settings.gradle
Code
18 1,233
src/main/java/me/Felzoh/deathnote/DeathNotePlugin.java
package me.Felzoh.deathnote;

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

public class DeathNotePlugin extends JavaPlugin {
    private DeathNoteManager deathNoteManager;
    private VexManager vexManager;
    private PersistenceManager persistenceManager;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        persistenceManager = new PersistenceManager(this);
        persistenceManager.load();
        vexManager = new VexManager(this);
        deathNoteManager = new DeathNoteManager(this, persistenceManager, vexManager);
        deathNoteManager.start();

        DeathNoteCommand deathNoteCommand = new DeathNoteCommand(this);
        if (getCommand("deathnote") != null) {
            getCommand("deathnote").setExecutor(deathNoteCommand);
            getCommand("deathnote").setTabCompleter(deathNoteCommand);
        }
        if (getCommand("relinquish") != null) {
            getCommand("relinquish").setExecutor(new RelinquishCommand(this));
        }
        Bukkit.getPluginManager().registerEvents(new DeathNoteListener(deathNoteManager), this);
    }

    @Override
    public void onDisable() {
        if (deathNoteManager != null) {
            deathNoteManager.shutdown();
        }
        if (vexManager != null) {
            vexManager.removeAll();
        }
    }

    public DeathNoteManager getDeathNoteManager() {
        return deathNoteManager;
    }
}