mcspring-boot icon indicating copy to clipboard operation
mcspring-boot copied to clipboard

DispatchCommand doesn't work properly

Open CC007 opened this issue 4 years ago • 2 comments

Using Bukkit.dispatchCommand(sender, cmd) doesn't seem to work properly with picocli. The command is fired, because I don't get the text that I entered an unknown command, but the run() method did not get executed.

CC007 avatar May 11 '20 00:05 CC007

Also I know that you have a command executor bean, but if another plugin want to call these commands, they will be unable to do so, since they aren't using mcspring-boot.

CC007 avatar Jun 01 '20 20:06 CC007

This is probably caused by the native command registration. In the case of a unexpected exception, it will fallback to event listeners, causing it to not work with dispatchCommand. mcpsring-boot already keeps track of that in a log in debug level, I raised it to warn in 0.20.7:

https://github.com/Alan-Gomes/mcspring-boot/blob/6e657cadb35e08d5b3a366ac9cbfbde5826ea4bd/src/main/java/dev/alangomes/springspigot/command/CommandService.java#L67-L80

Please let me know if this reports something in your console.

Alan-Gomes avatar Jul 06 '20 21:07 Alan-Gomes