mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2024-08-20 18:32:49 +00:00
Auto rename all case sensitive world folders to lower case (if
possible).
This commit is contained in:
parent
50ea442bf0
commit
fe7f479e63
|
@ -152,4 +152,5 @@ v 1.9:
|
|||
- Expanded '/manuadd'to accept an optional variable for the world (eg '/manuadd <player> <group> <world>').
|
||||
- Removed some debug spam.
|
||||
- Don't remove an attachment on a player leaving as Bukkit never forgets it. This fixes non mirrored permissions being messed up if a player relogs.
|
||||
- Treat all world names as lower case for file handling (please check in your worlds folder. You should have no folders with upper case letters from now).
|
||||
- Treat all world names as lower case for file handling (please check in your worlds folder. You should have no folders with upper case letters from now).
|
||||
- Auto rename all case sensitive world folders to lower case (if possible).
|
|
@ -106,7 +106,12 @@ public class WorldsHolder {
|
|||
if (!worldsData.containsKey(folder.getName().toLowerCase())
|
||||
&& ((!mirrorsGroup.containsKey(folder.getName().toLowerCase()))
|
||||
|| (!mirrorsUser.containsKey(folder.getName().toLowerCase())))) {
|
||||
loadWorld(folder.getName());
|
||||
/*
|
||||
* Call setupWorldFolder to check case sensitivity
|
||||
* and convert to lower case, before we attempt to load this world.
|
||||
*/
|
||||
setupWorldFolder(folder.getName());
|
||||
loadWorld(folder.getName().toLowerCase());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -454,7 +459,22 @@ public class WorldsHolder {
|
|||
|
||||
File defaultWorldFolder = new File(worldsFolder, worldNameLowered);
|
||||
if ((!defaultWorldFolder.exists()) && ((!mirrorsGroup.containsKey(worldNameLowered))) || (!mirrorsUser.containsKey(worldNameLowered))) {
|
||||
defaultWorldFolder.mkdirs();
|
||||
|
||||
/*
|
||||
* check and convert all old case sensitive folders to lower case
|
||||
*/
|
||||
File casedWorldFolder = new File(worldsFolder, worldName);
|
||||
if ((casedWorldFolder.exists()) && (casedWorldFolder.getName().toLowerCase().equals(worldNameLowered))) {
|
||||
/*
|
||||
* Rename the old folder to the new lower cased format
|
||||
*/
|
||||
casedWorldFolder.renameTo(new File(worldsFolder, worldNameLowered));
|
||||
} else {
|
||||
/*
|
||||
* Else we just create the folder
|
||||
*/
|
||||
defaultWorldFolder.mkdirs();
|
||||
}
|
||||
}
|
||||
if (defaultWorldFolder.exists()) {
|
||||
if (!mirrorsGroup.containsKey(worldNameLowered)) {
|
||||
|
|
Loading…
Reference in a new issue