Skip to content

Commit

Permalink
Reuse random in RegenWorldOptions.
Browse files Browse the repository at this point in the history
  • Loading branch information
dumptruckman committed Jan 24, 2025
1 parent 6d32393 commit 949c470
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import org.bukkit.block.Biome;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import org.mvplugins.multiverse.core.world.LoadedMultiverseWorld;

/**
Expand All @@ -22,6 +23,8 @@ public final class RegenWorldOptions implements KeepWorldSettingsOptions {
return new RegenWorldOptions(world);
}

private final Random random = new Random();

private final LoadedMultiverseWorld world;
private Biome biome;
private boolean keepGameRule = true;
Expand All @@ -44,8 +47,8 @@ public final class RegenWorldOptions implements KeepWorldSettingsOptions {
}

/**
* Sets the single biome used for this world. This may be null, in which case the biome from the generator will be used.
* If no generator is specified, the "natural" biome behaviour for this environment will be used.
* Sets the single biome used for this world. This may be null, in which case the biome from the generator will be
* used. If no generator is specified, the "natural" biome behaviour for this environment will be used.
*
* @param biome The biome used for this world
* @return This {@link RegenWorldOptions} instance.
Expand All @@ -56,8 +59,8 @@ public final class RegenWorldOptions implements KeepWorldSettingsOptions {
}

/**
* Gets the single biome used for this world. This may be null, in which case the biome from the generator will be used.
* If no generator is specified, the "natural" biome behaviour for this environment will be used.
* Gets the single biome used for this world. This may be null, in which case the biome from the generator will be
* used. If no generator is specified, the "natural" biome behaviour for this environment will be used.
*
* @return The biome used for this world
*/
Expand Down Expand Up @@ -194,7 +197,7 @@ public boolean randomSeed() {
*/
public long seed() {
if (randomSeed) {
return new Random().nextLong();
return random.nextLong();
} else if (seed == Long.MIN_VALUE) {
return world.getSeed();
}
Expand Down

0 comments on commit 949c470

Please sign in to comment.