From d13a85390967bd9be02d82ecf4769e31186e4ba4 Mon Sep 17 00:00:00 2001 From: Rutger Kok Date: Sun, 19 Aug 2018 11:03:54 +0200 Subject: [PATCH] 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. --- .../worldgeneratorapi/internal/WorldGeneratorApiImpl.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/main/java/nl/rutgerkok/worldgeneratorapi/internal/WorldGeneratorApiImpl.java b/src/main/java/nl/rutgerkok/worldgeneratorapi/internal/WorldGeneratorApiImpl.java index 38c7df8..0ccee76 100644 --- a/src/main/java/nl/rutgerkok/worldgeneratorapi/internal/WorldGeneratorApiImpl.java +++ b/src/main/java/nl/rutgerkok/worldgeneratorapi/internal/WorldGeneratorApiImpl.java @@ -28,11 +28,7 @@ public class WorldGeneratorApiImpl extends JavaPlugin implements WorldGeneratorA @Override public ChunkGenerator createCustomGenerator(WorldRef world, Consumer consumer) { - Consumer previous = this.worldGeneratorModifiers.putIfAbsent(world, consumer); - if (previous != null) { - throw new IllegalArgumentException( - "World " + world.getName() + " was already assigned to a world generator, namely " + previous); - } + this.worldGeneratorModifiers.putIfAbsent(world, consumer); return new DummyBukkitChunkGenerator(this); }