How to check if..

Discussion in 'Plugin Development' started by Sakarakis, Feb 24, 2015.

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

    Sakarakis

    How do i check if a location is flagged by world guard? I'm trying to make an explosion enchantment for my prison server and I don't want it blowing up the buildings or spawn. Thanks for any help.
     
  2. Offline

    SuchSwegMuchWow

  3. Offline

    stormneo7

    What does EventPriority do in this case?
     
  4. Offline

    teej107

    @Sakarakis You would need to use WorldGuard's API. Get the region manager for the world and then check to see if the location contains a WorldGuard region.
     
  5. Offline

    SuchSwegMuchWow

  6. Offline

    stormneo7

    Listen. I know what EventPriority is. The real deal is how will it be useful in this senerio? I've read how WorldGuard cancels the event. It clears the block list. You cannot uncancel it because it's apart of the WorldGuard API, prioritized first. You would need to access the WorldGuard API and check the blocks yourself. I know all the event priorities, you don't need to explain that.

    This is explosion based. You can't listen on EntityExplodeEvent / evt.setCancelled() as there are an illiterate of blocks which are checked. How would you use the WorldGuard API to do the checking yourself? Ex: Check if a block is protected by the 'other-explosions' flag, etc?
     
  7. Offline

    _Filip

  8. Offline

    stormneo7

  9. Offline

    Bluesocks

    @stormneo7 EventPriority is a parameter in the EventHandler annotation.
    Code:
        @EventHandler(priority = EventPriority.HIGH)
     
  10. Offline

    teej107

    EventPriority can't find out where the regions are or find out if they are flagged. EventPriority can't find out if WorldGuard is the only plugin to modify an event outcome. Other plugins could modify the outcome of the events as well. The best way to find out is to use the WorldGuard API.
    yes you may still need to change the event priority but you'll need to use WG's API as well.
     
  11. Offline

    stormneo7

    Sometimes I just question whether the forums are a bunch of trolls or not.

    The OP's origional question was
    "How do i check if a location is flagged by world guard?"

    How does event priority help?
    How would you use event priority to check if a block at 0, 100, 0 has been flagged as 'pvp deny'.
    The fact that this thread is filled with posts about event priority where it doesn't relate to anything puzzles me.

    Code:
        @EventHandler // (priority = EventPriority.HIGH) IS NOT NEEDED SINCE THE REGION WILL NOT BE BLOCKED BY WORLDGUARD'S 'other-explosion deny'!
        public void onExplode(EntityExplodeEvent evt){
            List<Block> b = evt.blockList();
            if(!(b.isEmpty())){
                // Check if b is marked by WorldGuard as 'build deny'.
                // Removes the block from the blocklist if so.
              
            }
        }
     
    Last edited: Feb 25, 2015
    teej107 likes this.
Thread Status:
Not open for further replies.

Share This Page