Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-12-26 19:02:36 +01:00
Use FastSchematicReader by default (#2478)
Dieser Commit ist enthalten in:
Ursprung
46dd71e807
Commit
1a7f555add
@ -313,9 +313,9 @@ public class SchematicCommands {
|
|||||||
Actor actor, LocalSession session,
|
Actor actor, LocalSession session,
|
||||||
@Arg(desc = "File name.")
|
@Arg(desc = "File name.")
|
||||||
String filename,
|
String filename,
|
||||||
@Arg(desc = "Format name.", def = "fast")
|
|
||||||
String formatName,
|
|
||||||
//FAWE start - random rotation
|
//FAWE start - random rotation
|
||||||
|
@Arg(desc = "Format name.", def = "")
|
||||||
|
String formatName,
|
||||||
@Switch(name = 'r', desc = "Apply random rotation to the clipboard")
|
@Switch(name = 'r', desc = "Apply random rotation to the clipboard")
|
||||||
boolean randomRotate
|
boolean randomRotate
|
||||||
//FAWE end
|
//FAWE end
|
||||||
@ -325,6 +325,11 @@ public class SchematicCommands {
|
|||||||
//FAWE start
|
//FAWE start
|
||||||
ClipboardFormat format;
|
ClipboardFormat format;
|
||||||
InputStream in = null;
|
InputStream in = null;
|
||||||
|
// if format is set explicitly, do not look up by extension!
|
||||||
|
boolean noExplicitFormat = formatName == null;
|
||||||
|
if (noExplicitFormat) {
|
||||||
|
formatName = "fast";
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
URI uri;
|
URI uri;
|
||||||
if (formatName.startsWith("url:")) {
|
if (formatName.startsWith("url:")) {
|
||||||
@ -369,7 +374,7 @@ public class SchematicCommands {
|
|||||||
actor.print(Caption.of("fawe.error.no-perm", "worldedit.schematic.load.other"));
|
actor.print(Caption.of("fawe.error.no-perm", "worldedit.schematic.load.other"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (filename.matches(".*\\.[\\w].*")) {
|
if (noExplicitFormat && filename.matches(".*\\.[\\w].*")) {
|
||||||
format = ClipboardFormats
|
format = ClipboardFormats
|
||||||
.findByExtension(filename.substring(filename.lastIndexOf('.') + 1));
|
.findByExtension(filename.substring(filename.lastIndexOf('.') + 1));
|
||||||
} else {
|
} else {
|
||||||
|
@ -26,7 +26,6 @@ import com.fastasyncworldedit.core.extent.clipboard.MultiClipboardHolder;
|
|||||||
import com.fastasyncworldedit.core.extent.clipboard.URIClipboardHolder;
|
import com.fastasyncworldedit.core.extent.clipboard.URIClipboardHolder;
|
||||||
import com.fastasyncworldedit.core.internal.io.FastByteArrayOutputStream;
|
import com.fastasyncworldedit.core.internal.io.FastByteArrayOutputStream;
|
||||||
import com.fastasyncworldedit.core.util.MainUtil;
|
import com.fastasyncworldedit.core.util.MainUtil;
|
||||||
import com.google.common.collect.HashMultimap;
|
|
||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
||||||
import com.google.common.collect.Multimaps;
|
import com.google.common.collect.Multimaps;
|
||||||
import com.google.common.io.ByteSource;
|
import com.google.common.io.ByteSource;
|
||||||
@ -51,6 +50,7 @@ import java.util.Collection;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -64,7 +64,9 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||||||
public class ClipboardFormats {
|
public class ClipboardFormats {
|
||||||
|
|
||||||
private static final Map<String, ClipboardFormat> aliasMap = new HashMap<>();
|
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<>();
|
private static final List<ClipboardFormat> registeredFormats = new ArrayList<>();
|
||||||
|
|
||||||
public static void registerClipboardFormat(ClipboardFormat format) {
|
public static void registerClipboardFormat(ClipboardFormat format) {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren