forked from clone/WorldGuardWrapper
		
	getPoints returns no longer a Set but a List to maintains object order but removing dupicates (distinct)
This commit is contained in:
		
							parent
							
								
									900e0a5017
								
							
						
					
					
						commit
						70aa8186e2
					
				|  | @ -2,12 +2,13 @@ package org.codemc.worldguardwrapper.selection; | |||
| 
 | ||||
| import org.bukkit.Location; | ||||
| 
 | ||||
| import java.util.List; | ||||
| import java.util.Set; | ||||
| 
 | ||||
| @SuppressWarnings("unused") | ||||
| public interface IPolygonalSelection extends ISelection { | ||||
| 
 | ||||
|     Set<Location> getPoints(); | ||||
|     List<Location> getPoints(); | ||||
| 
 | ||||
|     int getMinimumY(); | ||||
| 
 | ||||
|  |  | |||
|  | @ -5,9 +5,8 @@ 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; | ||||
| import java.util.*; | ||||
| import java.util.stream.Collectors; | ||||
| 
 | ||||
| @SuppressWarnings("unused") | ||||
| @UtilityClass | ||||
|  | @ -54,8 +53,9 @@ public class SelectionUtilities { | |||
|     public IPolygonalSelection createPolygonalSelection(Collection<Location> points, int minY, int maxY) { | ||||
|         return new IPolygonalSelection() { | ||||
|             @Override | ||||
|             public Set<Location> getPoints() { | ||||
|                 return new HashSet<>(points); | ||||
|             public List<Location> getPoints() { | ||||
|                 //recoreHosting -> set to  list , maintains order  but remove duplicates | ||||
|                 return new ArrayList<>(points).stream().distinct().collect(Collectors.toList()); | ||||
|             } | ||||
| 
 | ||||
|             @Override | ||||
|  |  | |||
|  | @ -314,8 +314,9 @@ public class WorldGuardImplementation implements IWorldGuardImplementation { | |||
|                     } else if (selection instanceof Polygonal2DSelection) { | ||||
|                         return new IPolygonalSelection() { | ||||
|                             @Override | ||||
|                             public Set<Location> getPoints() { | ||||
|                             public List<Location> getPoints() { | ||||
|                                 return ((Polygonal2DSelection) selection).getNativePoints().stream() | ||||
|                                         .distinct() | ||||
|                                         .map(vector -> new BlockVector(vector.toVector())) | ||||
|                                         .map(vector -> | ||||
|                                                 WorldGuardVectorUtilities.fromBlockVector( | ||||
|  | @ -323,7 +324,7 @@ public class WorldGuardImplementation implements IWorldGuardImplementation { | |||
|                                                         vector | ||||
|                                                 ) | ||||
|                                         ) | ||||
|                                         .collect(Collectors.toSet()); | ||||
|                                         .collect(Collectors.toList()); | ||||
|                             } | ||||
| 
 | ||||
|                             @Override | ||||
|  |  | |||
|  | @ -46,11 +46,12 @@ public class WrappedRegion implements IWrappedRegion { | |||
|         } else if (handle instanceof ProtectedPolygonalRegion) { | ||||
|             return new IPolygonalSelection() { | ||||
|                 @Override | ||||
|                 public Set<Location> getPoints() { | ||||
|                 public List<Location> getPoints() { | ||||
|                     return handle.getPoints().stream() | ||||
|                             .distinct() | ||||
|                             .map(vector -> new BlockVector(vector.toVector())) | ||||
|                             .map(vector -> WorldGuardVectorUtilities.fromBlockVector(world, vector)) | ||||
|                             .collect(Collectors.toSet()); | ||||
|                             .collect(Collectors.toList()); | ||||
|                 } | ||||
| 
 | ||||
|                 @Override | ||||
|  |  | |||
|  | @ -381,8 +381,9 @@ public class WorldGuardImplementation implements IWorldGuardImplementation { | |||
|                     } else if (selection instanceof Polygonal2DSelection) { | ||||
|                         return new IPolygonalSelection() { | ||||
|                             @Override | ||||
|                             public Set<Location> getPoints() { | ||||
|                             public List<Location> getPoints() { | ||||
|                                 return ((Polygonal2DSelection) selection).getNativePoints().stream() | ||||
|                                         .distinct() | ||||
|                                         .map(vector -> new BlockVector(vector.toVector())) | ||||
|                                         .map(vector -> | ||||
|                                                 WorldGuardVectorUtilities.fromBlockVector( | ||||
|  | @ -390,7 +391,7 @@ public class WorldGuardImplementation implements IWorldGuardImplementation { | |||
|                                                         vector | ||||
|                                                 ) | ||||
|                                         ) | ||||
|                                         .collect(Collectors.toSet()); | ||||
|                                         .collect(Collectors.toList()); | ||||
|                             } | ||||
| 
 | ||||
|                             @Override | ||||
|  |  | |||
|  | @ -46,11 +46,12 @@ public class WrappedRegion implements IWrappedRegion { | |||
|         } else if (handle instanceof ProtectedPolygonalRegion) { | ||||
|             return new IPolygonalSelection() { | ||||
|                 @Override | ||||
|                 public Set<Location> getPoints() { | ||||
|                 public List<Location> getPoints() { | ||||
|                     return handle.getPoints().stream() | ||||
|                             .distinct() | ||||
|                             .map(vector -> new BlockVector(vector.toVector())) | ||||
|                             .map(vector -> WorldGuardVectorUtilities.fromBlockVector(world, vector)) | ||||
|                             .collect(Collectors.toSet()); | ||||
|                             .collect(Collectors.toList()); | ||||
|                 } | ||||
| 
 | ||||
|                 @Override | ||||
|  |  | |||
|  | @ -383,11 +383,12 @@ public class WorldGuardImplementation implements IWorldGuardImplementation { | |||
|                     } else if (selection instanceof Polygonal2DRegion) { | ||||
|                         return new IPolygonalSelection() { | ||||
|                             @Override | ||||
|                             public Set<Location> getPoints() { | ||||
|                             public List<Location> getPoints() { | ||||
|                                 return ((Polygonal2DRegion) selection).getPoints().stream() | ||||
|                                         .distinct() | ||||
|                                         .map(BlockVector2::toBlockVector3) | ||||
|                                         .map(vector -> BukkitAdapter.adapt(world, vector)) | ||||
|                                         .collect(Collectors.toSet()); | ||||
|                                         .collect(Collectors.toList()); | ||||
|                             } | ||||
| 
 | ||||
|                             @Override | ||||
|  |  | |||
|  | @ -46,11 +46,12 @@ public class WrappedRegion implements IWrappedRegion { | |||
|         } else if (handle instanceof ProtectedPolygonalRegion) { | ||||
|             return new IPolygonalSelection() { | ||||
|                 @Override | ||||
|                 public Set<Location> getPoints() { | ||||
|                 public List<Location> getPoints() { | ||||
|                     return handle.getPoints().stream() | ||||
|                             .distinct() | ||||
|                             .map(BlockVector2::toBlockVector3) | ||||
|                             .map(vector -> BukkitAdapter.adapt(world, vector)) | ||||
|                             .collect(Collectors.toSet()); | ||||
|                             .collect(Collectors.toList()); | ||||
|                 } | ||||
| 
 | ||||
|                 @Override | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user