Remove error for duplicate world creation. Fixes #1

If a world is created using the Bukkit.createWorld API, Bukkit asks plugins multiple times to provide a world generator for the same world. So the error needs to be removed.
This commit is contained in:
Rutger Kok 2018-08-19 11:03:54 +02:00
parent dbe3e2e2ca
commit d13a853909

View File

@ -28,11 +28,7 @@ public class WorldGeneratorApiImpl extends JavaPlugin implements WorldGeneratorA
@Override @Override
public ChunkGenerator createCustomGenerator(WorldRef world, Consumer<WorldGenerator> consumer) { public ChunkGenerator createCustomGenerator(WorldRef world, Consumer<WorldGenerator> consumer) {
Consumer<WorldGenerator> previous = this.worldGeneratorModifiers.putIfAbsent(world, consumer); this.worldGeneratorModifiers.putIfAbsent(world, consumer);
if (previous != null) {
throw new IllegalArgumentException(
"World " + world.getName() + " was already assigned to a world generator, namely " + previous);
}
return new DummyBukkitChunkGenerator(this); return new DummyBukkitChunkGenerator(this);
} }