Merge remote-tracking branch 'upstream/master' into breaking

This commit is contained in:
Jesse Boyd
2019-04-03 16:53:34 +11:00
281 changed files with 5963 additions and 5444 deletions

View File

@ -58,7 +58,7 @@ import java.util.regex.Pattern;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import javax.annotation.Nullable;
import static com.google.common.base.Preconditions.checkNotNull;
public class ClipboardFormats {
@ -74,7 +74,7 @@ public class ClipboardFormats {
ClipboardFormat old = aliasMap.put(lowKey, format);
if (old != null) {
aliasMap.put(lowKey, old);
WorldEdit.logger.warning(format.getClass().getName() + " cannot override existing alias '" + lowKey + "' used by " + old.getClass().getName());
WorldEdit.logger.warn(format.getClass().getName() + " cannot override existing alias '" + lowKey + "' used by " + old.getClass().getName());
}
}
for (String ext : format.getFileExtensions()) {

View File

@ -19,8 +19,6 @@
package com.sk89q.worldedit.extent.clipboard.io;
import static com.google.common.base.Preconditions.checkNotNull;
import com.sk89q.jnbt.ByteArrayTag;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.jnbt.IntTag;
@ -46,14 +44,16 @@ import com.sk89q.worldedit.world.entity.EntityType;
import com.sk89q.worldedit.world.entity.EntityTypes;
import com.sk89q.worldedit.world.registry.LegacyMapper;
import com.sk89q.worldedit.world.storage.NBTConversions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Reads schematic files that are compatible with MCEdit and other editors.
@ -67,7 +67,7 @@ public class MCEditSchematicReader extends NBTSchematicReader {
// TODO Add a handler for skulls, flower pots, note blocks, etc.
}
private static final Logger log = Logger.getLogger(MCEditSchematicReader.class.getCanonicalName());
private static final Logger log = LoggerFactory.getLogger(MCEditSchematicReader.class);
private final NBTInputStream inputStream;
/**
@ -231,15 +231,15 @@ public class MCEditSchematicReader extends NBTSchematicReader {
clipboard.setBlock(region.getMinimumPoint().add(pt), state);
}
} else {
log.warning("Unknown block when pasting schematic: " + blocks[index] + ":" + blockData[index] + ". Please report this issue.");
log.warn("Unknown block when pasting schematic: " + blocks[index] + ":" + blockData[index] + ". Please report this issue.");
}
} catch (WorldEditException e) {
switch (failedBlockSets) {
case 0:
log.log(Level.WARNING, "Failed to set block on a Clipboard", e);
log.warn("Failed to set block on a Clipboard", e);
break;
case 1:
log.log(Level.WARNING, "Failed to set block on a Clipboard (again) -- no more messages will be logged", e);
log.warn("Failed to set block on a Clipboard (again) -- no more messages will be logged", e);
break;
default:
}
@ -254,9 +254,8 @@ public class MCEditSchematicReader extends NBTSchematicReader {
// Entities
// ====================================================================
try {
List<Tag> entityTags = requireTag(schematic, "Entities", ListTag.class).getValue();
List<Tag> entityTags = getTag(schematic, "Entities", ListTag.class).getValue();
if (entityTags != null) {
for (Tag tag : entityTags) {
if (tag instanceof CompoundTag) {
CompoundTag compound = (CompoundTag) tag;
@ -269,12 +268,11 @@ public class MCEditSchematicReader extends NBTSchematicReader {
BaseEntity state = new BaseEntity(entityType, compound);
clipboard.createEntity(location, state);
} else {
log.warning("Unknown entity when pasting schematic: " + id.toLowerCase());
log.warn("Unknown entity when pasting schematic: " + id.toLowerCase());
}
}
}
}
} catch (IOException ignored) { // No entities? No problem
}
return clipboard;

View File

@ -46,9 +46,7 @@ public abstract class NBTSchematicReader implements ClipboardReader {
}
@Nullable
protected static <T extends Tag> T getTag(CompoundTag tag, Class<T> expected, String key) {
Map<String, Tag> items = tag.getValue();
protected static <T extends Tag> T getTag(Map<String, Tag> items, String key, Class<T> expected) {
if (!items.containsKey(key)) {
return null;
}

View File

@ -86,7 +86,7 @@ public class SpongeSchematicReader extends NBTSchematicReader {
// If NBT Compat handlers are needed - add them here.
}
private static final Logger log = Logger.getLogger(SpongeSchematicReader.class.getCanonicalName());
private static final Logger log = LoggerFactory.getLogger(SpongeSchematicReader.class);
private final NBTInputStream inputStream;
/**
@ -108,12 +108,7 @@ public class SpongeSchematicReader extends NBTSchematicReader {
public Clipboard read(UUID uuid) throws IOException {
return readVersion1(uuid);
}
// private Clipboard readVersion1(Map<String, Tag> schematic) throws IOException {
// BlockVector3 origin;
// Region region;
//
// Map<String, Tag> metadata = requireTag(schematic, "Metadata", CompoundTag.class).getValue();
// }
private int width, height, length;
private int offsetX, offsetY, offsetZ;
private char[] palette;