Update WorldGuard hook

Dieser Commit ist enthalten in:
Jesse Boyd 2018-08-15 23:30:42 +10:00
Ursprung 13d2ae20d5
Commit be574391ed
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 59F1DE6293AF6E1F
3 geänderte Dateien mit 14 neuen und 12 gelöschten Zeilen

Datei anzeigen

@ -72,6 +72,7 @@ subprojects {
repositories { repositories {
mavenCentral() 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://repo.bukkit.org/content/groups/public" }
maven { url "http://maven.sk89q.com/repo/" } maven { url "http://maven.sk89q.com/repo/" }
maven { url "http://repo.maven.apache.org/maven2" } maven { url "http://repo.maven.apache.org/maven2" }

Datei anzeigen

@ -26,7 +26,8 @@ dependencies {
compile 'com.thevoxelbox.voxelsniper:voxelsniper:5.171.0' compile 'com.thevoxelbox.voxelsniper:voxelsniper:5.171.0'
compile 'com.comphenix.protocol:ProtocolLib-API:4.4.0-SNAPSHOT' compile 'com.comphenix.protocol:ProtocolLib-API:4.4.0-SNAPSHOT'
compile 'com.wasteofplastic:askyblock:3.0.8.2' 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') { compile('org.inventivetalent:mapmanager:1.4.0-SNAPSHOT') {
transitive = false transitive = false
} }

Datei anzeigen

@ -1,5 +1,6 @@
package com.boydti.fawe.bukkit.regions; package com.boydti.fawe.bukkit.regions;
import com.boydti.fawe.FaweAPI;
import com.boydti.fawe.bukkit.FaweBukkit; import com.boydti.fawe.bukkit.FaweBukkit;
import com.boydti.fawe.bukkit.filter.WorldGuardFilter; import com.boydti.fawe.bukkit.filter.WorldGuardFilter;
import com.boydti.fawe.object.FawePlayer; 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.Polygonal2DRegion;
import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldguard.LocalPlayer; import com.sk89q.worldguard.LocalPlayer;
import com.sk89q.worldguard.WorldGuard;
import com.sk89q.worldguard.bukkit.WorldGuardPlugin; import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
import com.sk89q.worldguard.protection.ApplicableRegionSet; import com.sk89q.worldguard.protection.ApplicableRegionSet;
import com.sk89q.worldguard.protection.managers.RegionManager; import com.sk89q.worldguard.protection.managers.RegionManager;
import com.sk89q.worldguard.protection.regions.GlobalProtectedRegion; import com.sk89q.worldguard.protection.regions.*;
import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion;
import com.sk89q.worldguard.protection.regions.ProtectedPolygonalRegion;
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Player; 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) { public ProtectedRegion getRegion(final com.sk89q.worldguard.LocalPlayer player, final Location loc) {
RegionManager manager = this.worldguard.getRegionManager(loc.getWorld()); RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
if (container == null) {
System.out.println("Region capability is not enabled for WorldGuard.");
return null;
}
RegionManager manager = container.get(FaweAPI.getWorld(loc.getWorld().getName()));
if (manager == null) { if (manager == null) {
if (this.worldguard.getGlobalStateManager().get(loc.getWorld()).useRegions) { System.out.println("Region capability is not enabled for that world.");
System.out.println("Region capability is not enabled for WorldGuard.");
} else {
System.out.println("WorldGuard is not enabled for that world.");
}
return null; return null;
} }
final ProtectedRegion global = manager.getRegion("__global__"); final ProtectedRegion global = manager.getRegion("__global__");
if (global != null && isAllowed(player, global)) { if (global != null && isAllowed(player, global)) {
return 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) { for (final ProtectedRegion region : regions) {
if (isAllowed(player, region)) { if (isAllowed(player, region)) {
return region; return region;