Uh, the JavaDocs are pretty clear. The actual explanation, however, resides in SpongeDocs.
To properly use it, make multiple CommandSpecs for each subcommand, then add them as children to the main /ru command. So for instance:
CommandSpec check = CommandSpec.builder()
CommandSpec cs = CommandSpec.builder()
By the way, note the permission change. A permission automatically inherits things that look like child permissions, so granting rankupper.check automatically grants rankupper.check.others as well. It is explained in SpongeDocs that you should append .self to permissions for commands that require an extra permission to operate on others.
Each subcommand gets its own CommandExecutor. You can use lambdas to simplify this.
RUCommand commands = new RUCommands();
And you would have a method just like execute() but named check(). This way you can fit multiple ones in one class.
In your command executor for /ru check, you’d get the player like so:
Player player = args.getOne("player").get();
If you’re targeting a User instead of a Player, you can use GenericArguments.userOrSource() (which I wrote! :3) instead of GenericArguments.playerOrSource().
A couple of other things:
You know that CommandResult you created? Take a look at the method name.
This indicates success. If the command failed, don’t return a success, throw a CommandException. That’s what they’re for. The argument for the constructor is a Text, this will be shown to the player. You can also put a boolean after the Text, and if it’s true, it’ll show the usage to the player.
Also, for things that show numbers to the player, maybe try returning a more descriptive result.
This can be used in command blocks and such by mapmakers.
Essentially, the high-level API is about having Sponge do everything for you. Instead of doing a switch statement on a string, make subcommands. Instead of checking UserStorageService, say that you want a User. Instead of returning success at every point, do things relevant to what actually happened.
In fact, you seem to have skimmed over a lot of SpongeDocs. Things such as injection.
@Inject Game game;
@Inject @ConfigDir(sharedRoot = false) File file;
@Inject PluginContainer container;
Things like that.
I’d recommend a read of basically all the docs before writing more plugins.