How to check if..

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

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


    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


  3. Offline


    What does EventPriority do in this case?
  4. Offline


    @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


  6. Offline


    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


  8. Offline


  9. Offline


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


    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


    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.

        @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();
                // 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