mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-22 17:27:38 +00:00
Use FastSchematicReader by default (#2478)
This commit is contained in:
parent
46dd71e807
commit
1a7f555add
@ -313,9 +313,9 @@ public class SchematicCommands {
|
||||
Actor actor, LocalSession session,
|
||||
@Arg(desc = "File name.")
|
||||
String filename,
|
||||
@Arg(desc = "Format name.", def = "fast")
|
||||
String formatName,
|
||||
//FAWE start - random rotation
|
||||
@Arg(desc = "Format name.", def = "")
|
||||
String formatName,
|
||||
@Switch(name = 'r', desc = "Apply random rotation to the clipboard")
|
||||
boolean randomRotate
|
||||
//FAWE end
|
||||
@ -325,6 +325,11 @@ public class SchematicCommands {
|
||||
//FAWE start
|
||||
ClipboardFormat format;
|
||||
InputStream in = null;
|
||||
// if format is set explicitly, do not look up by extension!
|
||||
boolean noExplicitFormat = formatName == null;
|
||||
if (noExplicitFormat) {
|
||||
formatName = "fast";
|
||||
}
|
||||
try {
|
||||
URI uri;
|
||||
if (formatName.startsWith("url:")) {
|
||||
@ -369,7 +374,7 @@ public class SchematicCommands {
|
||||
actor.print(Caption.of("fawe.error.no-perm", "worldedit.schematic.load.other"));
|
||||
return;
|
||||
}
|
||||
if (filename.matches(".*\\.[\\w].*")) {
|
||||
if (noExplicitFormat && filename.matches(".*\\.[\\w].*")) {
|
||||
format = ClipboardFormats
|
||||
.findByExtension(filename.substring(filename.lastIndexOf('.') + 1));
|
||||
} else {
|
||||
|
@ -26,7 +26,6 @@ import com.fastasyncworldedit.core.extent.clipboard.MultiClipboardHolder;
|
||||
import com.fastasyncworldedit.core.extent.clipboard.URIClipboardHolder;
|
||||
import com.fastasyncworldedit.core.internal.io.FastByteArrayOutputStream;
|
||||
import com.fastasyncworldedit.core.util.MainUtil;
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.google.common.collect.Multimaps;
|
||||
import com.google.common.io.ByteSource;
|
||||
@ -51,6 +50,7 @@ import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
@ -64,7 +64,9 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
public class ClipboardFormats {
|
||||
|
||||
private static final Map<String, ClipboardFormat> aliasMap = new HashMap<>();
|
||||
private static final Multimap<String, ClipboardFormat> fileExtensionMap = HashMultimap.create();
|
||||
// FAWE start - keep order of ClipboardFormat entries -> prefer FAST over SPONGE_SCHEMATIC
|
||||
private static final Multimap<String, ClipboardFormat> fileExtensionMap = Multimaps.newMultimap(new HashMap<>(), LinkedHashSet::new);
|
||||
// FAWE end
|
||||
private static final List<ClipboardFormat> registeredFormats = new ArrayList<>();
|
||||
|
||||
public static void registerClipboardFormat(ClipboardFormat format) {
|
||||
|
Loading…
Reference in New Issue
Block a user