Solved "issued server command:" still being outputted by console

Discussion in 'Spigot Plugin Development' started by thankyouTYBG, Aug 2, 2020.

  1. Hi,

    I'm currently practicing my plugin skills and was trying to figure out a way to get "issued server command:" to not appear whenever I type in a command.

    Before, I read that using PlayerCommandPreprocessEvent would make it so the message wouldn't output. I try this out and it doesn't work.

    Code (Java):

        @EventHandler
        public void theCommand(PlayerCommandPreprocessEvent event)
        {
            String[] args = event.getMessage().split(" ");
            Player player = event.getPlayer();
            if(args[0].equalsIgnoreCase("/test"))
            {
                int id = Integer.parseInt(args[1]);
                int amount = Integer.parseInt(args[2]);
           
                ItemStack items = new ItemStack(id, amount);
                player.getInventory().addItem(items);
                event.setCancelled(true);
            }
        }
     
     
  2. I think the pre-process is fired after the notification is actually sent, though you could test that with a simple debug statement. You may however be able to intercept it if you work with player-to-server packets.
     
    • Like Like x 1
  3. How would I go about doing this?
     
  4. Maybe disable admin command logging?
     
  5. Solved, had to make my own filter with log4j