geforkt von Mirrors/FastAsyncWorldEdit
Add get default version min/max world height to platform
- Fixes #1500
Dieser Commit ist enthalten in:
Ursprung
f9ecb449cf
Commit
f236934a39
@ -84,7 +84,7 @@ public class FaweBukkit implements IFawe, Listener {
|
||||
Bukkit.getServer().shutdown();
|
||||
}
|
||||
|
||||
chunksStretched = new MinecraftVersion().isEqualOrHigher(MinecraftVersion.NETHER);
|
||||
chunksStretched = new MinecraftVersion().isEqualOrLower(MinecraftVersion.NETHER);
|
||||
|
||||
platformAdapter = new NMSAdapter();
|
||||
|
||||
|
@ -1,7 +1,9 @@
|
||||
package com.fastasyncworldedit.bukkit.regions;
|
||||
|
||||
import com.fastasyncworldedit.core.regions.FaweMask;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
@ -38,12 +40,12 @@ public class GriefPreventionFeature extends BukkitMaskManager implements Listene
|
||||
claim.getGreaterBoundaryCorner().getBlockX();
|
||||
final BlockVector3 pos1 = BlockVector3.at(
|
||||
claim.getLesserBoundaryCorner().getBlockX(),
|
||||
0,
|
||||
player.getWorld().getMinHeight(),
|
||||
claim.getLesserBoundaryCorner().getBlockZ()
|
||||
);
|
||||
final BlockVector3 pos2 = BlockVector3.at(
|
||||
claim.getGreaterBoundaryCorner().getBlockX(),
|
||||
256,
|
||||
player.getWorld().getMaxHeight(),
|
||||
claim.getGreaterBoundaryCorner().getBlockZ()
|
||||
);
|
||||
return new FaweMask(new CuboidRegion(pos1, pos2)) {
|
||||
|
@ -12,6 +12,7 @@ public class MinecraftVersion implements Comparable<MinecraftVersion> {
|
||||
|
||||
public static final MinecraftVersion NETHER = new MinecraftVersion(1, 16);
|
||||
public static final MinecraftVersion CAVES_17 = new MinecraftVersion(1, 17);
|
||||
public static final MinecraftVersion CAVES_18 = new MinecraftVersion(1, 18);
|
||||
|
||||
private final int major;
|
||||
private final int minor;
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
package com.sk89q.worldedit.bukkit;
|
||||
|
||||
import com.fastasyncworldedit.bukkit.util.MinecraftVersion;
|
||||
import com.fastasyncworldedit.core.extent.processor.lighting.RelighterFactory;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.sk89q.bukkit.util.CommandInfo;
|
||||
@ -278,5 +279,15 @@ public class BukkitServerInterface extends AbstractPlatform implements MultiUser
|
||||
}
|
||||
return this.relighterFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getVersionMinY() {
|
||||
return new MinecraftVersion().isEqualOrLower(MinecraftVersion.CAVES_18) ? -64 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getVersionMaxY() {
|
||||
return new MinecraftVersion().isEqualOrLower(MinecraftVersion.CAVES_18) ? 319 : 255;
|
||||
}
|
||||
//FAWE end
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.fastasyncworldedit.core.regions;
|
||||
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
|
||||
@ -27,7 +29,13 @@ public class RegionWrapper extends CuboidRegion {
|
||||
*/
|
||||
@Deprecated
|
||||
public RegionWrapper(final int minX, final int maxX, final int minZ, final int maxZ) {
|
||||
this(minX, maxX, 0, 255, minZ, maxZ);
|
||||
this(minX,
|
||||
maxX,
|
||||
WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.WORLD_EDITING).getVersionMinY(),
|
||||
WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.WORLD_EDITING).getVersionMaxY(),
|
||||
minZ,
|
||||
maxZ
|
||||
);
|
||||
}
|
||||
|
||||
public RegionWrapper(final int minX, final int maxX, final int minY, final int maxY, final int minZ, final int maxZ) {
|
||||
|
@ -21,8 +21,10 @@ package com.sk89q.worldedit.extension.input;
|
||||
|
||||
import com.fastasyncworldedit.core.configuration.Caption;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.factory.MaskFactory;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.extension.platform.Locatable;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
@ -303,8 +305,8 @@ public class ParserContext {
|
||||
minY = extent.getMinY();
|
||||
maxY = extent.getMaxY();
|
||||
} else {
|
||||
minY = 0;
|
||||
maxY = 255;
|
||||
minY = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.WORLD_EDITING).getVersionMinY();
|
||||
maxY = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.WORLD_EDITING).getVersionMaxY();
|
||||
}
|
||||
|
||||
return minY;
|
||||
|
@ -22,6 +22,7 @@ package com.sk89q.worldedit.extension.platform;
|
||||
import com.fastasyncworldedit.core.extent.processor.lighting.Relighter;
|
||||
import com.fastasyncworldedit.core.extent.processor.lighting.RelighterFactory;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.internal.util.NonAbstractForCompatibility;
|
||||
import com.sk89q.worldedit.registry.Keyed;
|
||||
@ -235,5 +236,15 @@ public interface Platform extends Keyed {
|
||||
*/
|
||||
@Nonnull
|
||||
RelighterFactory getRelighterFactory();
|
||||
|
||||
/**
|
||||
* Get the default minimum Y value of worlds based on Minecraft version (inclusive).
|
||||
*/
|
||||
int getVersionMinY();
|
||||
|
||||
/**
|
||||
* Get the default maximum Y value of worlds based on Minecraft version (inclusive).
|
||||
*/
|
||||
int getVersionMaxY();
|
||||
//FAWE end
|
||||
}
|
||||
|
@ -22,7 +22,9 @@ package com.sk89q.worldedit.extent;
|
||||
import com.fastasyncworldedit.core.extent.processor.heightmap.HeightMapType;
|
||||
import com.fastasyncworldedit.core.math.MutableBlockVector3;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.function.operation.Operation;
|
||||
import com.sk89q.worldedit.internal.util.DeprecationUtil;
|
||||
import com.sk89q.worldedit.internal.util.NonAbstractForCompatibility;
|
||||
@ -95,7 +97,9 @@ public interface OutputExtent {
|
||||
@Deprecated
|
||||
default boolean setBiome(BlockVector2 position, BiomeType biome) {
|
||||
boolean result = false;
|
||||
for (int y = 0; y < 256; y++) {
|
||||
int minY = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.WORLD_EDITING).getVersionMinY();
|
||||
int maxY = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.WORLD_EDITING).getVersionMaxY();
|
||||
for (int y = minY; y < maxY; y++) {
|
||||
result |= setBiome(position.toBlockVector3().mutY(y), biome);
|
||||
}
|
||||
return result;
|
||||
|
@ -19,6 +19,8 @@
|
||||
|
||||
package com.sk89q.worldedit.function.mask;
|
||||
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
@ -47,7 +49,10 @@ public class OffsetMask extends AbstractMask {
|
||||
*/
|
||||
@Deprecated
|
||||
public OffsetMask(Mask mask, BlockVector3 offset) {
|
||||
this(mask, offset, 0, 255);
|
||||
this(mask, offset,
|
||||
WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.WORLD_EDITING).getVersionMinY(),
|
||||
WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.WORLD_EDITING).getVersionMaxY()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -28,7 +28,9 @@ import com.fastasyncworldedit.core.queue.implementation.SingleThreadQueueExtent;
|
||||
import com.fastasyncworldedit.core.util.ExtentTraverser;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.function.RegionFunction;
|
||||
import com.sk89q.worldedit.function.operation.Operation;
|
||||
@ -110,7 +112,10 @@ public abstract class BreadthFirstSearch implements Operation {
|
||||
*/
|
||||
public BreadthFirstSearch(RegionFunction function) {
|
||||
//FAWE start - int depth, min/max y
|
||||
this(function, Integer.MAX_VALUE, 0, 255, null);
|
||||
this(function, Integer.MAX_VALUE,
|
||||
WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.WORLD_EDITING).getVersionMinY(),
|
||||
WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.WORLD_EDITING).getVersionMaxY(), null
|
||||
);
|
||||
}
|
||||
|
||||
//FAWE start - int depth, min/max y, preloading
|
||||
|
@ -19,6 +19,8 @@
|
||||
|
||||
package com.sk89q.worldedit.function.visitor;
|
||||
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.function.RegionFunction;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
@ -48,7 +50,10 @@ public class DownwardVisitor extends RecursiveVisitor {
|
||||
@Deprecated
|
||||
public DownwardVisitor(Mask mask, RegionFunction function, int baseY) {
|
||||
//FAWE start - int depth, min/max y
|
||||
this(mask, function, baseY, Integer.MAX_VALUE, 0, 255, null);
|
||||
this(mask, function, baseY, Integer.MAX_VALUE, WorldEdit
|
||||
.getInstance().getPlatformManager().queryCapability(Capability.WORLD_EDITING).getVersionMinY(),
|
||||
WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.WORLD_EDITING).getVersionMaxY(), null
|
||||
);
|
||||
//FAWE end
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,8 @@
|
||||
|
||||
package com.sk89q.worldedit.function.visitor;
|
||||
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.function.RegionFunction;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
@ -39,7 +41,10 @@ public class NonRisingVisitor extends RecursiveVisitor {
|
||||
@Deprecated
|
||||
public NonRisingVisitor(Mask mask, RegionFunction function) {
|
||||
//FAWE start - int depth, y min/max
|
||||
this(mask, function, Integer.MAX_VALUE, 0, 255, null);
|
||||
this(mask, function, Integer.MAX_VALUE, WorldEdit
|
||||
.getInstance().getPlatformManager().queryCapability(Capability.WORLD_EDITING).getVersionMinY(),
|
||||
WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.WORLD_EDITING).getVersionMaxY(), null
|
||||
);
|
||||
//FAWE end
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,8 @@
|
||||
|
||||
package com.sk89q.worldedit.function.visitor;
|
||||
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.function.RegionFunction;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
@ -41,7 +43,10 @@ public class RecursiveVisitor extends BreadthFirstSearch {
|
||||
* @param function the function
|
||||
*/
|
||||
public RecursiveVisitor(Mask mask, RegionFunction function) {
|
||||
this(mask, function, Integer.MAX_VALUE, 0, 255, null);
|
||||
this(mask, function, Integer.MAX_VALUE, WorldEdit
|
||||
.getInstance().getPlatformManager().queryCapability(Capability.WORLD_EDITING).getVersionMinY(),
|
||||
WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.WORLD_EDITING).getVersionMaxY(), null
|
||||
);
|
||||
//FAWE end
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,8 @@
|
||||
package com.sk89q.worldedit.regions;
|
||||
|
||||
import com.fastasyncworldedit.core.math.BlockVectorSet;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
@ -221,14 +223,22 @@ public abstract class AbstractRegion extends AbstractSet<BlockVector3> implement
|
||||
// Sub-class utilities
|
||||
|
||||
protected final int getWorldMinY() {
|
||||
//FAWE start > Integer.MIN_VALUE -> 0 (to avoid crazy for loops...) TODO: See if there's a way to find a "server default"
|
||||
return world == null ? 0 : world.getMinY();
|
||||
//FAWE start > Server default based on version
|
||||
return world == null ? WorldEdit
|
||||
.getInstance()
|
||||
.getPlatformManager()
|
||||
.queryCapability(Capability.WORLD_EDITING)
|
||||
.getVersionMinY() : world.getMinY();
|
||||
//FAWE end
|
||||
}
|
||||
|
||||
protected final int getWorldMaxY() {
|
||||
//FAWE start > Integer.MAX_VALUE -> 255 (to avoid crazy for loops...) TODO: See if there's a way to find a "server default"
|
||||
return world == null ? 255 : world.getMaxY();
|
||||
//FAWE start > Server default based on version
|
||||
return world == null ? WorldEdit
|
||||
.getInstance()
|
||||
.getPlatformManager()
|
||||
.queryCapability(Capability.WORLD_EDITING)
|
||||
.getVersionMaxY() : world.getMaxY();
|
||||
//FAWE end
|
||||
}
|
||||
|
||||
|
@ -29,6 +29,8 @@ import com.fastasyncworldedit.core.queue.IBatchProcessor;
|
||||
import com.fastasyncworldedit.core.queue.IChunk;
|
||||
import com.fastasyncworldedit.core.queue.IChunkGet;
|
||||
import com.fastasyncworldedit.core.queue.IChunkSet;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.internal.util.DeprecationUtil;
|
||||
import com.sk89q.worldedit.internal.util.NonAbstractForCompatibility;
|
||||
@ -226,7 +228,18 @@ public interface Region extends Iterable<BlockVector3>, Cloneable, IBatchProcess
|
||||
BlockVector3 pos1 = getMinimumPoint();
|
||||
BlockVector3 pos2 = getMaximumPoint();
|
||||
return pos1.getBlockX() == Integer.MIN_VALUE && pos1.getBlockZ() == Integer.MIN_VALUE && pos2.getBlockX() == Integer.MAX_VALUE && pos2
|
||||
.getBlockZ() == Integer.MAX_VALUE && pos1.getBlockY() <= 0 && pos2.getBlockY() >= 255;
|
||||
.getBlockZ() == Integer.MAX_VALUE
|
||||
&& pos1.getBlockY() <= WorldEdit
|
||||
.getInstance()
|
||||
.getPlatformManager()
|
||||
.queryCapability(
|
||||
Capability.WORLD_EDITING)
|
||||
.getVersionMinY()
|
||||
&& pos2.getBlockY() >= WorldEdit
|
||||
.getInstance()
|
||||
.getPlatformManager()
|
||||
.queryCapability(Capability.WORLD_EDITING)
|
||||
.getVersionMaxY();
|
||||
}
|
||||
|
||||
default int getMinimumY() {
|
||||
|
@ -20,9 +20,11 @@
|
||||
package com.sk89q.worldedit.world;
|
||||
|
||||
import com.fastasyncworldedit.core.function.mask.BlockMaskBuilder;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseItem;
|
||||
import com.sk89q.worldedit.blocks.BaseItemStack;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.operation.Operation;
|
||||
@ -66,12 +68,12 @@ public abstract class AbstractWorld implements World {
|
||||
|
||||
@Override
|
||||
public int getMinY() {
|
||||
return 0;
|
||||
return WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.WORLD_EDITING).getVersionMinY();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxY() {
|
||||
return 255;
|
||||
return WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.WORLD_EDITING).getVersionMaxY();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren