package eu.mhsl.craftattack.teamLobby.util;

import com.google.common.io.ByteArrayDataOutput;
import com.google.common.io.ByteStreams;
import net.minestom.server.entity.Player;
import net.minestom.server.network.packet.server.common.PluginMessagePacket;

public class PluginMessageUtil {
    private static final String bungeeTargetSelector = "bungeecord:main";
    public static void connect(Player p, String bungeeServerTargetName) {
        ByteArrayDataOutput out = ByteStreams.newDataOutput();
        out.writeUTF("Connect");
        out.writeUTF(bungeeServerTargetName);
        p.sendPacket(new PluginMessagePacket(bungeeTargetSelector, out.toByteArray()));
    }
}
