How do I get an offline player as an argument?

I’m trying to create a command with a player argument which quite often will be used when the player is offline, I’m still fairly new to sponge programming so i’m not entirely sure as to how i should do this. Any help will be greatly appreciated!

There’s an open issue for using Users in command arguments:
https://github.com/SpongePowered/SpongeAPI/issues/583

I wrote a parser for EssentialCmds for exactly this use case:

You can then just use the argument like you would the GenericArguments in the argument builder, using new UserParser(Texts.of("player"))

Feel free to use that. It’s MIT licensed anyway. @gabizou - if any of that is useful to you as a base, go ahead and use it!

@zml actually did this, just not in master yet
https://github.com/SpongePowered/SpongeAPI/commit/d35277359b0afd978f09721ca49110b575c89545

1 Like

This looks great, i think i’ll use this for the time being until Users are implemented for arguments, thanks for letting me use it

Not a problem! :slight_smile: