Closed eggohito closed 1 year ago
...if you meant to suggest player names
Ah, no no, sorry if I haven't explained it correctly. Say, for example, one wants to use the skin of a random player or a player that has a certain tag. With this PR, it can be done by using /skin set player @a[limit = 1, sort = random]
and /skin set player @a[limit = 1, tag = <tagName>]
respectively
This PR also allows using usernames of offline players. Since EntitySelector
s throw a CommandSyntaxException
if the player couldn't be found (e.g: by being offline), I used a try-catch and check if the playerName
of the EntitySelector
is null, which will be the case if the user used a target selector (e.g: @a[limit = 1, ...]
). If it is null, then the exception (in this case, it will be EntityArgument.PLAYER_NOT_FOUND
) will be thrown again. Otherwise, it will use playerName
to fetch the skin
Ah, ok, totally forgot about the @
selectors 😅.
Thanks!
This PR changes the
/skin set player
sub-command to make it accept either a username of a player (online or offline) or a target selector limited to a single player.I apologize in advance if the code is not that great, but the only method I can think of for allowing input of offline player usernames is to use an accessor to get the player name from the
EntitySelector
, which will benull
if the user were to input a target selector