client: configure the launcher from within the client
This commit is contained in:
@@ -88,6 +88,7 @@ object Libraries {
|
||||
const val rxrelay = "2.1.1"
|
||||
const val sisu = "0.3.4"
|
||||
const val sentry = "1.7.29"
|
||||
const val semver = "0.9.0"
|
||||
const val slf4j = "1.7.30"
|
||||
}
|
||||
|
||||
@@ -151,6 +152,7 @@ object Libraries {
|
||||
const val slf4jNop = "org.slf4j:slf4j-nop:${Versions.slf4j}"
|
||||
const val slf4jSimple = "org.slf4j:slf4j-simple:${Versions.slf4j}"
|
||||
const val sentry = "io.sentry:sentry:${Versions.sentry}"
|
||||
const val semver = "com.github.zafarkhaja:java-semver:${Versions.semver}"
|
||||
const val substance = "org.pushing-pixels:radiance-substance:${Versions.radiance}"
|
||||
const val trident = "org.pushing-pixels:radiance-trident:${Versions.radiance}"
|
||||
const val vanilla = "net.runelite.rs:vanilla:${ProjectVersions.rsversion}"
|
||||
|
||||
@@ -66,6 +66,7 @@ dependencies {
|
||||
implementation(Libraries.jooqCodegen)
|
||||
implementation(Libraries.jooqMeta)
|
||||
implementation(Libraries.sentry)
|
||||
implementation(Libraries.semver)
|
||||
implementation(Libraries.slf4jApi)
|
||||
implementation(Libraries.pf4j) {
|
||||
exclude(group = "org.slf4j")
|
||||
@@ -105,16 +106,8 @@ fun formatDate(date: Date?) = with(date ?: Date()) {
|
||||
SimpleDateFormat("MM-dd-yyyy").format(this)
|
||||
}
|
||||
|
||||
fun launcherVersion(): String {
|
||||
if (project.hasProperty("releaseBuild")) {
|
||||
return ProjectVersions.launcherVersion
|
||||
}
|
||||
return "-1"
|
||||
}
|
||||
|
||||
fun pluginPath(): String {
|
||||
if (project.hasProperty("pluginPath")) {
|
||||
print(project.property("pluginPath").toString())
|
||||
return project.property("pluginPath").toString()
|
||||
}
|
||||
return ""
|
||||
@@ -135,7 +128,6 @@ tasks {
|
||||
"rs.version" to ProjectVersions.rsversion.toString(),
|
||||
"open.osrs.version" to ProjectVersions.openosrsVersion,
|
||||
"open.osrs.builddate" to formatDate(Date()),
|
||||
"launcher.version" to launcherVersion(),
|
||||
"plugin.path" to pluginPath()
|
||||
)
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ import net.runelite.client.callback.Hooks;
|
||||
import net.runelite.client.chat.ChatMessageManager;
|
||||
import net.runelite.client.config.ChatColorConfig;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.config.LauncherConfig;
|
||||
import net.runelite.client.config.OpenOSRSConfig;
|
||||
import net.runelite.client.config.RuneLiteConfig;
|
||||
import net.runelite.client.eventbus.EventBus;
|
||||
@@ -132,4 +133,11 @@ public class RuneLiteModule extends AbstractModule
|
||||
{
|
||||
return configManager.getConfig(ChatColorConfig.class);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
LauncherConfig provideLauncherConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(LauncherConfig.class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,8 +136,7 @@ public class RuneLiteProperties
|
||||
@Nullable
|
||||
public static String getLauncherVersion()
|
||||
{
|
||||
String launcherVersion = properties.getProperty(LAUNCHER_VERSION_PROPERTY);
|
||||
return launcherVersion.equals("-1") ? null : launcherVersion;
|
||||
return System.getProperty(LAUNCHER_VERSION_PROPERTY);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -0,0 +1,174 @@
|
||||
/*
|
||||
* Copyright (c) 2019 Owain van Brakel <https://github.com/Owain94>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package net.runelite.client.config;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@ConfigGroup("openosrs")
|
||||
public interface LauncherConfig extends Config
|
||||
{
|
||||
@Getter(AccessLevel.PRIVATE)
|
||||
@AllArgsConstructor
|
||||
enum BootstrapMode
|
||||
{
|
||||
STABLE("Stable"),
|
||||
NIGHTLY("Nightly");
|
||||
|
||||
private String name;
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return getName();
|
||||
}
|
||||
}
|
||||
|
||||
@ConfigTitleSection(
|
||||
keyName = "launcherTitle",
|
||||
name = "Launcher",
|
||||
description = "",
|
||||
position = -1
|
||||
)
|
||||
default Title launcherTitle()
|
||||
{
|
||||
return new Title();
|
||||
}
|
||||
|
||||
@ConfigTitleSection(
|
||||
keyName = "updateChannelTitle",
|
||||
name = "Update channel",
|
||||
description = "",
|
||||
position = 1,
|
||||
titleSection = "launcherTitle"
|
||||
)
|
||||
default Title updateChannelTitle()
|
||||
{
|
||||
return new Title();
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 2,
|
||||
keyName = "askMode",
|
||||
name = "Prompt for update channel",
|
||||
description = "Ask for nightly or stable every startup",
|
||||
titleSection = "updateChannelTitle"
|
||||
)
|
||||
default boolean askMode()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "bootstrapMode",
|
||||
name = "Update channel",
|
||||
description = "Select the update channel",
|
||||
titleSection = "updateChannelTitle",
|
||||
position = 3,
|
||||
hide = "askMode"
|
||||
)
|
||||
default BootstrapMode bootstrapMode()
|
||||
{
|
||||
return BootstrapMode.STABLE;
|
||||
}
|
||||
|
||||
@ConfigTitleSection(
|
||||
keyName = "miscLauncherTitle",
|
||||
name = "Miscellaneous",
|
||||
description = "",
|
||||
position = 4,
|
||||
titleSection = "launcherTitle"
|
||||
)
|
||||
default Title miscLauncherTitle()
|
||||
{
|
||||
return new Title();
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 5,
|
||||
keyName = "disableHw",
|
||||
name = "Disable hardware acceleration",
|
||||
description = "Enable this if you have graphical issues",
|
||||
titleSection = "miscLauncherTitle",
|
||||
warning = "Toggling this setting requires a restart of the client"
|
||||
)
|
||||
default boolean disableHw()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigTitleSection(
|
||||
keyName = "advancedTitle",
|
||||
name = "Advanced",
|
||||
description = "",
|
||||
position = 6,
|
||||
titleSection = "launcherTitle"
|
||||
)
|
||||
default Title advancedTitle()
|
||||
{
|
||||
return new Title();
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 7,
|
||||
keyName = "noJvm",
|
||||
name = "Use system java (caution!)",
|
||||
description = "Enable this if you want to make use of the system java version instead of the launcher bundled version",
|
||||
titleSection = "advancedTitle",
|
||||
warning = "Toggling this setting requires a restart of the client"
|
||||
)
|
||||
default boolean noJvm()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 8,
|
||||
keyName = "useProxy",
|
||||
name = "Use SOCKS5 proxy",
|
||||
description = "Enable the client to use a proxy",
|
||||
titleSection = "advancedTitle",
|
||||
warning = "Toggling this setting requires a restart of the client"
|
||||
)
|
||||
default boolean useProxy()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "proxyDetails",
|
||||
name = "Proxy details",
|
||||
description = "The format for this field is ip:port or ip:port:user:pass",
|
||||
titleSection = "advancedTitle",
|
||||
position = 9,
|
||||
hidden = true,
|
||||
unhide = "useProxy"
|
||||
)
|
||||
default String proxyDetails()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@@ -24,13 +24,16 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.config;
|
||||
|
||||
import com.github.zafarkhaja.semver.Version;
|
||||
import java.awt.image.BufferedImage;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Provider;
|
||||
import javax.swing.SwingUtilities;
|
||||
import net.runelite.api.MenuOpcode;
|
||||
import net.runelite.client.RuneLiteProperties;
|
||||
import net.runelite.client.config.ChatColorConfig;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.config.LauncherConfig;
|
||||
import net.runelite.client.config.OpenOSRSConfig;
|
||||
import net.runelite.client.config.RuneLiteConfig;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
@@ -69,6 +72,9 @@ public class ConfigPlugin extends Plugin
|
||||
@Inject
|
||||
private ChatColorConfig chatColorConfig;
|
||||
|
||||
@Inject
|
||||
private LauncherConfig launcherConfig;
|
||||
|
||||
private PluginListPanel pluginListPanel;
|
||||
|
||||
private NavigationButton navButton;
|
||||
@@ -92,6 +98,18 @@ public class ConfigPlugin extends Plugin
|
||||
"Chat Color", "Recolor chat text", PluginType.MISCELLANEOUS, new String[]{"colour", "messages"},
|
||||
null, chatColorConfig, configManager.getConfigDescriptor(chatColorConfig)
|
||||
));
|
||||
|
||||
// Support for this has been added in launcher version 2.2.0
|
||||
if (launcherVersion("2.2.0"))
|
||||
{
|
||||
pluginListPanel.addFakePlugin(
|
||||
new PluginConfigurationDescriptor(
|
||||
"Launcher", "Launcher settings", PluginType.IMPORTANT,
|
||||
new String[]{"hw", "nightly", "stable", "proxy", "bootstrap"},
|
||||
null, launcherConfig, configManager.getConfigDescriptor(launcherConfig)
|
||||
));
|
||||
}
|
||||
|
||||
pluginListPanel.rebuildPluginList();
|
||||
|
||||
final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "config_icon.png");
|
||||
@@ -137,4 +155,16 @@ public class ConfigPlugin extends Plugin
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private boolean launcherVersion(String version)
|
||||
{
|
||||
String launcherVersion = RuneLiteProperties.getLauncherVersion();
|
||||
|
||||
if (launcherVersion == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return Version.valueOf(launcherVersion).greaterThanOrEqualTo(Version.valueOf(version));
|
||||
}
|
||||
}
|
||||
@@ -79,11 +79,14 @@ class InfoPanel extends PluginPanel
|
||||
}
|
||||
|
||||
private JPanel syncPanel;
|
||||
|
||||
@Inject
|
||||
@Nullable
|
||||
private Client client;
|
||||
|
||||
@Inject
|
||||
private ConfigManager configManager;
|
||||
|
||||
@Inject
|
||||
private InfoPlugin plugin;
|
||||
|
||||
@@ -104,8 +107,11 @@ class InfoPanel extends PluginPanel
|
||||
JLabel version = new JLabel(htmlLabel("RuneLite version: ", RuneLiteProperties.getVersion()));
|
||||
version.setFont(smallFont);
|
||||
|
||||
JLabel plusVersion = new JLabel(htmlLabel("OpenOSRS version: ", RuneLiteProperties.getPlusVersion()));
|
||||
plusVersion.setFont(smallFont);
|
||||
JLabel openOsrsVersion = new JLabel(htmlLabel("OpenOSRS version: ", RuneLiteProperties.getPlusVersion()));
|
||||
openOsrsVersion.setFont(smallFont);
|
||||
|
||||
JLabel launcherVersion = new JLabel(htmlLabel("Launcher version: ", RuneLiteProperties.getLauncherVersion()));
|
||||
launcherVersion.setFont(smallFont);
|
||||
|
||||
JLabel revision = new JLabel();
|
||||
revision.setFont(smallFont);
|
||||
@@ -119,7 +125,8 @@ class InfoPanel extends PluginPanel
|
||||
revision.setText(htmlLabel("Oldschool revision: ", engineVer));
|
||||
|
||||
versionPanel.add(version);
|
||||
versionPanel.add(plusVersion);
|
||||
versionPanel.add(openOsrsVersion);
|
||||
versionPanel.add(launcherVersion);
|
||||
versionPanel.add(revision);
|
||||
|
||||
JPanel actionsContainer = new JPanel();
|
||||
|
||||
@@ -11,6 +11,5 @@ open.osrs.builddate=@open.osrs.builddate@
|
||||
runelite.wiki.troubleshooting.link=https://github.com/open-osrs/runelite/wiki/Troubleshooting-problems-with-the-client
|
||||
runelite.wiki.building.link=https://github.com/open-osrs/runelite/wiki/Building-with-IntelliJ-IDEA
|
||||
runelite.dnschange.link=https://1.1.1.1/dns/
|
||||
launcher.version=@launcher.version@
|
||||
plugin.path=@plugin.path@
|
||||
runelite.imgur.client.id=30d71e5f6860809
|
||||
|
||||
Reference in New Issue
Block a user