added spigot side and action bar

This commit is contained in:
ajgeiss0702
2020-05-12 09:13:56 -07:00
parent 77b5d3e507
commit 6634e1dbc9
10 changed files with 212 additions and 11 deletions
@@ -0,0 +1,26 @@
package us.ajg0702.queue.utils;
import java.util.Collection;
import com.google.common.io.ByteArrayDataOutput;
import com.google.common.io.ByteStreams;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.connection.ProxiedPlayer;
public class BungeeUtils {
public static void sendCustomData(ProxiedPlayer player, String channel, String data1) {
Collection<ProxiedPlayer> networkPlayers = ProxyServer.getInstance().getPlayers();
// perform a check to see if globally are no players
if ( networkPlayers == null || networkPlayers.isEmpty()) return;
ByteArrayDataOutput out = ByteStreams.newDataOutput();
out.writeUTF( channel );
out.writeUTF( data1 );
// we send the data to the server
// using ServerInfo the packet is being queued if there are no players in the server
// using only the server to send data the packet will be lost if no players are in it
player.getServer().getInfo().sendData( "ajqueue:tospigot", out.toByteArray() );
}
}