Skip to content

Commit

Permalink
Revert "Fixed errors about name cannot be null when creating islands"
Browse files Browse the repository at this point in the history
This reverts commit 0a91dbb.
  • Loading branch information
OmerBenGera committed Apr 28, 2023
1 parent ccd348e commit 83fbaa9
Showing 1 changed file with 4 additions and 7 deletions.
Expand Up @@ -14,7 +14,6 @@
import com.bgsoftware.superiorskyblock.island.builder.IslandBuilderImpl;
import com.google.common.base.Preconditions;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.BlockFace;

import java.util.UUID;
Expand Down Expand Up @@ -52,10 +51,10 @@ public CompletableFuture<IslandCreationResult> createIsland(UUID islandUUID, Sup
}

@Override
public CompletableFuture<IslandCreationResult> createIsland(Island.Builder builderParam, BlockPosition lastIslandPosition) {
public CompletableFuture<IslandCreationResult> createIsland(Island.Builder builderParam, BlockPosition lastIsland) {
Preconditions.checkNotNull(builderParam, "builder parameter cannot be null.");
Preconditions.checkArgument(builderParam instanceof IslandBuilderImpl, "Cannot create an island from custom builder.");
Preconditions.checkNotNull(lastIslandPosition, "lastIsland parameter cannot be null.");
Preconditions.checkNotNull(lastIsland, "lastIsland parameter cannot be null.");

IslandBuilderImpl builder = (IslandBuilderImpl) builderParam;

Expand All @@ -64,7 +63,7 @@ public CompletableFuture<IslandCreationResult> createIsland(Island.Builder build
Preconditions.checkArgument(builder.owner != null, "Cannot create an island from builder with no valid owner.");
Preconditions.checkArgument(schematic != null, "Cannot create an island from builder with invalid schematic name.");

Log.debug(Debug.CREATE_ISLAND, builder.owner.getName(), schematic.getName(), lastIslandPosition);
Log.debug(Debug.CREATE_ISLAND, builder.owner.getName(), schematic.getName(), lastIsland);

// Making sure an island with the same name does not exist.
if (!Text.isBlank(builder.islandName) && plugin.getGrid().getIsland(builder.islandName) != null) {
Expand All @@ -74,10 +73,8 @@ public CompletableFuture<IslandCreationResult> createIsland(Island.Builder build

CompletableFuture<IslandCreationResult> completableFuture = new CompletableFuture<>();

World spawnWorld = plugin.getGrid().getSpawnIsland().getCenter(plugin.getSettings().getWorlds().getDefaultWorld()).getWorld();
Location lastIsland = new Location(spawnWorld, lastIslandPosition.getX(), lastIslandPosition.getY(), lastIslandPosition.getZ());
Location islandLocation = plugin.getProviders().getWorldsProvider().getNextLocation(
lastIsland,
lastIsland.parse().clone(),
plugin.getSettings().getIslandHeight(),
plugin.getSettings().getMaxIslandSize(),
builder.owner.getUniqueId(),
Expand Down

0 comments on commit 83fbaa9

Please sign in to comment.