Skip to content

Commit

Permalink
Fixed overriding custom island creation algorithms that were registered
Browse files Browse the repository at this point in the history
  • Loading branch information
OmerBenGera committed Apr 13, 2023
1 parent 16d02ad commit 71f819e
Showing 1 changed file with 4 additions and 2 deletions.
Expand Up @@ -56,6 +56,7 @@
import java.util.List;
import java.util.Locale;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.UUID;
import java.util.function.Function;
Expand Down Expand Up @@ -106,7 +107,8 @@ public void loadData() {
throw new RuntimeException("GridManager was not initialized correctly. Contact Ome_R regarding this!");

initializeDatabaseBridge();
this.islandCreationAlgorithm = DefaultIslandCreationAlgorithm.getInstance();
if (this.islandCreationAlgorithm == null)
this.islandCreationAlgorithm = DefaultIslandCreationAlgorithm.getInstance();

this.lastIsland = new SBlockPosition(plugin.getSettings().getWorlds().getDefaultWorldName(), 0, 100, 0);
BukkitExecutor.sync(this::updateSpawn);
Expand Down Expand Up @@ -294,7 +296,7 @@ public void setIslandCreationAlgorithm(@Nullable IslandCreationAlgorithm islandC

@Override
public IslandCreationAlgorithm getIslandCreationAlgorithm() {
return this.islandCreationAlgorithm;
return Optional.ofNullable(this.islandCreationAlgorithm).orElse(DefaultIslandCreationAlgorithm.getInstance());
}

@Override
Expand Down

0 comments on commit 71f819e

Please sign in to comment.