Ok, basically, I can't run mods too well on my computer and would prefer using command blocks. There is a mod I want to semi replicate where on a random night, it will tell the player "This is not a normal Night...", and if the player tries to sleep, they will sleep for a second then be forced out of their bed, where some over powered zombies will spawn. I know how to spawn the zombies and how to test if the player is sleeping, but apart from killing them I don't know how to remove them from their bed.
You don't actually have to kill the player to push him out of his bed. All you need to do is damage him.
/effect @p 19 2
That will deal half a heart of damage to the player, by poisoning him briefly, in order to wake him up.
As of Minecraft 1.13.1, it is now possible to simply
/tp the player to be not touching the bed, whereupon they will stop sleeping.
Ok maybe this will work do /testfor (Name) at the x y z of the bed and use a comparator and connect one to an another commandblock and do /say this is not (Name) and the bed will disappear you can make it disappear by adding another command block and use /setblock x y z air then add two repeaters and delay it to its maximum and add another command block and use /setblock x y z bed and your done hope this worked