Override a Block Place event from other plugin (Factions)...

Discussion in 'Plugin Development' started by GeekyCompz, Dec 9, 2016.

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

    GeekyCompz

    Hello,
    I am creating an advanced plugin that integrates into the Factions API. However, where a player should be able to mine/build in the enemy's terrain, it is stopped by Factions protection system and the player is greeted with an ugly message.

    I am able to override the block break event, (it still shows the message though).

    I have tried tinkering with @EventHandler (priority = Priority.HIGHEST).

    I've even tried cancelling the event, and allow my plugin to handle it.

    Psst. the only method I can think of is if I were to have the client disable their faction protection through the configuration file. And have my plugin handle the territory protection.

    Cheers in advance,
    Axiom.
     
  2. Offline

    darthteddy1

    Pretty sure @EventHandler (priority = Priority.MONITER) is what you need. Once you try that, if it does not work, please provide your plugin classes (code)
     
  3. Offline

    timtower Moderator Moderator

    @darthteddy1 Monitor is only for non changing listeners
     
  4. Offline

    GeekyCompz

    Yeah, Priority.MONITOR did not do any noticeable changes. I will probably just consider doing the terrain handling myself (disabling faction's terrain protection through their config).

    My plugin is a little messy, sorry, I came back to it after months (I've learnt a bit since then, but I'd probably have to restart the entire thing): https://github.com/Axiom1999/War-De...wardeclaration/listeners/TerrainListener.java.

    @timtower @darthteddy1

    Actually, I'm not sure where I saw the configuration option to disable land protection (still allow claiming) in the Faction's configuration file. So, I guess I will need to override their event!

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Dec 9, 2016
  5. Offline

    darthteddy1

    Try in your override event doing
    Code:
    if(event.isCancelled()) {
    event.setCancelled(false)
    }
    
     
Thread Status:
Not open for further replies.

Share This Page