private void sendToChannel(MessageAgent agent, Player player) {
        ensureSetup();

        // create a new data output stream for the message
        ByteArrayDataOutput out = ByteStreams.newDataOutput();

        // write the channel
        out.writeUTF(agent.getSubChannel());
        // append the agents data
        agent.appendPayload(out);

        byte[] buf = out.toByteArray();
        player.sendPluginMessage(this.plugin, CHANNEL, buf);

        // if the agent is also a MessageCallback, register it
        if (agent instanceof MessageCallback) {
            MessageCallback callback = (MessageCallback) agent;
            registerCallback(callback);
        }
    }
Sends (or queues the sending of) the message encapsulated by the given message agent

@param agent the agent
helper/src/main/java/me/lucko/helper/messaging/bungee/BungeeCordImpl.java