Get console output

Discussion in 'Plugin Development' started by DarkenCake, Aug 11, 2016.

Thread Status:
Not open for further replies.
  1. Offline

    DarkenCake

    Hello forum.
    So I need to send a message to player when something happens in console.
    For example: "Enabling PermissionsEx...", so I need to send this message in chat, how can I do it?
     
    Last edited: Aug 11, 2016
  2. Offline

    Zombie_Striker

    @DarkenCake
    You can use Bukkit.broadcastMessage() or for loop through all the players online and individually send them a message using Player.sendMessage().
     
  3. Offline

    DarkenCake

    You are such a genius, thank you.
    My question is - how can I get what console returns when console issued command.
    As I said, for example:
    I type "pex group" in console, so, I need to get an "answer" on this command, like:
    "PermissionsEx groups:"
    "default"
    etc
    I did this:
    HTML:
            Bukkit.getLogger().addHandler(new Handler() {
    
                @Override
                public void close() throws SecurityException {
                    // TODO Auto-generated method stub
                  
                }
    
                @Override
                public void flush() {
                    // TODO Auto-generated method stub
                  
                }
    
                @Override
                public void publish(LogRecord rec) {
                    for (Player p : Bukkit.getOnlinePlayers()) {
                        p.sendMessage(rec.getMessage());
                    }
                }
            });
    Returns any messages like "Enabling plugin v...."
    But as I said, my aim is another thing.
     
    Last edited: Aug 11, 2016
  4. Offline

    Zombie_Striker

Thread Status:
Not open for further replies.

Share This Page