mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2025-01-26 10:01:21 +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);
|
ApplicableRegionSet applicableRegions = mgr.getApplicableRegions(pt);
|
||||||
LocalPlayer localPlayer = BukkitPlayer.wrapPlayer(cfg, (Player)entity);
|
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.");
|
((Player)entity).sendMessage(ChatColor.DARK_RED + "You don't have permission for this area.");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
||||||
import com.sk89q.worldguard.protection.UnsupportedIntersectionException;
|
import com.sk89q.worldguard.protection.UnsupportedIntersectionException;
|
||||||
import com.sk89q.worldguard.protection.dbs.ProtectionDatabase;
|
import com.sk89q.worldguard.protection.dbs.ProtectionDatabase;
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A very simple implementation of the region manager that uses a flat list
|
* 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);
|
regions.remove(id);
|
||||||
|
|
||||||
if (region != null) {
|
if (region != null) {
|
||||||
for (Map.Entry<String, ProtectedRegion> entry : regions.entrySet()) {
|
List<String> removeRegions = new ArrayList<String>();
|
||||||
if (entry.getValue().getParent() == region) {
|
Iterator<ProtectedRegion> iter = regions.values().iterator();
|
||||||
removeRegion(entry.getKey());
|
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.UnsupportedIntersectionException;
|
||||||
import com.sk89q.worldguard.protection.dbs.ProtectionDatabase;
|
import com.sk89q.worldguard.protection.dbs.ProtectionDatabase;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
public class PRTreeRegionManager extends RegionManager {
|
public class PRTreeRegionManager extends RegionManager {
|
||||||
|
|
||||||
@ -122,14 +123,22 @@ public void removeRegion(String id) {
|
|||||||
regions.remove(id);
|
regions.remove(id);
|
||||||
|
|
||||||
if (region != null) {
|
if (region != null) {
|
||||||
for (Map.Entry<String, ProtectedRegion> entry : regions.entrySet()) {
|
List<String> removeRegions = new ArrayList<String>();
|
||||||
if (entry.getValue().getParent() == region) {
|
Iterator<ProtectedRegion> iter = regions.values().iterator();
|
||||||
removeRegion(entry.getKey());
|
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());
|
tree.load(regions.values());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user