Solved Hide Command From Console?

Discussion in 'Plugin Development' started by thefiscster510, Oct 25, 2012.

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


    Is there any way to make a command not log to console../
    like whenever i do a command, it shows
    20:39:41 [INFO] thefiscster510 issued server command: /somecommand
    I want to make it so that ONLY when they use the "somecommand" command it won't show in console.. No others

    Some help here would be awesome :3 Kinda want to get this done either tonight or tomorrow..

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: May 29, 2016
  2. Offline


    I know that this won't help much, but I definitely know that this is possible. I have a few plugins that I run on my server that do this.
    I know one workaround that may work. Try using PlayerCommandPreproccessEvent. I don't know 100% if it will work, but I do know that you do not have to register the commands in the plugin.yml and as a result of this the command may not be logged to the console. Also this event is recommended to only be used in extreme situations, so if you can find another way, I suggest you do so.
  3. Offline


    I registered the commands outside of the plugin.yml using a CommandMap, but I need to make it so that they don't log to the server.. I've thought about using PlayerCommandPreproccessEvent but there is no "event.logtoconsole(false)" or anything like that that i can find..
  4. Offline


    Well, correct me if I am wrong, but I believe that if setup correctly, the PlayerCommandPreproccessEvent will not log any commands to the console.

    Also I was signed into my old account. kennylax12 = exload :)
  5. Offline


    How would I do that? (Explain in code please..)
  6. Offline


    2. @EventHandler
    3. public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event)
    4. {
    5. String[] args = event.getMessage().split(" ");
    6. Player player = event.getPlayer();
    7. if(args[0].equalsIgnoreCase("test"))
    8. {
    9. //code here
    10. event.setCancelled(true);
    11. }
    12. }
    13. }

    Ignore the crappy spacing :p
    thefiscster510 likes this.
  7. Offline


    So then, Would that work even if the command isn't registered?
  8. Offline


    If you listen for commands like that, you wouldn't have to register them and they would work in game, but they would not be recognized if you tried using them in the console. So not only would they not get logged, but they wouldn't work either. If you don't mind me asking, why don't you want to register the command.
  9. Offline


    Well, I could use ConsoleCommandEvent for console, Couldn't I? And I can't disclose WHY. It's a plugin for a private server that will never be released to the public due to security reasons.
  10. I never seen on my server that the commands are logged, can you verify if not an plugin is causing this?
  11. Offline


    Yes, I can. Actually, It's bukkit. Bukkit automatically logs commands. BUT, Using the onPlayerPreprocessCommand event handler, running my code, and then canceling the event, worked perfect :)
Thread Status:
Not open for further replies.

Share This Page