Solved Getting args of command from different plugin.

Discussion in 'Spigot Plugin Development' started by Nighterance, Jun 7, 2017.

  1. Hello! I am trying to log data from different plugin, whenever player executes command /tp, i need to get args[0].

    Since that command is in-built in essentials, how could I get args from command tp? Create a new plugin where is onCommand and then log data or is there easyer way?

    I tried with chat event
    public void chatFormat(AsyncPlayerChatEvent e){
    Player p = e.getPlayer();
    if(e.getMessage().contains("tp")){
    String log = e.getPlayer().getName() + " || " + e.getMessage().replace("tp", "");
    p.sendMessage(log);
    }
    }

    Whenever I write tp random, it sends player command Playername || random. But whenever it is command, /tp, it does not
     
  2. electronicboy

    IRC Staff

    use the player command preprocess event
     
  3. Thanks, figured it out!