Skip to content

Commit

Permalink
Changed the create island message to be sent only after teleporting t…
Browse files Browse the repository at this point in the history
…o the island
  • Loading branch information
OmerBenGera committed Oct 1, 2022
1 parent e9d40c6 commit 76d059e
Showing 1 changed file with 13 additions and 10 deletions.
Expand Up @@ -235,15 +235,18 @@ private void createIslandInternalAsync(IslandBuilderImpl builder, Biome biome, b

island.setIslandHome(schematic.adjustRotation(islandLocation));

Message.CREATE_ISLAND.send(builder.owner, Formatters.LOCATION_FORMATTER.format(
islandLocation), System.currentTimeMillis() - startTime);

if (teleportPlayer) {
BukkitExecutor.sync(() -> builder.owner.runIfOnline(player -> {
if (updateGamemode)
player.setGameMode(GameMode.SURVIVAL);

BukkitExecutor.sync(() -> builder.owner.runIfOnline(player -> {
if (updateGamemode)
player.setGameMode(GameMode.SURVIVAL);

if (!teleportPlayer) {
Message.CREATE_ISLAND.send(builder.owner, Formatters.LOCATION_FORMATTER.format(
islandLocation), System.currentTimeMillis() - startTime);
} else {
builder.owner.teleport(island, result -> {
Message.CREATE_ISLAND.send(builder.owner, Formatters.LOCATION_FORMATTER.format(
islandLocation), System.currentTimeMillis() - startTime);

if (result) {
if (loadedChunks != null)
BukkitExecutor.sync(() -> IslandUtils.resetChunksExcludedFromList(island, loadedChunks), 10L);
Expand All @@ -253,8 +256,8 @@ private void createIslandInternalAsync(IslandBuilderImpl builder, Biome biome, b
}
}
});
}), 1L);
}
}
}), 1L);

return;
} catch (Throwable runtimeError) {
Expand Down

0 comments on commit 76d059e

Please sign in to comment.