Solved Command Priority

Discussion in 'Plugin Development' started by AngryCupcake274, Jul 31, 2015.

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

    AngryCupcake274

    Hello all,
    I am creating a plugin that recreates some commands used in popular plugins. Is there a way to have my command execute first? I've tried the Preprocess command thing, but it executes my command and the other one. If you know of a way of not using the Preprocess thing, please tell me. If there is no way, can you help me figure out the Preprocess thing.

    EDIT: It is the PlayerCommandPreprocessEvent :p
     
  2. Offline

    ShadowLAX

    @AngryCupcake274 No, that is not what the intent of the event is for. Read this post about event priorities.
     
  3. Offline

    AngryCupcake274

    @ShadowLAX I am creating the new command, and need to stop the other one from happening. Even on MONITOR, the other one still called first.
     
  4. Offline

    ShadowLAX

    @AngryCupcake274 My apologies I misled you, those are for events not commands. You can't stop a command another plugin has already registered, so you need to change the name of your command.
     
  5. Offline

    AngryCupcake274

    Last edited by a moderator: Aug 1, 2015
  6. Offline

    Tecno_Wizard

    @AngryCupcake274, uhh, no it doesn't. Having it lowest means it has the last say over canceling the event.
     
  7. Offline

    AngryCupcake274

    @Tecno_Wizard Nope. Read the link.
    I know it makes no sense....but....
     
  8. Offline

    SuperOriginal

    You could just get Bukkit's command map and unregister commands you are overriding before adding your own
     
    Boomer likes this.
  9. Offline

    Tecno_Wizard

    @AngryCupcake274, i realized i typed that incorrectly. By having the priority the highest, it is called last, giving it final authority over the result of the event. Monitor is true last so the final result can be determined, hence the name monitor. It is not supposed to change the result.

    As far as stopping the command, put the command IN the preprocess event (this is a horrific practice, but it's necessary for this) and cancel the event.
     
Thread Status:
Not open for further replies.

Share This Page