Solved Messaging channel not working

Discussion in 'BungeeCord Plugin Development' started by FiXed, May 26, 2016.

Thread Status:
Not open for further replies.
  1. Code (Java):
        public final void connect(Player player, String server) {
            ByteArrayOutputStream b = new ByteArrayOutputStream();
            DataOutputStream out = new DataOutputStream(b);
           
            try {
                out.writeUTF("Connect");
                out.writeUTF(server);
            } catch (IOException e) {
            }
            player.sendPluginMessage(Main.getPlugin(), "BungeeCord", b.toByteArray()); // ERROR HERE
        }
    So I was trying to allow players to connect using this but it doesn't seem to work, yes the server I have it with actually exists so it should be working. What am I doing wrong? The plugin is not null.
     
  2. In main class in onEnable add
    Code (Java):
    getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
     
  3. Thanks, fixed
     
Thread Status:
Not open for further replies.