Get a Command from a String

Discussion in 'Plugin Development' started by hutattedonmyarm, Nov 8, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    hutattedonmyarm

    When I catch a PlayerCommandPreprocessEvent, I get the message the users entered. I strip the / and the arguments, so I only have the actual command-text left. But this could be an alias, what I need is the actual command.
    I tried using SimpleCommandMap (the getCommand()), but it only returns something for bukkit-intern commands (like /ban)... So, what else could I use?
     
  2. Offline

    Ewe Loon

    I think you will find they have been converted from the alias to the command when then plugins onCommand Method is called
     
  3. Offline

    hutattedonmyarm

    Yes, but I need to use the PlayerCommandPreprocessEvent, since I want to catch every entered command, not only from my plugin. And they're not converted there...
     
  4. Offline

    Ewe Loon

    lookup Server.getPluginCommand(String)
    it might tell you the name of a command for an alias

    you could setup a map<String,String> to use as a conversion table,
    unfortunately you would then have to add all aliases and their commands to the table,
     
  5. Offline

    hutattedonmyarm

    Okay, thanks, that's what I wanted!
     
Thread Status:
Not open for further replies.

Share This Page