Fix plot swap and have a nicer static AIR block

This commit is contained in:
dordsor21
2019-01-15 23:58:21 +00:00
parent 28c219c694
commit 7e6b11a21b
7 changed files with 33 additions and 512 deletions

View File

@ -184,6 +184,8 @@ public enum C {
* Area Create
*/
REQUIRES_UNMERGED("$2The plot cannot be merged", "debug"),
SET_ATTRIBUTE("$4Successfully set %s0 set to %s1", "Set"), /*
* Web
*/
@ -617,7 +619,7 @@ public enum C {
*/
DEBUG_HEADER("$1Debug Information&-", "Debug"), DEBUG_SECTION("$2>> $1&l%val%", "Debug"),
REQUIRES_UNMERGED("$2The plot cannot be merged", "Debug"),
DEBUG_LINE("$2>> $1%var%$2:$1 %val%&-", "Debug"), /*
* Invalid
*/

View File

@ -4,6 +4,8 @@ import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.flag.FlagManager;
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
import com.github.intellectualsites.plotsquared.plot.listener.WEExtent;
import com.github.intellectualsites.plotsquared.plot.listener.WEManager;
import com.github.intellectualsites.plotsquared.plot.object.*;
import com.github.intellectualsites.plotsquared.plot.util.*;
import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue;
@ -24,7 +26,6 @@ public abstract class HybridUtils {
public static Set<ChunkLoc> chunks = new HashSet<>();
public static PlotArea area;
public static boolean UPDATE = false;
private static BaseBlock air = BlockTypes.AIR.getDefaultState().toBaseBlock();
public abstract void analyzeRegion(String world, RegionWrapper region,
RunnableVal<PlotAnalysis> whenDone);
@ -361,7 +362,7 @@ public abstract class HybridUtils {
} else if (y <= extend) {
queue
.setBlock(x + X + plotWorld.ROAD_OFFSET_X, minY + y,
z + Z + plotWorld.ROAD_OFFSET_Z, air);
z + Z + plotWorld.ROAD_OFFSET_Z, WEExtent.AIRBASE);
}
}
}

View File

@ -50,14 +50,14 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
if (WEManager.maskContains(this.mask, location.getX(), location.getY(), location.getZ())) {
return super.getBlock(location);
}
return WEManager.AIR;
return WEExtent.AIRSTATE;
}
@Override public BaseBlock getFullBlock(BlockVector3 location) {
if (WEManager.maskContains(this.mask, location.getX(), location.getY(), location.getZ())) {
return super.getFullBlock(location);
}
return WEManager.AIR.toBaseBlock();
return WEExtent.AIRBASE;
}
@Override public boolean setBlock(BlockVector3 location, BlockStateHolder block)

View File

@ -10,9 +10,7 @@ import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.world.biome.BaseBiome;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.*;
import java.util.HashSet;
@ -20,6 +18,9 @@ public class WEExtent extends AbstractDelegateExtent {
private final HashSet<RegionWrapper> mask;
public static BlockState AIRSTATE = BlockTypes.AIR.getDefaultState();
public static BaseBlock AIRBASE = BlockTypes.AIR.getDefaultState().toBaseBlock();
public WEExtent(HashSet<RegionWrapper> mask, Extent extent) {
super(extent);
this.mask = mask;
@ -48,13 +49,13 @@ public class WEExtent extends AbstractDelegateExtent {
if (WEManager.maskContains(this.mask, location.getX(), location.getY(), location.getZ())) {
return super.getBlock(location);
}
return WEManager.AIR;
return AIRSTATE;
}
@Override public BaseBlock getFullBlock(BlockVector3 location) {
if (WEManager.maskContains(this.mask, location.getX(), location.getY(), location.getZ())) {
return super.getFullBlock(location);
}
return WEManager.AIR.toBaseBlock();
return AIRBASE;
}
}

View File

@ -4,6 +4,7 @@ import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
import com.github.intellectualsites.plotsquared.plot.object.*;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockType;
@ -12,9 +13,6 @@ import java.util.UUID;
public class WEManager {
public static BlockState AIR = new BlockType("AIR").getDefaultState();
public static boolean maskContains(HashSet<RegionWrapper> mask, int x, int y, int z) {
for (RegionWrapper region : mask) {
if (region.isIn(x, y, z)) {