diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 1c9b035..28345f7 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -3,12 +3,9 @@
-
-
-
-
+
@@ -22,38 +19,40 @@
-
+
-
+
+
+
-
+
-
+
-
+
-
+
-
+
@@ -64,8 +63,8 @@
-
-
+
+
@@ -73,10 +72,85 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -85,74 +159,11 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -178,6 +189,15 @@
waitTen
time
Out.out
+ parseString
+ doneTe
+ start
+ worldpa
+ world
+ copy
+ worldp
+ worldpath
+ size
log.error
@@ -200,14 +220,15 @@
-
-
-
+
+
+
+
@@ -315,10 +336,10 @@
-
+
-
+
@@ -396,7 +417,11 @@
-
+
+
+
+
+
@@ -409,19 +434,19 @@
-
+
-
+
-
+
@@ -545,124 +570,25 @@
-
-
-
-
-
-
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -673,20 +599,136 @@
-
+
-
-
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -744,7 +786,6 @@
diff --git a/src/main/java/morlok8k/MinecraftLandGenerator/DownloadFile.java b/src/main/java/morlok8k/MinecraftLandGenerator/DownloadFile.java
index 2833703..27e26e5 100644
--- a/src/main/java/morlok8k/MinecraftLandGenerator/DownloadFile.java
+++ b/src/main/java/morlok8k/MinecraftLandGenerator/DownloadFile.java
@@ -32,30 +32,25 @@ import org.apache.commons.logging.LogFactory;
import org.w3c.bert_bos.UTF8URL.Unescape;
/**
- *
* @author morlok8k
*/
public class DownloadFile {
+
private static Log log = LogFactory.getLog(Main.class);
/**
- *
* Downloads a File using a URL in a String.
* (If the file is a dynamic URL (Not like "http://example.com/file.txt") and it can't get the filename, it saves it as "System.currentTimeMillis();")
*
* Thanks to bs123 at
* http://www.daniweb.com/software-development/java/threads/84370
- *
- * @author Morlok8k
- * @param URL
- * URL in a String
- * @param Output
- * Displays output if true
+ *
+ * @param URL URL in a String
+ * @param Output Displays output if true
* @return Boolean: true if download was successful, false if download wasn't
+ * @author Morlok8k
*/
public static boolean downloadFile(final String URL, final boolean Output) {
- boolean success = true;
-
String fileName = URL.substring(URL.lastIndexOf("/") + 1, URL.length());
if (fileName.startsWith("\"")) {
@@ -78,7 +73,7 @@ public class DownloadFile {
}
final long differenceTime = System.currentTimeMillis();
- final Long[] timeTracking = new Long[] { differenceTime, differenceTime };
+ final Long[] timeTracking = new Long[]{differenceTime, differenceTime};
timeTracking[0] = System.currentTimeMillis();
if (Output) {
@@ -86,10 +81,8 @@ public class DownloadFile {
}
try {
- BufferedInputStream in;
- in = new BufferedInputStream(new URL(URL).openStream());
- FileOutputStream fos;
- fos = new FileOutputStream(fileName);
+ BufferedInputStream in = new BufferedInputStream(new URL(URL).openStream());
+ FileOutputStream fos = new FileOutputStream(fileName);
final BufferedOutputStream bout = new BufferedOutputStream(fos, size);
final byte[] data = new byte[size];
int x = 0;
@@ -111,21 +104,21 @@ public class DownloadFile {
timeTracking[1] = System.currentTimeMillis();
long differenceTime1 = (timeTracking[1] - timeTracking[0]);
if (Output) {
- log.info("Elapsed Time: " + String.format("%02d:%02d", (differenceTime1 / 1000) / 60, (differenceTime1 / 1000) % 60));
+ log.info("Elapsed Time: " + String.format("%02d min:%02d sec", (differenceTime1 / 1000) / 60, (differenceTime1 / 1000) % 60));
}
} catch (final FileNotFoundException e) {
e.printStackTrace();
- success = false;
+ return false;
} catch (final MalformedURLException e) {
e.printStackTrace();
- success = false;
+ return false;
} catch (final IOException e) {
e.printStackTrace();
- success = false;
+ return false;
}
if (Output) {
log.info("Done");
}
- return success;
+ return true;
}
}
diff --git a/src/main/java/morlok8k/MinecraftLandGenerator/Main.java b/src/main/java/morlok8k/MinecraftLandGenerator/Main.java
index ed65b32..54d1c20 100644
--- a/src/main/java/morlok8k/MinecraftLandGenerator/Main.java
+++ b/src/main/java/morlok8k/MinecraftLandGenerator/Main.java
@@ -27,6 +27,7 @@ import java.awt.EventQueue;
import java.io.File;
import java.io.IOException;
import java.net.URI;
+import java.nio.file.Files;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.logging.Level;
@@ -204,6 +205,7 @@ public class Main {
log.info("Backing up level.dat to level_backup.dat.\n");
Misc.copyFile(serverLevel, backupLevel);
+ Files.copy()
final Coordinates spawn = SpawnPoint.getSpawn(serverLevel);
log.info("Spawn point detected: [X,Y,Z] " + spawn);
diff --git a/src/main/java/morlok8k/MinecraftLandGenerator/Misc.java b/src/main/java/morlok8k/MinecraftLandGenerator/Misc.java
index a0d9c9f..0c5aad5 100644
--- a/src/main/java/morlok8k/MinecraftLandGenerator/Misc.java
+++ b/src/main/java/morlok8k/MinecraftLandGenerator/Misc.java
@@ -43,6 +43,9 @@ public class Misc {
* @param dst
* @throws IOException
*/
+
+
+ // TODO replace with Java Copy Path
public static void copyFile(final File src, final File dst) throws IOException {
final InputStream copyIn = new FileInputStream(src);
final OutputStream copyOut = new FileOutputStream(dst);