Whats the best way to connect a processing sketch to a minecraft server

i have a bukkit server running on ubuntu 20
i would like to have a processing sketch automatically trigger commands to make various games on the server
i could do this by simply using java.awt.robot to paste commands into the console but im confident theres a better way to do this