What should you return in CommandResult?

For anyone wondering the same as me, give Comprehensive Guide to CommandStats – testfor[dev] a read, it’s very informative on how Mojang handle command results.

3 Likes

I actually never knew that this is a thing in vanilla minecraft.
Some time ago, I returned .empty() at command failure but I am now throwing a CommandException. This isn’t a vanilla thing, right?

I believe that CommandExceptions are caught by Sponge, and are equivalent to a CommandResult.empty(), but with error messages displayed to the command sender, if someone knows for sure I would appreciate a reply to confirm this.

How this should work with commands that iterate over multiple targets I’m not sure.

3 Likes

Yes, this is in fact what happens. I routinely use them, and it’s even in the docs.