Event priority MONITOR question

Discussion in 'Spigot Plugin Development' started by Senpai, May 11, 2015.

  1. So I'm trying to uncancel the teleport event canceled by CombatLog. CambatLog teleportevent priority is on HIGHEST.

    I tried doing that: Is it safe?

    Code (Text):
        @EventHandler(priority=EventPriority.MONITOR)
        public void onTeleport(PlayerTeleportEvent e){
            if(plugin.playing.contains(e.getPlayer().getName())){
                    if(e.isCancelled()){
                        e.setCancelled(false);
                    }
            }
        }
     
  2. Sure.
     
    • Informative Informative x 1
  3. The name MONITOR... You're not supposed to use it for ANYTHING other than MONITORING.

    Doing so goes against convention, and can potentially break several plugins.
     
    • Agree Agree x 2
  4. @_Cory_ actually, it's just a priority higher than highest. I don't think there are any conventions for the api xD
     
  5. Omnivion

    Patron

    Also, check out @EventHandler(ignoreCancelled = <boolean>)
     
  6. He needs to have a event priority higher than highest because the plugin is already highest ignore cancel won't help if his listener is being called before the one in the plugin.
     
    • Like Like x 1
  7. So, anyone have an idea?
     
    #10 Senpai, May 11, 2015
    Last edited: May 11, 2015
  8. What you need to do is set your event priority to highest as well. Because bukkit calls events based on plugin load order if the priority is the same, you need to make sure that your plugin loads before the plugin using plugin.yml.
     
    • Informative Informative x 1
  9. Any idea how I would do that since I can't really edit the plugin.yml of CombatLog?
     
  10. Nvm just found the loadbefore
     
  11. Not sure, but it might be possible to listen at the same priority and check if its cancelled. You can disable combatlog blocking teleporting in their config though.
     
  12. Yes but some people like the CombatLog anti teleport feature