Need to stop a command from being logged

Discussion in 'Spigot Plugin Development' started by ChromeHD__, Jun 29, 2018.

  1. I am working on a plugin that requires the player to enter sensitive information and i am needing to hide said information from console. So far i have tried log filters log appenders to no avail hence why i am posting here for suggestions.

  2. So I tried a few different things, and here's the best option I could think of:

    Code (Text):
    on command "/password":
      add player to list;

    on async player chat event:
      if list contains player:
        string info = message;
        remove player from list;
        cancel chat event;
    This works because if you cancel the chat event, the message doesn't get logged.

    Example GIF:
    #2 FloThePony, Jun 29, 2018
    Last edited: Jun 29, 2018
  3. I dont want the user entering multiple command just to use it i know its possible its just trying to figure out how
  4. Try CommandPreprocess event
    Check the event cmd and cancel the event if it is the player's password
  5. That doesn't work. It stops the effects of the command, but still logs it.
  6. Yeah i tried that also did not work
  7. You can use the AsyncPlayerChatEvent to handle the command iirc.
  8. I just tested it and you can't.
  9. Mayvbe intercept packets and read them
  10. Try to use the CommandPreProcess and just run the code in there instead the command executor.
  11. Cancelling the command preprocess event does not stop it from being logged in the console, but cancelling async player chat event does.
    That would make the obvious answer to listen for the command in the chat event, but the chat event isn't called when running a command.
    I think the answer is still my first response here: