The simple way:
If it is single-player:
If cheats are enabled:
,/gamerule KeepInventory true, suicide, and go home, then /gamerule KeepInventory False
If cheats are not enabled:
do Esc-->make LAN world--->enable cheats--->
/gamerule KeepInventory true, suicide, and go home, /gamerule KeepInventory false
-->make LAN world--->disable cheats--->continue having an awesome time playing MC.