You can now forward data to servers using the API, this method will able you to send rewards or any data you want between servers..
Subchannel is named Splegg.
Key is any value you want, e.g you can use "winner" to identify that the data is from the winner.
I recommend you adding a delay to send data.
If you don't like how it works, you can do your own method using the Game Events on API.
Sending data
Code (Text):
@EventHandler
public void onGameEnd(GameEndEvent e) {
Player winner = e.getWinner();
if(Splegg.getAPI().forwardData(winner, "ALL", "winner")) {
Bukkit.getLogger().info("Data sent.");
}
}
Receiving data
Code (Text):
@Override
public void onPluginMessageReceived(String channel, Player player, byte[] message) {
if (!channel.equals("BungeeCord")) {
return;
}
try{
DataInputStream in = new DataInputStream(new ByteArrayInputStream(message));
String subchannel = in.readUTF();
if (subchannel.equals("Splegg")) {
short len = in.readShort();
byte[] data = new byte[len];
in.readFully(data);
String s = new String(data);
//player:key/server
Bukkit.getLogger().info(s);