1.17.x How to remove the default ban message

Discussion in 'Spigot Plugin Development' started by NorthyMc, Jun 23, 2021.

  1. Okay, so I'm trying to make a custom ban message.
    The kick message the first time is okay, but when a player tries to join they get the annoying text before the reason:

    You are banned from this server.
    Reason:

    I just want the reason and nothing else, so I can customize it.
     
  2. I solved it. For everyone that wants to know how, here is the code:
    Code (Java):
    @EventHandler
        public void onLogin(PlayerLoginEvent event) {
            if (event.getResult() == PlayerLoginEvent.Result.KICK_BANNED) {
                event.setKickMessage("Test\nTest");
            }
        }
     
  3. Code (Text):
        @EventHandler
        public void playerBanLoginEvent(PlayerLoginEvent e) {
            Result r = e.getResult();
         
            if(r == Result.KICK_BANNED) {
                e.setKickMessage("ยง4Your Ban Message");
            }

        }