From 3265a9e7942e43b533dcffc6057154a26234f45b Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Tue, 28 Apr 2020 11:16:51 -0400 Subject: [PATCH] Remove unused regenerate method --- .../sk89q/worldedit/bukkit/BukkitWorld.java | 2 +- .../bukkit/adapter/BukkitImplAdapter.java | 6 +----- .../adapter/impl/FAWE_Spigot_v1_14_R4.java | 21 ++++++------------- .../adapter/impl/FAWE_Spigot_v1_15_R1.java | 21 ++++++------------- .../adapter/impl/FAWE_Spigot_v1_15_R2.java | 21 ++++++------------- 5 files changed, 20 insertions(+), 51 deletions(-) diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java index fd38b7748..2818a8434 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java @@ -184,7 +184,7 @@ public class BukkitWorld extends AbstractWorld { BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter(); try { if (adapter != null) { - return adapter.regenerate(getWorld(), region, null, null, editSession); + return adapter.regenerate(getWorld(), region, editSession); } else { throw new UnsupportedOperationException("Missing BukkitImplAdapater for this version."); } diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplAdapter.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplAdapter.java index 7eb54e8f9..591626f0f 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplAdapter.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplAdapter.java @@ -240,11 +240,7 @@ public interface BukkitImplAdapter extends IBukkitAdapter { * @return true on success, false on failure */ default boolean regenerate(org.bukkit.World world, Region region, EditSession session) { - return regenerate(world, region, null, null, session); - } - - default boolean regenerate(org.bukkit.World world, Region region, @Nullable Long seed, @Nullable BiomeType biome, EditSession editSession) { - return editSession.regenerate(region); + return session.regenerate(region); } default IChunkGet get(World world, int chunkX, int chunkZ) { diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/FAWE_Spigot_v1_14_R4.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/FAWE_Spigot_v1_14_R4.java index a3dc483f3..b5094f0db 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/FAWE_Spigot_v1_14_R4.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/FAWE_Spigot_v1_14_R4.java @@ -54,6 +54,7 @@ import com.sk89q.worldedit.world.registry.BlockMaterial; import net.minecraft.server.v1_14_R1.*; import org.bukkit.Bukkit; import org.bukkit.Location; +import org.bukkit.World.Environment; import org.bukkit.block.data.BlockData; import org.bukkit.craftbukkit.v1_14_R1.CraftChunk; import org.bukkit.craftbukkit.v1_14_R1.CraftWorld; @@ -361,7 +362,7 @@ public final class FAWE_Spigot_v1_14_R4 extends CachedBukkitAdapter implements I } @Override - public boolean regenerate(org.bukkit.World world, Region region, @Nullable Long seed, @Nullable BiomeType biome, EditSession editSession) { + public boolean regenerate(org.bukkit.World world, Region region, EditSession editSession) { WorldServer originalWorld = ((CraftWorld) world).getHandle(); ChunkProviderServer provider = originalWorld.getChunkProvider(); if (!(provider instanceof ChunkProviderServer)) { @@ -379,26 +380,16 @@ public final class FAWE_Spigot_v1_14_R4 extends CachedBukkitAdapter implements I WorldData newWorldData = new WorldData(originalWorld.worldData.a((NBTTagCompound) null), server.dataConverterManager, getDataVersion(), null); - ChunkGenerator generator = world.getGenerator(); - org.bukkit.World.Environment environment = world.getEnvironment(); - if (seed != null) { - if (biome == BiomeTypes.NETHER) { - environment = org.bukkit.World.Environment.NETHER; - } else if (biome == BiomeTypes.THE_END) { - environment = org.bukkit.World.Environment.THE_END; - } else { - environment = org.bukkit.World.Environment.NORMAL; - } - generator = null; - } + ChunkGenerator gen = world.getGenerator(); + Environment env = world.getEnvironment(); try (WorldServer freshWorld = new WorldServer(server, server.executorService, saveHandler, newWorldData, originalWorld.worldProvider.getDimensionManager(), originalWorld.getMethodProfiler(), server.worldLoadListenerFactory.create(11), - environment, - generator){ + env, + gen){ @Override public boolean addEntityChunk(net.minecraft.server.v1_14_R1.Entity entity) { //Fixes #320; Prevent adding entities so we aren't attempting to spawn them asynchronously diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/FAWE_Spigot_v1_15_R1.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/FAWE_Spigot_v1_15_R1.java index ce6091bb9..49dfea72f 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/FAWE_Spigot_v1_15_R1.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/FAWE_Spigot_v1_15_R1.java @@ -56,6 +56,7 @@ import com.sk89q.worldedit.world.registry.BlockMaterial; import net.minecraft.server.v1_15_R1.*; import org.bukkit.Bukkit; import org.bukkit.Location; +import org.bukkit.World.Environment; import org.bukkit.block.data.BlockData; import org.bukkit.craftbukkit.v1_15_R1.CraftChunk; import org.bukkit.craftbukkit.v1_15_R1.CraftWorld; @@ -368,7 +369,7 @@ public final class FAWE_Spigot_v1_15_R1 extends CachedBukkitAdapter implements I } @Override - public boolean regenerate(org.bukkit.World world, Region region, @Nullable Long seed, @Nullable BiomeType biome, EditSession editSession) { + public boolean regenerate(org.bukkit.World world, Region region, EditSession editSession) { WorldServer originalWorld = ((CraftWorld) world).getHandle(); ChunkProviderServer provider = originalWorld.getChunkProvider(); if (!(provider instanceof ChunkProviderServer)) { @@ -387,26 +388,16 @@ public final class FAWE_Spigot_v1_15_R1 extends CachedBukkitAdapter implements I server.dataConverterManager, getDataVersion(), null); newWorldData.setName(UUID.randomUUID().toString()); - ChunkGenerator generator = world.getGenerator(); - org.bukkit.World.Environment environment = world.getEnvironment(); - if (seed != null) { - if (biome == BiomeTypes.NETHER) { - environment = org.bukkit.World.Environment.NETHER; - } else if (biome == BiomeTypes.THE_END) { - environment = org.bukkit.World.Environment.THE_END; - } else { - environment = org.bukkit.World.Environment.NORMAL; - } - generator = null; - } + ChunkGenerator gen = world.getGenerator(); + Environment env = world.getEnvironment(); try (WorldServer freshWorld = new WorldServer(server, server.executorService, saveHandler, newWorldData, originalWorld.worldProvider.getDimensionManager(), originalWorld.getMethodProfiler(), server.worldLoadListenerFactory.create(11), - environment, - generator){ + env, + gen){ @Override public boolean addEntityChunk(net.minecraft.server.v1_15_R1.Entity entity) { //Fixes #320; Prevent adding entities so we aren't attempting to spawn them asynchronously diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/FAWE_Spigot_v1_15_R2.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/FAWE_Spigot_v1_15_R2.java index e384bd4e4..3ee354bd6 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/FAWE_Spigot_v1_15_R2.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/FAWE_Spigot_v1_15_R2.java @@ -56,6 +56,7 @@ import com.sk89q.worldedit.world.registry.BlockMaterial; import net.minecraft.server.v1_15_R1.*; import org.bukkit.Bukkit; import org.bukkit.Location; +import org.bukkit.World.Environment; import org.bukkit.block.data.BlockData; import org.bukkit.craftbukkit.v1_15_R1.CraftChunk; import org.bukkit.craftbukkit.v1_15_R1.CraftWorld; @@ -370,7 +371,7 @@ public final class FAWE_Spigot_v1_15_R2 extends CachedBukkitAdapter implements I } @Override - public boolean regenerate(org.bukkit.World world, Region region, @Nullable Long seed, @Nullable BiomeType biome, EditSession editSession) { + public boolean regenerate(org.bukkit.World world, Region region, EditSession editSession) { WorldServer originalWorld = ((CraftWorld) world).getHandle(); ChunkProviderServer provider = originalWorld.getChunkProvider(); if (!(provider instanceof ChunkProviderServer)) { @@ -389,26 +390,16 @@ public final class FAWE_Spigot_v1_15_R2 extends CachedBukkitAdapter implements I server.dataConverterManager, getDataVersion(), null); newWorldData.setName(UUID.randomUUID().toString()); - ChunkGenerator generator = world.getGenerator(); - org.bukkit.World.Environment environment = world.getEnvironment(); - if (seed != null) { - if (biome == BiomeTypes.NETHER) { - environment = org.bukkit.World.Environment.NETHER; - } else if (biome == BiomeTypes.THE_END) { - environment = org.bukkit.World.Environment.THE_END; - } else { - environment = org.bukkit.World.Environment.NORMAL; - } - generator = null; - } + ChunkGenerator gen = world.getGenerator(); + Environment env = world.getEnvironment(); try (WorldServer freshWorld = new WorldServer(server, server.executorService, saveHandler, newWorldData, originalWorld.worldProvider.getDimensionManager(), originalWorld.getMethodProfiler(), server.worldLoadListenerFactory.create(11), - environment, - generator){ + env, + gen){ @Override public boolean addEntityChunk(net.minecraft.server.v1_15_R1.Entity entity) { //Fixes #320; Prevent adding entities so we aren't attempting to spawn them asynchronously