Implement getPlayerSelection() and SelectionUtilities, bump version

This commit is contained in:
Gabriele C 2020-06-26 20:43:13 +02:00
parent 4ea70913c5
commit bd1e41cbb6
15 changed files with 351 additions and 86 deletions

View File

@ -7,7 +7,7 @@
<parent>
<groupId>org.codemc.worldguardwrapper</groupId>
<artifactId>worldguardwrapper-parent</artifactId>
<version>1.1.8-SNAPSHOT</version>
<version>1.1.9-SNAPSHOT</version>
</parent>
<artifactId>worldguardwrapper-api</artifactId>

View File

@ -154,8 +154,9 @@ public interface IWorldGuardImplementation {
} else if (selection instanceof IPolygonalSelection) {
IPolygonalSelection sel = (IPolygonalSelection) selection;
return addRegion(id, new ArrayList<>(sel.getPoints()), sel.getMinimumY(), sel.getMaximumY());
} else {
throw new UnsupportedOperationException("Unknown " + selection.getClass().getSimpleName() + " selection type!");
}
return Optional.empty();
}
/**
@ -167,4 +168,12 @@ public interface IWorldGuardImplementation {
*/
Optional<Set<IWrappedRegion>> removeRegion(@NonNull World world, @NonNull String id);
/**
* Returns the current selection of the given player.
*
* @param player The player
* @return The current player's selection
*/
Optional<ISelection> getPlayerSelection(@NonNull Player player);
}

View File

