1//onEnable in Main class
2getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
3
4//When you want to connect the player
5//"server" is the server name the player should connect to
6//the variable "player" is the player you want to connect
7ByteArrayDataOutput out = ByteStreams.newDataOutput();
8out.writeUTF("Connect");
9out.writeUTF("server");
10player.sendPluginMessage(main, "BungeeCord", out.toByteArray());