From 487394e256cb1afd32e3735e81949c2a8b7ef79e Mon Sep 17 00:00:00 2001 From: Eric Date: Sun, 18 Nov 2018 15:57:46 +0100 Subject: [PATCH] Use currently latest WorldEdit/WorldGuard build When the sk89q repository is fixed, only worlguard-legacy version 7.0.0-SNAPSHOT is needed. --- implementation/v7/pom.xml | 182 +++++++----------- .../v7/WorldGuardImplementation.java | 32 +-- 2 files changed, 82 insertions(+), 132 deletions(-) diff --git a/implementation/v7/pom.xml b/implementation/v7/pom.xml index 3866795..e541f00 100644 --- a/implementation/v7/pom.xml +++ b/implementation/v7/pom.xml @@ -21,11 +21,71 @@ 1.0.3-SNAPSHOT - com.sk89q.worldedit - worldedit-bukkit - 7.0.0-20181112.023924-25 + com.sk89q.worldguard + worldguard-legacy + 7.0.0-20181117.063337-9 provided + + org.bukkit + bukkit + + + com.sk89q + commandbook + + + + + com.sk89q.worldguard + worldguard-core + 7.0.0-20181117.063337-9 + provided + + + com.sk89q.intake + intake + + + com.sk89q + squirrelid + + + org.flywaydb + flyway-core + + + org.khelekore + prtree + + + net.sf.opencsv + opencsv + + + com.googlecode.json-simple + json-simple + + + com.google.code.findbugs + jsr305 + + + + + com.sk89q.worldedit + worldedit-bukkit + 7.0.0-20181118.055910-28 + provided + + + com.sk89q + dummypermscompat + + + org.bukkit + bukkit + org.bstats bstats-bukkit @@ -35,117 +95,21 @@ paperlib - org.bukkit - bukkit + net.milkbowl.vault + VaultAPI - com.sk89q.intake - intake - - - com.sk89q - squirrelid - - - org.flywaydb - flyway-core - - - org.khelekore - prtree - - - com.googlecode.json-simple - json-simple - - - net.sf.opencsv - opencsv - - - com.sk89q - commandbook - - - de.schlichtherle - truezip - - - rhino - js - - - org.yaml - snakeyaml - - - com.google.guava - guava - - - com.sk89q - jchronic - - - com.google.code.findbugs - jsr305 - - - com.thoughtworks.paranamer - paranamer - - - com.google.code.gson - gson - - - com.sk89q.lib - jlibnoise - - - com.sk89q - dummypermscompat + org.mockito + mockito-core - - com.sk89q.worldguard - worldguard-legacy - 7.0.0-SNAPSHOT + + com.sk89q.worldedit + worldedit-core + 7.0.0-20181118.055910-28 provided - - org.bukkit - bukkit - - - com.sk89q.intake - intake - - - com.sk89q - squirrelid - - - org.flywaydb - flyway-core - - - org.khelekore - prtree - - - com.googlecode.json-simple - json-simple - - - net.sf.opencsv - opencsv - - - com.sk89q - commandbook - de.schlichtherle truezip @@ -183,8 +147,8 @@ jlibnoise - com.sk89q - dummypermscompat + org.mockito + mockito-core diff --git a/implementation/v7/src/main/java/org/codemc/worldguardwrapper/implementation/v7/WorldGuardImplementation.java b/implementation/v7/src/main/java/org/codemc/worldguardwrapper/implementation/v7/WorldGuardImplementation.java index 8931731..b6cbeaa 100644 --- a/implementation/v7/src/main/java/org/codemc/worldguardwrapper/implementation/v7/WorldGuardImplementation.java +++ b/implementation/v7/src/main/java/org/codemc/worldguardwrapper/implementation/v7/WorldGuardImplementation.java @@ -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 toBlockVector2DList(List locations) { - return locations.stream() - .map(location -> new BlockVector2D(location.getX(), location.getZ())) - .collect(Collectors.toList()); - } - private Optional wrapPlayer(Player player) { return Optional.ofNullable(player).map(bukkitPlayer -> plugin.wrapPlayer(player)); } @@ -73,7 +55,7 @@ public class WorldGuardImplementation implements IWorldGuardImplementation { } private Optional 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 Optional queryValue(Player player, @NonNull Location location, @NonNull Flag 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 addRegion(String id, List 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 vectorPoints = points.stream() + .map(location -> BukkitAdapter.asBlockVector(location).toBlockVector2()) + .collect(Collectors.toList()); + + region = new ProtectedPolygonalRegion(id, vectorPoints, minY, maxY); } Optional manager = getWorldManager(points.get(0).getWorld());