1.12.2 WorldGuard Regions info

Discussion in 'Spigot Plugin Development' started by Nico12, Jan 26, 2020.

  1. Hello, I know how to create regions with the worldguard api, but what I need is that the information of the region (and the region itself) be in a configuration file of my complement and not in that of worldguard. Does anyone know any method that helps me?
    Thanks in advance
     
  2. If you want to grab the WorldGuard regions at a certain location or name there are loads of examples on the WorldGuard API Wiki
    - > https://worldguard.enginehub.org/en/latest/developer/regions/spatial-queries/

    As for obtaining the information of a non-specific region, you'd loop through a ApplicableRegionSet, obtain the region and then you can get values from that region. If you're trying to get a specific region that you know exists you can either grab the region using a new WorldEdit Location.
     
  3. Could you give an example? I think I have not understood him very well
     
  4. Code (Java):
    Location loc = new Location(world, x, y, z);
    RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
    RegionQuery query = container.createQuery();
    ApplicableRegionSet regionSet = query.getApplicableRegions(loc);

    for (Region region : regionSet) {
        // Do something
    }
     
  5. Sorry but I do not know if I do not understand or you do not understand me, what I need is that when creating a region with that command a region is created but instead of being stored in the worldguard regions file I want it to be stored in a custom file of my plugin
     
  6. You're still going to need to grab the WorldGuard region, then transfer over the values to your own custom file from each value of the Region object.
     
  7. I understand that, but then how do I make my complement or recognize the values in the configuration file as regions?
    Also, what does that location mean from the example you sent me?
     
    #7 Nico12, Jan 27, 2020
    Last edited: Jan 27, 2020