forked from clone/WorldGuardWrapper
Fix getSelection for polygonal regions
This commit is contained in:
parent
abcc32bea0
commit
b62cd8fe12
|
@ -2,6 +2,7 @@ package org.codemc.worldguardwrapper.implementation.legacy.region;
|
||||||
|
|
||||||
import com.sk89q.worldedit.BlockVector;
|
import com.sk89q.worldedit.BlockVector;
|
||||||
import com.sk89q.worldguard.protection.flags.Flag;
|
import com.sk89q.worldguard.protection.flags.Flag;
|
||||||
|
import com.sk89q.worldguard.protection.regions.ProtectedPolygonalRegion;
|
||||||
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
@ -30,9 +31,8 @@ public class WrappedRegion implements IWrappedRegion {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ISelection getSelection() {
|
public ISelection getSelection() {
|
||||||
if (handle instanceof IPolygonalSelection) {
|
if (handle instanceof ProtectedPolygonalRegion) {
|
||||||
return new IPolygonalSelection() {
|
return new IPolygonalSelection() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<Location> getPoints() {
|
public Set<Location> getPoints() {
|
||||||
return handle.getPoints().stream()
|
return handle.getPoints().stream()
|
||||||
|
@ -43,17 +43,17 @@ public class WrappedRegion implements IWrappedRegion {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMinimumY() {
|
public int getMinimumY() {
|
||||||
return ((IPolygonalSelection) handle).getMinimumY();
|
return handle.getMinimumPoint().getBlockY();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaximumY() {
|
public int getMaximumY() {
|
||||||
return ((IPolygonalSelection) handle).getMaximumY();
|
return handle.getMaximumPoint().getBlockY();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return new ICuboidSelection() {
|
|
||||||
|
|
||||||
|
return new ICuboidSelection() {
|
||||||
@Override
|
@Override
|
||||||
public Location getMinimumPoint() {
|
public Location getMinimumPoint() {
|
||||||
return WorldGuardVectorUtilities.fromBlockVector(world, handle.getMinimumPoint());
|
return WorldGuardVectorUtilities.fromBlockVector(world, handle.getMinimumPoint());
|
||||||
|
|
|
@ -2,6 +2,7 @@ package org.codemc.worldguardwrapper.implementation.v6.region;
|
||||||
|
|
||||||
import com.sk89q.worldedit.BlockVector;
|
import com.sk89q.worldedit.BlockVector;
|
||||||
import com.sk89q.worldguard.protection.flags.Flag;
|
import com.sk89q.worldguard.protection.flags.Flag;
|
||||||
|
import com.sk89q.worldguard.protection.regions.ProtectedPolygonalRegion;
|
||||||
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
@ -30,9 +31,8 @@ public class WrappedRegion implements IWrappedRegion {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ISelection getSelection() {
|
public ISelection getSelection() {
|
||||||
if (handle instanceof IPolygonalSelection) {
|
if (handle instanceof ProtectedPolygonalRegion) {
|
||||||
return new IPolygonalSelection() {
|
return new IPolygonalSelection() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<Location> getPoints() {
|
public Set<Location> getPoints() {
|
||||||
return handle.getPoints().stream()
|
return handle.getPoints().stream()
|
||||||
|
@ -43,17 +43,17 @@ public class WrappedRegion implements IWrappedRegion {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMinimumY() {
|
public int getMinimumY() {
|
||||||
return ((IPolygonalSelection) handle).getMinimumY();
|
return handle.getMinimumPoint().getBlockY();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaximumY() {
|
public int getMaximumY() {
|
||||||
return ((IPolygonalSelection) handle).getMaximumY();
|
return handle.getMaximumPoint().getBlockY();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return new ICuboidSelection() {
|
|
||||||
|
|
||||||
|
return new ICuboidSelection() {
|
||||||
@Override
|
@Override
|
||||||
public Location getMinimumPoint() {
|
public Location getMinimumPoint() {
|
||||||
return WorldGuardVectorUtilities.fromBlockVector(world, handle.getMinimumPoint());
|
return WorldGuardVectorUtilities.fromBlockVector(world, handle.getMinimumPoint());
|
||||||
|
|
|
@ -3,6 +3,7 @@ package org.codemc.worldguardwrapper.implementation.v7.region;
|
||||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||||
import com.sk89q.worldedit.math.BlockVector2;
|
import com.sk89q.worldedit.math.BlockVector2;
|
||||||
import com.sk89q.worldguard.protection.flags.Flag;
|
import com.sk89q.worldguard.protection.flags.Flag;
|
||||||
|
import com.sk89q.worldguard.protection.regions.ProtectedPolygonalRegion;
|
||||||
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
@ -30,9 +31,8 @@ public class WrappedRegion implements IWrappedRegion {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ISelection getSelection() {
|
public ISelection getSelection() {
|
||||||
if (handle instanceof IPolygonalSelection) {
|
if (handle instanceof ProtectedPolygonalRegion) {
|
||||||
return new IPolygonalSelection() {
|
return new IPolygonalSelection() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<Location> getPoints() {
|
public Set<Location> getPoints() {
|
||||||
return handle.getPoints().stream()
|
return handle.getPoints().stream()
|
||||||
|
@ -43,17 +43,17 @@ public class WrappedRegion implements IWrappedRegion {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMinimumY() {
|
public int getMinimumY() {
|
||||||
return ((IPolygonalSelection) handle).getMinimumY();
|
return handle.getMinimumPoint().getBlockY();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaximumY() {
|
public int getMaximumY() {
|
||||||
return ((IPolygonalSelection) handle).getMaximumY();
|
return handle.getMaximumPoint().getBlockY();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return new ICuboidSelection() {
|
|
||||||
|
|
||||||
|
return new ICuboidSelection() {
|
||||||
@Override
|
@Override
|
||||||
public Location getMinimumPoint() {
|
public Location getMinimumPoint() {
|
||||||
return BukkitAdapter.adapt(world, handle.getMinimumPoint());
|
return BukkitAdapter.adapt(world, handle.getMinimumPoint());
|
||||||
|
|
|
@ -2,6 +2,7 @@ package org.codemc.worldguardwrapper.implementation.v7fawe.region;
|
||||||
|
|
||||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||||
import com.sk89q.worldguard.protection.flags.Flag;
|
import com.sk89q.worldguard.protection.flags.Flag;
|
||||||
|
import com.sk89q.worldguard.protection.regions.ProtectedPolygonalRegion;
|
||||||
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
@ -30,9 +31,8 @@ public class WrappedRegion implements IWrappedRegion {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ISelection getSelection() {
|
public ISelection getSelection() {
|
||||||
if (handle instanceof IPolygonalSelection) {
|
if (handle instanceof ProtectedPolygonalRegion) {
|
||||||
return new IPolygonalSelection() {
|
return new IPolygonalSelection() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<Location> getPoints() {
|
public Set<Location> getPoints() {
|
||||||
return handle.getPoints().stream()
|
return handle.getPoints().stream()
|
||||||
|
@ -43,17 +43,17 @@ public class WrappedRegion implements IWrappedRegion {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMinimumY() {
|
public int getMinimumY() {
|
||||||
return ((IPolygonalSelection) handle).getMinimumY();
|
return handle.getMinimumPoint().getBlockY();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaximumY() {
|
public int getMaximumY() {
|
||||||
return ((IPolygonalSelection) handle).getMaximumY();
|
return handle.getMaximumPoint().getBlockY();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return new ICuboidSelection() {
|
|
||||||
|
|
||||||
|
return new ICuboidSelection() {
|
||||||
@Override
|
@Override
|
||||||
public Location getMinimumPoint() {
|
public Location getMinimumPoint() {
|
||||||
return BukkitAdapter.adapt(world, handle.getMinimumPoint());
|
return BukkitAdapter.adapt(world, handle.getMinimumPoint());
|
||||||
|
|
Loading…
Reference in New Issue
Block a user