Use the Google IO library to move the files.

This commit is contained in:
graywolf336 2014-12-28 17:46:26 -06:00
parent bb8cdd229a
commit 830cf5cebb

View File

@ -12,6 +12,7 @@ import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import com.google.common.io.Files;
import com.graywolf336.jail.JailMain; import com.graywolf336.jail.JailMain;
import com.graywolf336.jail.enums.Settings; import com.graywolf336.jail.enums.Settings;
@ -430,24 +431,15 @@ public class LegacyManager {
} }
private void moveOldConfigs() throws IOException { private void moveOldConfigs() throws IOException {
File global = new File(pl.getDataFolder(), "global.yml"); File to = new File(pl.getDataFolder() + File.separator + "preJail3Data");
if(global.exists()) {
global.renameTo(new File(pl.getDataFolder() + File.separator + "preJail3Data" + File.separator + "global.yml"));
}
File jails = new File(pl.getDataFolder(), "jails.yml"); Files.move(new File(pl.getDataFolder(), "global.yml"), to);
if(jails.exists()) { Files.move(new File(pl.getDataFolder(), "jails.yml"), to);
jails.renameTo(new File(pl.getDataFolder() + File.separator + "preJail3Data" + File.separator + "jails.yml")); Files.move(new File(pl.getDataFolder(), "jailLog.txt"), to);
}
File log = new File(pl.getDataFolder(), "jailLog.txt");
if(log.exists()) {
log.renameTo(new File(pl.getDataFolder() + File.separator + "preJail3Data" + File.separator + "jailLog.txt"));
}
File sqlite = new File(pl.getDataFolder(), "jail.sqlite"); File sqlite = new File(pl.getDataFolder(), "jail.sqlite");
if(sqlite.exists()) { if(sqlite.exists()) {
sqlite.renameTo(new File(pl.getDataFolder() + File.separator + "preJail3Data" + File.separator + "jail.sqlite")); Files.move(sqlite, to);
} }
} }
} }