How do you make a command block say something in chat? [duplicate]
I want to make a command block output a message in chat every half hour on my server. The purpose of this is to remind players to read the rules of the server.
Would plugins be necessary to do something like this?
01 Answer
Command delay part
Refer to: How do I delay a command
This solution only works on Minecraft 1.9 and above!
This is possible with scoreboard objectives. You will have to do the following for each command you want to delay. Note that this also only works on commands executed on entities.
How to make:
Create a scoreboard objective to hold delays (I will use
timeas an example)/scoreboard objectives add time dummyPlace the following commands into each command block:
Repeat Command Block:
/scoreboard players add @e[score_time_min=1] time 1Chain Command Block 1: Put your delayed command here. For example:
/tp @e[type=ArmorStand,score_time_min={delay}] ~ ~1 ~Chain Command Block 2:
/scoreboard players set @e[score_time_min={delay}] time 0Start the delay by running this command:
/scoreboard players set {entity} time 1
A few things to note:
- Replace
{delay}with the delay you want in ticks, plus one. For example, if you want a delay of 5 seconds, you would put101there since5sec * 20 tick/sec + 1 = 101.- Replace
{entity}with the selector for the entity that you want to run the command. For example,@e[type=ArmorStand,name=Bob].- The command in the second command block is up to you to. Just know that your need to run the command with
{entity}targeted and you must havescore_time_min={delay}in the entity selector for that command.
Broadcast part
Put the following command into Chain Command Block 1:
tellraw @a <raw json message>If you are not familiar with json messages, you can use a generator like this one.