mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2025-01-09 09:57:40 +01:00
Added IslandsManager#nameExists(World, String)
This commit is contained in:
parent
e8ea537160
commit
f63f73a3b7
@ -1199,4 +1199,15 @@ public class IslandsManager {
|
||||
islandCache.resetAllFlags(world);
|
||||
this.saveAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the specified island custom name exists in this world.
|
||||
* @param world World of the gamemode
|
||||
* @param name Name of an island
|
||||
* @return {@code true} if there is an island with the specified name in this world, {@code false} otherwise.
|
||||
* @since 1.7.0
|
||||
*/
|
||||
public boolean nameExists(@NonNull World world, @NonNull String name) {
|
||||
return getIslands(world).stream().filter(island -> island.getName() != null).map(Island::getName).anyMatch(n -> n.equals(name));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user