Disable specific join message

Discussion in 'BungeeCord Plugin Development' started by Christophe6, Jun 24, 2016.

  1. Hello,
    I am new to BungeeCord. I want to disable join and leave messages when the player gets kicked by the server... Otherwise it has to be shown.
    Code (Java):
        public void onPostLogin(PostLoginEvent e) {
            List<ProxiedPlayer> normalplayers = new ArrayList<ProxiedPlayer>();
            for(ProxiedPlayer p : ProxyServer.getInstance().getPlayers()) {
                if(!p.hasPermission("vipjoin.join")) {
            if(normalplayers.size() >= (20 + 1)) {
                ProxiedPlayer player = e.getPlayer();
                if(player.hasPermission("vipjoin.join")) {
                    player.sendMessage(new TextComponent(ChatColor.translateAlternateColorCodes('&', "&6Welcome! The server is full, but beacause you have a rank, you can join.")));
                player.disconnect(ChatColor.translateAlternateColorCodes('&', "&6There is no slot left for default users. Buy a rank to join, if the server is full! &5Store: &owww.example.com"));
  2. MiniDigger


    the join and kick messages are handles by the spigot servers not by the proxy.
    • Like Like x 1
  3. @MiniDigger
    How to communicate with the spigot server and say: "Hey, disable the join/leave message"??
  4. MiniDigger


    plugin messaging channel
    • Like Like x 1
  5. @MiniDigger
    I tried to understand the messaging channel. But how should I do that?????
  6. MiniDigger


    create a subchannel, send a message to all spigot servers: "don't show join/leave messages for player <name>"
    then you listen to that on your spigot servers and disable the messages there.
    • Like Like x 1
  7. @MiniDigger
    So I have to make a spigot plugin also?
  8. MiniDigger


    yep. you want to change how the server behaves. because of that you need a plugin for the server.
    • Like Like x 1
  9. @MiniDigger
    I used this code on my spigot server.
    Code (Text):
    package com.christophe6.vipjoinspigot;

    import org.bukkit.entity.Player;
    import org.bukkit.plugin.java.JavaPlugin;
    import org.bukkit.plugin.messaging.PluginMessageListener;

    import com.google.common.io.ByteArrayDataInput;
    import com.google.common.io.ByteStreams;

    public class MainClass extends JavaPlugin implements PluginMessageListener {
        public void onEnable() {
            this.getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
            this.getServer().getMessenger().registerIncomingPluginChannel(this, "BungeeCord", this);
        public void onDisable() {
          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("VipJoinChannel")) {
              // Use the code sample in the 'Response' sections below to read
              // the data.
    That server has to check for a specific message: (Don't show join/leave messages). How to check that and where?
    And where and how can I send that message from the bungeecord plugin?

    Thank you very much to help me out!
    #9 Christophe6, Jun 24, 2016
    Last edited: Jun 24, 2016