Update to latest p2 v5

(implement FAWE biome setting)
Dieser Commit ist enthalten in:
dordsor21 2020-05-14 16:20:17 +01:00
Ursprung 5225099ec0
Commit bdc129cf7b
4 geänderte Dateien mit 40 neuen und 25 gelöschten Zeilen

Datei anzeigen

@ -8,6 +8,7 @@ fun Project.applyCommonConfiguration() {
repositories {
mavenCentral()
mavenLocal()
maven { url = uri("https://mvn.intellectualsites.com/content/groups/public/") }
maven { url = uri("https://plotsquared.com/mvn/") }
maven { url = uri("https://maven.sk89q.com/repo/") }
maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots/") }

Datei anzeigen

@ -6,24 +6,27 @@ import com.boydti.fawe.util.EditSessionBuilder;
import com.boydti.fawe.util.TaskManager;
import com.plotsquared.core.location.Location;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.util.ChunkManager;
import com.plotsquared.core.util.RegionManager;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.function.FlatRegionFunction;
import com.sk89q.worldedit.function.biome.BiomeReplace;
import com.sk89q.worldedit.function.operation.ForwardExtentCopy;
import com.sk89q.worldedit.function.operation.Operations;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.function.visitor.FlatRegionVisitor;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.regions.Regions;
import com.sk89q.worldedit.world.World;
import java.util.concurrent.CompletableFuture;
import com.sk89q.worldedit.world.biome.BiomeType;
public class FaweChunkManager extends ChunkManager {
public class FaweRegionManager extends RegionManager {
private ChunkManager parent;
private RegionManager parent;
public FaweChunkManager(ChunkManager parent) {
public FaweRegionManager(RegionManager parent) {
this.parent = parent;
}
@ -32,16 +35,6 @@ public class FaweChunkManager extends ChunkManager {
return parent.countEntities(plot);
}
@Override
public CompletableFuture loadChunk(String world, BlockVector2 loc, boolean force) {
return parent.loadChunk(world, loc, force);
}
@Override
public void unloadChunk(String world, BlockVector2 loc, boolean save) {
parent.unloadChunk(world, loc, save);
}
@Override
public void clearAllEntities(Location pos1, Location pos2) {
parent.clearAllEntities(pos1, pos2);
@ -50,7 +43,7 @@ public class FaweChunkManager extends ChunkManager {
@Override
public void swap(final Location pos1, final Location pos2, final Location pos3, final Location pos4, final Runnable whenDone) {
TaskManager.IMP.async(() -> {
synchronized (FaweChunkManager.class) {
synchronized (FaweRegionManager.class) {
//todo because of the following code this should proably be in the Bukkit module
World pos1World = BukkitAdapter.adapt(getWorld(pos1.getWorld()));
World pos3World = BukkitAdapter.adapt(getWorld(pos3.getWorld()));
@ -75,10 +68,30 @@ public class FaweChunkManager extends ChunkManager {
});
}
@Override
public void setBiome(CuboidRegion region, int extendBiome, BiomeType biome, String world, Runnable whenDone) {
region.expand(BlockVector3.at(extendBiome, 0, extendBiome));
region.expand(BlockVector3.at(-extendBiome, 0, -extendBiome));
TaskManager.IMP.async(() -> {
synchronized (FaweRegionManager.class) {
EditSession editSession = new EditSessionBuilder(BukkitAdapter.adapt(getWorld(world))).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build();
FlatRegionFunction replace = new BiomeReplace(editSession, biome);
FlatRegionVisitor visitor = new FlatRegionVisitor(region, replace);
try {
Operations.completeLegacy(visitor);
editSession.flushQueue();
} catch (MaxChangedBlocksException e) {
e.printStackTrace();
}
TaskManager.IMP.task(whenDone);
}
});
}
@Override
public boolean copyRegion(final Location pos1, final Location pos2, final Location pos3, final Runnable whenDone) {
TaskManager.IMP.async(() -> {
synchronized (FaweChunkManager.class) {
synchronized (FaweRegionManager.class) {
World pos1World = BukkitAdapter.adapt(getWorld(pos1.getWorld()));
World pos3World = BukkitAdapter.adapt(getWorld(pos3.getWorld()));
EditSession from = new EditSessionBuilder(pos1World).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build();
@ -100,7 +113,7 @@ public class FaweChunkManager extends ChunkManager {
@Override
public boolean regenerateRegion(final Location pos1, final Location pos2, boolean ignore, final Runnable whenDone) {
TaskManager.IMP.async(() -> {
synchronized (FaweChunkManager.class) {
synchronized (FaweRegionManager.class) {
World pos1World = BukkitAdapter.adapt(getWorld(pos1.getWorld()));
try (EditSession editSession = new EditSessionBuilder(pos1World).checkMemory(false)
.fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build()) {

Datei anzeigen

@ -15,7 +15,7 @@ import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
import com.plotsquared.core.plot.flag.implementations.NoWorldeditFlag;
import com.plotsquared.core.util.ChunkManager;
import com.plotsquared.core.util.RegionManager;
import com.plotsquared.core.util.SchematicHandler;
import com.plotsquared.core.util.WEManager;
import com.plotsquared.core.util.uuid.UUIDHandler;
@ -45,7 +45,7 @@ public class PlotSquaredFeature extends FaweMaskManager {
try {
setupBlockQueue();
setupSchematicHandler();
setupChunkManager();
setupRegionManager();
} catch (Throwable ignored) {
log.debug("Please update PlotSquared: http://ci.athion.net/job/PlotSquared/");
}
@ -81,9 +81,9 @@ public class PlotSquaredFeature extends FaweMaskManager {
log.debug(" - HybridPlotManager.REGENERATIVE_CLEAR: " + HybridPlotManager.REGENERATIVE_CLEAR);
}
private void setupChunkManager() throws RuntimeException {
ChunkManager.manager = new FaweChunkManager(ChunkManager.manager);
log.debug(" - ChunkManager: " + ChunkManager.manager);
private void setupRegionManager() throws RuntimeException {
RegionManager.manager = new FaweRegionManager(RegionManager.manager);
log.debug(" - RegionManager: " + RegionManager.manager);
}
private void setupSchematicHandler() throws RuntimeException {

Datei anzeigen

@ -15,6 +15,7 @@ plugins {
repositories {
maven { url = uri("https://plotsquared.com/mvn") }
maven { url = uri("https://mvn.intellectualsites.com/content/groups/public/") }
mavenCentral()
}
@ -58,7 +59,7 @@ dependencies {
"compile"("com.github.intellectualsites.plotsquared:PlotSquared-API:latest") {
isTransitive = false
}
"compile"("com.plotsquared:PlotSquared:5.1") {
"compile"("com.plotsquared:PlotSquared:5.11.1") {
isTransitive = false
}
implementation(kotlin("stdlib-jdk8", "1.3.61"))