added all relevant documentation for Extensions, needs implementation

This commit is contained in:
sirjonasxx 2018-06-15 23:53:03 +02:00
parent ff8cec50bc
commit 2b9c553c9c
3 changed files with 85 additions and 2 deletions

View File

@ -9,7 +9,7 @@
<VBox xmlns="http://javafx.com/javafx/8.0.112" xmlns:fx="http://javafx.com/fxml/1" fx:controller="main.ui.GEarthController">
<Pane fx:id="mover" maxHeight="0.0" minHeight="0.0" prefWidth="200.0" />
<TabPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="-Infinity" prefHeight="295.0" prefWidth="565.0" tabClosingPolicy="UNAVAILABLE">
<TabPane fx:id="tabBar" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="-Infinity" prefHeight="295.0" prefWidth="565.0" tabClosingPolicy="UNAVAILABLE">
<tabs>
<Tab text="Connection">
<content>
@ -34,7 +34,7 @@
<fx:include fx:id="scheduler" source="scheduler/Scheduler.fxml" />
</content>
</Tab>
<Tab text="Settings">
<Tab fx:id="tab_Settings" text="Settings">
<content>
<fx:include fx:id="settings" source="settings/Settings.fxml" />
</content>

View File

@ -1,5 +1,7 @@
package main.ui;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.scene.layout.Pane;
import javafx.stage.Stage;
import main.protocol.HConnection;
@ -14,6 +16,8 @@ import main.ui.tools.Tools;
public class GEarthController {
public Tab tab_Settings;
public TabPane tabBar;
private Stage stage = null;
private volatile HConnection hConnection;
@ -42,6 +46,8 @@ public class GEarthController {
infoController.setParentController(this);
extensionsController.setParentController(this);
tabBar.getTabs().remove(tab_Settings);
//custom header bar
// final Point[] startpos = {null};

View File

@ -5,5 +5,82 @@ import main.ui.SubForm;
/**
* Created by Jonas on 06/04/18.
*/
/**
* THE EXTENSION COMMUNCATION PRINCIPLES & PROTOCOL:
*
* You will be able to write extensions in ANY language you want, but we will only provide an interface
* for Java so if you write your own in for example Python, make SURE you do it correctly or it could fuck G-Earth.
*
* Also, don't let the method where you manipulate the packets block. Similiar as how you must not block things in an UI thread.
* Why? Because Habbo relies on the TCP protocol, which ENSURES that packets get received in the right order, so we will not be fucking that up.
* That means that all packets following the packet you're manipulating in your extension will be blocked from being sent untill you're done.
* TIP: If you're trying to replace a packet in your extension but you know it will take time, just block the packet, end the method, and let something asynchronous send
* the editted packet when you're done.
*
*
* You may ignore everything beneath this line if you're extending the abstract Extension class we provide in Java.
* -----------------------------------------------------------------------------------------------------------------
*
* (0. We recommend to use a cross-platform language for your extension)
*
* 1. An extension will run as a seperate process on your device and has to be called with the flag "-p <PORT>",
* where <PORT> is a random port where the G-Earth local extension server will run on. Your extension has to connect with this server.
*
* 2. G-Earth will open your program only ONCE, that is on the boot of G-Earth or when you install the exension.
* Same story goes for closing the connection between the program and G-Earth, only once (on uninstall or close of G-Earth).
*
* You may also run your extension completely seperate from G-Earth for debugging purpose for example, then it won't be installed in G-Earth
* (but you have to configure the port yourself, which will be displayed in the extension page)
*
* 3. Once a connection is made, your extension will have to deal with the following incoming & outgoing messages as described (follows the same protocol structure as Habbo communication does):
* (if an object is sent; the object will be sent with its String representation from the StringifyAble interface, so the object's class must implement that)
*
* INCOMING MESSAGES: (marked with * if you're required to correctly respond or take action, ** if it's a response on something you requested)
* -----------------------------------------------------------------------------------------------------
* | ID | TITLE | BODY & DESCRIPTION |
* -----------------------------------------------------------------------------------------------------
* | 1 | ON-DOUBLECLICK | No body, the extension has been double clicked from within G-Earth | ( <- typically for tanji-module-like extensions you will open the UI here)
* -----------------------------------------------------------------------------------------------------
* | 2 | INFO-REQUEST* | Needs response with extension info (name, desc, author, version, ..), |
* | | | exact implementation is found in the Java abstract Extension class |
* -----------------------------------------------------------------------------------------------------
* | 3 | PACKET-INTERCEPT* | Includes the whole HMessage as body, needs response with the |
* | | | manipulated HMessage (OUTGOING id: 2) (blank body = no manipulation) |
* -----------------------------------------------------------------------------------------------------
* | 4 | FLAGS-CHECK** | Body: String with G-Earth's boot flags (args from static main method) |
* -----------------------------------------------------------------------------------------------------
* | 5 | CONNECTION START | Empty body, just a note that a new connection has been made, |
* | | | you could check this yourself as well (listen to out:4000 packet) |
* -----------------------------------------------------------------------------------------------------
* | 6 | CONNECTION END | Empty body, just a note that a connection has ended |
* -----------------------------------------------------------------------------------------------------
*
* OUTGOING MESSAGES: (marked with * if that is a response to one of the msgs above)
* -----------------------------------------------------------------------------------------------------
* | ID | TITLE | BODY & DESCRIPTION |
* -----------------------------------------------------------------------------------------------------
* | 1 | EXTENSION-INFO* | Response for INFO-REQUEST |
* -----------------------------------------------------------------------------------------------------
* | 2 | MANIPULATED-PACKET*| Response for PACKET-INTERCEPT |
* -----------------------------------------------------------------------------------------------------
* | 3 | REQUEST-FLAGS | Request G-Earth's flags, results in incoming FLAGS-CHECK response |
* -----------------------------------------------------------------------------------------------------
* | 4 | SEND-MESSAGE | Body: HMessage object. Sends the HPacket wrapped in the HMessage |
* | | | to the client/server |
* -----------------------------------------------------------------------------------------------------
*
* 4. Your extension will only appear in the extension list once the EXTENSION-INFO has been received by G-Earth
*
*
*/
public class Extensions extends SubForm {
public void initialize() {
}
}