update to v2.5.4
This commit is contained in:
@@ -1,10 +1,49 @@
|
||||
package pers.xanadu.enderdragon.config;
|
||||
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
import static pers.xanadu.enderdragon.EnderDragon.plugin;
|
||||
|
||||
public class FileUpdater {
|
||||
public static void update() throws IOException {
|
||||
Lang.warn("Nothing to update.");
|
||||
boolean updated = false;
|
||||
File folder = new File(plugin.getDataFolder(),"setting");
|
||||
if(folder.exists()){
|
||||
File[] files = folder.listFiles();
|
||||
if(files != null){
|
||||
for(File file : files){
|
||||
FileConfiguration config = YamlConfiguration.loadConfiguration(file);
|
||||
String ver = config.getString("version");
|
||||
if(!"2.4.0".equals(ver)) {
|
||||
Lang.error("The version of setting/"+file.getName()+" is not supported!");
|
||||
continue;
|
||||
}
|
||||
updated = true;
|
||||
String name = file.getName();
|
||||
Config.copyFile("setting/"+name,"new/setting/"+name,true);
|
||||
}
|
||||
File new_folder = new File(plugin.getDataFolder(),"new/setting/");
|
||||
files = new_folder.listFiles();
|
||||
if(files != null){
|
||||
for(File file : files){
|
||||
FileConfiguration fc = YamlConfiguration.loadConfiguration(file);
|
||||
fc.set("version","2.5.4");
|
||||
fc.set("bossbar.create_fog",fc.getBoolean("bossbar.create_frog"));
|
||||
fc.set("bossbar.create_frog",null);
|
||||
fc.save(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (updated){
|
||||
Lang.info("New config files are generated in plugins/EnderDragon/new.");
|
||||
Lang.warn("Attention: Please confirm the accuracy before using new config!");
|
||||
}
|
||||
else {
|
||||
Lang.warn("Nothing to update!");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
name: EnderDragon
|
||||
version: 2.5.3
|
||||
version: 2.5.4
|
||||
main: pers.xanadu.enderdragon.EnderDragon
|
||||
author: Xanadu13
|
||||
api-version: 1.13
|
||||
|
||||
Reference in New Issue
Block a user