PlayerCommandPreprocessEvent

Discussion in 'Spigot Plugin Help' started by Vladimir_Redin, Jul 23, 2018.

  1. Hello!
    How can I get the Player parameter from the entered command?
    I use event PlayerCommandPreprocessEvent.
    Example: /tp NickName
    I can't do this as follows:
    Code (Text):
    List<String> arg = Arrays.asList(e.getMessage().split(" "));
    Player p = arg.get(1);
    How to do it? Tell me, please :(
     
  2. what do you need this for? just use a normal command ? :D
     
  3. Teleportation to the player is possible only if this player has what is needed.
    I have to check this out. And for this I need to get the Player parameter.

    sorry for my english
     
  4. DavidDevelops

    Supporter

    if the command is from your plugin then just do the check in the command event...
    If the command has a arg if it does compare it to online players....
     
  5. I think its Bukkit.getPlayer(arg.get(0));
     
  6. I did just that xD And worked