mirror of
https://github.com/sirjonasxx/G-Earth.git
synced 2024-11-23 08:50:52 +01:00
fix bug in extensionForm 2
This commit is contained in:
parent
4d29895f5f
commit
3636c42245
@ -157,12 +157,7 @@ public class BlockAndReplacePackets extends ExtensionForm {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initExtension() {
|
protected void initExtension() {
|
||||||
intercept(HMessage.Side.TOSERVER, new Extension.MessageListener() {
|
intercept(HMessage.Side.TOSERVER, message -> System.out.println("just testing"));
|
||||||
@Override
|
|
||||||
public void act(HMessage message) {
|
|
||||||
System.out.println("just testing");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -13,19 +13,17 @@ import java.util.concurrent.Semaphore;
|
|||||||
*/
|
*/
|
||||||
public abstract class ExtensionForm extends Application {
|
public abstract class ExtensionForm extends Application {
|
||||||
|
|
||||||
private Extension extension = null;
|
private volatile Extension extension;
|
||||||
protected static String[] args;
|
protected static String[] args;
|
||||||
protected volatile Stage primaryStage;
|
protected volatile Stage primaryStage;
|
||||||
|
|
||||||
private ExtensionForm realForm = null;
|
private volatile ExtensionForm realForm = null;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void start(Stage primaryStage) throws Exception {
|
public void start(Stage primaryStage) throws Exception {
|
||||||
ExtensionInfo extInfo = getClass().getAnnotation(ExtensionInfo.class);
|
ExtensionInfo extInfo = getClass().getAnnotation(ExtensionInfo.class);
|
||||||
Semaphore semaphore = new Semaphore(1);
|
|
||||||
semaphore.acquire();
|
|
||||||
realForm = launchForm(primaryStage);
|
realForm = launchForm(primaryStage);
|
||||||
Thread t = new Thread(() -> {
|
|
||||||
realForm.extension = new Extension(args) {
|
realForm.extension = new Extension(args) {
|
||||||
@Override
|
@Override
|
||||||
protected void init() {
|
protected void init() {
|
||||||
@ -52,7 +50,8 @@ public abstract class ExtensionForm extends Application {
|
|||||||
return extInfo;
|
return extInfo;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
semaphore.release();
|
realForm.primaryStage = primaryStage;
|
||||||
|
Thread t = new Thread(() -> {
|
||||||
realForm.extension.run();
|
realForm.extension.run();
|
||||||
// Platform.runLater(primaryStage::close);
|
// Platform.runLater(primaryStage::close);
|
||||||
//when the extension has ended, close this process
|
//when the extension has ended, close this process
|
||||||
@ -60,10 +59,7 @@ public abstract class ExtensionForm extends Application {
|
|||||||
});
|
});
|
||||||
t.start();
|
t.start();
|
||||||
|
|
||||||
semaphore.acquire();
|
|
||||||
Platform.setImplicitExit(false);
|
Platform.setImplicitExit(false);
|
||||||
realForm = launchForm(primaryStage);
|
|
||||||
realForm.primaryStage = primaryStage;
|
|
||||||
|
|
||||||
primaryStage.setOnCloseRequest(event -> {
|
primaryStage.setOnCloseRequest(event -> {
|
||||||
event.consume();
|
event.consume();
|
||||||
|
@ -291,7 +291,9 @@ public class Extensions extends SubForm {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
extension.onClick(observable -> extension.sendMessage(new HPacket(OUTGOING_MESSAGES_IDS.ONDOUBLECLICK)));
|
extension.onClick(observable -> {
|
||||||
|
extension.sendMessage(new HPacket(OUTGOING_MESSAGES_IDS.ONDOUBLECLICK));
|
||||||
|
});
|
||||||
|
|
||||||
Platform.runLater(() -> producer.extensionConnected(extension));
|
Platform.runLater(() -> producer.extensionConnected(extension));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user