Force the Blueprint name to be lowercased using English locale

This commit is contained in:
Florian CUNY 2019-10-05 22:22:25 +02:00
parent 94ff2ebf75
commit 27647da6f4
2 changed files with 5 additions and 5 deletions

View File

@ -56,8 +56,9 @@ public class Blueprint {
/**
* @param name the name to set
*/
public Blueprint setName(String name) {
this.name = name;
public Blueprint setName(@NonNull String name) {
// Force lowercase
this.name = name.toLowerCase(Locale.ENGLISH);
return this;
}
/**

View File

@ -508,7 +508,7 @@ public class BlueprintsManager {
}
File bpf = getBlueprintsFolder(addon);
// Get the filename
File fileName = new File(bpf, bp.getName().toLowerCase(Locale.ENGLISH) + BLUEPRINT_SUFFIX);
File fileName = new File(bpf, bp.getName() + BLUEPRINT_SUFFIX);
// Delete the old file
try {
Files.deleteIfExists(fileName.toPath());
@ -516,10 +516,9 @@ public class BlueprintsManager {
plugin.logError("Could not delete old Blueprint " + e.getLocalizedMessage());
}
// Set new name
bp.setName(name);
bp.setName(name.toLowerCase(Locale.ENGLISH));
// Save it
saveBlueprint(addon, bp);
}
}