From ad052f762ec0dc9396f9c284af5f144827d01d49 Mon Sep 17 00:00:00 2001 From: Magnus Ulf Date: Sat, 22 Dec 2018 11:35:46 +0100 Subject: [PATCH] UPdate WorldGuard integration to 7.0.0 Not tested --- pom.xml | 19 +++++------ .../worldguard/EngineWorldGuard.java | 34 ++++++------------- 2 files changed, 19 insertions(+), 34 deletions(-) diff --git a/pom.xml b/pom.xml index 0c51e74e..fe9fa2e9 100644 --- a/pom.xml +++ b/pom.xml @@ -32,11 +32,19 @@ MassiveCore + + com.sk89q.worldedit + worldedit-core + com.sk89q.worldedit worldedit-bukkit + + com.sk89q.worldguard + worldguard-core + com.sk89q.worldguard worldguard-legacy @@ -71,17 +79,6 @@ false - - - - org.apache.maven.plugins - maven-compiler-plugin - - 11 - 11 - - - diff --git a/src/com/massivecraft/factions/integration/worldguard/EngineWorldGuard.java b/src/com/massivecraft/factions/integration/worldguard/EngineWorldGuard.java index 603f4e28..56b5b8e7 100644 --- a/src/com/massivecraft/factions/integration/worldguard/EngineWorldGuard.java +++ b/src/com/massivecraft/factions/integration/worldguard/EngineWorldGuard.java @@ -6,9 +6,10 @@ import com.massivecraft.factions.entity.MPlayer; import com.massivecraft.factions.event.EventFactionsChunksChange; import com.massivecraft.massivecore.Engine; import com.massivecraft.massivecore.ps.PS; -import com.sk89q.worldedit.BlockVector; +import com.sk89q.worldedit.bukkit.BukkitWorld; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldguard.LocalPlayer; -import com.sk89q.worldguard.bukkit.WGBukkit; +import com.sk89q.worldguard.WorldGuard; import com.sk89q.worldguard.bukkit.WorldGuardPlugin; import com.sk89q.worldguard.protection.managers.RegionManager; import com.sk89q.worldguard.protection.regions.GlobalProtectedRegion; @@ -30,13 +31,7 @@ public class EngineWorldGuard extends Engine private static EngineWorldGuard i = new EngineWorldGuard(); public static EngineWorldGuard get() { return i; } - - // -------------------------------------------- // - // FIELDS - // -------------------------------------------- // - - protected WorldGuardPlugin worldGuard; - + // -------------------------------------------- // // OVERRIDE // -------------------------------------------- // @@ -44,14 +39,7 @@ public class EngineWorldGuard extends Engine @Override public void setActiveInner(boolean active) { - if (active) - { - this.worldGuard = WGBukkit.getPlugin(); - } - else - { - this.worldGuard = null; - } + } // -------------------------------------------- // @@ -62,7 +50,7 @@ public class EngineWorldGuard extends Engine public void checkForRegion(EventFactionsChunksChange event) { // Skip checks if the configuration has worldguardCheckEnabled disabled - if ( ! MConf.get().worldguardCheckEnabled) return; + if ( ! MConf.get().worldguardCheckEnabled) return; // Permanent Factions should not apply this rule if (event.getNewFaction().getFlag(MFlag.ID_PERMANENT)) return; @@ -73,7 +61,7 @@ public class EngineWorldGuard extends Engine // Only do this for players if (player == null) return; - LocalPlayer wrapperPlayer = this.worldGuard.wrapPlayer(player); + LocalPlayer wrapperPlayer = WorldGuardPlugin.inst().wrapPlayer(player); if ( ! MConf.get().worldguardCheckWorldsEnabled.contains(player)) return; @@ -119,15 +107,15 @@ public class EngineWorldGuard extends Engine int worldHeight = ps.asBukkitWorld().getMaxHeight(); - BlockVector minChunk = new BlockVector(minChunkX, 0, minChunkZ); - BlockVector maxChunk = new BlockVector(maxChunkX, worldHeight, maxChunkZ); + BlockVector3 minChunk = BlockVector3.at(minChunkX, 0, minChunkZ); + BlockVector3 maxChunk = BlockVector3.at(maxChunkX, worldHeight, maxChunkZ); - RegionManager regionManager = this.worldGuard.getRegionManager(ps.asBukkitWorld()); + RegionManager regionManager = WorldGuard.getInstance().getPlatform().getRegionContainer().get(new BukkitWorld(ps.asBukkitWorld())); String regionName = "factions_temp"; ProtectedCuboidRegion region = new ProtectedCuboidRegion(regionName, minChunk, maxChunk); - Map regionMap = regionManager.getRegions(); + Map regionMap = regionManager.getRegions(); List regionList = new ArrayList<>(regionMap.values()); // Let's find what we've overlapped