The keepInventory gamerule determines whether players drop their items on death or keep them in their inventory.
Server Console
Log In to the Control Panel ↗

Select Your Server

Run the Gamerule Command
In the Console, type gamerule keepInventory true to enable, or gamerule keepInventory false to disable.
Alternative: Graves
Instead of enabling keep inventory, some server owners use a plugin or datapack that stores players’ items in a grave on death. This prevents items from burning in lava or falling into the void.
You have successfully toggled keep inventory on your server.
