Run pex command.

Discussion in 'Spigot Plugin Development' started by UnlimitedNinjas, Jul 6, 2018.

  1. So when a command /saconfig add <playername> (not from my plugin) is ran, i need to add a player to a pex group. So for example: i do /saconfig add player1 and it does what the command does (in this case adds a player to an admin list) and then it runs code that will do: /pex user player1 group set admin
     
  2. Bukkit#dispatchCommad(Bukkit.getConsoleSender(), “pex ...”)
     
  3. so how would i do the commandpreproccessevent?
    public void oncmd(PlayerCommandPreprocessEvent e) {
    if (e.getEventName().equals("saconfig add player1"))
    Bukkit#dispatchCommad(Bukkit.getConsoleSender(), “pex user ” + player1.getname() + " group set admin")
    }
    and how would i get player name? e.getPlayer.getname?
     
  4. split the command into args, and use args[2]