diff --git a/Extensions/AdminOnConnect/pom.xml b/Extensions/AdminOnConnect/pom.xml
new file mode 100644
index 0000000..7a5eab6
--- /dev/null
+++ b/Extensions/AdminOnConnect/pom.xml
@@ -0,0 +1,110 @@
+
+
+ 4.0.0
+
+ AdminOnConnect
+
+ jar
+
+ 0.0.1-beta
+
+
+ G-Earth
+ G-Earth-Parent
+ 0.0.1-beta
+
+
+
+
+
+
+ false
+ src/main/java
+
+ **/*.fxml
+ **/*.css
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.7.0
+
+
+ 1.8
+
+
+
+
+ maven-resources-plugin
+ 2.6
+
+
+ copy-resources
+ validate
+
+ copy-resources
+
+
+ ${project.build.directory}
+
+
+ src/main/resources
+
+
+
+
+
+
+
+
+ maven-dependency-plugin
+
+
+ package
+
+ copy-dependencies
+
+
+ ${project.build.directory}/bin/lib
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ 2.5
+
+ ${project.build.directory}/bin
+
+
+ true
+ true
+ extensions.adminonconnect.AdminOnConnect
+ false
+ lib/
+ true
+
+
+ ${artifactId}
+
+
+
+
+
+
+
+ G-Earth
+ G-Earth-UI
+ 0.0.1-beta
+
+
+
+
\ No newline at end of file
diff --git a/src/main/extensions/examples/adminonconnect/AdminOnConnect.java b/Extensions/AdminOnConnect/src/main/java/extensions/adminonconnect/AdminOnConnect.java
similarity index 85%
rename from src/main/extensions/examples/adminonconnect/AdminOnConnect.java
rename to Extensions/AdminOnConnect/src/main/java/extensions/adminonconnect/AdminOnConnect.java
index 499f3e1..e7106c8 100644
--- a/src/main/extensions/examples/adminonconnect/AdminOnConnect.java
+++ b/Extensions/AdminOnConnect/src/main/java/extensions/adminonconnect/AdminOnConnect.java
@@ -1,16 +1,14 @@
-package main.extensions.examples.adminonconnect;
+package extensions.adminonconnect;
-import main.extensions.Extension;
-import main.extensions.ExtensionInfo;
-import main.protocol.HMessage;
-import main.protocol.HPacket;
+import gearth.extensions.Extension;
+import gearth.extensions.ExtensionInfo;
+import gearth.protocol.HMessage;
+import gearth.protocol.HPacket;
/**
* Created by Jonas on 26/06/18.
*/
-
-
@ExtensionInfo(
Title = "Always admin!",
Description = "Gives you admin permission on connect",
diff --git a/Extensions/BlockReplacePackets/pom.xml b/Extensions/BlockReplacePackets/pom.xml
new file mode 100644
index 0000000..f44fd20
--- /dev/null
+++ b/Extensions/BlockReplacePackets/pom.xml
@@ -0,0 +1,110 @@
+
+
+ 4.0.0
+
+ BlockReplacePackets
+
+ jar
+
+ 0.0.1-beta
+
+
+ G-Earth
+ G-Earth-Parent
+ 0.0.1-beta
+
+
+
+
+
+
+ false
+ src/main/java
+
+ **/*.fxml
+ **/*.css
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.7.0
+
+
+ 1.8
+
+
+
+
+ maven-resources-plugin
+ 2.6
+
+
+ copy-resources
+ validate
+
+ copy-resources
+
+
+ ${project.build.directory}
+
+
+ src/main/resources
+
+
+
+
+
+
+
+
+ maven-dependency-plugin
+
+
+ package
+
+ copy-dependencies
+
+
+ ${project.build.directory}/bin/lib
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ 2.5
+
+ ${project.build.directory}/bin
+
+
+ true
+ true
+ extensions.blockreplacepackets.BlockAndReplacePackets
+ false
+ lib/
+ true
+
+
+ ${artifactId}
+
+
+
+
+
+
+
+ G-Earth
+ G-Earth-UI
+ 0.0.1-beta
+
+
+
+
\ No newline at end of file
diff --git a/src/main/extensions/examples/blockreplacepackets/BlockAndReplacePackets.java b/Extensions/BlockReplacePackets/src/main/java/extensions/blockreplacepackets/BlockAndReplacePackets.java
similarity index 85%
rename from src/main/extensions/examples/blockreplacepackets/BlockAndReplacePackets.java
rename to Extensions/BlockReplacePackets/src/main/java/extensions/blockreplacepackets/BlockAndReplacePackets.java
index 97114ef..dbb49ba 100644
--- a/src/main/extensions/examples/blockreplacepackets/BlockAndReplacePackets.java
+++ b/Extensions/BlockReplacePackets/src/main/java/extensions/blockreplacepackets/BlockAndReplacePackets.java
@@ -1,4 +1,4 @@
-package main.extensions.examples.blockreplacepackets;
+package extensions.blockreplacepackets;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
@@ -7,11 +7,9 @@ import javafx.scene.control.Button;
import javafx.scene.control.ComboBox;
import javafx.scene.control.TextField;
import javafx.stage.Stage;
-import main.extensions.ExtensionForm;
-import main.extensions.ExtensionInfo;
-import main.ui.GEarthController;
-
-import java.net.URL;
+import gearth.extensions.ExtensionForm;
+import gearth.extensions.ExtensionInfo;
+import gearth.ui.GEarthController;
/**
* Created by Jonas on 22/09/18.
@@ -54,6 +52,6 @@ public class BlockAndReplacePackets extends ExtensionForm {
primaryStage.setTitle("Packet blocker &/ replacer");
primaryStage.setScene(new Scene(root, 580, 262));
- primaryStage.getScene().getStylesheets().add(GEarthController.class.getResource("bootstrap3.css").toExternalForm());
+ primaryStage.getScene().getStylesheets().add(GEarthController.class.getResource("/gearth/ui/bootstrap3.css").toExternalForm());
}
}
diff --git a/src/main/extensions/examples/blockreplacepackets/blockreplace.fxml b/Extensions/BlockReplacePackets/src/main/java/extensions/blockreplacepackets/blockreplace.fxml
similarity index 97%
rename from src/main/extensions/examples/blockreplacepackets/blockreplace.fxml
rename to Extensions/BlockReplacePackets/src/main/java/extensions/blockreplacepackets/blockreplace.fxml
index 42748a1..e490eea 100644
--- a/src/main/extensions/examples/blockreplacepackets/blockreplace.fxml
+++ b/Extensions/BlockReplacePackets/src/main/java/extensions/blockreplacepackets/blockreplace.fxml
@@ -12,7 +12,7 @@
-
+
diff --git a/Extensions/SpeechColorizer/pom.xml b/Extensions/SpeechColorizer/pom.xml
new file mode 100644
index 0000000..a6a40e5
--- /dev/null
+++ b/Extensions/SpeechColorizer/pom.xml
@@ -0,0 +1,110 @@
+
+
+ 4.0.0
+
+ SpeechColorizer
+
+ jar
+
+ 0.0.1-beta
+
+
+ G-Earth
+ G-Earth-Parent
+ 0.0.1-beta
+
+
+
+
+
+
+ false
+ src/main/java
+
+ **/*.fxml
+ **/*.css
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.7.0
+
+
+ 1.8
+
+
+
+
+ maven-resources-plugin
+ 2.6
+
+
+ copy-resources
+ validate
+
+ copy-resources
+
+
+ ${project.build.directory}
+
+
+ src/main/resources
+
+
+
+
+
+
+
+
+ maven-dependency-plugin
+
+
+ package
+
+ copy-dependencies
+
+
+ ${project.build.directory}/bin/lib
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ 2.5
+
+ ${project.build.directory}/bin
+
+
+ true
+ true
+ extensions.speechcolorizer.SpeechColorizer
+ false
+ lib/
+ true
+
+
+ ${artifactId}
+
+
+
+
+
+
+
+ G-Earth
+ G-Earth-UI
+ 0.0.1-beta
+
+
+
+
\ No newline at end of file
diff --git a/src/main/extensions/examples/speechcolorizer/SpeechColorizer.java b/Extensions/SpeechColorizer/src/main/java/extensions/speechcolorizer/SpeechColorizer.java
similarity index 89%
rename from src/main/extensions/examples/speechcolorizer/SpeechColorizer.java
rename to Extensions/SpeechColorizer/src/main/java/extensions/speechcolorizer/SpeechColorizer.java
index 919c76c..f01feb7 100644
--- a/src/main/extensions/examples/speechcolorizer/SpeechColorizer.java
+++ b/Extensions/SpeechColorizer/src/main/java/extensions/speechcolorizer/SpeechColorizer.java
@@ -1,9 +1,9 @@
-package main.extensions.examples.speechcolorizer;
+package extensions.speechcolorizer;
-import main.extensions.Extension;
-import main.extensions.ExtensionInfo;
-import main.protocol.HMessage;
-import main.protocol.HPacket;
+import gearth.extensions.Extension;
+import gearth.extensions.ExtensionInfo;
+import gearth.protocol.HMessage;
+import gearth.protocol.HPacket;
import java.util.Random;
diff --git a/G-Earth-UI/pom.xml b/G-Earth-UI/pom.xml
new file mode 100644
index 0000000..65d1503
--- /dev/null
+++ b/G-Earth-UI/pom.xml
@@ -0,0 +1,138 @@
+
+
+ 4.0.0
+
+ G-Earth-UI
+
+ jar
+
+ 0.0.1-beta
+
+
+ G-Earth
+ G-Earth-Parent
+ 0.0.1-beta
+
+
+
+
+
+
+ false
+ src/main/java
+
+ **/*.fxml
+ **/*.css
+ **/*.png
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.7.0
+
+
+ 1.8
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ maven-resources-plugin
+ 2.6
+
+
+ copy-resources
+ validate
+
+ copy-resources
+
+
+ ${project.build.directory}
+
+
+ src/main/resources
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ maven-assembly-plugin
+
+
+ package
+
+ single
+
+
+
+
+
+
+ main.Main
+
+
+
+ jar-with-dependencies
+
+
+
+
+
+
+
+
+ org.json
+ json
+ 20180813
+
+
+ org.fxmisc.richtext
+ richtextfx
+ 0.9.1
+
+
+
\ No newline at end of file
diff --git a/G-Earth-UI/src/META-INF/MANIFEST.MF b/G-Earth-UI/src/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..c12866f
--- /dev/null
+++ b/G-Earth-UI/src/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Main-Class: gearth.Main
+
diff --git a/src/main/Main.java b/G-Earth-UI/src/main/java/gearth/Main.java
similarity index 90%
rename from src/main/Main.java
rename to G-Earth-UI/src/main/java/gearth/Main.java
index aff2565..06c87c7 100644
--- a/src/main/Main.java
+++ b/G-Earth-UI/src/main/java/gearth/Main.java
@@ -1,16 +1,12 @@
-package main;
+package gearth;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
-import javafx.stage.Modality;
import javafx.stage.Stage;
-import javafx.stage.StageStyle;
-import main.ui.GEarthController;
-
-import java.util.Arrays;
+import gearth.ui.GEarthController;
// run as root issue Invalid MIT-MAGIC-COOKIE-1 key fix: https://stackoverflow.com/questions/48139447/invalid-mit-magic-cookie-1-key
diff --git a/src/main/extensions/Extension.java b/G-Earth-UI/src/main/java/gearth/extensions/Extension.java
similarity index 98%
rename from src/main/extensions/Extension.java
rename to G-Earth-UI/src/main/java/gearth/extensions/Extension.java
index 525582c..b4dc3e0 100644
--- a/src/main/extensions/Extension.java
+++ b/G-Earth-UI/src/main/java/gearth/extensions/Extension.java
@@ -1,8 +1,8 @@
-package main.extensions;
+package gearth.extensions;
-import main.protocol.HMessage;
-import main.protocol.HPacket;
-import main.ui.extensions.Extensions;
+import gearth.protocol.HMessage;
+import gearth.protocol.HPacket;
+import gearth.ui.extensions.Extensions;
import java.io.*;
import java.net.Socket;
@@ -134,7 +134,7 @@ public abstract class Extension {
onEndConnection();
}
else if (packet.headerId() == Extensions.OUTGOING_MESSAGES_IDS.FLAGSCHECK) {
- // body = an array of G-Earths main flags
+ // body = an array of G-Earths gearth flags
if (flagRequestCallback != null) {
int arraysize = packet.readInteger();
String[] gEarthArgs = new String[arraysize];
diff --git a/src/main/extensions/ExtensionForm.java b/G-Earth-UI/src/main/java/gearth/extensions/ExtensionForm.java
similarity index 97%
rename from src/main/extensions/ExtensionForm.java
rename to G-Earth-UI/src/main/java/gearth/extensions/ExtensionForm.java
index fe50b9a..75d04fd 100644
--- a/src/main/extensions/ExtensionForm.java
+++ b/G-Earth-UI/src/main/java/gearth/extensions/ExtensionForm.java
@@ -1,10 +1,10 @@
-package main.extensions;
+package gearth.extensions;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.stage.Stage;
-import main.protocol.HMessage;
-import main.protocol.HPacket;
+import gearth.protocol.HMessage;
+import gearth.protocol.HPacket;
/**
* Created by Jonas on 22/09/18.
diff --git a/src/main/extensions/ExtensionInfo.java b/G-Earth-UI/src/main/java/gearth/extensions/ExtensionInfo.java
similarity index 91%
rename from src/main/extensions/ExtensionInfo.java
rename to G-Earth-UI/src/main/java/gearth/extensions/ExtensionInfo.java
index a4f16d7..3e2a527 100644
--- a/src/main/extensions/ExtensionInfo.java
+++ b/G-Earth-UI/src/main/java/gearth/extensions/ExtensionInfo.java
@@ -1,4 +1,4 @@
-package main.extensions;
+package gearth.extensions;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
diff --git a/src/main/extensions/extra/Inspector.java b/G-Earth-UI/src/main/java/gearth/extensions/extra/Inspector.java
similarity index 67%
rename from src/main/extensions/extra/Inspector.java
rename to G-Earth-UI/src/main/java/gearth/extensions/extra/Inspector.java
index 6da0308..89acbf5 100644
--- a/src/main/extensions/extra/Inspector.java
+++ b/G-Earth-UI/src/main/java/gearth/extensions/extra/Inspector.java
@@ -1,4 +1,4 @@
-package main.extensions.extra;
+package gearth.extensions.extra;
/**
* Created by Jonas on 22/09/18.
diff --git a/src/main/misc/Cacher.java b/G-Earth-UI/src/main/java/gearth/misc/Cacher.java
similarity index 63%
rename from src/main/misc/Cacher.java
rename to G-Earth-UI/src/main/java/gearth/misc/Cacher.java
index 4581f09..2866e0e 100644
--- a/src/main/misc/Cacher.java
+++ b/G-Earth-UI/src/main/java/gearth/misc/Cacher.java
@@ -1,52 +1,48 @@
-package main.misc;
+package gearth.misc;
-import main.Main;
-import org.json.simple.JSONObject;
-import org.json.simple.parser.JSONParser;
-import org.json.simple.parser.ParseException;
+import gearth.Main;
+import org.json.JSONArray;
+import org.json.JSONObject;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.nio.file.Files;
-import java.util.ArrayList;
import java.util.List;
-import java.util.Map;
/**
* Created by Jonas on 28/09/18.
*/
public class Cacher {
- private static final String CACHEFILENAME = "cache.json";
+ private static final String CACHE_FILENAME = "cache.json";
private static String getCacheDir() {
return new File(Main.class.getProtectionDomain().getCodeSource().getLocation().getPath()).getParent();
}
private static boolean cacheFileExists() {
- File f = new File(getCacheDir(), CACHEFILENAME);
+ File f = new File(getCacheDir(), CACHE_FILENAME);
return (f.exists() && !f.isDirectory());
}
private static JSONObject getCacheContents() {
if (cacheFileExists()) {
try {
- File f = new File(getCacheDir(), CACHEFILENAME);
+ File f = new File(getCacheDir(), CACHE_FILENAME);
String contents = String.join("\n", Files.readAllLines(f.toPath()));
- JSONParser parser = new JSONParser();
- return (JSONObject) parser.parse(contents);
- } catch (IOException | ParseException e) {
+ return new JSONObject(contents);
+ } catch (IOException e) {
e.printStackTrace();
}
}
return new JSONObject();
}
private static void updateCache(JSONObject contents) {
- try (FileWriter file = new FileWriter(new File(getCacheDir(), CACHEFILENAME))) {
+ try (FileWriter file = new FileWriter(new File(getCacheDir(), CACHE_FILENAME))) {
- file.write(contents.toJSONString());
+ file.write(contents.toString());
file.flush();
} catch (IOException e) {
@@ -56,16 +52,24 @@ public class Cacher {
public static void put(String key, Object val) {
JSONObject object = getCacheContents();
- if (object.containsKey(key)) object.remove(key);
+ if (object.has(key)) object.remove(key);
object.put(key, val);
updateCache(object);
}
+
public static Object get(String key) {
JSONObject object = getCacheContents();
-
- return object.get(key);
+ if (object.has(key)) return object.get(key);
+ else return null;
}
+
+ public static List