Update WorldGuard dependency to 7.0.0-SNAPSHOT (#343)
This commit is contained in:
parent
e7495011aa
commit
31c1581ca2
50
pom.xml
50
pom.xml
|
|
@ -25,6 +25,10 @@
|
||||||
<id>worldedit-worldguard-repo</id>
|
<id>worldedit-worldguard-repo</id>
|
||||||
<url>http://maven.sk89q.com/repo/</url>
|
<url>http://maven.sk89q.com/repo/</url>
|
||||||
</repository>
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>codemc-repo</id>
|
||||||
|
<url>https://repo.codemc.org/repository/maven-public/</url>
|
||||||
|
</repository>
|
||||||
<repository>
|
<repository>
|
||||||
<id>vault-repo</id>
|
<id>vault-repo</id>
|
||||||
<url>http://nexus.hc.to/content/repositories/pub_releases</url>
|
<url>http://nexus.hc.to/content/repositories/pub_releases</url>
|
||||||
|
|
@ -66,33 +70,37 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
<!--Worldguard dependency-->
|
<!--Worldguard dependency-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.sk89q</groupId>
|
<groupId>com.sk89q.worldguard</groupId>
|
||||||
<artifactId>worldguard</artifactId>
|
<artifactId>worldguard-legacy</artifactId>
|
||||||
<version>6.1.1-SNAPSHOT</version>
|
<version>7.0.0-SNAPSHOT</version>
|
||||||
</dependency>
|
<scope>provided</scope>
|
||||||
<!--WorldGuard depends on WorldEdit-->
|
<exclusions>
|
||||||
<dependency>
|
<exclusion>
|
||||||
<groupId>com.sk89q.worldedit</groupId>
|
<groupId>org.bukkit</groupId>
|
||||||
<artifactId>worldedit-bukkit</artifactId>
|
<artifactId>bukkit</artifactId>
|
||||||
<version>6.1.4-SNAPSHOT</version>
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>com.sk89q.worldedit</groupId>
|
||||||
|
<artifactId>worldedit-bukkit</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>com.sk89q</groupId>
|
||||||
|
<artifactId>commandbook</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!--Vault dependency-->
|
<!--Vault dependency-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.milkbowl.vault</groupId>
|
<groupId>net.milkbowl.vault</groupId>
|
||||||
<artifactId>VaultAPI</artifactId>
|
<artifactId>VaultAPI</artifactId>
|
||||||
<version>1.6</version>
|
<version>1.6</version>
|
||||||
</dependency>
|
<scope>provided</scope>
|
||||||
<!--Google stuff-->
|
<exclusions>
|
||||||
<dependency>
|
<exclusion>
|
||||||
<groupId>com.google.guava</groupId>
|
<groupId>org.bukkit</groupId>
|
||||||
<artifactId>guava</artifactId>
|
<artifactId>bukkit</artifactId>
|
||||||
<version>21.0</version>
|
</exclusion>
|
||||||
</dependency>
|
</exclusions>
|
||||||
<!--json stuff-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.googlecode.json-simple</groupId>
|
|
||||||
<artifactId>json-simple</artifactId>
|
|
||||||
<version>1.1.1</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,16 @@
|
||||||
package me.ryanhamshire.GriefPrevention;
|
package me.ryanhamshire.GriefPrevention;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.sk89q.worldedit.BlockVector;
|
import com.sk89q.worldedit.BlockVector;
|
||||||
import com.sk89q.worldguard.LocalPlayer;
|
import com.sk89q.worldedit.world.World;
|
||||||
|
import com.sk89q.worldguard.WorldGuard;
|
||||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||||
import com.sk89q.worldguard.bukkit.permission.RegionPermissionModel;
|
import com.sk89q.worldguard.bukkit.BukkitPlayer;
|
||||||
|
import com.sk89q.worldguard.internal.permission.RegionPermissionModel;
|
||||||
import com.sk89q.worldguard.protection.ApplicableRegionSet;
|
import com.sk89q.worldguard.protection.ApplicableRegionSet;
|
||||||
import com.sk89q.worldguard.protection.flags.DefaultFlag;
|
import com.sk89q.worldguard.protection.flags.Flags;
|
||||||
import com.sk89q.worldguard.protection.managers.RegionManager;
|
import com.sk89q.worldguard.protection.managers.RegionManager;
|
||||||
import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion;
|
import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion;
|
||||||
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
||||||
|
|
@ -17,42 +18,43 @@ import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
||||||
class WorldGuardWrapper
|
class WorldGuardWrapper
|
||||||
{
|
{
|
||||||
private WorldGuardPlugin worldGuard = null;
|
private WorldGuardPlugin worldGuard = null;
|
||||||
|
|
||||||
public WorldGuardWrapper() throws ClassNotFoundException
|
public WorldGuardWrapper() throws ClassNotFoundException
|
||||||
{
|
{
|
||||||
this.worldGuard = (WorldGuardPlugin)GriefPrevention.instance.getServer().getPluginManager().getPlugin("WorldGuard");
|
this.worldGuard = (WorldGuardPlugin)GriefPrevention.instance.getServer().getPluginManager().getPlugin("WorldGuard");
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canBuild(Location lesserCorner, Location greaterCorner, Player creatingPlayer)
|
public boolean canBuild(Location lesserCorner, Location greaterCorner, Player creatingPlayer)
|
||||||
{
|
{
|
||||||
World world = lesserCorner.getWorld();
|
|
||||||
|
|
||||||
if (worldGuard == null)
|
if (worldGuard == null)
|
||||||
{
|
{
|
||||||
GriefPrevention.AddLogEntry("WorldGuard is out of date and not enabled. Please update or remove WorldGuard.", CustomLogEntryTypes.Debug, false);
|
GriefPrevention.AddLogEntry("WorldGuard is out of date and not enabled. Please update or remove WorldGuard.", CustomLogEntryTypes.Debug, false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(new RegionPermissionModel(this.worldGuard, creatingPlayer).mayIgnoreRegionProtection(world)) return true;
|
BukkitPlayer localPlayer = new BukkitPlayer(this.worldGuard, creatingPlayer);
|
||||||
|
World world = WorldGuard.getInstance().getPlatform().getWorldByName(lesserCorner.getWorld().getName());
|
||||||
RegionManager manager = this.worldGuard.getRegionManager(world);
|
|
||||||
|
if(new RegionPermissionModel(localPlayer).mayIgnoreRegionProtection(world)) return true;
|
||||||
|
|
||||||
|
RegionManager manager = WorldGuard.getInstance().getPlatform().getRegionContainer().get(world);
|
||||||
|
|
||||||
if(manager != null)
|
if(manager != null)
|
||||||
{
|
{
|
||||||
ProtectedCuboidRegion tempRegion = new ProtectedCuboidRegion(
|
ProtectedCuboidRegion tempRegion = new ProtectedCuboidRegion(
|
||||||
"GP_TEMP",
|
"GP_TEMP",
|
||||||
new BlockVector(lesserCorner.getX(), 0, lesserCorner.getZ()),
|
new BlockVector(lesserCorner.getX(), 0, lesserCorner.getZ()),
|
||||||
new BlockVector(greaterCorner.getX(), world.getMaxHeight(), greaterCorner.getZ()));
|
new BlockVector(greaterCorner.getX(), world.getMaxY(), greaterCorner.getZ()));
|
||||||
|
|
||||||
ApplicableRegionSet overlaps = manager.getApplicableRegions(tempRegion);
|
ApplicableRegionSet overlaps = manager.getApplicableRegions(tempRegion);
|
||||||
LocalPlayer localPlayer = worldGuard.wrapPlayer(creatingPlayer);
|
|
||||||
for (ProtectedRegion r : overlaps.getRegions()) {
|
for (ProtectedRegion r : overlaps.getRegions()) {
|
||||||
if (!manager.getApplicableRegions(r).testState(localPlayer, DefaultFlag.BUILD)) {
|
if (!manager.getApplicableRegions(r).testState(localPlayer, Flags.BUILD)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user