geforkt von Mirrors/FastAsyncWorldEdit
Upstream and debugging changes.
Dieser Commit ist enthalten in:
Ursprung
9efdd886c5
Commit
0d1e32efcb
@ -108,11 +108,6 @@ public class ClipboardWorld extends AbstractWorld implements Clipboard, CLIWorld
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Entity> getEntities(Region region) {
|
||||
return clipboard.getEntities(region);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean generateTree(TreeGenerator.TreeType type, EditSession editSession, BlockVector3 position)
|
||||
throws MaxChangedBlocksException {
|
||||
@ -120,13 +115,18 @@ public class ClipboardWorld extends AbstractWorld implements Clipboard, CLIWorld
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Entity> getEntities() {
|
||||
return clipboard.getEntities();
|
||||
public BlockVector3 getSpawnPosition() {
|
||||
return clipboard.getOrigin();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockVector3 getSpawnPosition() {
|
||||
return clipboard.getOrigin();
|
||||
public List<? extends Entity> getEntities(Region region) {
|
||||
return clipboard.getEntities(region);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Entity> getEntities() {
|
||||
return clipboard.getEntities();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
@ -1,7 +1,6 @@
|
||||
package com.boydti.fawe;
|
||||
|
||||
import com.boydti.fawe.beta.implementation.queue.QueueHandler;
|
||||
import com.boydti.fawe.config.Caption;
|
||||
import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.object.brush.visualization.VisualQueue;
|
||||
import com.boydti.fawe.regions.general.integrations.plotquared.PlotSquaredFeature;
|
||||
|
@ -10,7 +10,7 @@ public interface IQueueChunk<T extends Future<T>> extends IChunk, Callable<T> {
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
default IQueueChunk reset() {
|
||||
default IQueueChunk<T> reset() {
|
||||
init(null, getX(), getZ());
|
||||
return this;
|
||||
}
|
||||
|
@ -97,7 +97,12 @@ public class PlotSquaredFeature extends FaweMaskManager {
|
||||
return false;
|
||||
}
|
||||
UUID uid = player.getUniqueId();
|
||||
return !Flags.NO_WORLDEDIT.isTrue(plot) && ((plot.isOwner(uid) || (type == MaskType.MEMBER && (plot.getTrusted().contains(uid) || plot.getTrusted().contains(DBFunc.EVERYONE) || ((plot.getMembers().contains(uid) || plot.getMembers().contains(DBFunc.EVERYONE)) && player.hasPermission("fawe.plotsquared.member"))))) || player.hasPermission("fawe.plotsquared.admin"));
|
||||
return !Flags.NO_WORLDEDIT.isTrue(plot) && (plot.isOwner(uid)
|
||||
|| type == MaskType.MEMBER && (plot.getTrusted().contains(uid) || plot.getTrusted()
|
||||
.contains(DBFunc.EVERYONE)
|
||||
|| (plot.getMembers().contains(uid) || plot.getMembers().contains(DBFunc.EVERYONE))
|
||||
&& player.hasPermission("fawe.plotsquared.member")) || player
|
||||
.hasPermission("fawe.plotsquared.admin"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -13,6 +13,7 @@ import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.HashSet;
|
||||
@ -92,6 +93,7 @@ public class WEManager {
|
||||
backupRegions.add(region);
|
||||
}
|
||||
} else {
|
||||
player.printDebug(TextComponent.of("Invalid Mask"));
|
||||
removed = true;
|
||||
iterator.remove();
|
||||
}
|
||||
@ -115,6 +117,8 @@ public class WEManager {
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
player.printError(TextComponent.of("Missing permission " + "fawe." + manager.getKey()));
|
||||
}
|
||||
}
|
||||
regions.addAll(backupRegions);
|
||||
|
@ -19,6 +19,9 @@
|
||||
|
||||
package com.sk89q.worldedit.function.factory;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.sk89q.worldedit.util.GuavaUtil.firstNonNull;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
@ -39,9 +42,6 @@ import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.sk89q.worldedit.util.GuavaUtil.firstNonNull;
|
||||
|
||||
public class Deform implements Contextual<Operation> {
|
||||
|
||||
private Extent destination;
|
||||
@ -157,12 +157,6 @@ public class Deform implements Contextual<Operation> {
|
||||
session == null ? WorldEdit.getInstance().getConfiguration().calculationTimeout : session.getTimeout());
|
||||
}
|
||||
|
||||
public enum Mode {
|
||||
RAW_COORD,
|
||||
OFFSET,
|
||||
UNIT_CUBE
|
||||
}
|
||||
|
||||
private static final class DeformOperation implements Operation {
|
||||
private final Extent destination;
|
||||
private final Region region;
|
||||
@ -199,9 +193,15 @@ public class Deform implements Contextual<Operation> {
|
||||
@Override
|
||||
public Iterable<Component> getStatusMessages() {
|
||||
return ImmutableList.of(TranslatableComponent.of("worldedit.operation.deform.expression",
|
||||
TextComponent.of(expression).color(TextColor.GRAY)));
|
||||
TextComponent.of(expression).color(TextColor.LIGHT_PURPLE)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public enum Mode {
|
||||
RAW_COORD,
|
||||
OFFSET,
|
||||
UNIT_CUBE
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -38,11 +38,6 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
public interface Operation {
|
||||
|
||||
/**
|
||||
* This is an internal field, and should not be touched.
|
||||
*/
|
||||
Set<String> warnedDeprecatedClasses = new HashSet<>();
|
||||
|
||||
/**
|
||||
* Complete the next step. If this method returns true, then the method may
|
||||
* be called again in the future, or possibly never. If this method
|
||||
@ -74,6 +69,11 @@ public interface Operation {
|
||||
default void addStatusMessages(List<String> messages) {
|
||||
}
|
||||
|
||||
/**
|
||||
* This is an internal field, and should not be touched.
|
||||
*/
|
||||
Set<String> warnedDeprecatedClasses = new HashSet<>();
|
||||
|
||||
/**
|
||||
* Gets an iterable of messages that describe the current status of the
|
||||
* operation.
|
||||
@ -87,7 +87,7 @@ public interface Operation {
|
||||
if (oldMessages.size() > 0) {
|
||||
String className = getClass().getName();
|
||||
if (!warnedDeprecatedClasses.contains(className)) {
|
||||
WorldEdit.logger.warn("An operation is using the old status message API. This will be removed in further versions. Class: " + className);
|
||||
WorldEdit.logger.warn("An operation is using the old status message API. This will be removed in WorldEdit 8. Class: " + className);
|
||||
warnedDeprecatedClasses.add(className);
|
||||
}
|
||||
}
|
||||
|
@ -86,6 +86,27 @@ public final class Closer implements Closeable {
|
||||
return zipFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call {@link #rethrow(Throwable)} with the given exception, but before throwing the exception,
|
||||
* also close this Closer. Exceptions from closing are added to {@code t} as suppressed
|
||||
* exceptions.
|
||||
*
|
||||
* @param t the throwable that should be re-thrown
|
||||
* @throws IOException if {@code t} is an IOException, or one occurs
|
||||
*/
|
||||
public RuntimeException rethrowAndClose(Throwable t) throws IOException {
|
||||
// bit of a hack here
|
||||
try {
|
||||
throw rethrow(t);
|
||||
} finally {
|
||||
try {
|
||||
close();
|
||||
} catch (Throwable closeThrown) {
|
||||
t.addSuppressed(closeThrown);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Stores the given throwable and rethrows it. It will be rethrown as is if it is an
|
||||
* {@code IOException}, {@code RuntimeException} or {@code Error}. Otherwise, it will be rethrown
|
||||
|
@ -19,6 +19,9 @@
|
||||
|
||||
package com.sk89q.worldedit.util.translation;
|
||||
|
||||
import static java.util.stream.Collectors.toMap;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
@ -26,7 +29,6 @@ import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.util.formatting.text.renderer.FriendlyComponentRenderer;
|
||||
import com.sk89q.worldedit.util.io.ResourceLoader;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
@ -76,8 +78,10 @@ public class TranslationManager {
|
||||
}
|
||||
|
||||
private Map<String, String> filterTranslations(Map<String, String> translations) {
|
||||
translations.entrySet().removeIf(entry -> entry.getValue().isEmpty());
|
||||
return translations;
|
||||
return translations.entrySet().stream()
|
||||
.filter(e -> !e.getValue().isEmpty())
|
||||
.map(e -> Maps.immutableEntry(e.getKey(), e.getValue().replace("'", "''")))
|
||||
.collect(toMap(Map.Entry::getKey, Map.Entry::getValue));
|
||||
}
|
||||
|
||||
private Map<String, String> parseTranslationFile(InputStream inputStream) {
|
||||
|
@ -29,7 +29,6 @@ import com.sk89q.jnbt.Tag;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.DataException;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
@ -55,11 +54,10 @@ public class AnvilChunk implements Chunk {
|
||||
/**
|
||||
* Construct the chunk with a compound tag.
|
||||
*
|
||||
* @param world the world to construct the chunk for
|
||||
* @param tag the tag to read
|
||||
* @throws DataException on a data error
|
||||
*/
|
||||
public AnvilChunk(World world, CompoundTag tag) throws DataException {
|
||||
public AnvilChunk(CompoundTag tag) throws DataException {
|
||||
rootTag = tag;
|
||||
|
||||
rootX = NBTUtils.getChildTag(rootTag.getValue(), "xPos", IntTag.class).getValue();
|
||||
@ -261,13 +259,11 @@ public class AnvilChunk implements Chunk {
|
||||
WorldEdit.logger.warn("Unknown legacy block " + id + ":" + data + " found when loading legacy anvil chunk.");
|
||||
return BlockTypes.AIR.getDefaultState().toBaseBlock();
|
||||
}
|
||||
if (state.getMaterial().hasContainer()) {
|
||||
CompoundTag tileEntity = getBlockTileEntity(position);
|
||||
|
||||
if (tileEntity != null) {
|
||||
return state.toBaseBlock(tileEntity);
|
||||
}
|
||||
}
|
||||
|
||||
return state.toBaseBlock();
|
||||
}
|
||||
|
@ -226,9 +226,9 @@ public class AnvilChunk13 implements Chunk {
|
||||
BlockState[] sectionBlocks = blocks[section];
|
||||
BlockState state = sectionBlocks != null ? sectionBlocks[(yIndex << 8) | (z << 4) | x] : BlockTypes.AIR.getDefaultState();
|
||||
|
||||
if (state.getMaterial().hasContainer()) {
|
||||
CompoundTag tileEntity = getBlockTileEntity(position);
|
||||
|
||||
if (tileEntity != null) {
|
||||
return state.toBaseBlock(tileEntity);
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,6 @@ import com.sk89q.jnbt.Tag;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.DataException;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
@ -55,11 +54,10 @@ public class OldChunk implements Chunk {
|
||||
/**
|
||||
* Construct the chunk with a compound tag.
|
||||
*
|
||||
* @param world the world
|
||||
* @param tag the tag
|
||||
* @throws DataException
|
||||
*/
|
||||
public OldChunk(World world, CompoundTag tag) throws DataException {
|
||||
public OldChunk(CompoundTag tag) throws DataException {
|
||||
rootTag = tag;
|
||||
|
||||
blocks = NBTUtils.getChildTag(rootTag.getValue(), "Blocks", ByteArrayTag.class).getValue();
|
||||
@ -185,13 +183,12 @@ public class OldChunk implements Chunk {
|
||||
WorldEdit.logger.warn("Unknown legacy block " + id + ":" + dataVal + " found when loading legacy anvil chunk.");
|
||||
return BlockTypes.AIR.getDefaultState().toBaseBlock();
|
||||
}
|
||||
if (state.getBlockType().getMaterial().hasContainer()) {
|
||||
|
||||
CompoundTag tileEntity = getBlockTileEntity(position);
|
||||
|
||||
if (tileEntity != null) {
|
||||
return state.toBaseBlock(tileEntity);
|
||||
}
|
||||
}
|
||||
|
||||
return state.toBaseBlock();
|
||||
}
|
||||
|
@ -20,34 +20,19 @@
|
||||
package com.sk89q.worldedit.world.storage;
|
||||
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.jnbt.Tag;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.DataException;
|
||||
import com.sk89q.worldedit.world.DataFixer;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.chunk.AnvilChunk;
|
||||
import com.sk89q.worldedit.world.chunk.AnvilChunk13;
|
||||
import com.sk89q.worldedit.world.chunk.Chunk;
|
||||
import com.sk89q.worldedit.world.chunk.OldChunk;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Represents chunk storage mechanisms.
|
||||
*/
|
||||
public abstract class ChunkStore implements Closeable {
|
||||
|
||||
/**
|
||||
* The DataVersion for Minecraft 1.13
|
||||
*/
|
||||
private static final int DATA_VERSION_MC_1_13 = 1519;
|
||||
|
||||
/**
|
||||
* {@code >>} - to chunk
|
||||
* {@code <<} - from chunk
|
||||
@ -85,46 +70,7 @@ public abstract class ChunkStore implements Closeable {
|
||||
*/
|
||||
public Chunk getChunk(BlockVector2 position, World world) throws DataException, IOException {
|
||||
CompoundTag rootTag = getChunkTag(position, world);
|
||||
|
||||
Map<String, Tag> children = rootTag.getValue();
|
||||
CompoundTag tag = null;
|
||||
|
||||
// Find Level tag
|
||||
for (Map.Entry<String, Tag> entry : children.entrySet()) {
|
||||
if (entry.getKey().equals("Level")) {
|
||||
if (entry.getValue() instanceof CompoundTag) {
|
||||
tag = (CompoundTag) entry.getValue();
|
||||
break;
|
||||
} else {
|
||||
throw new ChunkStoreException("CompoundTag expected for 'Level'; got " + entry.getValue().getClass().getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (tag == null) {
|
||||
throw new ChunkStoreException("Missing root 'Level' tag");
|
||||
}
|
||||
|
||||
int dataVersion = rootTag.getInt("DataVersion");
|
||||
if (dataVersion == 0) dataVersion = -1;
|
||||
final Platform platform = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.WORLD_EDITING);
|
||||
final int currentDataVersion = platform.getDataVersion();
|
||||
if (tag.getValue().containsKey("Sections") && dataVersion < currentDataVersion) { // only fix up MCA format, DFU doesn't support MCR chunks
|
||||
final DataFixer dataFixer = platform.getDataFixer();
|
||||
if (dataFixer != null) {
|
||||
return new AnvilChunk13((CompoundTag) dataFixer.fixUp(DataFixer.FixTypes.CHUNK, rootTag, dataVersion).getValue().get("Level"));
|
||||
}
|
||||
}
|
||||
if (dataVersion >= DATA_VERSION_MC_1_13) {
|
||||
return new AnvilChunk13(tag);
|
||||
}
|
||||
|
||||
Map<String, Tag> tags = tag.getValue();
|
||||
if (tags.containsKey("Sections")) {
|
||||
return new AnvilChunk(world, tag);
|
||||
}
|
||||
|
||||
return new OldChunk(world, tag);
|
||||
return ChunkStoreHelper.getChunk(rootTag);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -0,0 +1,117 @@
|
||||
/*
|
||||
* WorldEdit, a Minecraft world manipulation toolkit
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldEdit team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.world.storage;
|
||||
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.jnbt.NBTInputStream;
|
||||
import com.sk89q.jnbt.Tag;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.world.DataException;
|
||||
import com.sk89q.worldedit.world.DataFixer;
|
||||
import com.sk89q.worldedit.world.chunk.AnvilChunk;
|
||||
import com.sk89q.worldedit.world.chunk.AnvilChunk13;
|
||||
import com.sk89q.worldedit.world.chunk.Chunk;
|
||||
import com.sk89q.worldedit.world.chunk.OldChunk;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Map;
|
||||
|
||||
public class ChunkStoreHelper {
|
||||
|
||||
@FunctionalInterface
|
||||
public interface ChunkDataInputSupplier {
|
||||
|
||||
InputStream openInputStream() throws DataException, IOException;
|
||||
|
||||
}
|
||||
|
||||
public static CompoundTag readCompoundTag(ChunkDataInputSupplier input) throws DataException, IOException {
|
||||
try (InputStream stream = input.openInputStream();
|
||||
NBTInputStream nbt = new NBTInputStream(stream)) {
|
||||
Tag tag = nbt.readNamedTag().getTag();
|
||||
if (!(tag instanceof CompoundTag)) {
|
||||
throw new ChunkStoreException("CompoundTag expected for chunk; got "
|
||||
+ tag.getClass().getName());
|
||||
}
|
||||
|
||||
return (CompoundTag) tag;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The DataVersion for Minecraft 1.13
|
||||
*/
|
||||
private static final int DATA_VERSION_MC_1_13 = 1519;
|
||||
|
||||
/**
|
||||
* Convert a chunk NBT tag into a {@link Chunk} implementation.
|
||||
*
|
||||
* @param rootTag the root tag of the chunk
|
||||
* @return a Chunk implementation
|
||||
* @throws DataException if the rootTag is not valid chunk data
|
||||
*/
|
||||
public static Chunk getChunk(CompoundTag rootTag) throws DataException {
|
||||
Map<String, Tag> children = rootTag.getValue();
|
||||
CompoundTag tag = null;
|
||||
|
||||
// Find Level tag
|
||||
for (Map.Entry<String, Tag> entry : children.entrySet()) {
|
||||
if (entry.getKey().equals("Level")) {
|
||||
if (entry.getValue() instanceof CompoundTag) {
|
||||
tag = (CompoundTag) entry.getValue();
|
||||
break;
|
||||
} else {
|
||||
throw new ChunkStoreException("CompoundTag expected for 'Level'; got " + entry.getValue().getClass().getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (tag == null) {
|
||||
throw new ChunkStoreException("Missing root 'Level' tag");
|
||||
}
|
||||
|
||||
int dataVersion = rootTag.getInt("DataVersion");
|
||||
if (dataVersion == 0) dataVersion = -1;
|
||||
final Platform platform = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.WORLD_EDITING);
|
||||
final int currentDataVersion = platform.getDataVersion();
|
||||
if (tag.getValue().containsKey("Sections") && dataVersion < currentDataVersion) { // only fix up MCA format, DFU doesn't support MCR chunks
|
||||
final DataFixer dataFixer = platform.getDataFixer();
|
||||
if (dataFixer != null) {
|
||||
return new AnvilChunk13((CompoundTag) dataFixer.fixUp(DataFixer.FixTypes.CHUNK, rootTag, dataVersion).getValue().get("Level"));
|
||||
}
|
||||
}
|
||||
if (dataVersion >= DATA_VERSION_MC_1_13) {
|
||||
return new AnvilChunk13(tag);
|
||||
}
|
||||
|
||||
Map<String, Tag> tags = tag.getValue();
|
||||
if (tags.containsKey("Sections")) {
|
||||
return new AnvilChunk(tag);
|
||||
}
|
||||
|
||||
return new OldChunk(tag);
|
||||
}
|
||||
|
||||
private ChunkStoreHelper() {
|
||||
}
|
||||
}
|
@ -20,12 +20,9 @@
|
||||
package com.sk89q.worldedit.world.storage;
|
||||
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.jnbt.NBTInputStream;
|
||||
import com.sk89q.jnbt.Tag;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.world.DataException;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@ -78,18 +75,9 @@ public abstract class LegacyChunkStore extends ChunkStore {
|
||||
String filename = "c." + Integer.toString(x, 36)
|
||||
+ "." + Integer.toString(z, 36) + ".dat";
|
||||
|
||||
InputStream stream = getInputStream(folder1, folder2, filename);
|
||||
Tag tag;
|
||||
|
||||
try (NBTInputStream nbt = new NBTInputStream(new GZIPInputStream(stream))) {
|
||||
tag = nbt.readNamedTag().getTag();
|
||||
if (!(tag instanceof CompoundTag)) {
|
||||
throw new ChunkStoreException("CompoundTag expected for chunk; got "
|
||||
+ tag.getClass().getName());
|
||||
}
|
||||
|
||||
return (CompoundTag) tag;
|
||||
}
|
||||
return ChunkStoreHelper.readCompoundTag(() ->
|
||||
new GZIPInputStream(getInputStream(folder1, folder2, filename))
|
||||
);
|
||||
}
|
||||
|
||||
private static int divisorMod(int a, int n) {
|
||||
|
@ -408,6 +408,7 @@
|
||||
"worldedit.restore.failed": "Failed to load snapshot: {0}",
|
||||
"worldedit.restore.loaded": "Snapshot '{0}' loaded; now restoring...",
|
||||
"worldedit.restore.restored": "Restored; {0} missing chunks and {1} other errors.",
|
||||
"worldedit.restore.none-for-specific-world": "No snapshots were found for world '{0}'.",
|
||||
"worldedit.restore.none-for-world": "No snapshots were found for this world.",
|
||||
"worldedit.restore.none-found": "No snapshots were found.",
|
||||
"worldedit.restore.none-found-console": "No snapshots were found. See console for details.",
|
||||
@ -517,6 +518,7 @@
|
||||
"worldedit.replace.replaced": "{0} blocks have been replaced.",
|
||||
"worldedit.stack.changed": "{0} blocks changed. Undo with //undo",
|
||||
"worldedit.regen.regenerated": "Region regenerated.",
|
||||
"worldedit.regen.failed": "Unable to regenerate chunks. Check console for details.",
|
||||
"worldedit.walls.changed": "{0} blocks have been changed.",
|
||||
"worldedit.faces.changed": "{0} blocks have been changed.",
|
||||
"worldedit.overlay.overlaid": "{0} blocks have been overlaid.",
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren