Disabling join messages to the console?

Discussion in 'Spigot Plugin Development' started by Moderance, May 30, 2016.

  1. So every time a player joins it will notify the console, I know there's a PlayerJoinEvent but how do I stop join/leave messages printing to the console because I have set up a ban system and it prints multiple lines to the clients screen, reason, date, who by, etc.. and on the console it does the same and looks like this:


    Just a huge bulk of text is printed to the console because of all the new lines, anyway I can stop this from happening?
  2. on the PlayerJoinEvent, set the join message to null.
  3. Didn't work, still prints to console
  4. picture of console when you did this ?
  5. Same as above
  6. how about set the join message to " "
  7. Did that previously, plus that will print a line in game to all online players
  8. oh yes you're right. what about inside the PlayerJoinEvent set the join message to null then getConsoleCommandSender then sendMessage(null);
  9. Could you give an example in code please?
  10. Code (Java):
    // void PlayerJoinEvent e {
     // set the join message to null
     ConsoleCommandSender console = Bukkit.getServer().getConsoleCommandSender();
     console.sendMessage(String message);
  11. Code (Text):
                ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();
                console.sendMessage("[Alert] " + player.getName() + " tried to join but is currently banned!");
    Prints both
  12. oh now I know what you're trying to do.

    first try to check if the player is banned, if so send message to console without setting the join message to null, use e.setCancelled(true); to stop him / her from joining.
    • Optimistic Optimistic x 1
  13. You can't cancel a PlayerJoinEvent..
  14. sorry not in my desktop try kicking player.
  15. ...???? That's what I'm doing.. the question is how do I hide kick message from the console?
  16. use the PlayerKickEvent then set the leavemessage to null.
  17. Code for what you're doing now?
  18. I just want to prevent the player.KickPlayer(MSG) from pasting in the console
  19. Nope
  20. I don't really get it what's the point you're hiding it in console ?