Solved Plugin commands, higher priority

Discussion in 'Spigot Plugin Development' started by UnlimitedNinjas, Aug 9, 2018.

  1. if we have 2 plugins with the same command, how do i make my command take higher priority?
    so if we both have /ban (example) i want my command to be the one that runs it
     
  2. where you do
    Code (Java):
    @EventHandler
    do
    Code (Java):
    @EventHandler(priority = EventPriority.HIGHEST)
     
    • Funny Funny x 3
  3. As far as i know, the first loaded plugin wins, so you need to make your plugin load bevore the other.
    This can be done with the "loadbefore" key in the plugin.yml (see: https://bukkit.gamepedia.com/Plugin_YAML).

    OR

    According to bukkits command priority (see https://bukkit.gamepedia.com/Commands.yml), aliases have the highest priority.
    So call your command "/blablabla" and make "/ban" as alias only.

    EDIT:
    onCommand is no event. This is not relevant.
     
    • Agree Agree x 1
  4. Thanks!
    Btw do you know how to check for args on message if it is even possible?
    for example if a message contains "broadcast lol" it will check for the lol arg
     
  5. There is a CommandPreproccessEvent which you could use
     
  6. It is possible, you can just do
    Code (Java):
    if(args.contains("lol")) {

    //Do stuff

    }
     
  7. i need it on a AsyncPlayerChatEvent
     
  8. Use event.getMessage()
    Also, if I remember correctly, the @ Override annotation gives commands priority over another of the same name.
     
  9. Which you should NOT use.
    org.bukkit.event.player.PlayerCommandPreprocessEvent:
    That's why i didn't want to mention it.
     
    • Like Like x 1
  10. I scraped the idea for the message args, marked as solved
     
  11. Well, it only doesn't want you to use it as an alternative for the command executor. It is like how people tell beginners not to use null. But if you are good enough then you are able to use it.
     
  12. I have another problem now oof
     
  13. which is? I am still here XD