geforkt von Mirrors/FastAsyncWorldEdit
Updated a class, minor command tweaks, and formatting
Dieser Commit ist enthalten in:
Ursprung
ff5860113d
Commit
3a3efb8117
@ -110,7 +110,7 @@ public class AnvilCommands {
|
||||
@Command(
|
||||
name = "replaceall",
|
||||
aliases = {"rea", "repall"},
|
||||
desc = "Replace all blocks in the selection with another",
|
||||
desc = "Replace all blocks in the selection with another"
|
||||
)
|
||||
@CommandPermissions("worldedit.anvil.replaceall")
|
||||
public void replaceAll(Player player, String folder,
|
||||
@ -221,8 +221,7 @@ public class AnvilCommands {
|
||||
aliases = {"deloldreg" },
|
||||
desc = "Delete regions which haven't been accessed in a certain amount of time",
|
||||
descFooter = "You can use seconds (s), minutes (m), hours (h), days (d), weeks (w), years (y)\n" +
|
||||
"(months are not a unit of time)\n" +
|
||||
"E.g. 8h5m12s\n"
|
||||
"(months are not a unit of time) E.g. 8h5m12s\n"
|
||||
)
|
||||
@CommandPermissions("worldedit.anvil.deletealloldregions")
|
||||
public void deleteAllOldRegions(Player player, String folder, String time) throws WorldEditException {
|
||||
@ -300,7 +299,7 @@ public class AnvilCommands {
|
||||
desc = "Replace all blocks in the selection with another"
|
||||
)
|
||||
@CommandPermissions("worldedit.anvil.replaceall")
|
||||
public void replaceAllPattern(Player player, String folder, @Arg(name = "from", desc = "String", def = "") String from, final Pattern to, @Switch(name = 'd', desc = "TODO") boolean useData, @Switch(name = 'm', desc = "TODO") boolean useMap) throws WorldEditException {
|
||||
public void replaceAllPattern(Player player, String folder, @Arg(name = "from", desc = "String", def = "") String from, Pattern to, @Switch(name = 'd', desc = "TODO") boolean useData, @Switch(name = 'm', desc = "TODO") boolean useMap) throws WorldEditException {
|
||||
// MCAFilterCounter filter; TODO NOT IMPLEMENTED
|
||||
// if (useMap) {
|
||||
// if (to instanceof RandomPattern) {
|
||||
|
@ -26,15 +26,15 @@ public class VisualExtent extends AbstractDelegateExtent {
|
||||
this.queue = queue;
|
||||
}
|
||||
|
||||
public VisualChunk getChunk(int cx, int cz) {
|
||||
return chunks.get(MathMan.pairInt(cx, cz));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException {
|
||||
return setBlock(location.getBlockX(), location.getBlockY(), location.getBlockZ(), block);
|
||||
}
|
||||
|
||||
public VisualChunk getChunk(int cx, int cz) {
|
||||
return chunks.get(MathMan.pairInt(cx, cz));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBlock(int x, int y, int z, BlockStateHolder block) throws WorldEditException {
|
||||
BlockStateHolder previous = super.getBlock(x, y, z);
|
||||
|
@ -16,8 +16,7 @@ public class VisualQueue extends SingleThreadIntervalQueue<FawePlayer> {
|
||||
|
||||
@Override
|
||||
public void operate(FawePlayer fp) {
|
||||
LocalSession session = WorldEdit.getInstance().getSessionManager()
|
||||
.get(fp.toWorldEditPlayer());
|
||||
LocalSession session = WorldEdit.getInstance().getSessionManager().get(fp.toWorldEditPlayer());
|
||||
Player player = fp.getPlayer();
|
||||
Tool tool = session.getTool(player);
|
||||
if (tool instanceof BrushTool) {
|
||||
|
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
@ -6,7 +6,8 @@ import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.function.pattern.AbstractPattern;
|
||||
|
||||
public abstract class AbstractExtentPattern extends AbstractPattern {
|
||||
private transient final Extent extent;
|
||||
|
||||
private final transient Extent extent;
|
||||
|
||||
public AbstractExtentPattern(Extent extent) {
|
||||
checkNotNull(extent);
|
||||
|
@ -18,7 +18,6 @@ import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.registry.BiomeRegistry;
|
||||
import com.sk89q.worldedit.world.registry.LegacyMapper;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
// TODO FIXME
|
||||
|
@ -24,8 +24,6 @@ import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.SpongeSchematicWriter;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import net.jpountz.lz4.LZ4BlockInputStream;
|
||||
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
@ -36,6 +34,7 @@ import java.net.URL;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import net.jpountz.lz4.LZ4BlockInputStream;
|
||||
|
||||
public class FaweSchematicHandler extends SchematicHandler {
|
||||
@Override
|
||||
|
@ -1,39 +1,8 @@
|
||||
package com.boydti.fawe.regions.general.plot;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.example.NullFaweChunk;
|
||||
import com.boydti.fawe.jnbt.anvil.MCAChunk;
|
||||
import com.boydti.fawe.jnbt.anvil.MCAQueue;
|
||||
import com.boydti.fawe.jnbt.anvil.MCAWriter;
|
||||
import com.boydti.fawe.object.FaweChunk;
|
||||
import com.boydti.fawe.beta.IQueueExtent;
|
||||
import com.boydti.fawe.util.SetQueue;
|
||||
import com.github.intellectualsites.plotsquared.commands.Command;
|
||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||
import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.commands.CommandCategory;
|
||||
import com.github.intellectualsites.plotsquared.plot.commands.MainCommand;
|
||||
import com.github.intellectualsites.plotsquared.plot.commands.RequiredType;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Captions;
|
||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||
import com.github.intellectualsites.plotsquared.plot.database.SQLManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotWorld;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal3;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.SetupObject;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.SetupUtils;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.WorldUtil;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
@CommandDeclaration(
|
||||
command = "moveto512",
|
||||
|
@ -1,16 +1,14 @@
|
||||
package com.boydti.fawe.regions.general.plot;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.boydti.fawe.regions.general.CuboidRegionFilter;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
public class PlotRegionFilter extends CuboidRegionFilter {
|
||||
private final PlotArea area;
|
||||
|
||||
|
@ -27,10 +27,8 @@ import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.biome.BiomeTypes;
|
||||
import com.sk89q.worldedit.world.biome.Biomes;
|
||||
import com.sk89q.worldedit.world.registry.BiomeRegistry;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
@CommandDeclaration(
|
||||
|
@ -13,6 +13,7 @@ import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
||||
import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.listener.WEManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
@ -22,7 +23,6 @@ import com.github.intellectualsites.plotsquared.plot.util.SchematicHandler;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.block.QueueProvider;
|
||||
import com.github.intellectualsites.plotsquared.plot.listener.WEManager;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
|
@ -17,8 +17,6 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
import it.unimi.dsi.fastutil.ints.IntArraySet;
|
||||
import it.unimi.dsi.fastutil.longs.LongArrayList;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
@ -41,50 +39,11 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipFile;
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
// TODO FIXME
|
||||
public class TextureUtil implements TextureHolder {
|
||||
|
||||
public static TextureUtil fromClipboard(Clipboard clipboard) throws FileNotFoundException {
|
||||
boolean[] ids = new boolean[BlockTypes.size()];
|
||||
for (BlockVector3 pt : clipboard.getRegion()) {
|
||||
ids[clipboard.getBlock(pt).getInternalBlockTypeId()] = true;
|
||||
}
|
||||
HashSet<BlockType> blocks = new HashSet<>();
|
||||
for (int typeId = 0; typeId < ids.length; typeId++) {
|
||||
if (ids[typeId]) {
|
||||
blocks.add(BlockTypes.get(typeId));
|
||||
}
|
||||
}
|
||||
return fromBlocks(blocks);
|
||||
}
|
||||
|
||||
public static TextureUtil fromBlocks(Set<BlockType> blocks) throws FileNotFoundException {
|
||||
return new FilteredTextureUtil(Fawe.get().getTextureUtil(), blocks);
|
||||
}
|
||||
|
||||
public static TextureUtil fromMask(Mask mask) throws FileNotFoundException {
|
||||
HashSet<BlockType> blocks = new HashSet<>();
|
||||
|
||||
SingleFilterBlock extent = new SingleFilterBlock();
|
||||
new MaskTraverser(mask).reset(extent);
|
||||
|
||||
TextureUtil tu = Fawe.get().getTextureUtil();
|
||||
for (int typeId : tu.getValidBlockIds()) {
|
||||
BlockType block = BlockTypes.get(typeId);
|
||||
extent.init(0, 0, 0, block.getDefaultState().toBaseBlock());
|
||||
if (mask.test(extent)) {
|
||||
blocks.add(block);
|
||||
}
|
||||
}
|
||||
return fromBlocks(blocks);
|
||||
}
|
||||
|
||||
@Override public TextureUtil getTextureUtil() {
|
||||
return this;
|
||||
}
|
||||
|
||||
private final File folder;
|
||||
private static final int[] FACTORS = new int[766];
|
||||
|
||||
static {
|
||||
@ -93,18 +52,16 @@ public class TextureUtil implements TextureHolder {
|
||||
}
|
||||
}
|
||||
|
||||
private final File folder;
|
||||
protected int[] blockColors = new int[BlockTypes.size()];
|
||||
protected long[] blockDistance = new long[BlockTypes.size()];
|
||||
protected long[] distances;
|
||||
protected int[] validColors;
|
||||
protected int[] validBlockIds;
|
||||
|
||||
protected int[] validLayerColors;
|
||||
protected int[][] validLayerBlocks;
|
||||
|
||||
protected int[] validMixBiomeColors;
|
||||
protected long[] validMixBiomeIds;
|
||||
|
||||
/**
|
||||
* https://github.com/erich666/Mineways/blob/master/Win/biomes.cpp
|
||||
*/
|
||||
@ -373,6 +330,7 @@ public class TextureUtil implements TextureHolder {
|
||||
new BiomeColor(253, "Unknown Biome", 0.8f, 0.4f, 0x92BD59, 0x77AB2F),
|
||||
new BiomeColor(254, "Unknown Biome", 0.8f, 0.4f, 0x92BD59, 0x77AB2F),
|
||||
new BiomeColor(255, "Unknown Biome", 0.8f, 0.4f, 0x92BD59, 0x77AB2F),};
|
||||
private BlockType[] layerBuffer = new BlockType[2];
|
||||
|
||||
public TextureUtil() throws FileNotFoundException {
|
||||
this(MainUtil.getFile(Fawe.imp().getDirectory(), Settings.IMP.PATHS.TEXTURES));
|
||||
@ -386,6 +344,61 @@ public class TextureUtil implements TextureHolder {
|
||||
}
|
||||
}
|
||||
|
||||
public static TextureUtil fromClipboard(Clipboard clipboard) throws FileNotFoundException {
|
||||
boolean[] ids = new boolean[BlockTypes.size()];
|
||||
for (BlockVector3 pt : clipboard.getRegion()) {
|
||||
ids[clipboard.getBlock(pt).getInternalBlockTypeId()] = true;
|
||||
}
|
||||
HashSet<BlockType> blocks = new HashSet<>();
|
||||
for (int typeId = 0; typeId < ids.length; typeId++) {
|
||||
if (ids[typeId]) {
|
||||
blocks.add(BlockTypes.get(typeId));
|
||||
}
|
||||
}
|
||||
return fromBlocks(blocks);
|
||||
}
|
||||
|
||||
public static TextureUtil fromBlocks(Set<BlockType> blocks) throws FileNotFoundException {
|
||||
return new FilteredTextureUtil(Fawe.get().getTextureUtil(), blocks);
|
||||
}
|
||||
|
||||
public static TextureUtil fromMask(Mask mask) throws FileNotFoundException {
|
||||
HashSet<BlockType> blocks = new HashSet<>();
|
||||
|
||||
SingleFilterBlock extent = new SingleFilterBlock();
|
||||
new MaskTraverser(mask).reset(extent);
|
||||
|
||||
TextureUtil tu = Fawe.get().getTextureUtil();
|
||||
for (int typeId : tu.getValidBlockIds()) {
|
||||
BlockType block = BlockTypes.get(typeId);
|
||||
extent.init(0, 0, 0, block.getDefaultState().toBaseBlock());
|
||||
if (mask.test(extent)) {
|
||||
blocks.add(block);
|
||||
}
|
||||
}
|
||||
return fromBlocks(blocks);
|
||||
}
|
||||
|
||||
protected static int hueDistance(int red1, int green1, int blue1, int red2, int green2,
|
||||
int blue2) {
|
||||
int total1 = (red1 + green1 + blue1);
|
||||
int total2 = (red2 + green2 + blue2);
|
||||
if (total1 == 0 || total2 == 0) {
|
||||
return 0;
|
||||
}
|
||||
int factor1 = FACTORS[total1];
|
||||
int factor2 = FACTORS[total2];
|
||||
long r = (512 * (red1 * factor1 - red2 * factor2)) >> 10;
|
||||
long g = (green1 * factor1 - green2 * factor2);
|
||||
long b = (767 * (blue1 * factor1 - blue2 * factor2)) >> 10;
|
||||
return (int) ((r * r + g * g + b * b) >> 25);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureUtil getTextureUtil() {
|
||||
return this;
|
||||
}
|
||||
|
||||
public BlockType getNearestBlock(int color) {
|
||||
long min = Long.MAX_VALUE;
|
||||
int closest = 0;
|
||||
@ -440,8 +453,6 @@ public class TextureUtil implements TextureHolder {
|
||||
return BlockTypes.get(closest);
|
||||
}
|
||||
|
||||
private BlockType[] layerBuffer = new BlockType[2];
|
||||
|
||||
/**
|
||||
* Returns the block combined ids as an array
|
||||
*
|
||||
@ -975,21 +986,6 @@ public class TextureUtil implements TextureHolder {
|
||||
* hd);
|
||||
}
|
||||
|
||||
protected static int hueDistance(int red1, int green1, int blue1, int red2, int green2,
|
||||
int blue2) {
|
||||
int total1 = (red1 + green1 + blue1);
|
||||
int total2 = (red2 + green2 + blue2);
|
||||
if (total1 == 0 || total2 == 0) {
|
||||
return 0;
|
||||
}
|
||||
int factor1 = FACTORS[total1];
|
||||
int factor2 = FACTORS[total2];
|
||||
long r = (512 * (red1 * factor1 - red2 * factor2)) >> 10;
|
||||
long g = (green1 * factor1 - green2 * factor2);
|
||||
long b = (767 * (blue1 * factor1 - blue2 * factor2)) >> 10;
|
||||
return (int) ((r * r + g * g + b * b) >> 25);
|
||||
}
|
||||
|
||||
public long getDistance(BufferedImage image, int c1) {
|
||||
long totalDistSqr = 0;
|
||||
int width = image.getWidth();
|
||||
@ -1008,7 +1004,12 @@ public class TextureUtil implements TextureHolder {
|
||||
return totalDistSqr / area;
|
||||
}
|
||||
|
||||
public int[] getValidBlockIds() {
|
||||
return validBlockIds.clone();
|
||||
}
|
||||
|
||||
public static class BiomeColor {
|
||||
|
||||
public int id;
|
||||
public String name;
|
||||
public float temperature;
|
||||
@ -1028,8 +1029,4 @@ public class TextureUtil implements TextureHolder {
|
||||
this.foliage = foliage;
|
||||
}
|
||||
}
|
||||
|
||||
public int[] getValidBlockIds() {
|
||||
return validBlockIds.clone();
|
||||
}
|
||||
}
|
||||
|
@ -45,13 +45,12 @@ import com.sk89q.worldedit.world.item.ItemType;
|
||||
import com.sk89q.worldedit.world.item.ItemTypes;
|
||||
import com.sk89q.worldedit.world.registry.BlockMaterial;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.File;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* An abstract implementation of both a {@link Actor} and a {@link Player}
|
||||
* that is intended for implementations of WorldEdit to use to wrap
|
||||
* players that make use of WorldEdit.
|
||||
* An abstract implementation of both a {@link Actor} and a {@link Player} that is intended for
|
||||
* implementations of WorldEdit to use to wrap players that make use of WorldEdit.
|
||||
*/
|
||||
public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
||||
|
||||
@ -111,7 +110,8 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
||||
|
||||
BlockVector3 mutablePos = MutableBlockVector3.ZERO;
|
||||
while (y <= world.getMaximumPoint().getBlockY() + 2) {
|
||||
if (!world.getBlock(mutablePos.setComponents(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) {
|
||||
if (!world.getBlock(mutablePos.setComponents(x, y, z)).getBlockType().getMaterial()
|
||||
.isMovementBlocker()) {
|
||||
++free;
|
||||
} else {
|
||||
free = 0;
|
||||
@ -120,7 +120,8 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
||||
if (free == 2) {
|
||||
final BlockVector3 pos = mutablePos.setComponents(x, y - 2, z);
|
||||
final BlockStateHolder state = world.getBlock(pos);
|
||||
setPosition(new Location(world, Vector3.at(x + 0.5, y - 2 + BlockTypeUtil.centralTopLimit(state), z + 0.5)));
|
||||
setPosition(new Location(world,
|
||||
Vector3.at(x + 0.5, y - 2 + BlockTypeUtil.centralTopLimit(state), z + 0.5)));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -139,7 +140,8 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
||||
final BlockVector3 pos = BlockVector3.at(x, y, z);
|
||||
final BlockState id = world.getBlock(pos);
|
||||
if (id.getBlockType().getMaterial().isMovementBlocker()) {
|
||||
setPosition(new Location(world, Vector3.at(x + 0.5, y + + BlockTypeUtil.centralTopLimit(id), z + 0.5)));
|
||||
setPosition(new Location(world,
|
||||
Vector3.at(x + 0.5, y + +BlockTypeUtil.centralTopLimit(id), z + 0.5)));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -161,7 +163,9 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
||||
final Extent world = pos.getExtent();
|
||||
|
||||
int maxY = world.getMaxY();
|
||||
if (y >= maxY) return false;
|
||||
if (y >= maxY) {
|
||||
return false;
|
||||
}
|
||||
|
||||
BlockMaterial initialMaterial = world.getBlock(BlockVector3.at(x, y, z)).getMaterial();
|
||||
|
||||
@ -172,8 +176,11 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
||||
|
||||
for (int level = y + 1; level <= maxY + 2; level++) {
|
||||
BlockState state;
|
||||
if (level >= maxY) state = BlockTypes.VOID_AIR.getDefaultState();
|
||||
else state = world.getBlock(BlockVector3.at(x, level, z));
|
||||
if (level >= maxY) {
|
||||
state = BlockTypes.VOID_AIR.getDefaultState();
|
||||
} else {
|
||||
state = world.getBlock(BlockVector3.at(x, level, z));
|
||||
}
|
||||
BlockType type = state.getBlockType();
|
||||
BlockMaterial material = type.getMaterial();
|
||||
|
||||
@ -218,14 +225,19 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
||||
boolean lastState = initialMaterial.isMovementBlocker() && initialMaterial.isFullCube();
|
||||
|
||||
int maxY = world.getMaxY();
|
||||
if (y <= 2) return false;
|
||||
if (y <= 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
double freeEnd = -1;
|
||||
double height = 1.85;
|
||||
for (int level = y + 1; level > 0; level--) {
|
||||
BlockState state;
|
||||
if (level >= maxY) state = BlockTypes.VOID_AIR.getDefaultState();
|
||||
else state = world.getBlock(BlockVector3.at(x, level, z));
|
||||
if (level >= maxY) {
|
||||
state = BlockTypes.VOID_AIR.getDefaultState();
|
||||
} else {
|
||||
state = world.getBlock(BlockVector3.at(x, level, z));
|
||||
}
|
||||
BlockType type = state.getBlockType();
|
||||
BlockMaterial material = type.getMaterial();
|
||||
|
||||
@ -279,7 +291,8 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
||||
|
||||
while (y <= world.getMaximumPoint().getY()) {
|
||||
// Found a ceiling!
|
||||
if (world.getBlock(BlockVector3.at(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) {
|
||||
if (world.getBlock(BlockVector3.at(x, y, z)).getBlockType().getMaterial()
|
||||
.isMovementBlocker()) {
|
||||
int platformY = Math.max(initialY, y - 3 - clearance);
|
||||
floatAt(x, platformY + 1, z, alwaysGlass);
|
||||
return true;
|
||||
@ -307,7 +320,8 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
||||
final Extent world = getLocation().getExtent();
|
||||
|
||||
while (y <= world.getMaximumPoint().getY() + 2) {
|
||||
if (world.getBlock(BlockVector3.at(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) {
|
||||
if (world.getBlock(BlockVector3.at(x, y, z)).getBlockType().getMaterial()
|
||||
.isMovementBlocker()) {
|
||||
break; // Hit something
|
||||
} else if (y > maxY + 1) {
|
||||
break;
|
||||
@ -326,7 +340,8 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
||||
public void floatAt(int x, int y, int z, boolean alwaysGlass) {
|
||||
try {
|
||||
BlockVector3 spot = BlockVector3.at(x, y - 1, z);
|
||||
if (!getLocation().getExtent().getBlock(spot).getBlockType().getMaterial().isMovementBlocker()) {
|
||||
if (!getLocation().getExtent().getBlock(spot).getBlockType().getMaterial()
|
||||
.isMovementBlocker()) {
|
||||
getLocation().getExtent().setBlock(spot, BlockTypes.GLASS.getDefaultState());
|
||||
}
|
||||
} catch (WorldEditException e) {
|
||||
@ -342,7 +357,8 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
||||
|
||||
@Override
|
||||
public Location getBlockOn() {
|
||||
return getLocation().setPosition(getLocation().setY(getLocation().getY() - 1).toVector().floor());
|
||||
return getLocation()
|
||||
.setPosition(getLocation().setY(getLocation().getY() - 1).toVector().floor());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -433,7 +449,8 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
||||
boolean inFree = false;
|
||||
|
||||
while ((block = hitBlox.getNextBlock()) != null) {
|
||||
boolean free = !world.getBlock(block.toVector().toBlockPoint()).getBlockType().getMaterial().isMovementBlocker();
|
||||
boolean free = !world.getBlock(block.toVector().toBlockPoint()).getBlockType()
|
||||
.getMaterial().isMovementBlocker();
|
||||
|
||||
if (firstBlock) {
|
||||
firstBlock = false;
|
||||
|
@ -22,8 +22,6 @@
|
||||
package com.sk89q.worldedit.world.snapshot;
|
||||
|
||||
import com.sk89q.worldedit.world.storage.MissingWorldException;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.File;
|
||||
import java.io.FilenameFilter;
|
||||
import java.time.ZoneOffset;
|
||||
@ -33,6 +31,7 @@ import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* A repository contains zero or more snapshots.
|
||||
@ -67,13 +66,13 @@ public class SnapshotRepository {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of snapshots in a directory. The newest snapshot is
|
||||
* near the top of the array.
|
||||
* Get a list of snapshots in a directory. The newest snapshot is near the top of the array.
|
||||
*
|
||||
* @param newestFirst true to get the newest first
|
||||
* @return a list of snapshots
|
||||
*/
|
||||
public List<Snapshot> getSnapshots(boolean newestFirst, String worldName) throws MissingWorldException {
|
||||
public List<Snapshot> getSnapshots(boolean newestFirst, String worldName)
|
||||
throws MissingWorldException {
|
||||
FilenameFilter filter = (dir, name) -> {
|
||||
File f = new File(dir, name);
|
||||
return isValidSnapshot(f);
|
||||
@ -117,7 +116,8 @@ public class SnapshotRepository {
|
||||
* @return a snapshot or null
|
||||
*/
|
||||
@Nullable
|
||||
public Snapshot getSnapshotAfter(ZonedDateTime date, String world) throws MissingWorldException {
|
||||
public Snapshot getSnapshotAfter(ZonedDateTime date, String world)
|
||||
throws MissingWorldException {
|
||||
List<Snapshot> snapshots = getSnapshots(true, world);
|
||||
Snapshot last = null;
|
||||
|
||||
@ -139,7 +139,8 @@ public class SnapshotRepository {
|
||||
* @return a snapshot or null
|
||||
*/
|
||||
@Nullable
|
||||
public Snapshot getSnapshotBefore(ZonedDateTime date, String world) throws MissingWorldException {
|
||||
public Snapshot getSnapshotBefore(ZonedDateTime date, String world)
|
||||
throws MissingWorldException {
|
||||
List<Snapshot> snapshots = getSnapshots(false, world);
|
||||
Snapshot last = null;
|
||||
|
||||
@ -205,7 +206,8 @@ public class SnapshotRepository {
|
||||
* @return whether it is a valid snapshot
|
||||
*/
|
||||
protected boolean isValidSnapshot(File file) {
|
||||
if (!file.getName().matches("^[A-Za-z0-9_\\- \\./\\\\'\\$@~!%\\^\\*\\(\\)\\[\\]\\+\\{\\},\\?]+$")) {
|
||||
if (!file.getName()
|
||||
.matches("^[A-Za-z0-9_\\- \\./\\\\'\\$@~!%\\^\\*\\(\\)\\[\\]\\+\\{\\},\\?]+$")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren