UPdate WorldGuard integration to 7.0.0

Not tested
This commit is contained in:
Magnus Ulf 2018-12-22 11:35:46 +01:00
parent 595a051a23
commit ad052f762e
2 changed files with 19 additions and 34 deletions

19
pom.xml
View File

@ -32,11 +32,19 @@
<artifactId>MassiveCore</artifactId> <artifactId>MassiveCore</artifactId>
</dependency> </dependency>
<!-- WorldEdit --> <!-- WorldEdit -->
<dependency>
<groupId>com.sk89q.worldedit</groupId>
<artifactId>worldedit-core</artifactId>
</dependency>
<dependency> <dependency>
<groupId>com.sk89q.worldedit</groupId> <groupId>com.sk89q.worldedit</groupId>
<artifactId>worldedit-bukkit</artifactId> <artifactId>worldedit-bukkit</artifactId>
</dependency> </dependency>
<!-- WorldGuard --> <!-- WorldGuard -->
<dependency>
<groupId>com.sk89q.worldguard</groupId>
<artifactId>worldguard-core</artifactId>
</dependency>
<dependency> <dependency>
<groupId>com.sk89q.worldguard</groupId> <groupId>com.sk89q.worldguard</groupId>
<artifactId>worldguard-legacy</artifactId> <artifactId>worldguard-legacy</artifactId>
@ -71,17 +79,6 @@
<filtering>false</filtering> <filtering>false</filtering>
</resource> </resource>
</resources> </resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
</plugins>
</build> </build>
</project> </project>

View File

@ -6,9 +6,10 @@ import com.massivecraft.factions.entity.MPlayer;
import com.massivecraft.factions.event.EventFactionsChunksChange; import com.massivecraft.factions.event.EventFactionsChunksChange;
import com.massivecraft.massivecore.Engine; import com.massivecraft.massivecore.Engine;
import com.massivecraft.massivecore.ps.PS; 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.LocalPlayer;
import com.sk89q.worldguard.bukkit.WGBukkit; import com.sk89q.worldguard.WorldGuard;
import com.sk89q.worldguard.bukkit.WorldGuardPlugin; import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
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.GlobalProtectedRegion;
@ -31,12 +32,6 @@ public class EngineWorldGuard extends Engine
private static EngineWorldGuard i = new EngineWorldGuard(); private static EngineWorldGuard i = new EngineWorldGuard();
public static EngineWorldGuard get() { return i; } public static EngineWorldGuard get() { return i; }
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
protected WorldGuardPlugin worldGuard;
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE
// -------------------------------------------- // // -------------------------------------------- //
@ -44,14 +39,7 @@ public class EngineWorldGuard extends Engine
@Override @Override
public void setActiveInner(boolean active) public void setActiveInner(boolean active)
{ {
if (active)
{
this.worldGuard = WGBukkit.getPlugin();
}
else
{
this.worldGuard = null;
}
} }
// -------------------------------------------- // // -------------------------------------------- //
@ -73,7 +61,7 @@ public class EngineWorldGuard extends Engine
// Only do this for players // Only do this for players
if (player == null) return; if (player == null) return;
LocalPlayer wrapperPlayer = this.worldGuard.wrapPlayer(player); LocalPlayer wrapperPlayer = WorldGuardPlugin.inst().wrapPlayer(player);
if ( ! MConf.get().worldguardCheckWorldsEnabled.contains(player)) return; if ( ! MConf.get().worldguardCheckWorldsEnabled.contains(player)) return;
@ -119,10 +107,10 @@ public class EngineWorldGuard extends Engine
int worldHeight = ps.asBukkitWorld().getMaxHeight(); int worldHeight = ps.asBukkitWorld().getMaxHeight();
BlockVector minChunk = new BlockVector(minChunkX, 0, minChunkZ); BlockVector3 minChunk = BlockVector3.at(minChunkX, 0, minChunkZ);
BlockVector maxChunk = new BlockVector(maxChunkX, worldHeight, maxChunkZ); 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"; String regionName = "factions_temp";
ProtectedCuboidRegion region = new ProtectedCuboidRegion(regionName, minChunk, maxChunk); ProtectedCuboidRegion region = new ProtectedCuboidRegion(regionName, minChunk, maxChunk);