Skip to content

Commit ad0175c

Browse files
authored
Merge pull request #2762 from BentoBoxWorld/more_api
More api
2 parents 80f72ad + 025b2d4 commit ad0175c

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
<!-- Do not change unless you want different name for local builds. -->
7676
<build.number>-LOCAL</build.number>
7777
<!-- This allows to change between versions. -->
78-
<build.version>3.9.3</build.version>
78+
<build.version>3.10.0</build.version>
7979
<sonar.organization>bentobox-world</sonar.organization>
8080
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
8181
<server.jars>${project.basedir}/lib</server.jars>

src/main/java/world/bentobox/bentobox/managers/IslandsManager.java

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,10 +248,23 @@ public Island createIsland(@NonNull Location location) {
248248
*/
249249
@Nullable
250250
public Island createIsland(@NonNull Location location, @Nullable UUID owner) {
251-
Island island = new Island(location, owner, plugin.getIWM().getIslandProtectionRange(location.getWorld()));
251+
return createIsland(location, owner, plugin.getIWM().getIslandProtectionRange(location.getWorld()));
252+
}
253+
254+
/**
255+
* Create an island with owner, and a specified protection range. Note this does not paste blocks. It just creates
256+
* the island data object.
257+
*
258+
* @param location the location, not null
259+
* @param owner the island owner UUID, may be null
260+
* @param protectionRange size of protection range
261+
* @return Island or null if the island could not be created for some reason
262+
* @since 3.10.0
263+
*/
264+
public Island createIsland(@NonNull Location location, @Nullable UUID owner, int protectionRange) {
265+
Island island = new Island(location, owner, protectionRange);
252266
// Game the gamemode name and prefix the uniqueId
253-
String gmName = plugin.getIWM().getAddon(location.getWorld()).map(gm -> gm.getDescription().getName())
254-
.orElse("");
267+
String gmName = plugin.getIWM().getAddon(location.getWorld()).map(gm -> gm.getDescription().getName()).orElse("");
255268
island.setGameMode(gmName);
256269
island.setUniqueId(gmName + island.getUniqueId());
257270
if (islandCache.addIsland(island)) {
@@ -265,6 +278,7 @@ public Island createIsland(@NonNull Location location, @Nullable UUID owner) {
265278
}
266279
return null;
267280
}
281+
268282

269283
/**
270284
* Deletes island.

0 commit comments

Comments
 (0)