Update WorldGuard hook

This commit is contained in:
Jesse Boyd 2018-08-15 23:30:42 +10:00
parent 13d2ae20d5
commit be574391ed
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
3 changed files with 14 additions and 12 deletions

View File

@ -72,6 +72,7 @@ subprojects {
repositories {
mavenCentral()
maven { url "http://ci.athion.net/job/FAWE-WorldGuard-1.13/ws/mvn/" }
maven { url "http://repo.bukkit.org/content/groups/public" }
maven { url "http://maven.sk89q.com/repo/" }
maven { url "http://repo.maven.apache.org/maven2" }

View File

@ -26,7 +26,8 @@ dependencies {
compile 'com.thevoxelbox.voxelsniper:voxelsniper:5.171.0'
compile 'com.comphenix.protocol:ProtocolLib-API:4.4.0-SNAPSHOT'
compile 'com.wasteofplastic:askyblock:3.0.8.2'
compile 'com.sk89q:worldguard:6.0.0-SNAPSHOT'
compile 'com.sk89q:worldguard-core:latest'
compile 'com.sk89q:worldguard-legacy:latest'
compile('org.inventivetalent:mapmanager:1.4.0-SNAPSHOT') {
transitive = false
}

View File

@ -1,5 +1,6 @@
package com.boydti.fawe.bukkit.regions;
import com.boydti.fawe.FaweAPI;
import com.boydti.fawe.bukkit.FaweBukkit;
import com.boydti.fawe.bukkit.filter.WorldGuardFilter;
import com.boydti.fawe.object.FawePlayer;
@ -13,13 +14,11 @@ import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.regions.Polygonal2DRegion;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldguard.LocalPlayer;
import com.sk89q.worldguard.WorldGuard;
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
import com.sk89q.worldguard.protection.ApplicableRegionSet;
import com.sk89q.worldguard.protection.managers.RegionManager;
import com.sk89q.worldguard.protection.regions.GlobalProtectedRegion;
import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion;
import com.sk89q.worldguard.protection.regions.ProtectedPolygonalRegion;
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
import com.sk89q.worldguard.protection.regions.*;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Player;
@ -48,20 +47,21 @@ public class Worldguard extends BukkitMaskManager implements Listener {
}
public ProtectedRegion getRegion(final com.sk89q.worldguard.LocalPlayer player, final Location loc) {
RegionManager manager = this.worldguard.getRegionManager(loc.getWorld());
if (manager == null) {
if (this.worldguard.getGlobalStateManager().get(loc.getWorld()).useRegions) {
RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
if (container == null) {
System.out.println("Region capability is not enabled for WorldGuard.");
} else {
System.out.println("WorldGuard is not enabled for that world.");
return null;
}
RegionManager manager = container.get(FaweAPI.getWorld(loc.getWorld().getName()));
if (manager == null) {
System.out.println("Region capability is not enabled for that world.");
return null;
}
final ProtectedRegion global = manager.getRegion("__global__");
if (global != null && isAllowed(player, global)) {
return global;
}
final ApplicableRegionSet regions = manager.getApplicableRegions(loc);
final ApplicableRegionSet regions = manager.getApplicableRegions(new Vector(loc.getX(), loc.getY(), loc.getZ()));
for (final ProtectedRegion region : regions) {
if (isAllowed(player, region)) {
return region;