Override P2's /plot set

Dieser Commit ist enthalten in:
dordsor21 2020-05-20 09:44:59 +01:00
Ursprung a6514f8a78
Commit 9085365165
2 geänderte Dateien mit 30 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -1,11 +1,10 @@
package com.boydti.fawe.bukkit.regions.plotsquared;
import static org.bukkit.Bukkit.getWorld;
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.plot.PlotArea;
import com.plotsquared.core.util.RegionManager;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.MaxChangedBlocksException;
@ -15,13 +14,18 @@ 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.function.pattern.Pattern;
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.regions.Region;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.biome.BiomeType;
import java.util.Set;
import static org.bukkit.Bukkit.getWorld;
public class FaweRegionManager extends RegionManager {
private RegionManager parent;
@ -40,6 +44,28 @@ public class FaweRegionManager extends RegionManager {
parent.clearAllEntities(pos1, pos2);
}
@Override
public boolean setCuboids(final PlotArea area, final Set<CuboidRegion> regions, final Pattern blocks, final int minY, final int maxY) {
TaskManager.IMP.async(() -> {
synchronized (FaweRegionManager.class) {
World world = BukkitAdapter.adapt(getWorld(area.getWorldName()));
EditSession session = new EditSessionBuilder(world).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build();
for (CuboidRegion region : regions) {
System.out.println(minY + " " + maxY);
region.setPos1(region.getPos1().withY(minY));
region.setPos2(region.getPos2().withY(maxY));
session.setBlocks((Region) region, blocks);
}
try {
session.flushQueue();
} catch (MaxChangedBlocksException e) {
e.printStackTrace();
}
}
});
return true;
}
@Override
public void swap(final Location pos1, final Location pos2, final Location pos3, final Location pos4, final Runnable whenDone) {
TaskManager.IMP.async(() -> {

Datei anzeigen

@ -59,7 +59,7 @@ dependencies {
"compile"("com.github.intellectualsites.plotsquared:PlotSquared-API:latest") {
isTransitive = false
}
"compile"("com.plotsquared:PlotSquared:5.11.1") {
"compile"("com.plotsquared:PlotSquared:5.11.2") {
isTransitive = false
}
implementation(kotlin("stdlib-jdk8", "1.3.61"))