TransWikia.com

How to detect a players name in minecraft without testfor command in minecraft

Arqade Asked by brain challenger on March 13, 2021

I know that you can use testfor @p, but imagine the adventure maps or story maps if you care about chats. You will see it knows your name; for example, if the player name is "345tyou", we can have a simulated conversation where the player name is substituted in:

(DAD):345tyou u have to buy cookies
(345tyou) okay dad

The map should be able to detect the player’s username and substitute it in where required: like flowerpot22

(DAD):flowerpot22 u have to buy cookies
(Flowerpot22)okay dad

I think it has some thing to do with command blocks.

One Answer

Try generating a Json String.

The selector allows you to dynamically substitute an entity's name in your text, with the argument being a selector string. For example:

..., {"selector": "@p"}, ...

Will print the closest player.


Note that @p will select the closest player to the command's source (command block, likely).
To select the player it is displayed to, use @s for 'self'.

Answered by aytimothy on March 13, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP