Remove unused regenerate method

This commit is contained in:
MattBDev 2020-04-28 11:16:51 -04:00
parent 4307e3a671
commit 3265a9e794
5 changed files with 20 additions and 51 deletions

View File

@ -184,7 +184,7 @@ public class BukkitWorld extends AbstractWorld {
BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter(); BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter();
try { try {
if (adapter != null) { if (adapter != null) {
return adapter.regenerate(getWorld(), region, null, null, editSession); return adapter.regenerate(getWorld(), region, editSession);
} else { } else {
throw new UnsupportedOperationException("Missing BukkitImplAdapater for this version."); throw new UnsupportedOperationException("Missing BukkitImplAdapater for this version.");
} }

View File

@ -240,11 +240,7 @@ public interface BukkitImplAdapter<T> extends IBukkitAdapter {
* @return true on success, false on failure * @return true on success, false on failure
*/ */
default boolean regenerate(org.bukkit.World world, Region region, EditSession session) { default boolean regenerate(org.bukkit.World world, Region region, EditSession session) {
return regenerate(world, region, null, null, session); return session.regenerate(region);
}
default boolean regenerate(org.bukkit.World world, Region region, @Nullable Long seed, @Nullable BiomeType biome, EditSession editSession) {
return editSession.regenerate(region);
} }
default IChunkGet get(World world, int chunkX, int chunkZ) { default IChunkGet get(World world, int chunkX, int chunkZ) {

View File

@ -54,6 +54,7 @@ import com.sk89q.worldedit.world.registry.BlockMaterial;
import net.minecraft.server.v1_14_R1.*; import net.minecraft.server.v1_14_R1.*;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.World.Environment;
import org.bukkit.block.data.BlockData; import org.bukkit.block.data.BlockData;
import org.bukkit.craftbukkit.v1_14_R1.CraftChunk; import org.bukkit.craftbukkit.v1_14_R1.CraftChunk;
import org.bukkit.craftbukkit.v1_14_R1.CraftWorld; 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 @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(); WorldServer originalWorld = ((CraftWorld) world).getHandle();
ChunkProviderServer provider = originalWorld.getChunkProvider(); ChunkProviderServer provider = originalWorld.getChunkProvider();
if (!(provider instanceof ChunkProviderServer)) { 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), WorldData newWorldData = new WorldData(originalWorld.worldData.a((NBTTagCompound) null),
server.dataConverterManager, getDataVersion(), null); server.dataConverterManager, getDataVersion(), null);
ChunkGenerator generator = world.getGenerator(); ChunkGenerator gen = world.getGenerator();
org.bukkit.World.Environment environment = world.getEnvironment(); Environment env = 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;
}
try (WorldServer freshWorld = new WorldServer(server, try (WorldServer freshWorld = new WorldServer(server,
server.executorService, saveHandler, server.executorService, saveHandler,
newWorldData, newWorldData,
originalWorld.worldProvider.getDimensionManager(), originalWorld.worldProvider.getDimensionManager(),
originalWorld.getMethodProfiler(), originalWorld.getMethodProfiler(),
server.worldLoadListenerFactory.create(11), server.worldLoadListenerFactory.create(11),
environment, env,
generator){ gen){
@Override @Override
public boolean addEntityChunk(net.minecraft.server.v1_14_R1.Entity entity) { 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 //Fixes #320; Prevent adding entities so we aren't attempting to spawn them asynchronously

View File

@ -56,6 +56,7 @@ import com.sk89q.worldedit.world.registry.BlockMaterial;
import net.minecraft.server.v1_15_R1.*; import net.minecraft.server.v1_15_R1.*;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.World.Environment;
import org.bukkit.block.data.BlockData; import org.bukkit.block.data.BlockData;
import org.bukkit.craftbukkit.v1_15_R1.CraftChunk; import org.bukkit.craftbukkit.v1_15_R1.CraftChunk;
import org.bukkit.craftbukkit.v1_15_R1.CraftWorld; 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 @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(); WorldServer originalWorld = ((CraftWorld) world).getHandle();
ChunkProviderServer provider = originalWorld.getChunkProvider(); ChunkProviderServer provider = originalWorld.getChunkProvider();
if (!(provider instanceof ChunkProviderServer)) { if (!(provider instanceof ChunkProviderServer)) {
@ -387,26 +388,16 @@ public final class FAWE_Spigot_v1_15_R1 extends CachedBukkitAdapter implements I
server.dataConverterManager, getDataVersion(), null); server.dataConverterManager, getDataVersion(), null);
newWorldData.setName(UUID.randomUUID().toString()); newWorldData.setName(UUID.randomUUID().toString());
ChunkGenerator generator = world.getGenerator(); ChunkGenerator gen = world.getGenerator();
org.bukkit.World.Environment environment = world.getEnvironment(); Environment env = 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;
}
try (WorldServer freshWorld = new WorldServer(server, try (WorldServer freshWorld = new WorldServer(server,
server.executorService, saveHandler, server.executorService, saveHandler,
newWorldData, newWorldData,
originalWorld.worldProvider.getDimensionManager(), originalWorld.worldProvider.getDimensionManager(),
originalWorld.getMethodProfiler(), originalWorld.getMethodProfiler(),
server.worldLoadListenerFactory.create(11), server.worldLoadListenerFactory.create(11),
environment, env,
generator){ gen){
@Override @Override
public boolean addEntityChunk(net.minecraft.server.v1_15_R1.Entity entity) { 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 //Fixes #320; Prevent adding entities so we aren't attempting to spawn them asynchronously

View File

@ -56,6 +56,7 @@ import com.sk89q.worldedit.world.registry.BlockMaterial;
import net.minecraft.server.v1_15_R1.*; import net.minecraft.server.v1_15_R1.*;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.World.Environment;
import org.bukkit.block.data.BlockData; import org.bukkit.block.data.BlockData;
import org.bukkit.craftbukkit.v1_15_R1.CraftChunk; import org.bukkit.craftbukkit.v1_15_R1.CraftChunk;
import org.bukkit.craftbukkit.v1_15_R1.CraftWorld; 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 @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(); WorldServer originalWorld = ((CraftWorld) world).getHandle();
ChunkProviderServer provider = originalWorld.getChunkProvider(); ChunkProviderServer provider = originalWorld.getChunkProvider();
if (!(provider instanceof ChunkProviderServer)) { if (!(provider instanceof ChunkProviderServer)) {
@ -389,26 +390,16 @@ public final class FAWE_Spigot_v1_15_R2 extends CachedBukkitAdapter implements I
server.dataConverterManager, getDataVersion(), null); server.dataConverterManager, getDataVersion(), null);
newWorldData.setName(UUID.randomUUID().toString()); newWorldData.setName(UUID.randomUUID().toString());
ChunkGenerator generator = world.getGenerator(); ChunkGenerator gen = world.getGenerator();
org.bukkit.World.Environment environment = world.getEnvironment(); Environment env = 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;
}
try (WorldServer freshWorld = new WorldServer(server, try (WorldServer freshWorld = new WorldServer(server,
server.executorService, saveHandler, server.executorService, saveHandler,
newWorldData, newWorldData,
originalWorld.worldProvider.getDimensionManager(), originalWorld.worldProvider.getDimensionManager(),
originalWorld.getMethodProfiler(), originalWorld.getMethodProfiler(),
server.worldLoadListenerFactory.create(11), server.worldLoadListenerFactory.create(11),
environment, env,
generator){ gen){
@Override @Override
public boolean addEntityChunk(net.minecraft.server.v1_15_R1.Entity entity) { 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 //Fixes #320; Prevent adding entities so we aren't attempting to spawn them asynchronously