Closed Lamp-Post closed 9 years ago
I'm unable to replicate the functionality you've described in regard to the /help command on a local Sponge server. Is this PR tested?
I think the better way to implement this is to register the commands in Bukkit directly in Sponge's command service and remove the CommandEvent
. That way it will also work when called through the CommandCallable
directly.
@caseif I've tested it, and noticed it too. But this is because it is not yet implemented by Sponge, it is in the SpongeAPI. @Minecrell I've also thought of that, the only problem I came across was that I only get the arguments of the command, not the command itself. So I cannot pass it on to Pore.
I guess you would need to create a custom CommandMap
implementation that forwards everything to Sponge's CommandService.
I mean, when the command is being called, this method in CommandBase
is called:
public Optional<CommandResult> process(CommandSource source, String arguments) throws CommandException
the command is being called, but I only get the source of the command and its arguments not the command itself So I do not know which command is being called
Nevermind I can also store the command itself in CommandBase
for every command when it is being registered
You can find the Lapis code style for both Eclipse and IntelliJ in https://github.com/LapisBlue/Commons/tree/master/etc .
@Lamp-Post Is this ready to merge?
@Minecrell yes it is
@Minecrell ready if you don't mind having no tab-complete support...
After looking into it some more, I decided to implement this a little bit different. Basically, your way has the following problems:
The custom PoreCommandMap
lets Sponge handle the complete command handling which should be more reliable in most cases. Thanks a lot for your contribution anyway!
With this PR commands from Bukkit plugins are getting registered to Sponge. So you get information on them, with the help command. You also do not get an error anymore saying it is an unknown command. I also changed that the commands are only being passed to the pore server, when it is a command used by a Bukkit plugin.