Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-05 11:00:05 +01:00
Merge pull request #282
Add support for listing schematics inside subdirectories Conflicts: src/main/java/com/sk89q/worldedit/command/SchematicCommands.java
Dieser Commit ist enthalten in:
Commit
996438ff91
@ -234,7 +234,6 @@ public class SchematicCommands {
|
|||||||
if (files == null) {
|
if (files == null) {
|
||||||
throw new FilenameResolutionException(dir.getPath(), "Schematics directory invalid or not found.");
|
throw new FilenameResolutionException(dir.getPath(), "Schematics directory invalid or not found.");
|
||||||
}
|
}
|
||||||
StringBuilder build = new StringBuilder("Available schematics (Filename (Format)): ");
|
|
||||||
|
|
||||||
final int sortType = args.hasFlag('d') ? -1 : args.hasFlag('n') ? 1 : 0;
|
final int sortType = args.hasFlag('d') ? -1 : args.hasFlag('n') ? 1 : 0;
|
||||||
// cleanup file list
|
// cleanup file list
|
||||||
@ -253,11 +252,27 @@ public class SchematicCommands {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
player.print("Available schematics (Filename (Format)):");
|
||||||
|
player.print(listFiles("", files));
|
||||||
|
}
|
||||||
|
|
||||||
|
private String listFiles(String prefix, File[] files) {
|
||||||
|
StringBuilder build = new StringBuilder();
|
||||||
for (File file : files) {
|
for (File file : files) {
|
||||||
|
if (file.isDirectory()) {
|
||||||
|
build.append(listFiles(prefix + file.getName() + "/", file.listFiles()));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!file.isFile()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
build.append("\n\u00a79");
|
build.append("\n\u00a79");
|
||||||
SchematicFormat format = SchematicFormat.getFormat(file);
|
SchematicFormat format = SchematicFormat.getFormat(file);
|
||||||
build.append(file.getName()).append(": ").append(format == null ? "Unknown" : format.getName());
|
build.append(prefix).append(file.getName())
|
||||||
|
.append(": ").append(format == null ? "Unknown" : format.getName());
|
||||||
}
|
}
|
||||||
player.print(build.toString());
|
return build.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren