mojira.dev
MC-79677

/execute does not execute as a Player (or entity)

if you want to execute for example the command

/execute @r ~ ~ ~ scoreboard teams join Team 4

it will give you two error messages:
Player 'commands.generic.player.unspecified' cannot be found
and
`Failed to execute 'tp ~ ~1 ~' as <Player name>
where <Player name> is the @p player.
There are three bugs here, but if one gets fixed, the others become irrelevant:

  • The command doesn't work like it would if it got executed from the player (which execute should simulate).

  • The player name doesn't get put into the first error message. If the target selection for example meets an item, it gets displayed the same way as in the /kill feedback, but not for the player.

  • There are two error messages for one error.

If the first one gets fixed, the other two get irrelevant.

Linked issues

Comments 15

What is the exact error message ?

Confirmed for

  • 1.8.4 it will give you first the syntax error: Syntax:/scoreboard teams join <team> [<player>] and then the error message that it failed executing the command

Confirmed for every command with optional player argument, so /kill, /gamemode MODE and maybe some more.

Maybe relates to: MC-78779

And partwise duplicates: MC-65290

I would hazard a guess and say that the /execute command is run by the console at the position of all eligible entities. That is, the command is not run by the entities in the first place, so it needs a selector (the console can't target itself).

Then maybe MC-55510 relates to it because it was probably caused by the same issue

If you try to execute the command

execute @a[c=1,team=!ZOMBEYKRIEGER] ~ ~ ~ execute @p[c=1,team=!MongoClan] ~ ~ ~ execute @p[c=1,team=!4] ~ ~ ~ scoreboard teams join 3

in a command Block it will give you

[12:15:23] Failed to execute 'execute @p[c=1,team=!MongoClan] ~ ~ ~ execute @p[c=1,team=!4] ~ ~ ~ scoreboard teams join 3' as RoiEX

as ERROR

5 more comments

Confirmed for 15w43c

This has been fixed for relative coordinates in 16w21b. I would like to sincerely thank Mojang for actually fixing the bug instead of taking the approach they did with MC-108. I can now finally get my teleporters working the way they should.

Unfortunately, the other bug detailed in this report (needing an argument in an execute command when a command actually run by the player doesn't need one) has not yet been fixed. I suggest that they are split into 2 separate reports- change this one to be about relative coordinates, and make MC-65290 about the unnecessary arguments.

It seems as though no such issue has been created; if it were, would it not get duplicated back to this issue now? I think it should be created.

To amend my previous statement- The bug about relative coordinates has been fixed for all nonplayer entities. It still happens when executing at a player. This causes more inconsistencies, and is arguably even worse than the way it was before.

A more detailed description, also containing special cases for help, seed, msg and publish is at MC-108965.

Robin T.

michael

Community Consensus

Minecraft 1.8.3, Minecraft 1.8.4, Minecraft 1.8.6, Minecraft 15w37a, Minecraft 15w43c

Retrieved