From b6d1dedac76a893ee5b1d62602d33e6ce4f24b60 Mon Sep 17 00:00:00 2001
From: sirjonasxx <36828922+sirjonasxx@users.noreply.github.com>
Date: Sat, 2 Feb 2019 18:25:08 +0100
Subject: [PATCH] troubleshooting page redirect when stuck loading
---
.../gearth/protocol/memory/Rc4Obtainer.java | 35 +++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/G-Earth/src/main/java/gearth/protocol/memory/Rc4Obtainer.java b/G-Earth/src/main/java/gearth/protocol/memory/Rc4Obtainer.java
index 35e9bb9..8af8793 100644
--- a/G-Earth/src/main/java/gearth/protocol/memory/Rc4Obtainer.java
+++ b/G-Earth/src/main/java/gearth/protocol/memory/Rc4Obtainer.java
@@ -1,5 +1,6 @@
package gearth.protocol.memory;
+import gearth.Main;
import gearth.protocol.HConnection;
import gearth.protocol.HMessage;
import gearth.protocol.HPacket;
@@ -10,6 +11,14 @@ import gearth.protocol.packethandler.Handler;
import gearth.protocol.packethandler.IncomingHandler;
import gearth.protocol.packethandler.OutgoingHandler;
import gearth.protocol.packethandler.PayloadBuffer;
+import javafx.application.Platform;
+import javafx.scene.control.Alert;
+import javafx.scene.control.ButtonType;
+import javafx.scene.control.Hyperlink;
+import javafx.scene.control.Label;
+import javafx.scene.layout.FlowPane;
+import javafx.scene.layout.Region;
+import javafx.scene.web.WebView;
import java.util.Arrays;
import java.util.List;
@@ -70,6 +79,32 @@ public class Rc4Obtainer {
if (!worked) {
System.err.println("COULD NOT FIND RC4 TABLE");
+
+
+ Platform.runLater(() -> {
+ Alert alert = new Alert(Alert.AlertType.WARNING, "Something went wrong!", ButtonType.OK);
+
+ FlowPane fp = new FlowPane();
+ Label lbl = new Label("G-Earth has experienced an issue" + System.lineSeparator()+ System.lineSeparator() + "Head over to our Troubleshooting page to solve the problem:");
+ Hyperlink link = new Hyperlink("https://github.com/sirjonasxx/G-Earth/wiki/Troubleshooting");
+ fp.getChildren().addAll( lbl, link);
+ link.setOnAction(event -> {
+ Main.main.getHostServices().showDocument(link.getText());
+ event.consume();
+ });
+
+ WebView webView = new WebView();
+ webView.getEngine().loadContent("G-Earth has experienced an issue
Head over to our Troubleshooting page to solve the problem:
https://github.com/sirjonasxx/G-Earth/wiki/Troubleshooting");
+ webView.setPrefSize(500, 200);
+ alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);
+ alert.getDialogPane().setContent(fp);
+ alert.setOnCloseRequest(event -> {
+ Main.main.getHostServices().showDocument(link.getText());
+ });
+ alert.show();
+
+ });
+
}
incomingHandler.unblock();