mirror of
https://github.com/JamesPeters98/ChestsPlusPlus.git
synced 2025-02-28 18:31:25 +01:00
Fixed Legacy File Conversion
This commit is contained in:
parent
9c18999df7
commit
ca87e0a34e
@ -35,7 +35,7 @@ public class Config {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
config = YamlConfiguration.loadConfiguration(getStorageFile());
|
config = YamlConfiguration.loadConfiguration(getStorageFile());
|
||||||
} catch (IllegalArgumentException e){
|
} catch (IllegalArgumentException | IOException e){
|
||||||
ChestsPlusPlus.PLUGIN.getLogger().severe("Config was null or couldn't be read!");
|
ChestsPlusPlus.PLUGIN.getLogger().severe("Config was null or couldn't be read!");
|
||||||
config = new YamlConfiguration();
|
config = new YamlConfiguration();
|
||||||
}
|
}
|
||||||
@ -89,9 +89,12 @@ public class Config {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static File getStorageFile(){
|
private static File getStorageFile() throws IOException {
|
||||||
File pluginDataFolder = ChestsPlusPlus.PLUGIN.getDataFolder();
|
File pluginDataFolder = ChestsPlusPlus.PLUGIN.getDataFolder();
|
||||||
return new File(pluginDataFolder, saveName);
|
File file = new File(pluginDataFolder, saveName);
|
||||||
|
file.getParentFile().mkdirs();
|
||||||
|
if(!file.exists()) file.createNewFile();
|
||||||
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
private File getLegacyFile(){
|
private File getLegacyFile(){
|
||||||
@ -119,6 +122,7 @@ public class Config {
|
|||||||
private String legacyContentConverter(String content){
|
private String legacyContentConverter(String content){
|
||||||
content = content.replaceAll("==: LinkedChest", "==: ConfigStorage");
|
content = content.replaceAll("==: LinkedChest", "==: ConfigStorage");
|
||||||
content = content.replaceAll("==: com.jamesdpeters.minecraft.chests.storage.InventoryStorage", "==: ChestLinkStorage");
|
content = content.replaceAll("==: com.jamesdpeters.minecraft.chests.storage.InventoryStorage", "==: ChestLinkStorage");
|
||||||
|
content = content.replaceAll("==: com.jamesdpeters.minecraft.chests.serialize.InventoryStorage", "==: ChestLinkStorage");
|
||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user