Bungeecord Plugin Message Channels

Discussion in 'BungeeCord Plugin Development' started by TehJan, Apr 18, 2017.

  1. Hello everyone,
    I have problem, getting the PlayerCount of a Server.
    I use the Bungeecord Plugin Message System, but when I ask the PlayerCount of a Server(
    Code (Text):

    ByteArrayOutputStream b = new ByteArrayOutputStream();
     DataOutputStream out = new DataOutputStream(b);
     }catch(IOException ex){
     Collection<? extends Player> players = Bukkit.getOnlinePlayers();
     Player p = Iterables.get(players, 0);
     p.sendPluginMessage(plugin, "BungeeCord", b.toByteArray());
    ), I get 873333 as answer(There are 0 players on the server).
    I registered the messaging Channel (outgoing and incoming).
    My incoming method looks like this:
    Code (Text):

     public void onPluginMessageReceived(String channel, Player player, byte[] message) {
     this.getLogger().info("Got Plugin Message on " + channel + " from " + player.getName() + " message was: " + message.toString());
     ByteArrayDataInput in = ByteStreams.newDataInput(message);
     String subchannel = in.readUTF();
     int playercount = in.readInt();
     Bukkit.broadcastMessage("" + playercount);
    Thank you for your help!
  2. By what print (you got 3 console output commands). Post the complete output of all 3 commands.

    Then this:
    would return null?

    What is "server"?