4

This question already has an answer here:

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?

marked as duplicate by Virusbomb, greg-449, B. S. Morganstein, Tim S., galacticninja Jul 18 at 4:47

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 2
    No, but you could use book and quills. I once made a system that detected players who had written commands in books and quills, and when they had, they had something execute at them. It's currently in one of my singleplayer worlds, but I'm not able to access them at the moment. If you give me a few days, I can send you the world, or the commands I used. (By the way, one command I had set up was /home.) – A.J. Ruckman Mar 27 '15 at 14:46
  • One way to monitor chat is to have "choose-your-adventure" format, ie made with /tellraw commands that have a click event which causes the player to choose what they say, and control functioal reactions by setting clickEvent areas to place redstone blocks in a possibly remote system. – Chemical Comrade Nov 30 '16 at 5:04
10

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.

  • Sorry if I missed something, but how does this test if the player is saying something in chat? – 2xedo Mar 27 '15 at 19:23
  • 2
    @tuxedoandex It tests if the player types /trigger home into chat. It won't appear in chat for other players as it's a command, but appearing in chat for other players to see does not seem to be a requirement for OP's question. It's more of a workaround than exactly what was wanted, but it should still work. – SirBenet Mar 27 '15 at 19:49
  • THIS CHANGES EVERYTHING! you could make reformatted commands so typing "/trigger spawn" would teleport you to spawn, thus bypassing the needs for plugins! THANK YOU!!! – Chemical Comrade Nov 30 '16 at 5:06
7

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.

0

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

-2

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.

  • 1
    What plugin is this exactly? – Unionhawk Apr 26 '16 at 1:41

Not the answer you're looking for? Browse other questions tagged or ask your own question.