-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from iXanadu13/2.5.3
update to v2.5.4
- Loading branch information
Showing
19 changed files
with
91 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 41 additions & 2 deletions
43
src/main/java/pers/xanadu/enderdragon/config/FileUpdater.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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!"); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters