Fixed test and sample decks

This commit is contained in:
Oleg Agafonov 2020-08-10 18:24:21 +04:00
parent 3a1b741509
commit 8b2bc064cd
7 changed files with 30 additions and 20 deletions

View file

@ -115,11 +115,12 @@ public final class MtgJson {
if (stream == null) {
File file = new File(filename);
if (!file.exists()) {
System.out.println("Downloading " + filename + " to " + file.getAbsolutePath());
URLConnection connection = new URL("https://mtgjson.com/files/" + filename).openConnection();
connection.setRequestProperty("user-agent", "xmage");
InputStream download = connection.getInputStream();
Files.copy(download, file.toPath(), StandardCopyOption.REPLACE_EXISTING);
System.out.println("Downloaded " + filename + " to " + file.getAbsolutePath());
System.out.println("Downloading DONE");
} else {
System.out.println("Using " + filename + " from " + file.getAbsolutePath());
}