mirror of
https://github.com/2009scape/2009Scape-mobile.git
synced 2026-08-01 14:19:12 -06:00
Move forge/OF installer stuff to a different package and fix deep nesting of if statements in the window handler
This commit is contained in:
parent
d4f912afcd
commit
96c021eecc
10 changed files with 27 additions and 21 deletions
Binary file not shown.
|
|
@ -1 +1 @@
|
|||
1688118307460
|
||||
1688133008591
|
||||
|
|
@ -85,7 +85,7 @@ Java_net_kdt_pojavlaunch_Logger_begin(JNIEnv *env, __attribute((unused)) jclass
|
|||
|
||||
/* open latestlog.txt for writing */
|
||||
const char* logFilePath = (*env)->GetStringUTFChars(env, logPath, NULL);
|
||||
latestlog_fd = open(logFilePath, O_WRONLY | O_TRUNC | O_CREAT, 644);
|
||||
latestlog_fd = open(logFilePath, O_WRONLY | O_TRUNC);
|
||||
if(latestlog_fd == -1) {
|
||||
latestlog_fd = 0;
|
||||
(*env)->ThrowNew(env, ioeClass, strerror(errno));
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ jar {
|
|||
versionFile.write(String.valueOf(new Date().getTime()))
|
||||
manifest {
|
||||
attributes("Manifest-Version": "1.0",
|
||||
"PreMain-Class": "git.artdeell.forgeinstaller.Agent")
|
||||
"PreMain-Class": "git.artdeell.installer_agent.Agent")
|
||||
}
|
||||
destinationDirectory.set(file("../app_pojavlauncher/src/main/assets/components/forge_installer/"))
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package git.artdeell.forgeinstaller;
|
||||
package git.artdeell.installer_agent;
|
||||
|
||||
import java.awt.AWTEvent;
|
||||
import java.awt.Component;
|
||||
|
|
@ -32,19 +32,25 @@ public class Agent implements AWTEventListener {
|
|||
public void eventDispatched(AWTEvent event) {
|
||||
WindowEvent windowEvent = (WindowEvent) event;
|
||||
Window window = windowEvent.getWindow();
|
||||
if(windowEvent.getID() == WindowEvent.WINDOW_OPENED) {
|
||||
if(!forgeWindowHandled) { // false at startup, so we will handle the first window as the Forge one
|
||||
forgeWindowHandled = handleMainWindow(window);
|
||||
if(forgeWindowHandled) {
|
||||
componentTimer.cancel();
|
||||
componentTimer.purge();
|
||||
}else{
|
||||
componentTimer.schedule(new ComponentTimeoutTask(), 30000);
|
||||
}
|
||||
}else if(window instanceof JDialog) { // expecting a new dialog
|
||||
handleDialog(window);
|
||||
}
|
||||
if(windowEvent.getID() != WindowEvent.WINDOW_OPENED) return;
|
||||
if(forgeWindowHandled && window instanceof JDialog) { // expecting a new dialog
|
||||
handleDialog(window);
|
||||
return;
|
||||
}
|
||||
if(!forgeWindowHandled) { // false at startup, so we will handle the first window as the Forge one
|
||||
forgeWindowHandled = handleMainWindow(window);
|
||||
checkComponentTimer();
|
||||
}
|
||||
}
|
||||
|
||||
public void checkComponentTimer() {
|
||||
if(forgeWindowHandled) {
|
||||
componentTimer.cancel();
|
||||
componentTimer.purge();
|
||||
return;
|
||||
}
|
||||
componentTimer.schedule(new ComponentTimeoutTask(), 30000);
|
||||
|
||||
}
|
||||
|
||||
public boolean handleMainWindow(Window window) {
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package git.artdeell.forgeinstaller;
|
||||
package git.artdeell.installer_agent;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package git.artdeell.forgeinstaller;
|
||||
package git.artdeell.installer_agent;
|
||||
|
||||
import java.util.TimerTask;
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package git.artdeell.forgeinstaller;
|
||||
package git.artdeell.installer_agent;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package git.artdeell.forgeinstaller;
|
||||
package git.artdeell.installer_agent;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package git.artdeell.forgeinstaller;
|
||||
package git.artdeell.installer_agent;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
Loading…
Add table
Add a link
Reference in a new issue