Minecraft – How to send a message to everyone at a certain in-game time

minecraft-bedrock-editionminecraft-commands

I'm looking for a way to send a chat message to all players telling them it is nearing night in my local Bedrock Edition server. I have searched Google and Arqade for this, but do not have an answer that isn't either outdated or using plugins. I am, despite my lack of knowledge of the matter, willing to use command blocks if needed.

Here's the message I want to send, in tellraw command format:

/tellraw @a {"rawtext":[{"text":"§6It's getting late!"}]}

How can I get it to send at in-game dusk?

Best Answer

That's what daylight sensors are for. These blocks send out a redstone signal that has it's power dependent on what time of the day/night it is.

Daylight sensors come in 2 different types: the regular and the inverted.

For your situation, the inverted type is better to use, as it starts sending out redstone signal during dusk. You simply place the sensor, place a 1 block long redstone wire next to it that powers a command block that sends the message to chat. The syntax of a command that would say in chat "Goodnight" would be:

/tellraw @a {"rawtext":[{"text":"Goodnight"}]}

For hiding the contraption, I suggest using non-opaque blocks. Lava seems to work just fine for this.