From 6642dce9c43f69270dd58d4f9af20b6a977f602c Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Tue, 27 Nov 2018 23:04:59 +0100 Subject: [PATCH] Fix build, maven enhancements --- implementation/pom.xml | 3 ++ implementation/v6/pom.xml | 4 -- .../v6/event/EventListener.java | 2 +- .../implementation/v6/flag/WrappedFlag.java | 1 - .../v6/region/WrappedRegion.java | 1 - implementation/v7/pom.xml | 40 +++++++++++++++++++ .../v7/WorldGuardImplementation.java | 39 ++++++------------ .../v7/region/WrappedRegion.java | 6 +-- pom.xml | 5 +-- 9 files changed, 60 insertions(+), 41 deletions(-) diff --git a/implementation/pom.xml b/implementation/pom.xml index 3c1637c..225c932 100644 --- a/implementation/pom.xml +++ b/implementation/pom.xml @@ -28,6 +28,9 @@ sk89q-repo http://maven.sk89q.com/repo/ + + always + diff --git a/implementation/v6/pom.xml b/implementation/v6/pom.xml index 75f2f13..a7b8917 100644 --- a/implementation/v6/pom.xml +++ b/implementation/v6/pom.xml @@ -49,10 +49,6 @@ org.yaml snakeyaml - - com.google.code.findbugs - jsr305 - com.thoughtworks.paranamer paranamer diff --git a/implementation/v6/src/main/java/org/codemc/worldguardwrapper/implementation/v6/event/EventListener.java b/implementation/v6/src/main/java/org/codemc/worldguardwrapper/implementation/v6/event/EventListener.java index 05a80c6..b3587cd 100644 --- a/implementation/v6/src/main/java/org/codemc/worldguardwrapper/implementation/v6/event/EventListener.java +++ b/implementation/v6/src/main/java/org/codemc/worldguardwrapper/implementation/v6/event/EventListener.java @@ -7,10 +7,10 @@ import com.sk89q.worldguard.protection.events.DisallowedPVPEvent; import lombok.NoArgsConstructor; import org.bukkit.Bukkit; import org.bukkit.entity.Player; +import org.bukkit.event.Event.Result; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; -import org.bukkit.event.Event.Result; import org.codemc.worldguardwrapper.event.*; @NoArgsConstructor diff --git a/implementation/v6/src/main/java/org/codemc/worldguardwrapper/implementation/v6/flag/WrappedFlag.java b/implementation/v6/src/main/java/org/codemc/worldguardwrapper/implementation/v6/flag/WrappedFlag.java index b5318d7..75ab934 100644 --- a/implementation/v6/src/main/java/org/codemc/worldguardwrapper/implementation/v6/flag/WrappedFlag.java +++ b/implementation/v6/src/main/java/org/codemc/worldguardwrapper/implementation/v6/flag/WrappedFlag.java @@ -1,7 +1,6 @@ package org.codemc.worldguardwrapper.implementation.v6.flag; import com.sk89q.worldguard.protection.flags.Flag; -import lombok.AccessLevel; import lombok.AllArgsConstructor; import lombok.Getter; import org.codemc.worldguardwrapper.flag.IWrappedFlag; diff --git a/implementation/v6/src/main/java/org/codemc/worldguardwrapper/implementation/v6/region/WrappedRegion.java b/implementation/v6/src/main/java/org/codemc/worldguardwrapper/implementation/v6/region/WrappedRegion.java index b58ffac..1fd74b6 100644 --- a/implementation/v6/src/main/java/org/codemc/worldguardwrapper/implementation/v6/region/WrappedRegion.java +++ b/implementation/v6/src/main/java/org/codemc/worldguardwrapper/implementation/v6/region/WrappedRegion.java @@ -3,7 +3,6 @@ package org.codemc.worldguardwrapper.implementation.v6.region; import com.sk89q.worldedit.BlockVector; import com.sk89q.worldguard.protection.flags.Flag; import com.sk89q.worldguard.protection.regions.ProtectedRegion; -import lombok.AccessLevel; import lombok.AllArgsConstructor; import lombok.Getter; import org.bukkit.Location; diff --git a/implementation/v7/pom.xml b/implementation/v7/pom.xml index 051945d..e0daafc 100644 --- a/implementation/v7/pom.xml +++ b/implementation/v7/pom.xml @@ -35,6 +35,46 @@ com.sk89q commandbook + + com.sk89q + dummypermscompat + + + com.sk89q.intake + intake + + + com.sk89q + squirrelid + + + org.khelekore + prtree + + + net.sf.opencsv + opencsv + + + com.googlecode.json-simple + json-simple + + + org.flywaydb + flyway-core + + + io.papermc + paperlib + + + org.bstats.bStats-Metrics + bstats-bukkit + + + org.bstats + bstats-bukkit + 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 8324e34..a5ee466 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,9 +1,8 @@ package org.codemc.worldguardwrapper.implementation.v7; -import com.sk89q.worldedit.BlockVector; -import com.sk89q.worldedit.BlockVector2D; 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; @@ -15,8 +14,8 @@ import com.sk89q.worldguard.protection.managers.RegionManager; import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion; import com.sk89q.worldguard.protection.regions.ProtectedPolygonalRegion; import com.sk89q.worldguard.protection.regions.ProtectedRegion; +import lombok.NoArgsConstructor; import lombok.NonNull; -import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.World; import org.bukkit.entity.Player; @@ -32,37 +31,28 @@ import org.codemc.worldguardwrapper.region.IWrappedRegion; import java.util.*; import java.util.stream.Collectors; +@NoArgsConstructor public class WorldGuardImplementation implements IWorldGuardImplementation { - private final WorldGuard core; - private final FlagRegistry flagRegistry; - private final WorldGuardPlugin plugin; - - public WorldGuardImplementation() { - core = WorldGuard.getInstance(); - flagRegistry = core.getFlagRegistry(); - plugin = WorldGuardPlugin.inst(); - } + private final WorldGuard core = WorldGuard.getInstance(); + private final FlagRegistry flagRegistry = core.getFlagRegistry(); + private final WorldGuardPlugin plugin = WorldGuardPlugin.inst(); private Optional wrapPlayer(Player player) { return Optional.ofNullable(player).map(bukkitPlayer -> plugin.wrapPlayer(player)); } - private Optional getPlayer(LocalPlayer player) { - return Optional.ofNullable(Bukkit.getPlayer(player.getUniqueId())); - } - private Optional getWorldManager(@NonNull World world) { return Optional.ofNullable(core.getPlatform().getRegionContainer().get(BukkitAdapter.adapt(world))); } private Optional getApplicableRegions(@NonNull Location location) { - return getWorldManager(location.getWorld()).map(manager -> manager.getApplicableRegions(BukkitAdapter.asVector(location))); + return getWorldManager(location.getWorld()).map(manager -> manager.getApplicableRegions(BukkitAdapter.asBlockVector(location))); } private Optional getApplicableRegions(@NonNull Location minimum, @NonNull Location maximum) { return getWorldManager(minimum.getWorld()).map(manager -> manager.getApplicableRegions( - new ProtectedCuboidRegion("temp", new BlockVector(BukkitAdapter.asVector(minimum)), new BlockVector(BukkitAdapter.asVector(maximum))))); + new ProtectedCuboidRegion("temp", BukkitAdapter.asBlockVector(minimum), BukkitAdapter.asBlockVector(maximum)))); } private Optional queryValue(Player player, @NonNull Location location, @NonNull Flag flag) { @@ -70,11 +60,6 @@ public class WorldGuardImplementation implements IWorldGuardImplementation { .orElse(null), flag)); } - private Optional queryState(Player player, @NonNull Location location, @NonNull StateFlag... stateFlags) { - return getApplicableRegions(location).map(applicableRegions -> applicableRegions.queryState(wrapPlayer(player) - .orElse(null), stateFlags)); - } - @Override public JavaPlugin getWorldGuardPlugin() { return WorldGuardPlugin.inst(); @@ -177,11 +162,11 @@ public class WorldGuardImplementation implements IWorldGuardImplementation { ProtectedRegion region; World world = points.get(0).getWorld(); if (points.size() == 2) { - region = new ProtectedCuboidRegion(id, new BlockVector(BukkitAdapter.asVector(points.get(0))), - new BlockVector(BukkitAdapter.asVector(points.get(1)))); + region = new ProtectedCuboidRegion(id, BukkitAdapter.asBlockVector(points.get(0)), + BukkitAdapter.asBlockVector(points.get(1))); } else { - List vectorPoints = points.stream() - .map(location -> new BlockVector2D(BukkitAdapter.asVector(location).toVector2D())) + List vectorPoints = points.stream() + .map(location -> BukkitAdapter.asBlockVector(location).toBlockVector2()) .collect(Collectors.toList()); region = new ProtectedPolygonalRegion(id, vectorPoints, minY, maxY); diff --git a/implementation/v7/src/main/java/org/codemc/worldguardwrapper/implementation/v7/region/WrappedRegion.java b/implementation/v7/src/main/java/org/codemc/worldguardwrapper/implementation/v7/region/WrappedRegion.java index 86695c3..bd7a7e6 100644 --- a/implementation/v7/src/main/java/org/codemc/worldguardwrapper/implementation/v7/region/WrappedRegion.java +++ b/implementation/v7/src/main/java/org/codemc/worldguardwrapper/implementation/v7/region/WrappedRegion.java @@ -1,7 +1,7 @@ package org.codemc.worldguardwrapper.implementation.v7.region; -import com.sk89q.worldedit.BlockVector2D; import com.sk89q.worldedit.bukkit.BukkitAdapter; +import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldguard.protection.flags.Flag; import com.sk89q.worldguard.protection.regions.ProtectedRegion; import lombok.AllArgsConstructor; @@ -34,7 +34,7 @@ public class WrappedRegion implements IWrappedRegion { @Override public Set getPoints() { return handle.getPoints().stream() - .map(BlockVector2D::toVector) + .map(BlockVector2::toBlockVector3) .map(vector -> BukkitAdapter.adapt(world, vector)) .collect(Collectors.toSet()); } @@ -168,7 +168,7 @@ public class WrappedRegion implements IWrappedRegion { @Override public boolean contains(Location location) { - return handle.contains(BukkitAdapter.asVector(location)); + return handle.contains(BukkitAdapter.asBlockVector(location)); } } diff --git a/pom.xml b/pom.xml index 4654194..00d116b 100644 --- a/pom.xml +++ b/pom.xml @@ -149,10 +149,7 @@ org.apache.maven.plugins maven-shade-plugin - 3.2.0 - - false - + 3.2.1 org.apache.maven.plugins