how to overcome being attacked in sleep Minecraft Servers

how to overcome being attacked in sleep