Fix for global region

This commit is contained in:
Jesse Boyd 2016-04-21 08:15:54 +10:00
parent b4c4dc2e5c
commit aa02b34d7c
2 changed files with 12 additions and 5 deletions

View File

@ -1,6 +1,6 @@
name: FastAsyncWorldEdit name: FastAsyncWorldEdit
main: com.boydti.fawe.bukkit.FaweBukkit main: com.boydti.fawe.bukkit.FaweBukkit
version: 3.3.18 version: 3.3.19
description: Fast Async WorldEdit plugin description: Fast Async WorldEdit plugin
authors: [Empire92] authors: [Empire92]
loadbefore: [WorldEdit] loadbefore: [WorldEdit]

View File

@ -39,7 +39,7 @@ public class Worldguard extends BukkitMaskManager implements Listener {
final com.sk89q.worldguard.LocalPlayer localplayer = this.worldguard.wrapPlayer(player); final com.sk89q.worldguard.LocalPlayer localplayer = this.worldguard.wrapPlayer(player);
RegionManager manager = this.worldguard.getRegionManager(player.getWorld()); RegionManager manager = this.worldguard.getRegionManager(player.getWorld());
final ProtectedRegion global = manager.getRegion("__global__"); final ProtectedRegion global = manager.getRegion("__global__");
if (isAllowed(localplayer, global)) { if (global != null && isAllowed(localplayer, global)) {
return global; return global;
} }
final ApplicableRegionSet regions = manager.getApplicableRegions(player.getLocation()); final ApplicableRegionSet regions = manager.getApplicableRegions(player.getLocation());
@ -52,7 +52,7 @@ public class Worldguard extends BukkitMaskManager implements Listener {
} }
public boolean isAllowed(LocalPlayer localplayer, ProtectedRegion region) { public boolean isAllowed(LocalPlayer localplayer, ProtectedRegion region) {
if (region.isOwner(localplayer)) { if (region.isOwner(localplayer) || region.isOwner(localplayer.getName())) {
return true; return true;
} else if (region.getId().toLowerCase().equals(localplayer.getName().toLowerCase())) { } else if (region.getId().toLowerCase().equals(localplayer.getName().toLowerCase())) {
return true; return true;
@ -70,8 +70,15 @@ public class Worldguard extends BukkitMaskManager implements Listener {
final Location location = player.getLocation(); final Location location = player.getLocation();
final ProtectedRegion myregion = this.getRegion(player, location); final ProtectedRegion myregion = this.getRegion(player, location);
if (myregion != null) { if (myregion != null) {
final Location pos1 = new Location(location.getWorld(), myregion.getMinimumPoint().getBlockX(), myregion.getMinimumPoint().getBlockY(), myregion.getMinimumPoint().getBlockZ()); final Location pos1;
final Location pos2 = new Location(location.getWorld(), myregion.getMaximumPoint().getBlockX(), myregion.getMaximumPoint().getBlockY(), myregion.getMaximumPoint().getBlockZ()); final Location pos2;
if (myregion.getId().equals("__global__")) {
pos1 = new Location(location.getWorld(), Integer.MIN_VALUE, 0, Integer.MIN_VALUE);
pos2 = new Location(location.getWorld(), Integer.MAX_VALUE, 255, Integer.MAX_VALUE);
} else {
pos1 = new Location(location.getWorld(), myregion.getMinimumPoint().getBlockX(), myregion.getMinimumPoint().getBlockY(), myregion.getMinimumPoint().getBlockZ());
pos2 = new Location(location.getWorld(), myregion.getMaximumPoint().getBlockX(), myregion.getMaximumPoint().getBlockY(), myregion.getMaximumPoint().getBlockZ());
}
return new BukkitMask(pos1, pos2) { return new BukkitMask(pos1, pos2) {
@Override @Override
public String getName() { public String getName() {