spigot run command in console and get response code example
Example: spigot execute command as console
ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();
String command = "command";
Bukkit.dispatchCommand(console, command)
ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();
String command = "command";
Bukkit.dispatchCommand(console, command)