summaryrefslogtreecommitdiff
path: root/tmwcon/src/Converter.java
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-01-16 20:16:56 +0200
committerAndrei Karas <akaras@inbox.ru>2011-01-16 20:19:11 +0200
commitfbf09712699cc005ddebe4f0cd000e5a14038faf (patch)
tree8d378c00518a510bab1d39e1a393e6b942148801 /tmwcon/src/Converter.java
parent688132dfa62d7a02c6ba0cbc67f86648c5f0e035 (diff)
downloadtools-fbf09712699cc005ddebe4f0cd000e5a14038faf.tar.gz
tools-fbf09712699cc005ddebe4f0cd000e5a14038faf.tar.bz2
tools-fbf09712699cc005ddebe4f0cd000e5a14038faf.tar.xz
tools-fbf09712699cc005ddebe4f0cd000e5a14038faf.zip
Add java map converter from tmw repo.
Diffstat (limited to 'tmwcon/src/Converter.java')
-rw-r--r--tmwcon/src/Converter.java54
1 files changed, 54 insertions, 0 deletions
diff --git a/tmwcon/src/Converter.java b/tmwcon/src/Converter.java
new file mode 100644
index 0000000..0f245aa
--- /dev/null
+++ b/tmwcon/src/Converter.java
@@ -0,0 +1,54 @@
+/*
+ * TMWServ to eAthena Converter (c) 2008 Jared Adams
+ * License: GPL, v2 or later
+ */
+
+import java.io.*;
+import java.lang.reflect.*;
+import java.net.*;
+import java.util.*;
+
+public abstract class Converter {
+ static String[] tiledJars = {"tiled-core.jar", "tiled.jar"};
+ static String[] wlkJars = {"plugins/tmw.jar", "tmw.jar"};
+
+ public static void main(String[] args) throws Exception {
+ List<URL> urls = new ArrayList<URL>();
+
+ File tiled = null;
+ for (String s : tiledJars) {
+ tiled = new File(s);
+ if (tiled.exists()) break;
+ }
+ if (tiled == null || !tiled.exists()) {
+ System.err.println("Unable to find a Tiled jar file! Exiting.");
+ System.exit(-5);
+ }
+ urls.add(tiled.toURI().toURL());
+
+ File wlkWriter = null;
+ for (String s : wlkJars) {
+ wlkWriter = new File(s);
+ if (wlkWriter.exists()) break;
+ }
+ if (wlkWriter == null || !wlkWriter.exists()) {
+ System.err.println("Unable to find the tmw plugin for Tiled! No wlk files will be made!");
+ } else {
+ urls.add(wlkWriter.toURI().toURL());
+ }
+
+ File self = new File("converter.jar");
+ if (!self.exists()) {
+ System.err.println("Unable to find a the converter jar! Exiting.");
+ System.exit(-5);
+ }
+ urls.add(self.toURI().toURL());
+
+ URLClassLoader loader = new URLClassLoader(urls.toArray(new URL[0]));
+ Class c = loader.loadClass("converter.Main");
+ Method m = c.getMethod("run", String[].class, Integer.TYPE);
+ System.out.println("Starting");
+
+ m.invoke(null, args, 0);
+ }
+}