Fixed region priorities, but it needs a test.

This commit is contained in:
sk89q 2011-04-13 03:06:39 -07:00
parent 28c44e0b2f
commit 08ab359534
2 changed files with 10 additions and 6 deletions

View File

@ -19,9 +19,9 @@
package com.sk89q.worldguard.protection.managers;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.TreeMap;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldguard.LocalPlayer;
@ -138,14 +138,16 @@ public ProtectedRegion getRegion(String id) {
*/
@Override
public ApplicableRegionSet getApplicableRegions(Vector pt) {
PriorityQueue<ProtectedRegion> appRegions =
new PriorityQueue<ProtectedRegion>();
List<ProtectedRegion> appRegions =
new ArrayList<ProtectedRegion>();
for (ProtectedRegion region : regions.values()) {
if (region.contains(pt)) {
appRegions.add(region);
}
}
Collections.sort(appRegions);
return new ApplicableRegionSet(appRegions, regions.get("__global__"));
}

View File

@ -19,9 +19,9 @@
package com.sk89q.worldguard.protection.managers;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.TreeMap;
import org.khelekore.prtree.MBRConverter;
import org.khelekore.prtree.PRTree;
@ -154,8 +154,8 @@ public void removeRegion(String id) {
*/
@Override
public ApplicableRegionSet getApplicableRegions(Vector pt) {
PriorityQueue<ProtectedRegion> appRegions =
new PriorityQueue<ProtectedRegion>();
List<ProtectedRegion> appRegions =
new ArrayList<ProtectedRegion>();
int x = pt.getBlockX();
int z = pt.getBlockZ();
@ -165,6 +165,8 @@ public ApplicableRegionSet getApplicableRegions(Vector pt) {
appRegions.add(region);
}
}
Collections.sort(appRegions);
return new ApplicableRegionSet(appRegions, regions.get("__global__"));
}