Properly preventing drops on death

Hi, one of the first plugins I made was one to prevent players from dropping all their inventory, instead just a few items.
I wanted to re-write that plugin so I wanted to know if anyone knows a better way todo it.

What I did at the time:
  • World had to have keepInventory true
  • When PlayerDeathEvent triggers, iterate through the player's inv and call dropItem at some items
Disadvantages:
  • Little plugin compatibility, specially those that also interact with player inv
  • Curse of Vanishing breaks unless hardcoded into the logic
  • If I forget to set every world with keepInventory, then players will lose everything
Was this page helpful?