Console Command Reply

I’m familiar with sending commands to console via Sponge:

Sponge.getCommandManager().process(Sponge.getServer().getConsole(), command);

Is there a way to get the response back from the command? Or to start a ‘Conversation’ with the console to log the output of the command to a variable?

The CommandResult is in fact returned by that very function.

You’re correct in that it does return a CommandResult object. I should’ve been more specific in my original post that I’m looking for something to capture a string reply of a command sent.

For example:
if I send the command “foo” and the plugin responsible for that command replies “bar” I want to be able to catch “bar” into a variable.

From what I’ve looked at there’s no method for getting a text based response, which is why I was looking for some kind of conversation service perhaps.

Define “response”. There’s no textual result to a command, there’s just some sendMessage calls. And a conversation API is in the works.

You could override the sendMessage methods in CommandSource and delegate the other methods to the console source.
Here is an example:

This was 100% what I was looking for and got it working easily. Thanks!!