Keep Inventory: When the players teleports, their items will be stored, then the items in their inventory will be replace to just, by default a wooden pickaxe and bread. After they escape, the wooden pickaxe and bread will be replace by their original item.
Add Timer: You can choose to either add a timer to their nightmare and if this runs out, the player will be forcefully awaken and will experience Nausea and Hunger.
- I also added a scoreboard to display the remaining time before you get forcefully awaken.
Bug Fix: There was a bug before that when you set the "Force Death" and "Keep Inventory" to true, then you use a portal, even if you still have nightmare, your item will be return to you.
Current Bug: Right now there's a bug where, if you sleep and got a nightmare and at the same time also got damage, i.e, while sleeping a zombie hit you and you got a nightmare, then you will glitch, players won't be able to see you and you won't be able to send any messages, sometimes you will also get a "Error executing task on Server" error. Quick fix is the player just need to logout and log back in.
Not sure if I can fix this one, since I only started learning Java just a few days ago
WARNING: Have not tried this in a medium to large server or a multi world server,
be careful, if the
server stops or crash and some player are still in nightmare, all of their items will be gone.