mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-22 17:27:38 +00:00
fix: correctly resolve file if extension is given (#2857)
* fix: correctly resolve file if extension is given * Adjust error if ClipboardFormats#findByFile null
This commit is contained in:
parent
638344d815
commit
f93ad596c6
@ -712,6 +712,12 @@ public class MainUtil {
|
||||
return file;
|
||||
}
|
||||
}
|
||||
if (filename.matches(".*\\.[\\w].*")) {
|
||||
File file = MainUtil.resolveRelative(new File(dir, filename));
|
||||
if (file.exists()) {
|
||||
return file;
|
||||
}
|
||||
}
|
||||
for (ClipboardFormat f : ClipboardFormats.getAll()) {
|
||||
File file = MainUtil.resolveRelative(new File(dir, filename + "." + f.getPrimaryFileExtension()));
|
||||
if (file.exists()) {
|
||||
|
@ -401,7 +401,11 @@ public class SchematicCommands {
|
||||
if (format == null) {
|
||||
format = ClipboardFormats.findByFile(file);
|
||||
if (format == null) {
|
||||
if (noExplicitFormat) {
|
||||
actor.print(Caption.of("fawe.worldedit.schematic.schematic.load-failure", TextComponent.of(file.getName())));
|
||||
} else {
|
||||
actor.print(Caption.of("worldedit.schematic.unknown-format", TextComponent.of(formatName)));
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -208,7 +208,6 @@ public class ClipboardFormats {
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
public static MultiClipboardHolder loadAllFromInput(
|
||||
|
Loading…
Reference in New Issue
Block a user