Universal command to string convertion

Hello guys,
Is there a way to get command with all arguments to a single string?

To clarify, after player types any command, for example:
/exampleCommand argument1 argument2,
I want to be able to get this string:
“exampleCommand argument1 argument2”

Thanks for help

Listen for the SendCommandEvent

https://jd.spongepowered.org/7.3.0/org/spongepowered/api/event/command/SendCommandEvent.html#getCommand--
https://jd.spongepowered.org/7.3.0/org/spongepowered/api/event/command/SendCommandEvent.html#getArguments--

@AuroraLS3 One more… what should I use to get command sender?
I see those methods from Event:

getCause, getContext, getSource

But I have no idea which one to use, and I am unable to perform tests.

I’m not sure I follow - are you trying to implement a command? Plugin Commands — Sponge 7.2.0 documentation

@AuroraLS3 I am trying to do a custom command (or to clarify - arguments) handler. I hate the Sponge’s version, I came here from Bukkit.

I am trying to get:
A) Command & it’s args :white_check_mark:
B) Command sender

Well getSource is whatever called it. It might be a player or it might be the console or something else, so you will need to do an instance of check

Much appreciated!

Interesting you hate the sponge command system. You can register a new command with the unparsed argument making it pretty much identical to the Bukkit version (the only difference is that all the arguments are a single string instead of a array, but thats a easy split).

The traditional sponge command system was designed to make things simpler and more compatibile with everything (in bukkit before 1.13, many plugins didnt use tabs, yet its hard to find a Sponge plugins that doesnt).

I mean i always hated looking at all my code to parse a string argument in Bukkit, in Sponge its either handled by sponge itself or a small section of code in a class on its own

Well, I love string arguments because I have 100% control over them. Sometimes I have a situation when when arg 1 == “a”, then arg 2 must be a string, and when arg 1 == “b”, then arg 2 must be a player.

I know it’s possible in here, but… it’s not on my nerves ;D

Fair enough. The easiest way to handle that is registering the command as a child of the main command. You can also do flags. Both are one liners