mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 01:37:37 +00:00
Update WorldGuard hook
This commit is contained in:
parent
13d2ae20d5
commit
be574391ed
@ -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" }
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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());
|
||||
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 (this.worldguard.getGlobalStateManager().get(loc.getWorld()).useRegions) {
|
||||
System.out.println("Region capability is not enabled for WorldGuard.");
|
||||
} else {
|
||||
System.out.println("WorldGuard is not enabled for that world.");
|
||||
}
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user