mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2025-01-12 11:21:34 +01:00
fixed crash in removeRegion
This commit is contained in:
parent
e4d05e14ac
commit
cdf067bba8
@ -444,7 +444,7 @@ public void onBlockInteract(BlockInteractEvent event) {
|
||||
ApplicableRegionSet applicableRegions = mgr.getApplicableRegions(pt);
|
||||
LocalPlayer localPlayer = BukkitPlayer.wrapPlayer(cfg, (Player)entity);
|
||||
|
||||
if (!applicableRegions.isFlagAllowed(AreaFlags.FLAG_LEVER_AND_BUTTON, true, localPlayer)) {
|
||||
if (!applicableRegions.isFlagAllowed(AreaFlags.FLAG_LEVER_AND_BUTTON, true, null)) {
|
||||
((Player)entity).sendMessage(ChatColor.DARK_RED + "You don't have permission for this area.");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
|
@ -30,6 +30,7 @@
|
||||
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
||||
import com.sk89q.worldguard.protection.UnsupportedIntersectionException;
|
||||
import com.sk89q.worldguard.protection.dbs.ProtectionDatabase;
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* A very simple implementation of the region manager that uses a flat list
|
||||
@ -94,11 +95,19 @@ public void removeRegion(String id) {
|
||||
regions.remove(id);
|
||||
|
||||
if (region != null) {
|
||||
for (Map.Entry<String, ProtectedRegion> entry : regions.entrySet()) {
|
||||
if (entry.getValue().getParent() == region) {
|
||||
removeRegion(entry.getKey());
|
||||
List<String> removeRegions = new ArrayList<String>();
|
||||
Iterator<ProtectedRegion> iter = regions.values().iterator();
|
||||
while (iter.hasNext()) {
|
||||
ProtectedRegion curRegion = iter.next();
|
||||
if (curRegion.getParent() == region) {
|
||||
removeRegions.add(curRegion.getId());
|
||||
}
|
||||
}
|
||||
|
||||
for(String remId : removeRegions)
|
||||
{
|
||||
removeRegion(remId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,6 +33,7 @@
|
||||
import com.sk89q.worldguard.protection.UnsupportedIntersectionException;
|
||||
import com.sk89q.worldguard.protection.dbs.ProtectionDatabase;
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
|
||||
public class PRTreeRegionManager extends RegionManager {
|
||||
|
||||
@ -122,14 +123,22 @@ public void removeRegion(String id) {
|
||||
regions.remove(id);
|
||||
|
||||
if (region != null) {
|
||||
for (Map.Entry<String, ProtectedRegion> entry : regions.entrySet()) {
|
||||
if (entry.getValue().getParent() == region) {
|
||||
removeRegion(entry.getKey());
|
||||
List<String> removeRegions = new ArrayList<String>();
|
||||
Iterator<ProtectedRegion> iter = regions.values().iterator();
|
||||
while (iter.hasNext()) {
|
||||
ProtectedRegion curRegion = iter.next();
|
||||
if (curRegion.getParent() == region) {
|
||||
removeRegions.add(curRegion.getId());
|
||||
}
|
||||
}
|
||||
|
||||
for(String remId : removeRegions)
|
||||
{
|
||||
removeRegion(remId);
|
||||
}
|
||||
}
|
||||
|
||||
tree = new PRTree<ProtectedRegion>(converter, BRANCH_FACTOR);
|
||||
tree = new PRTree<ProtectedRegion>(converter, BRANCH_FACTOR);
|
||||
tree.load(regions.values());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user