send console output to player

Discussion in 'Plugin Development' started by ZahnatomLetsPlay, Aug 15, 2019.

Thread Status:
Not open for further replies.
  1. Hi!
    I'm working on a plugin for a CityBuild server and I want the plugin to send me the console output as soon as there is a new message in the console. I did some research and didnt really find what i was looking for. Since i have no idea if there is an event for console output, i'm asking here.
    Is there any way for me to get only the newest line in the console and forward it to a specific player?

    this is what I have done so far:
    Code:
    @EventHandler(priority = EventPriority.LOW)
        public void onChat(AsyncPlayerChatEvent e) {
            Player p = e.getPlayer();
            oldmsg = System.out.toString();
         
            if(consoleCMD.console.contains(p.getUniqueId())) {
                e.getRecipients().remove(p);
                if(oldmsg != System.out.toString()) {
                    p.sendMessage(System.out.toString());
                }
            }
        }
     
    Last edited: Aug 15, 2019
  2. Offline

    timtower Administrator Administrator Moderator

    @ZahnatomLetsPlay I do know that you can add a listener to the console logger.
    There is no pre-made event for it as it is outside of Bukkit. But it certainly is possible.
     
Thread Status:
Not open for further replies.

Share This Page