Plugin Messages not working

Discussion in 'BungeeCord Plugin Development' started by TGlev, May 29, 2015.

  1. Hello,

    I started working with Plugin Messages today. I got a small problem though. Whenever I try to send a plugin message in code, it doesn't do anything. But when I force shutdown the server (Just clicking the cross), it suddenly is sended to the other server. When I type /stop in the console, nothing happens.

    My code:
    Code (Text):
    public class Main extends JavaPlugin implements PluginMessageListener, Listener{

        String channelName = "BungeeCord";
        final JavaPlugin instance = this;

        public void onEnable(){
            //this.getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");

            this.getServer().getMessenger().registerOutgoingPluginChannel(this, channelName);
            this.getServer().getMessenger().registerIncomingPluginChannel(this, channelName, this);

        public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {

                 ByteArrayDataOutput out = ByteStreams.newDataOutput();
                 byte[] data = "TEST".getBytes();
                 this.getServer().sendPluginMessage(this, "BungeeCord", out.toByteArray());

            return true;
    I got a tiny plugin on the other side which broadcasts all recieved messages, I know this works because when I join the server using the BungeeCord command, I see the message getting broadcasted.
  2. Idk what writeUTF is... but usually dont you want to use System.out.println or getLogger() method in the code for the console to get messages? =/ idk im a noob and still learning java/bukkit coding.
  3. This has nothing to do with sending messages to players and consoles. It is a way of servers communicating with eachother over the bungeecord network. Still thanks for thinking with me, though.
  4. Oh... completely sorry XD. I aint advanced enough sorry man. But someone help this guy!
  5. I'm confused, first you're saying the message isn't getting sent, but later you say it does send it. You háve to have a player on a server (not the proxy) to be able send and recieve plugin messages, this might be your issue.
  6. Thank you! This was indeed my issue!