use of de.Keyle.MyPet.repository.types.NbtRepository in project MyPet by xXKeyleXx.
the class Converter method convert.
public static boolean convert() {
MyPetApi.getLogger().info("Converting from NBT to " + Configuration.Repository.REPOSITORY_TYPE + "...");
NbtRepository fromRepo = new NbtRepository();
fromRepo.init();
SqLiteRepository toRepo = (SqLiteRepository) MyPetApi.getRepository();
List<MyPetPlayer> playerList = fromRepo.getAllMyPetPlayers();
toRepo.addMyPetPlayers(playerList);
List<StoredMyPet> pets = fromRepo.getAllMyPets();
toRepo.addMyPets(pets);
toRepo.save();
fromRepo.disable();
File nbtFile = new File(MyPetApi.getPlugin().getDataFolder().getPath() + File.separator + "My.Pets");
File nbtFileOld = new File(MyPetApi.getPlugin().getDataFolder().getPath() + File.separator + "My.Pets.old");
nbtFile.renameTo(nbtFileOld);
MyPetApi.getPlugin().getConfig().set("MyPet.Repository.NBT", null);
MyPetApi.getPlugin().saveConfig();
MyPetApi.getLogger().info("Conversion from NBT to " + Configuration.Repository.REPOSITORY_TYPE + " complete!");
return true;
}
Aggregations