private void sendMessage(MessageAgent agent) {
        // check if the agent has a specific player handle to use when sending the message
        Player player = agent.getHandle();
        if (player != null) {
            if (!player.isOnline()) {
                throw new IllegalStateException("Player not online");
            }

            sendToChannel(agent, player);
            return;
        }

        // try to find a player
        player = Iterables.getFirst(Players.all(), null);
        if (player != null) {
            sendToChannel(agent, player);
        } else {
            // no players online, queue the message
            this.queuedMessages.add(agent);
            ensureSetup();
        }
    }
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