Server Menu

Discussion in 'BungeeCord Plugin Development' started by arci224, May 4, 2017.

  1. Hi i have problem, i creating my own first plugin -> Server menu, i have all with count players via bungeecord api -> Message Listener. And i can´t find how to get server if offline and if server offline then api give me same number when server online and empty -> 0 .. how can i fix that ? i need get server when offline and when online Thank for help.. Sorry for my bad english
    Code (Text):
    public void onEnable() {
            getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
            getServer().getMessenger().registerIncomingPluginChannel(this, "BungeeCord", this);
    public void onPluginMessageReceived(String channel, Player player, byte[] message) {
            if (!channel.equals("BungeeCord")) {
            ByteArrayDataInput in = ByteStreams.newDataInput(message);
            String subchannel = in.readUTF();
            if (subchannel.equals("PlayerCount")) {
                String server = in.readUTF();
                int playerCount = in.readInt();
                addServerMenu(server, playerCount, player);

    public void addServerMenu(String server, int playerCount, Player player)
            String mng1 = "mng1";
                createDisplay(Material.EMERALD_BLOCK, myInventory, 4, "Survival 01", "Status: Online", "Počet hráčů:" + playerCount + "/50", "", "");

    public void getCount(Player player, String server) {
            if (server == null) {
                server = "ALL";
            ByteArrayDataOutput out = ByteStreams.newDataOutput();
            player.sendPluginMessage(this, "BungeeCord", out.toByteArray());
  2. Hey,
    There is no channel method, so I think you have to get the status you want with Sockets :p
  3. Can you send cde please i dont know how to work sockets