runelite-client: shut down discord service when closed
It is preventing jvm termination otherwise for some reason
This commit is contained in:
@@ -131,7 +131,7 @@ public class RuneLite
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Load swing UI
|
// Load swing UI
|
||||||
SwingUtilities.invokeAndWait(() -> setGui(ClientUI.create(properties, client)));
|
SwingUtilities.invokeAndWait(() -> setGui(ClientUI.create(this, properties, client)));
|
||||||
|
|
||||||
// Initialize Discord service
|
// Initialize Discord service
|
||||||
discordService.init();
|
discordService.init();
|
||||||
@@ -182,6 +182,11 @@ public class RuneLite
|
|||||||
eventBus.post(new ClientUILoaded());
|
eventBus.post(new ClientUILoaded());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void shutdown()
|
||||||
|
{
|
||||||
|
discordService.close();
|
||||||
|
}
|
||||||
|
|
||||||
public void setGui(ClientUI gui)
|
public void setGui(ClientUI gui)
|
||||||
{
|
{
|
||||||
this.gui = gui;
|
this.gui = gui;
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import net.runelite.api.GameState;
|
import net.runelite.api.GameState;
|
||||||
import net.runelite.api.events.ConfigChanged;
|
import net.runelite.api.events.ConfigChanged;
|
||||||
|
import net.runelite.client.RuneLite;
|
||||||
import net.runelite.client.RuneLiteProperties;
|
import net.runelite.client.RuneLiteProperties;
|
||||||
import org.pushingpixels.substance.api.skin.SubstanceGraphiteLookAndFeel;
|
import org.pushingpixels.substance.api.skin.SubstanceGraphiteLookAndFeel;
|
||||||
import org.pushingpixels.substance.internal.utils.SubstanceCoreUtilities;
|
import org.pushingpixels.substance.internal.utils.SubstanceCoreUtilities;
|
||||||
@@ -75,6 +76,7 @@ public class ClientUI extends JFrame
|
|||||||
@Getter
|
@Getter
|
||||||
private TrayIcon trayIcon;
|
private TrayIcon trayIcon;
|
||||||
|
|
||||||
|
private final RuneLite runelite;
|
||||||
private final Applet client;
|
private final Applet client;
|
||||||
private final RuneLiteProperties properties;
|
private final RuneLiteProperties properties;
|
||||||
private JPanel navContainer;
|
private JPanel navContainer;
|
||||||
@@ -100,7 +102,7 @@ public class ClientUI extends JFrame
|
|||||||
ICON = icon;
|
ICON = icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ClientUI create(RuneLiteProperties properties, Applet client)
|
public static ClientUI create(RuneLite runelite, RuneLiteProperties properties, Applet client)
|
||||||
{
|
{
|
||||||
// Force heavy-weight popups/tooltips.
|
// Force heavy-weight popups/tooltips.
|
||||||
// Prevents them from being obscured by the game applet.
|
// Prevents them from being obscured by the game applet.
|
||||||
@@ -128,11 +130,12 @@ public class ClientUI extends JFrame
|
|||||||
// Use custom UI font
|
// Use custom UI font
|
||||||
setUIFont(new FontUIResource(FontManager.getRunescapeFont()));
|
setUIFont(new FontUIResource(FontManager.getRunescapeFont()));
|
||||||
|
|
||||||
return new ClientUI(properties, client);
|
return new ClientUI(runelite, properties, client);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ClientUI(RuneLiteProperties properties, Applet client)
|
private ClientUI(RuneLite runelite, RuneLiteProperties properties, Applet client)
|
||||||
{
|
{
|
||||||
|
this.runelite = runelite;
|
||||||
this.properties = properties;
|
this.properties = properties;
|
||||||
this.client = client;
|
this.client = client;
|
||||||
this.trayIcon = setupTrayIcon();
|
this.trayIcon = setupTrayIcon();
|
||||||
@@ -385,6 +388,7 @@ public class ClientUI extends JFrame
|
|||||||
|
|
||||||
if (result == JOptionPane.OK_OPTION)
|
if (result == JOptionPane.OK_OPTION)
|
||||||
{
|
{
|
||||||
|
runelite.shutdown();
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user