Skip to content

Stop death bounce-back from hijacking the drops - #182

Merged
tastybento merged 1 commit into
developfrom
fix/deathchest-drops-compat
Jul 31, 2026
Merged

Stop death bounce-back from hijacking the drops#182
tastybento merged 1 commit into
developfrom
fix/deathchest-drops-compat

Conversation

@tastybento

Copy link
Copy Markdown
Member

Problem

The death drop protection added in 8d88d9a (4.7.0) handles PlayerDeathEvent at NORMAL priority by taking every item out of event.getDrops(), spawning them by hand with dropItemNaturally, and clearing the list.

Any plugin that stores death drops — DeathChest, grave plugins, keep-inventory features — runs at a later priority and now sees an empty event, while the items are already lying on the ground. With the default bounce-back: true, Border 4.7.0+ silently breaks all of them. Tracked down on a live server where DeathChest chests were always empty: a drops-list tracker caught PlayerListener.lambda$onPlayerDeath$0 clearing 5 stacks just before DeathChest ran.

Fix

Leave the event's drops untouched:

  • onPlayerDeath now runs at MONITOR — after every plugin has decided what happens to the items — and only records the death spot and island for one tick.
  • A new onDeathDropSpawn (ItemSpawnEvent) applies the existing trackItem bounce-back to items the server spawns that tick near a recorded death spot.

If another plugin takes the drops, nothing spawns and there is nothing to track; if the drops survive, they are tracked exactly as before. Vanilla drop behaviour (velocities, despawn timers) is also preserved since the server spawns the items itself.

Testing

  • 6 new unit tests: drops are left in the event, no manual dropItemNaturally, spawned death drops get tracked, far-away/no-death item spawns are ignored, bounce-back: false and empty-drops paths do nothing.
  • Full suite: 110 tests, 0 failures.
  • Root-caused on a production server (AOneBlock + DeathChest + 95 plugins) with a debug build of DeathChest.

🤖 Generated with Claude Code

https://claude.ai/code/session_013RPEWFAQcCivzQqB4L72Bx

The death drop protection added in 8d88d9a took the items out of the
PlayerDeathEvent at NORMAL priority, dropped them by hand, and cleared
the drops list. Any plugin that stores death drops - DeathChest, graves,
keep-inventory - then ran on an empty event while the items lay on the
ground, so with the default bounce-back: true, Border 4.7.0+ silently
broke every such plugin.

Leave the event alone: note the death spot at MONITOR, after those
plugins have decided what happens to the items, and apply the bounce-back
tracking to whatever the server then actually spawns, caught through
ItemSpawnEvent in the same tick. If another plugin keeps the items,
nothing spawns and there is nothing to track.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013RPEWFAQcCivzQqB4L72Bx
@sonarqubecloud

Copy link
Copy Markdown

@tastybento
tastybento merged commit 6d2cb01 into develop Jul 31, 2026
3 checks passed
@tastybento
tastybento deleted the fix/deathchest-drops-compat branch July 31, 2026 23:57
@tastybento tastybento mentioned this pull request Aug 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant