BungeeCord plugin message not being received.

Discussion in 'BungeeCord Plugin Development' started by SenpaiiCat, Jan 10, 2020.

  1. Hello, everyone. I have a huge node of servers on a bungee cord network (around 500), which are turned on when needed. Not asking for suggestions to change this cluster as the network I am working on has been using this "method" for at least 3 years, so I am not interested in alternatives. What I am asking for is assistance as to why my plugin message is not being received :(
    Code (Text):
        public void onEnable() {
            Bukkit.getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");

        private void sendServerInfo() {
            JSONObject data = new JSONObject();
            data.put("port", getServer().getPort());
            data.put("name", getConfig().getString("type"));

            ByteArrayOutputStream  b = new ByteArrayOutputStream();
            DataOutputStream d = new DataOutputStream(b);
            try {
            } catch (IOException e) {
            Bukkit.getServer().sendPluginMessage(getPlugin(NotifyStartup.class), "BungeeCord", b.toByteArray());
    The above is the code I am using for sending the plugin message to my bugeecord server. Below this is the code for receiving the plugin message.
    Code (Text):
    override fun onEnable() {
        proxy.pluginManager.registerListener(this, this)
    //... (same class). Event is being called for when the "porter" channel receives a message.
    fun onPluginMessage(e: PluginMessageEvent) {
        if (e.tag != "BungeeCord") return
        val din = DataInputStream(ByteArrayInputStream(e.data))
        try {
            val chan = din.readUTF()
            val input = din.readUTF()

            when (chan) {
                "porter" -> {
                    val p = proxy.getPlayer(e.receiver.toString())
                    proxy.pluginManager.dispatchCommand(p, input)
                "notify" -> {
                    println("notify: $input")
                else -> return

        } catch (e: Exception) {
    I know the above code is written in Kotlin, and so if someone needs me to convert it into Java, I will do so, so you can understand it. But I don't think you should face any issues!. The main problem I am facing is that the notify: $input is not being printed to console whenever a server (on the network) is whipped up.. :(. Any further questions are welcome.
  2. You cannot send plugin messages like you do there. The method is not working.

    You need a player online to send a plugin message. That player must be connected thrugh your bungeecord. If a player is online, use player.sendPluginMessage(...)