mirror of
				https://github.com/CodeMC/WorldGuardWrapper.git
				synced 2025-10-31 15:02:36 +01:00 
			
		
		
		
	Allow removing regions
This commit is contained in:
		
							parent
							
								
									e43eed1821
								
							
						
					
					
						commit
						fd1178edce
					
				|  | @ -132,4 +132,13 @@ public interface IWorldGuardImplementation { | |||
|         return addRegion(id, Arrays.asList(point1, point2), 0, 0); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Remove a region, including inheriting children. | ||||
|      *  | ||||
|      * @param world The world | ||||
|      * @param id    The region ID | ||||
|      * @return A list of removed regions where the first entry is the region specified by {@code id} | ||||
|      */ | ||||
|     Optional<Set<WrappedRegion>> removeRegion(@NonNull World world, @NonNull String id); | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -215,4 +215,14 @@ public class WorldGuardImplementation implements IWorldGuardImplementation { | |||
|         } | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public Optional<Set<WrappedRegion>> removeRegion(World world, String id) { | ||||
|         Optional<Set<ProtectedRegion>> set = getWorldManager(world).map(manager -> manager.removeRegion(id)); | ||||
|         if (set.isPresent()) { | ||||
|             return Optional.of(set.get().stream().map(region -> toRegion(region)).collect(Collectors.toSet())); | ||||
|         } else { | ||||
|             return Optional.empty(); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -230,4 +230,14 @@ public class WorldGuardImplementation implements IWorldGuardImplementation { | |||
|             return Optional.empty(); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public Optional<Set<WrappedRegion>> removeRegion(World world, String id) { | ||||
|         Optional<Set<ProtectedRegion>> set = getWorldManager(world).map(manager -> manager.removeRegion(id)); | ||||
|         if (set.isPresent()) { | ||||
|             return Optional.of(set.get().stream().map(region -> toRegion(region)).collect(Collectors.toSet())); | ||||
|         } else { | ||||
|             return Optional.empty(); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user