From b62cd8fe12e0aec32bf9a7238d200ab06250136e Mon Sep 17 00:00:00 2001 From: Eric Date: Fri, 31 May 2019 12:03:42 +0200 Subject: [PATCH] Fix getSelection for polygonal regions --- .../implementation/legacy/region/WrappedRegion.java | 10 +++++----- .../implementation/v6/region/WrappedRegion.java | 10 +++++----- .../implementation/v7/region/WrappedRegion.java | 10 +++++----- .../implementation/v7fawe/region/WrappedRegion.java | 10 +++++----- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/implementation/legacy/src/main/java/org/codemc/worldguardwrapper/implementation/legacy/region/WrappedRegion.java b/implementation/legacy/src/main/java/org/codemc/worldguardwrapper/implementation/legacy/region/WrappedRegion.java index 20f3d46..ff35e3d 100644 --- a/implementation/legacy/src/main/java/org/codemc/worldguardwrapper/implementation/legacy/region/WrappedRegion.java +++ b/implementation/legacy/src/main/java/org/codemc/worldguardwrapper/implementation/legacy/region/WrappedRegion.java @@ -2,6 +2,7 @@ package org.codemc.worldguardwrapper.implementation.legacy.region; import com.sk89q.worldedit.BlockVector; import com.sk89q.worldguard.protection.flags.Flag; +import com.sk89q.worldguard.protection.regions.ProtectedPolygonalRegion; import com.sk89q.worldguard.protection.regions.ProtectedRegion; import lombok.AllArgsConstructor; import lombok.Getter; @@ -30,9 +31,8 @@ public class WrappedRegion implements IWrappedRegion { @Override public ISelection getSelection() { - if (handle instanceof IPolygonalSelection) { + if (handle instanceof ProtectedPolygonalRegion) { return new IPolygonalSelection() { - @Override public Set getPoints() { return handle.getPoints().stream() @@ -43,17 +43,17 @@ public class WrappedRegion implements IWrappedRegion { @Override public int getMinimumY() { - return ((IPolygonalSelection) handle).getMinimumY(); + return handle.getMinimumPoint().getBlockY(); } @Override public int getMaximumY() { - return ((IPolygonalSelection) handle).getMaximumY(); + return handle.getMaximumPoint().getBlockY(); } }; } - return new ICuboidSelection() { + return new ICuboidSelection() { @Override public Location getMinimumPoint() { return WorldGuardVectorUtilities.fromBlockVector(world, handle.getMinimumPoint()); 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 75cfcb8..603c821 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 @@ -2,6 +2,7 @@ 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.ProtectedPolygonalRegion; import com.sk89q.worldguard.protection.regions.ProtectedRegion; import lombok.AllArgsConstructor; import lombok.Getter; @@ -30,9 +31,8 @@ public class WrappedRegion implements IWrappedRegion { @Override public ISelection getSelection() { - if (handle instanceof IPolygonalSelection) { + if (handle instanceof ProtectedPolygonalRegion) { return new IPolygonalSelection() { - @Override public Set getPoints() { return handle.getPoints().stream() @@ -43,17 +43,17 @@ public class WrappedRegion implements IWrappedRegion { @Override public int getMinimumY() { - return ((IPolygonalSelection) handle).getMinimumY(); + return handle.getMinimumPoint().getBlockY(); } @Override public int getMaximumY() { - return ((IPolygonalSelection) handle).getMaximumY(); + return handle.getMaximumPoint().getBlockY(); } }; } - return new ICuboidSelection() { + return new ICuboidSelection() { @Override public Location getMinimumPoint() { return WorldGuardVectorUtilities.fromBlockVector(world, handle.getMinimumPoint()); 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 8dcc2f5..edfc391 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 @@ -3,6 +3,7 @@ package org.codemc.worldguardwrapper.implementation.v7.region; 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.ProtectedPolygonalRegion; import com.sk89q.worldguard.protection.regions.ProtectedRegion; import lombok.AllArgsConstructor; import lombok.Getter; @@ -30,9 +31,8 @@ public class WrappedRegion implements IWrappedRegion { @Override public ISelection getSelection() { - if (handle instanceof IPolygonalSelection) { + if (handle instanceof ProtectedPolygonalRegion) { return new IPolygonalSelection() { - @Override public Set getPoints() { return handle.getPoints().stream() @@ -43,17 +43,17 @@ public class WrappedRegion implements IWrappedRegion { @Override public int getMinimumY() { - return ((IPolygonalSelection) handle).getMinimumY(); + return handle.getMinimumPoint().getBlockY(); } @Override public int getMaximumY() { - return ((IPolygonalSelection) handle).getMaximumY(); + return handle.getMaximumPoint().getBlockY(); } }; } - return new ICuboidSelection() { + return new ICuboidSelection() { @Override public Location getMinimumPoint() { return BukkitAdapter.adapt(world, handle.getMinimumPoint()); diff --git a/implementation/v7fawe/src/main/java/org/codemc/worldguardwrapper/implementation/v7fawe/region/WrappedRegion.java b/implementation/v7fawe/src/main/java/org/codemc/worldguardwrapper/implementation/v7fawe/region/WrappedRegion.java index 72c3e7e..ebdb662 100644 --- a/implementation/v7fawe/src/main/java/org/codemc/worldguardwrapper/implementation/v7fawe/region/WrappedRegion.java +++ b/implementation/v7fawe/src/main/java/org/codemc/worldguardwrapper/implementation/v7fawe/region/WrappedRegion.java @@ -2,6 +2,7 @@ package org.codemc.worldguardwrapper.implementation.v7fawe.region; import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldguard.protection.flags.Flag; +import com.sk89q.worldguard.protection.regions.ProtectedPolygonalRegion; import com.sk89q.worldguard.protection.regions.ProtectedRegion; import lombok.AllArgsConstructor; import lombok.Getter; @@ -30,9 +31,8 @@ public class WrappedRegion implements IWrappedRegion { @Override public ISelection getSelection() { - if (handle instanceof IPolygonalSelection) { + if (handle instanceof ProtectedPolygonalRegion) { return new IPolygonalSelection() { - @Override public Set getPoints() { return handle.getPoints().stream() @@ -43,17 +43,17 @@ public class WrappedRegion implements IWrappedRegion { @Override public int getMinimumY() { - return ((IPolygonalSelection) handle).getMinimumY(); + return handle.getMinimumPoint().getBlockY(); } @Override public int getMaximumY() { - return ((IPolygonalSelection) handle).getMaximumY(); + return handle.getMaximumPoint().getBlockY(); } }; } - return new ICuboidSelection() { + return new ICuboidSelection() { @Override public Location getMinimumPoint() { return BukkitAdapter.adapt(world, handle.getMinimumPoint());