Solved Overriding commands

Discussion in 'Plugin Development' started by WarmakerT, Oct 13, 2012.

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

    WarmakerT

    How can I make /f desc <x> run /desc <x> instead?
     
  2. try Player.chat("/desc "+arg[2])
    when you verified all the arguments
     
  3. Offline

    WarmakerT

    But how can I override /f desc?
    I tried to use a PlayerCommandPreprocessEvent and cancelling it, but the command runs before it gets cancelled :S
     
  4. the player pre command process always gets handled before the commands are run, unless the plugin that registered its command is also doing that trick
     
  5. Offline

    chaseoes

    You could try adding a load-before or softdepend/depend thing in your plugin.yml. Pretty sure the plugin loaded first gets priority over commands.
     
  6. Offline

    WarmakerT

    Possibly, since it's not working =\ .
    It also didn't work, my command didn't even end up running.
     
  7. Offline

    Tirelessly

    Show some code.
     
  8. Offline

    WarmakerT

    Code:java
    1.  
    2. @EventHandler(priority = EventPriority.HIGHEST)
    3. public void onCommandPreProcess(PlayerCommandPreprocessEvent event){
    4. if(event.getMessage().startsWith("/f desc ")){
    5. event.setCancelled(true);
    6. event.getPlayer().sendMessage("1");
    7. }
    8.  
     
  9. Offline

    Tirelessly

    That's interesting. I don't know why they'd use a Preprocess if that's what they did, and I definitely don't know why the priorities and loadbefore don't work..
     
  10. Offline

    one4me

    WarmakerT
    Try @EventHandler(priority = EventPriority.LOWEST), and what plugin is conflicting with what you're trying to do?
     
  11. Offline

    WarmakerT

    Factions, I'll try what you said :)
    Edit.: Thanks, it worked!
     
Thread Status:
Not open for further replies.

Share This Page