Carpet

Carpet

2M Downloads

Player command should accept a target selector

Username-Cant-Be-Blank opened this issue ยท 3 comments

commented

Carpet Version 1.4.29
Fabric Version 0.32.0+1.16
Minecraft Version 1.16.5
Description: The player command won't accept a Minecraft target selector
Steps to reproduce: run /player @p attack once. you will get the error Expected whitespace to end one argument, but found trailing data

commented

There was a vanilla command that errored "more than one target provided", so there is no reason to deprive people of, for example, command books interacting with the closest bot. You can limit it to just @s, and we would use it through execute as.

commented

Problem is, target selector built-in argument (for autocomplete and things, which is probably what matters) doesn't allow using that argument for non-existent players (therefore breaking player [name] spawn command, which is an important one).

Target selectors could probably be added artificially, but as said, it would probably break autocomplete for those selectors.

If you really need to use the @p/@anything commands, you could use Scarpet's entity_selector('@anything') as a replacement, though if it's for just running the command once/in chat, it would make it a bit verbose
(/script run run('player '+entity_selector('@p')+' attack once'), or something similar ).

You could probably put it in an app to make a custom command accepting selectors, though.

commented

Yeah, the reason is that fake players are not players, and you would always require just one to be provided. And also not in all circumstances @p is valid. I get ya, having ability to target @p could be useful