forked from clone/WorldGuardWrapper
Use currently latest WorldEdit/WorldGuard build
When the sk89q repository is fixed, only worlguard-legacy version 7.0.0-SNAPSHOT is needed.
This commit is contained in:
parent
7efc516a14
commit
487394e256
|
@ -21,11 +21,71 @@
|
|||
<version>1.0.3-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sk89q.worldedit</groupId>
|
||||
<artifactId>worldedit-bukkit</artifactId>
|
||||
<version>7.0.0-20181112.023924-25</version>
|
||||
<groupId>com.sk89q.worldguard</groupId>
|
||||
<artifactId>worldguard-legacy</artifactId>
|
||||
<version>7.0.0-20181117.063337-9</version> <!-- Manually set version -->
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>com.sk89q</groupId>
|
||||
<artifactId>commandbook</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency> <!-- Override worldguard-core to manually set version -->
|
||||
<groupId>com.sk89q.worldguard</groupId>
|
||||
<artifactId>worldguard-core</artifactId>
|
||||
<version>7.0.0-20181117.063337-9</version>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.sk89q.intake</groupId>
|
||||
<artifactId>intake</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>com.sk89q</groupId>
|
||||
<artifactId>squirrelid</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.flywaydb</groupId>
|
||||
<artifactId>flyway-core</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.khelekore</groupId>
|
||||
<artifactId>prtree</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>net.sf.opencsv</groupId>
|
||||
<artifactId>opencsv</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>com.googlecode.json-simple</groupId>
|
||||
<artifactId>json-simple</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>com.google.code.findbugs</groupId>
|
||||
<artifactId>jsr305</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency> <!-- Override worldedit-bukkit to manually set version -->
|
||||
<groupId>com.sk89q.worldedit</groupId>
|
||||
<artifactId>worldedit-bukkit</artifactId>
|
||||
<version>7.0.0-20181118.055910-28</version>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.sk89q</groupId>
|
||||
<artifactId>dummypermscompat</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.bstats</groupId>
|
||||
<artifactId>bstats-bukkit</artifactId>
|
||||
|
@ -35,117 +95,21 @@
|
|||
<artifactId>paperlib</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<groupId>net.milkbowl.vault</groupId>
|
||||
<artifactId>VaultAPI</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>com.sk89q.intake</groupId>
|
||||
<artifactId>intake</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>com.sk89q</groupId>
|
||||
<artifactId>squirrelid</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.flywaydb</groupId>
|
||||
<artifactId>flyway-core</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.khelekore</groupId>
|
||||
<artifactId>prtree</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>com.googlecode.json-simple</groupId>
|
||||
<artifactId>json-simple</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>net.sf.opencsv</groupId>
|
||||
<artifactId>opencsv</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>com.sk89q</groupId>
|
||||
<artifactId>commandbook</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>de.schlichtherle</groupId>
|
||||
<artifactId>truezip</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>rhino</groupId>
|
||||
<artifactId>js</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.yaml</groupId>
|
||||
<artifactId>snakeyaml</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>com.sk89q</groupId>
|
||||
<artifactId>jchronic</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>com.google.code.findbugs</groupId>
|
||||
<artifactId>jsr305</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>com.thoughtworks.paranamer</groupId>
|
||||
<artifactId>paranamer</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>com.sk89q.lib</groupId>
|
||||
<artifactId>jlibnoise</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>com.sk89q</groupId>
|
||||
<artifactId>dummypermscompat</artifactId>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sk89q.worldguard</groupId>
|
||||
<artifactId>worldguard-legacy</artifactId>
|
||||
<version>7.0.0-SNAPSHOT</version>
|
||||
<dependency> <!-- Override worldedit-core to manually set version -->
|
||||
<groupId>com.sk89q.worldedit</groupId>
|
||||
<artifactId>worldedit-core</artifactId>
|
||||
<version>7.0.0-20181118.055910-28</version>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>com.sk89q.intake</groupId>
|
||||
<artifactId>intake</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>com.sk89q</groupId>
|
||||
<artifactId>squirrelid</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.flywaydb</groupId>
|
||||
<artifactId>flyway-core</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.khelekore</groupId>
|
||||
<artifactId>prtree</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>com.googlecode.json-simple</groupId>
|
||||
<artifactId>json-simple</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>net.sf.opencsv</groupId>
|
||||
<artifactId>opencsv</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>com.sk89q</groupId>
|
||||
<artifactId>commandbook</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>de.schlichtherle</groupId>
|
||||
<artifactId>truezip</artifactId>
|
||||
|
@ -183,8 +147,8 @@
|
|||
<artifactId>jlibnoise</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>com.sk89q</groupId>
|
||||
<artifactId>dummypermscompat</artifactId>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
package org.codemc.worldguardwrapper.implementation.v7;
|
||||
|
||||
import com.sk89q.worldedit.BlockVector;
|
||||
import com.sk89q.worldedit.BlockVector2D;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldedit.bukkit.BukkitWorld;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
import com.sk89q.worldguard.WorldGuard;
|
||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||
|
@ -44,22 +42,6 @@ public class WorldGuardImplementation implements IWorldGuardImplementation {
|
|||
plugin = WorldGuardPlugin.inst();
|
||||
}
|
||||
|
||||
// Adapters
|
||||
|
||||
private static Vector toVector(Location location) {
|
||||
return new Vector(location.getX(), location.getY(), location.getZ());
|
||||
}
|
||||
|
||||
private static BlockVector toBlockVector(Location location) {
|
||||
return new BlockVector(location.getX(), location.getY(), location.getZ());
|
||||
}
|
||||
|
||||
private static List<BlockVector2D> toBlockVector2DList(List<Location> locations) {
|
||||
return locations.stream()
|
||||
.map(location -> new BlockVector2D(location.getX(), location.getZ()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private Optional<LocalPlayer> wrapPlayer(Player player) {
|
||||
return Optional.ofNullable(player).map(bukkitPlayer -> plugin.wrapPlayer(player));
|
||||
}
|
||||
|
@ -73,7 +55,7 @@ public class WorldGuardImplementation implements IWorldGuardImplementation {
|
|||
}
|
||||
|
||||
private Optional<ApplicableRegionSet> getApplicableRegions(@NonNull Location location) {
|
||||
return getWorldManager(location.getWorld()).map(manager -> manager.getApplicableRegions(toVector(location)));
|
||||
return getWorldManager(location.getWorld()).map(manager -> manager.getApplicableRegions(BukkitAdapter.asBlockVector(location)));
|
||||
}
|
||||
|
||||
private <V> Optional<V> queryValue(Player player, @NonNull Location location, @NonNull Flag<V> flag) {
|
||||
|
@ -112,7 +94,7 @@ public class WorldGuardImplementation implements IWorldGuardImplementation {
|
|||
|
||||
@Override
|
||||
public boolean contains(Location location) {
|
||||
return region.contains(toVector(location));
|
||||
return region.contains(BukkitAdapter.asBlockVector(location));
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -226,9 +208,13 @@ public class WorldGuardImplementation implements IWorldGuardImplementation {
|
|||
public Optional<WrappedRegion> addRegion(String id, List<Location> points, int minY, int maxY) {
|
||||
ProtectedRegion region;
|
||||
if (points.size() == 2) {
|
||||
region = new ProtectedCuboidRegion(id, toBlockVector(points.get(0)), toBlockVector(points.get(1)));
|
||||
region = new ProtectedCuboidRegion(id, BukkitAdapter.asBlockVector(points.get(0)), BukkitAdapter.asBlockVector(points.get(1)));
|
||||
} else {
|
||||
region = new ProtectedPolygonalRegion(id, toBlockVector2DList(points), minY, maxY);
|
||||
List<BlockVector2> vectorPoints = points.stream()
|
||||
.map(location -> BukkitAdapter.asBlockVector(location).toBlockVector2())
|
||||
.collect(Collectors.toList());
|
||||
|
||||
region = new ProtectedPolygonalRegion(id, vectorPoints, minY, maxY);
|
||||
}
|
||||
|
||||
Optional<RegionManager> manager = getWorldManager(points.get(0).getWorld());
|
||||
|
|
Loading…
Reference in New Issue
Block a user