Solved I need help getRegion in 1.15.2

Discussion in 'Spigot Plugin Development' started by JNSWYR, Mar 5, 2020.

  1. Hello,

    I want to rebuild a plugin but api Wordguard not support, Please help me solve this problem.
    And I'm want example for this solve.

    private static String getRegion(Location location) {
    RegionManager regionManager =Duel.p.getWorldGuard().getRegionManager(location.getWorld());
    ApplicableRegionSet set = regionManager.getApplicableRegions(location);
    LinkedList<String> parentNames = new LinkedList<String>();
    LinkedList<String> regions = new LinkedList<String>();

    for (ProtectedRegion region : set) {
    String id = region.getId();
    regions.add(id);
    ProtectedRegion parent = region.getParent();
    while (parent != null) {
    parentNames.add(parent.getId());
    parent = parent.getParent();
    }
    }
    for (String name : parentNames) {
    regions.remove(name);
    }
    return regions.toString();
    }


    Thank you for the help,
     
    #1 JNSWYR, Mar 5, 2020
    Last edited: Mar 6, 2020