Fix wna when used internally

This commit is contained in:
dordsor21
2021-01-09 21:27:55 +00:00
parent 6f0180447f
commit 6bc3dd2293
18 changed files with 324 additions and 41 deletions

View File

@ -222,6 +222,8 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
private final int maxY;
private final List<WatchdogTickingExtent> watchdogExtents = new ArrayList<>(2);
private final boolean wnaMode;
@Deprecated
public EditSession(@NotNull EventBus bus, World world, @Nullable Player player,
@ -257,6 +259,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
this.maxY = world.getMaxY();
this.blockBag = builder.getBlockBag();
this.history = changeSet != null;
this.wnaMode = builder.isWNAMode();
}
/**
@ -1075,6 +1078,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
player.printError(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.outside.level"));
}
}
if (wnaMode) {
getWorld().flush();
}
// Reset limit
limit.set(originalLimit);
// Enqueue it

View File

@ -30,6 +30,8 @@ import com.sk89q.worldedit.world.block.BlockStateHolder;
import javax.annotation.Nullable;
import java.io.Flushable;
import static com.google.common.base.Preconditions.checkNotNull;
/**
@ -186,4 +188,6 @@ public interface WorldNativeAccess<NC, NBS, NP> {
onBlockStateChange(pos, oldState, newState);
}
void flush();
}

View File

@ -48,6 +48,7 @@ import com.sk89q.worldedit.world.block.BlockTypes;
import com.sk89q.worldedit.world.weather.WeatherType;
import com.sk89q.worldedit.world.weather.WeatherTypes;
import java.io.IOException;
import java.util.Collections;
import java.util.List;
import java.util.Set;
@ -233,4 +234,7 @@ public class NullWorld extends AbstractWorld {
public boolean regenerate(Region region, Extent extent, RegenOptions options) {
return false;
}
@Override
public void flush() {}
}

View File

@ -401,4 +401,6 @@ public interface World extends Extent, Keyed, IChunkCache<IChunkGet> {
default boolean setBiome(BlockVector3 position, BiomeType biome) {
return false;
}
void flush();
}