Change the relevant world's inventory protection rule so that players retain their items upon death. The command name may look different depending on the Minecraft version.
Step by step
-
Enter the target world with the authorized account and open the completion list after the command
/gamerule. -
Select the inventory protection key that the version indicates. Java 1.21.11 and later uses the name format
/gamerule minecraft:keep_inventory true. Example/gamerule keepInventory truein older versions. -
If you are using a Nether, End or separate world add-on, also check how the rule is applied in those worlds.
-
Die and respawn in a safe place with a test account carrying junk. Test inventory and experience behavior.
Keep in mind
To turn off the rule, use false in the same command. Death and grave add-ons may change the outcome.