mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 01:37:37 +00:00
Re-implement incremental schematic names in a folder (#1833)
* Re-implement incremental schematic names in a folder - Fixes #1545 * Move fawe end comment * Slight cleanup
This commit is contained in:
parent
100288ada5
commit
704f87da23
@ -470,9 +470,16 @@ public class SchematicCommands {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//FAWE end
|
|
||||||
File f = worldEdit.getSafeSaveFile(actor, dir, filename, format.getPrimaryFileExtension());
|
File f = worldEdit.getSafeSaveFile(actor, dir, filename, format.getPrimaryFileExtension());
|
||||||
|
int i = f.getName().lastIndexOf('.');
|
||||||
|
if (i == -1 && f.getName().isEmpty() || i == 0) {
|
||||||
|
File directory = f.getParentFile();
|
||||||
|
int fileNumber = directory.exists() ? MainUtil.getMaxFileId(directory) : 0;
|
||||||
|
String extension = i == 0 ? f.getName().substring(i + 1) : format.getPrimaryFileExtension();
|
||||||
|
String name = String.format("%s.%s", fileNumber, extension);
|
||||||
|
f = new File(directory, name);
|
||||||
|
filename += name;
|
||||||
|
}
|
||||||
boolean overwrite = f.exists();
|
boolean overwrite = f.exists();
|
||||||
if (overwrite) {
|
if (overwrite) {
|
||||||
if (!actor.hasPermission("worldedit.schematic.delete")) {
|
if (!actor.hasPermission("worldedit.schematic.delete")) {
|
||||||
@ -489,6 +496,7 @@ public class SchematicCommands {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//FAWE end
|
||||||
|
|
||||||
// Create parent directories
|
// Create parent directories
|
||||||
File parent = f.getParentFile();
|
File parent = f.getParentFile();
|
||||||
|
Loading…
Reference in New Issue
Block a user