Override command in onCommand?

Discussion in 'Plugin Development' started by NerdsWBNerds, May 26, 2012.

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

    NerdsWBNerds

    So I have an onCommand method and I have info as one of the commands, essentials is installed on my server and whenever I do /info, it does the essentials one instead of the one I want it to. How can I make /info do my plugin's event instead of essentials.
     
  2. Offline

    ZeusAllMighty11 Retired Staff

    I think you have to set the plugin priority to HIGHEST

    like so:

    @EventHandler(Event.PRIORITY = HIGHEST)

    Something like that
     
  3. Offline

    PandazNWafflez

    You don't use EventHandler for commands. Instead listen for PlayerCommandPreprocessEvent (which ironically would use EventHandler) and cancel it, then fire your onCommand manually.
     
  4. Offline

    fishballdan

    Can you give an example? I was wondering how to do this too.
     
  5. Offline

    HON95

    Or you could schedule a task in onEnable to run one tick later, which would get the command using "getServer().getPluginCommand("command")", and then set the executor of it to whatever CommandExecutor you want. I haven't tested it, but it looks like it might work. :p
     
Thread Status:
Not open for further replies.

Share This Page