Running Commands from Different Plugins

Hi

I searched through the forums to see if it was possible to execute a command that comes form a different plugin
I’m trying to run a command through luckperms to set a players group

/lp user Tyiwnl switchprimarygroup pawn

I’ve tried

game.getCommandManager().process(game.getServer().getConsole(), “lp user " +playerName + " Tyiwnl switchprimarygroup pawn”);

But the command isn’t running and I keep getting this error in console

Error - Pastebin.com

Thanks in Advance!

Your stacktrace suggests that you are getting an error at: Listeners.onInteractItemSecondary(Listeners.java:58)

I expect Listeners is your class. Without your code, we cannot help you debug this effectively, but something is coming up null on line 58.

That being said, my guess is that game is null, because you’ve put an @Inject on the Game game field, but Listeners isn’t your main class. Try replacing game with Sponge.getGame().

Thanks for the reply!

I totally forgot to mention that the error was on line 58 which was the code game.getCommandManager().process();

Sponge.getGame() Fixed this perfectly

Thanks