It's always frustrating getting everyone on the server to go to sleep to prevent mobs from spawning and having to carry a "travel bed" takes up precious space when out gathering resources. With this setup only one person needs to sleep in order for the night cycle to be skipped.
Based on this video: Super Simple VANILLA MINECRAFT ONE PLAYER SLEEPING|1.13-1.14+
The command blocks will spam your server with constant message, so the first thing to do is to disable their output:
/gamerule commandBlockOutput false
Next we will use the scoreboard command to create a new custom objective called
sleeping
:
/scoreboard objectives add sleeping minecraft.custom:minecraft.sleep_in_bed
- 1 Daylight Sensor
- 1 Redstone Repeater
- 1 Redstone Comparator
- 3 Command Blocks
Setup the items in this patter:
[DLS] | =4=> | [CB-I] | |
---|---|---|---|
[CB-2] | <=C= | [CB-1] | |
L |
Item | Description |
---|---|
DLS | Daylight sensor |
=4=> | Repeater facing right at 4 ticks |
CB-I | Command block set to impulse , requires redstone signal |
CB-# | Command block set to repeat , requires redstone signal |
<=C= | Comparator facing left |
L | Level on top of command block, turned on |
The following commands are all going to go into the command blocks that are set to repeat.
This command will detect when the player goes to sleep and will clear the weather:
/execute as @a[scores={sleeping=1}] run weather clear
This command will increase the time by 100 each game tick:
/time add 100t
Add this code to the command block set to impulse to reset the sleeping objective and have it ready for the next time:
/scoreboard players set @a sleeping 0
Not in 1.16, and our server is planning on skipping to 1.18 because it's not worth it and one of our plugins is also doing so.