@ -0,0 +1,72 @@
package org.codemc.worldguardwrapper.utility;
import lombok.experimental.UtilityClass;
import org.bukkit.Location;
import org.codemc.worldguardwrapper.selection.ICuboidSelection;
import org.codemc.worldguardwrapper.selection.IPolygonalSelection;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
@UtilityClass
public class SelectionUtilities {
/**
* Creates a static cuboid selection.
*
* @param first the first point of the cuboid
* @param second the second point of the cuboid
* @return the selection
*/
public ICuboidSelection createCuboidSelection(Location first, Location second) {
Location minimum;
Location maximum;
if (first.getBlockY() > second.getBlockY()) {
maximum = first;
minimum = second;
} else {
maximum = second;
minimum = first;
}
return new ICuboidSelection() {
@Override
public Location getMinimumPoint() {
return minimum;
}
@Override
public Location getMaximumPoint() {
return maximum;
}
};
}
/**
* Creates a static polygonal selection.
*
* @param points the points of the selection
* @param minY the minimum Y coordinate of the selection
* @param maxY the maximum Y coordinate of the selection
* @return the selection
*/
public IPolygonalSelection createPolygonalSelection(Collection<Location> points, int minY, int maxY) {
return new IPolygonalSelection() {
@Override
public Set<Location> getPoints() {
return new HashSet<>(points);
}
@Override
public int getMinimumY() {
return minY;
}
@Override
public int getMaximumY() {
return maxY;
}
};
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>org.codemc.worldguardwrapper</groupId>
<artifactId>worldguardwrapper-implementation</artifactId>
<version>1.1.8-SNAPSHOT</version>
<version>1.1.9-SNAPSHOT</version>
</parent>
<artifactId>worldguardwrapper-implementation-legacy</artifactId>
@ -28,7 +28,7 @@
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>worldguardwrapper-api</artifactId>
<version>1.1.8-SNAPSHOT</version>
<version>1.1.9-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>

View File

@ -1,6 +1,10 @@
package org.codemc.worldguardwrapper.implementation.legacy;
import com.google.common.collect.Maps;
import com.sk89q.minecraft.util.commands.CommandException;
import com.sk89q.worldedit.BlockVector;
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
import com.sk89q.worldedit.bukkit.selections.CuboidSelection;
import com.sk89q.worldedit.bukkit.selections.Polygonal2DSelection;
import com.sk89q.worldguard.LocalPlayer;
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
import com.sk89q.worldguard.protection.ApplicableRegionSet;
@ -10,7 +14,6 @@ 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.Location;
import org.bukkit.World;
@ -23,21 +26,33 @@ import org.codemc.worldguardwrapper.implementation.legacy.region.WrappedRegion;
import org.codemc.worldguardwrapper.implementation.legacy.utility.WorldGuardFlagUtilities;
import org.codemc.worldguardwrapper.implementation.legacy.utility.WorldGuardVectorUtilities;
import org.codemc.worldguardwrapper.region.IWrappedRegion;
import org.codemc.worldguardwrapper.selection.ICuboidSelection;
import org.codemc.worldguardwrapper.selection.IPolygonalSelection;
import org.codemc.worldguardwrapper.selection.ISelection;
import java.util.*;
import java.util.stream.Collectors;
@NoArgsConstructor
public class WorldGuardImplementation implements IWorldGuardImplementation {
private final WorldGuardPlugin plugin = WorldGuardPlugin.inst();
private final WorldGuardPlugin worldGuardPlugin;
private final WorldEditPlugin worldEditPlugin;
public WorldGuardImplementation() {
worldGuardPlugin = WorldGuardPlugin.inst();
try {
worldEditPlugin = worldGuardPlugin.getWorldEdit();
} catch (CommandException e) {
throw new RuntimeException(e);
}
}
private Optional<LocalPlayer> wrapPlayer(Player player) {
return Optional.ofNullable(player).map(bukkitPlayer -> plugin.wrapPlayer(player));
return Optional.ofNullable(player).map(bukkitPlayer -> worldGuardPlugin.wrapPlayer(player));
}
private Optional<RegionManager> getWorldManager(@NonNull World world) {
return Optional.ofNullable(plugin.getRegionManager(world));
return Optional.ofNullable(worldGuardPlugin.getRegionManager(world));
}
private Optional<ApplicableRegionSet> getApplicableRegions(@NonNull Location location) {
@ -126,7 +141,7 @@ public class WorldGuardImplementation implements IWorldGuardImplementation {
@Override
public Map<String, IWrappedRegion> getRegions(World world) {
RegionManager regionManager = plugin.getRegionManager(world);
RegionManager regionManager = worldGuardPlugin.getRegionManager(world);
Map<String, ProtectedRegion> regions = regionManager.getRegions();
Map<String, IWrappedRegion> map = new HashMap<>();
@ -187,4 +202,45 @@ public class WorldGuardImplementation implements IWorldGuardImplementation {
.collect(Collectors.toSet()));
}
@Override
public Optional<ISelection> getPlayerSelection(@NonNull Player player) {
return Optional.ofNullable(worldEditPlugin.getSelection(player))
.map(selection -> {
if (selection instanceof CuboidSelection) {
return new ICuboidSelection() {
@Override
public Location getMinimumPoint() {
return selection.getMinimumPoint();
}
@Override
public Location getMaximumPoint() {
return selection.getMaximumPoint();
}
};
} else if (selection instanceof Polygonal2DSelection) {
return new IPolygonalSelection() {
@Override
public Set<Location> getPoints() {
return ((Polygonal2DSelection) selection).getNativePoints().stream()
.map(vector -> new BlockVector(vector.toVector()))
.map(vector -> WorldGuardVectorUtilities.fromBlockVector(selection.getWorld(), vector))
.collect(Collectors.toSet());
}
@Override
public int getMinimumY() {
return selection.getMinimumPoint().getBlockY();
}
@Override
public int getMaximumY() {
return selection.getMaximumPoint().getBlockY();
}
};
} else {
throw new UnsupportedOperationException("Unsupported " + selection.getClass().getSimpleName() + " selection!");
}
});
}
}

View File

@ -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.ProtectedCuboidRegion;
import com.sk89q.worldguard.protection.regions.ProtectedPolygonalRegion;
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
import lombok.AllArgsConstructor;
@ -34,7 +35,19 @@ public class WrappedRegion implements IWrappedRegion {
@Override
public ISelection getSelection() {
if (handle instanceof ProtectedPolygonalRegion) {
if (handle instanceof ProtectedCuboidRegion) {
return new ICuboidSelection() {
@Override
public Location getMinimumPoint() {
return WorldGuardVectorUtilities.fromBlockVector(world, handle.getMinimumPoint());
}
@Override
public Location getMaximumPoint() {
return WorldGuardVectorUtilities.fromBlockVector(world, handle.getMaximumPoint());
}
};
} else if (handle instanceof ProtectedPolygonalRegion) {
return new IPolygonalSelection() {
@Override
public Set<Location> getPoints() {
@ -54,19 +67,9 @@ public class WrappedRegion implements IWrappedRegion {
return handle.getMaximumPoint().getBlockY();
}
};
} else {
throw new UnsupportedOperationException("Unsupported " + handle.getClass().getSimpleName() + " region!");
}
return new ICuboidSelection() {
@Override
public Location getMinimumPoint() {
return WorldGuardVectorUtilities.fromBlockVector(world, handle.getMinimumPoint());
}
@Override
public Location getMaximumPoint() {
return WorldGuardVectorUtilities.fromBlockVector(world, handle.getMaximumPoint());
}
};
}
@Override

View File

@ -7,7 +7,7 @@
<parent>
<groupId>org.codemc.worldguardwrapper</groupId>
<artifactId>worldguardwrapper-parent</artifactId>
<version>1.1.8-SNAPSHOT</version>
<version>1.1.9-SNAPSHOT</version>
</parent>
<artifactId>worldguardwrapper-implementation</artifactId>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>org.codemc.worldguardwrapper</groupId>
<artifactId>worldguardwrapper-implementation</artifactId>
<version>1.1.8-SNAPSHOT</version>
<version>1.1.9-SNAPSHOT</version>
</parent>
<artifactId>worldguardwrapper-implementation-v6</artifactId>
@ -28,7 +28,7 @@
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>worldguardwrapper-api</artifactId>
<version>1.1.8-SNAPSHOT</version>
<version>1.1.9-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>

View File

@ -1,6 +1,10 @@
package org.codemc.worldguardwrapper.implementation.v6;
import com.google.common.collect.Maps;
import com.sk89q.minecraft.util.commands.CommandException;
import com.sk89q.worldedit.BlockVector;
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
import com.sk89q.worldedit.bukkit.selections.CuboidSelection;
import com.sk89q.worldedit.bukkit.selections.Polygonal2DSelection;
import com.sk89q.worldguard.LocalPlayer;
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
import com.sk89q.worldguard.protection.ApplicableRegionSet;
@ -11,7 +15,6 @@ 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.Location;
import org.bukkit.World;
@ -26,22 +29,35 @@ import org.codemc.worldguardwrapper.implementation.v6.region.WrappedRegion;
import org.codemc.worldguardwrapper.implementation.v6.utility.WorldGuardFlagUtilities;
import org.codemc.worldguardwrapper.implementation.v6.utility.WorldGuardVectorUtilities;
import org.codemc.worldguardwrapper.region.IWrappedRegion;
import org.codemc.worldguardwrapper.selection.ICuboidSelection;
import org.codemc.worldguardwrapper.selection.IPolygonalSelection;
import org.codemc.worldguardwrapper.selection.ISelection;
import java.util.*;
import java.util.stream.Collectors;
@NoArgsConstructor
public class WorldGuardImplementation implements IWorldGuardImplementation {
private final WorldGuardPlugin plugin = WorldGuardPlugin.inst();
private final FlagRegistry flagRegistry = plugin.getFlagRegistry();
private final WorldGuardPlugin worldGuardPlugin;
private final WorldEditPlugin worldEditPlugin;
private final FlagRegistry flagRegistry;
public WorldGuardImplementation() {
worldGuardPlugin = WorldGuardPlugin.inst();
try {
worldEditPlugin = worldGuardPlugin.getWorldEdit();
} catch (CommandException e) {
throw new RuntimeException(e);
}
flagRegistry = worldGuardPlugin.getFlagRegistry();
}
private Optional<LocalPlayer> wrapPlayer(Player player) {
return Optional.ofNullable(player).map(bukkitPlayer -> plugin.wrapPlayer(player));
return Optional.ofNullable(player).map(bukkitPlayer -> worldGuardPlugin.wrapPlayer(player));
}
private Optional<RegionManager> getWorldManager(@NonNull World world) {
return Optional.ofNullable(plugin.getRegionManager(world));
return Optional.ofNullable(worldGuardPlugin.getRegionManager(world));
}
private Optional<ApplicableRegionSet> getApplicableRegions(@NonNull Location location) {
@ -152,7 +168,7 @@ public class WorldGuardImplementation implements IWorldGuardImplementation {
@Override
public Map<String, IWrappedRegion> getRegions(World world) {
RegionManager regionManager = plugin.getRegionManager(world);
RegionManager regionManager = worldGuardPlugin.getRegionManager(world);
Map<String, ProtectedRegion> regions = regionManager.getRegions();
Map<String, IWrappedRegion> map = new HashMap<>();
@ -213,4 +229,45 @@ public class WorldGuardImplementation implements IWorldGuardImplementation {
.collect(Collectors.toSet()));
}
@Override
public Optional<ISelection> getPlayerSelection(@NonNull Player player) {
return Optional.ofNullable(worldEditPlugin.getSelection(player))
.map(selection -> {
if (selection instanceof CuboidSelection) {
return new ICuboidSelection() {
@Override
public Location getMinimumPoint() {
return selection.getMinimumPoint();
}
@Override
public Location getMaximumPoint() {
return selection.getMaximumPoint();
}
};
} else if (selection instanceof Polygonal2DSelection) {
return new IPolygonalSelection() {
@Override
public Set<Location> getPoints() {
return ((Polygonal2DSelection) selection).getNativePoints().stream()
.map(vector -> new BlockVector(vector.toVector()))
.map(vector -> WorldGuardVectorUtilities.fromBlockVector(selection.getWorld(), vector))
.collect(Collectors.toSet());
}
@Override
public int getMinimumY() {
return selection.getMinimumPoint().getBlockY();
}
@Override
public int getMaximumY() {
return selection.getMaximumPoint().getBlockY();
}
};
} else {
throw new UnsupportedOperationException("Unsupported " + selection.getClass().getSimpleName() + " selection!");
}
});
}
}

View File

@ -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.ProtectedCuboidRegion;
import com.sk89q.worldguard.protection.regions.ProtectedPolygonalRegion;
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
import lombok.AllArgsConstructor;
@ -18,11 +19,7 @@ import org.codemc.worldguardwrapper.selection.ICuboidSelection;
import org.codemc.worldguardwrapper.selection.IPolygonalSelection;
import org.codemc.worldguardwrapper.selection.ISelection;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.UUID;
import java.util.*;
import java.util.stream.Collectors;
@AllArgsConstructor
@ -34,7 +31,19 @@ public class WrappedRegion implements IWrappedRegion {
@Override
public ISelection getSelection() {
if (handle instanceof ProtectedPolygonalRegion) {
if (handle instanceof ProtectedCuboidRegion) {
return new ICuboidSelection() {
@Override
public Location getMinimumPoint() {
return WorldGuardVectorUtilities.fromBlockVector(world, handle.getMinimumPoint());
}
@Override
public Location getMaximumPoint() {
return WorldGuardVectorUtilities.fromBlockVector(world, handle.getMaximumPoint());
}
};
} else if (handle instanceof ProtectedPolygonalRegion) {
return new IPolygonalSelection() {
@Override
public Set<Location> getPoints() {
@ -54,19 +63,9 @@ public class WrappedRegion implements IWrappedRegion {
return handle.getMaximumPoint().getBlockY();
}
};
} else {
throw new UnsupportedOperationException("Unsupported " + handle.getClass().getSimpleName() + " region!");
}
return new ICuboidSelection() {
@Override
public Location getMinimumPoint() {
return WorldGuardVectorUtilities.fromBlockVector(world, handle.getMinimumPoint());
}
@Override
public Location getMaximumPoint() {
return WorldGuardVectorUtilities.fromBlockVector(world, handle.getMaximumPoint());
}
};
}
@Override

View File

@ -7,7 +7,7 @@
<parent>
<groupId>org.codemc.worldguardwrapper</groupId>
<artifactId>worldguardwrapper-implementation</artifactId>
<version>1.1.8-SNAPSHOT</version>
<version>1.1.9-SNAPSHOT</version>
</parent>
<artifactId>worldguardwrapper-implementation-v7</artifactId>
@ -28,7 +28,7 @@
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>worldguardwrapper-api</artifactId>
<version>1.1.8-SNAPSHOT</version>
<version>1.1.9-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>

View File

@ -1,9 +1,14 @@
package org.codemc.worldguardwrapper.implementation.v7;
import com.google.common.collect.Maps;
import com.sk89q.minecraft.util.commands.CommandException;
import com.sk89q.worldedit.IncompleteRegionException;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.bukkit.BukkitWorld;
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.regions.Polygonal2DRegion;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldguard.LocalPlayer;
import com.sk89q.worldguard.WorldGuard;
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
@ -15,7 +20,6 @@ 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.Location;
import org.bukkit.World;
@ -29,19 +33,33 @@ import org.codemc.worldguardwrapper.implementation.v7.flag.AbstractWrappedFlag;
import org.codemc.worldguardwrapper.implementation.v7.region.WrappedRegion;
import org.codemc.worldguardwrapper.implementation.v7.utility.WorldGuardFlagUtilities;
import org.codemc.worldguardwrapper.region.IWrappedRegion;
import org.codemc.worldguardwrapper.selection.ICuboidSelection;
import org.codemc.worldguardwrapper.selection.IPolygonalSelection;
import org.codemc.worldguardwrapper.selection.ISelection;
import java.util.*;
import java.util.stream.Collectors;
@NoArgsConstructor
public class WorldGuardImplementation implements IWorldGuardImplementation {
private final WorldGuard core = WorldGuard.getInstance();
private final FlagRegistry flagRegistry = core.getFlagRegistry();
private final WorldGuardPlugin plugin = WorldGuardPlugin.inst();
private final WorldGuard core;
private final FlagRegistry flagRegistry;
private final WorldGuardPlugin worldGuardPlugin;
private final WorldEditPlugin worldEditPlugin;
public WorldGuardImplementation() {
core = WorldGuard.getInstance();
flagRegistry = core.getFlagRegistry();
worldGuardPlugin = WorldGuardPlugin.inst();
try {
worldEditPlugin = worldGuardPlugin.getWorldEdit();
} catch (CommandException e) {
throw new RuntimeException(e);
}
}
private Optional<LocalPlayer> wrapPlayer(Player player) {
return Optional.ofNullable(player).map(bukkitPlayer -> plugin.wrapPlayer(player));
return Optional.ofNullable(player).map(bukkitPlayer -> worldGuardPlugin.wrapPlayer(player));
}
private Optional<RegionManager> getWorldManager(@NonNull World world) {
@ -221,4 +239,56 @@ public class WorldGuardImplementation implements IWorldGuardImplementation {
return set.map(protectedRegions -> protectedRegions.stream()
.map(region -> new WrappedRegion(world, region)).collect(Collectors.toSet()));
}
@Override
public Optional<ISelection> getPlayerSelection(@NonNull Player player) {
Region region;
try {
region = worldEditPlugin.getSession(player).getSelection(BukkitAdapter.adapt(player.getWorld()));
} catch (IncompleteRegionException e) {
region = null;
}
return Optional.ofNullable(region)
.map(selection -> {
World world = Optional.ofNullable(selection.getWorld()).map(BukkitAdapter::adapt).orElse(null);
if (world == null) {
return null;
}
if (selection instanceof CuboidRegion) {
return new ICuboidSelection() {
@Override
public Location getMinimumPoint() {
return BukkitAdapter.adapt(world, selection.getMinimumPoint());
}
@Override
public Location getMaximumPoint() {
return BukkitAdapter.adapt(world, selection.getMaximumPoint());
}
};
} else if (selection instanceof Polygonal2DRegion) {
return new IPolygonalSelection() {
@Override
public Set<Location> getPoints() {
return ((Polygonal2DRegion) selection).getPoints().stream()
.map(BlockVector2::toBlockVector3)
.map(vector -> BukkitAdapter.adapt(world, vector))
.collect(Collectors.toSet());
}
@Override
public int getMinimumY() {
return selection.getMinimumPoint().getBlockY();
}
@Override
public int getMaximumY() {
return selection.getMaximumPoint().getBlockY();
}
};
} else {
throw new UnsupportedOperationException("Unsupported " + selection.getClass().getSimpleName() + " selection!");
}
});
}
}

View File

@ -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.ProtectedCuboidRegion;
import com.sk89q.worldguard.protection.regions.ProtectedPolygonalRegion;
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
import lombok.AllArgsConstructor;
@ -18,11 +19,7 @@ import org.codemc.worldguardwrapper.selection.ICuboidSelection;
import org.codemc.worldguardwrapper.selection.IPolygonalSelection;
import org.codemc.worldguardwrapper.selection.ISelection;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.UUID;
import java.util.*;
import java.util.stream.Collectors;
@AllArgsConstructor
@ -34,7 +31,19 @@ public class WrappedRegion implements IWrappedRegion {
@Override
public ISelection getSelection() {
if (handle instanceof ProtectedPolygonalRegion) {
if (handle instanceof ProtectedCuboidRegion) {
return new ICuboidSelection() {
@Override
public Location getMinimumPoint() {
return BukkitAdapter.adapt(world, handle.getMinimumPoint());
}
@Override
public Location getMaximumPoint() {
return BukkitAdapter.adapt(world, handle.getMaximumPoint());
}
};
} else if (handle instanceof ProtectedPolygonalRegion) {
return new IPolygonalSelection() {
@Override
public Set<Location> getPoints() {
@ -54,19 +63,9 @@ public class WrappedRegion implements IWrappedRegion {
return handle.getMaximumPoint().getBlockY();
}
};
} else {
throw new UnsupportedOperationException("Unsupported " + handle.getClass().getSimpleName() + " region!");
}
return new ICuboidSelection() {
@Override
public Location getMinimumPoint() {
return BukkitAdapter.adapt(world, handle.getMinimumPoint());
}
@Override
public Location getMaximumPoint() {
return BukkitAdapter.adapt(world, handle.getMaximumPoint());
}
};
}
@Override

View File

@ -7,7 +7,7 @@
<parent>
<groupId>org.codemc.worldguardwrapper</groupId>
<artifactId>worldguardwrapper-parent</artifactId>
<version>1.1.8-SNAPSHOT</version>
<version>1.1.9-SNAPSHOT</version>
</parent>
<artifactId>worldguardwrapper</artifactId>
@ -18,22 +18,22 @@
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>worldguardwrapper-api</artifactId>
<version>1.1.8-SNAPSHOT</version>
<version>1.1.9-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>worldguardwrapper-implementation-legacy</artifactId>
<version>1.1.8-SNAPSHOT</version>
<version>1.1.9-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>worldguardwrapper-implementation-v6</artifactId>
<version>1.1.8-SNAPSHOT</version>
<version>1.1.9-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>worldguardwrapper-implementation-v7</artifactId>
<version>1.1.8-SNAPSHOT</version>
<version>1.1.9-SNAPSHOT</version>
</dependency>
</dependencies>

View File

@ -6,7 +6,7 @@
<groupId>org.codemc.worldguardwrapper</groupId>
<artifactId>worldguardwrapper-parent</artifactId>
<version>1.1.8-SNAPSHOT</version>
<version>1.1.9-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>