how to let a console send commands spigot code example
Example: how to send commands to console spigot plugin
getServer().dispatchCommand(getServer().getConsoleSender(), "command");
getServer().dispatchCommand(getServer().getConsoleSender(), "command");