4

I'm wondering if it's possible to prevent a player from leaving the bed once he gets in it. I want to count how many times a player slept in a bed in a Minecraft map. I made a scoreboard with it:

/scoreboard objectives add sleepingInBed stat.sleepInBed

The problem is that a player can quit the bed when the night isn't over. The score goes up every time the player tries to sleep in it. Is there a solution for this?

2 Answers 2

3

Adjust blocks around the bed in such a way that the player will wake up on 1 particular block every time.

Circuit A :

Now add pressure plate (preferably stone) on that block.

Circuit B:

Now use daylight sensor somewhere outside add repeater to extend the signal.

Circuit Main:

Use "And" gate with input from A and B and output of the and gate will be linked to your counting command-block.

3
  • I could be wrong but I don't this this could be a solution to the problem OP has presented, I believe the OP runs a server and building a redstone circuit above every users bed could be impossible. I think he wants to be able to programmatically or otherwise restrict the user from exiting the bed. Aug 20, 2016 at 21:59
  • He hasn't mentioned it. He might be making a map.
    – Fennekin
    Aug 21, 2016 at 10:46
  • I'm making a map. Sorry that I didn't mention it Aug 30, 2016 at 20:54
0

To automatically set the time to day when a player sleeps, you could use a comparator that activates a command block only when it shuts off. Comparators can be used to detect most block updates, but a BUD or observer may also do the trick (although only sending a pulse) if you are using a sticky piston.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .