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
8 Replies
Admincraft Meta
Admincraft Meta2mo ago
Thanks for asking your question!
Make sure to provide as much helpful information as possible such as logs/what you tried and what your exact issue is
Make sure to mark solved when issue is solved!!!
/close !close !solved !answered
Requested by duoslingo#0
duolingo se acerca
duolingo se acercaOP2mo ago
bump guess there’s no better way to do this
Skullians
Skullians2mo ago
Why not just listen for playerdeathevent on like the highest priority and change the itemsToKeep event.getItemsToKeep().remove(…) Or more, add to the items to keep
duolingo se acerca
duolingo se acercaOP2mo ago
Because that didn’t existed when I created that plugin at that time 😅 Thxxx! Never noticed they added that
Snow Kit
Snow Kit2mo ago
it could be specific to the paper API
duolingo se acerca
duolingo se acercaOP2mo ago
yup, actually is just checked why I didn't noticed its existence, and apparently is only on paper i usually check spigot jd
1who¡ssus?
1who¡ssus?2mo ago
Paper on top

Did you find this page helpful?