Is there a way to test if someone has said something in chat? [duplicate]

Is there a way to test if someone has said something in chat? [duplicate] - Positive stylish multiethnic women talking and crossing road in city

What I want to do is make a command that allows me to say something like "home" in the chat, and have a command block teleport me to my house. Is there a way to test for a word in chat?



Best Answer

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.




Pictures about "Is there a way to test if someone has said something in chat? [duplicate]"

Is there a way to test if someone has said something in chat? [duplicate] - Diverse pupils talking while looking at textbooks and preparing for test near school
Is there a way to test if someone has said something in chat? [duplicate] - Woman in White Sweater Writing on White Paper
Is there a way to test if someone has said something in chat? [duplicate] - Wooden Bridge on Rainforest





Checkmarks in Chat Apps




More answers regarding is there a way to test if someone has said something in chat? [duplicate]

Answer 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.

Answer 3

In addition to the above answer, if you're using the home functionality, you might also want to repeat the steps above to create a sethome trigger, then use a command to set an armorstand there with a unique name.

See How to enable home / sethome on a Vanilla Minecraft Server

Answer 4

Yes, it's possible to /testfor if someone is saying something in chat but you need plugins (/testforchat). Then you put in any text that you want the player to say and then you can mess around with it.

Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

Images: Tim Douglas, Mary Taylor, cottonbro, Pixabay