Is there a way to test if someone has said something in chat? [duplicate]
Solution 1:
You cannot test for what someone has said in chat. You could however set up your own custom /trigger
commands.
You can do this by first creating a "trigger" type scoreboard objective:
/scoreboard objectives add home trigger
Then enable it for whoever you want to be able to use it:
/scoreboard players enable @a home
Any player who has it enabled, even non-OPs, can now use /trigger home set
or /trigger home add
to manipulate their "home" scoreboard objective.
You can add a /tp @a[score_home_min=1] X Y Z
on a clock to have it so anyone who does /trigger home set 1
in chat is teleported home. Follow it up with setting their home score back to 1, so they aren't constantly teleported, and re-enable the objective for them, so they can use it again.
Solution 2:
Not in vanilla Minecraft, no. There is no way in vanilla Minecraft on a vanilla server to implement any sort of custom chat commands, or detect any sort of chat events.