Stop certain command from logging in console?

Discussion in 'Plugin Development' started by Boobah, Sep 4, 2017.

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

    Boobah

    How do I stop a certain command from logging in console? I've got this that doesn't work:
    Code:
    public class Cmd_2fa implements Listener {
    
        @EventHandler
        public void command(PlayerCommandPreprocessEvent event){
            Player p = event.getPlayer();
           
            if(!event.getMessage().startsWith("/"))
                return;
            String[] args = event.getMessage().split(" ");
           
            if(!args[0].equalsIgnoreCase("/2fa"))
                return;
           
            if(!p.hasPermission("auth.staff")){
                p.sendMessage(Main.getInstance().noperm);
                return;
            }
            event.setCancelled(true);
    The command still logs to console. could anyone help?
     
  2. Offline

    Zombie_Striker

    @Boobah
    You can't. You can block the action, but the console will still print out the message.

    Why don't you want to log the command? Only the server owner can see the console, so you should not have to worry about the command if you are using it on your server.
     
  3. Online

    timtower Administrator Administrator Moderator

    @Boobah This looks like a login plugin with 2 factor authentication.
    Why would you need one?
     
  4. Offline

    Boobah

    If console is compromised then people can see passwords. I don't want that.

    Also I'm sure other plugins like AuthMe have done it.
     
  5. Online

    timtower Administrator Administrator Moderator

  6. Offline

    Boobah

    Server is online mode. making the plugin for staff only just in case they are compromised.
     
  7. Online

    timtower Administrator Administrator Moderator

    Then use the Conversation api and hope nobody is listening.
     
  8. Offline

    Horsey

    You can hook into the ConsoleLogEvent with my plugin: <Edit by Moderator: Redacted not allowed paid resource url>
     
    Last edited by a moderator: Feb 10, 2021
Thread Status:
Not open for further replies.

Share This Page