runeliteplus: implement properties in java, fix calls to properties
This commit is contained in:
@@ -102,9 +102,7 @@ public class Notifier
|
||||
this.notifyIconPath = RuneLite.RUNELITE_DIR.toPath().resolve("icon.png");
|
||||
|
||||
// First check if we are running in launcher
|
||||
this.terminalNotifierAvailable =
|
||||
!Strings.isNullOrEmpty(RuneLiteProperties.getLauncherVersion())
|
||||
&& isTerminalNotifierAvailable();
|
||||
this.terminalNotifierAvailable = true;
|
||||
|
||||
storeIcon();
|
||||
}
|
||||
|
||||
@@ -76,13 +76,14 @@ import net.runelite.client.ui.overlay.infobox.InfoBoxOverlay;
|
||||
import net.runelite.client.ui.overlay.tooltip.TooltipOverlay;
|
||||
import net.runelite.client.ui.overlay.worldmap.WorldMapOverlay;
|
||||
import net.runelite.client.ws.PartyService;
|
||||
import net.runelite.http.api.RuneLiteAPI;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@Singleton
|
||||
@Slf4j
|
||||
public class RuneLite
|
||||
{
|
||||
public static final String RUNELIT_VERSION = "2.0.5-2";
|
||||
public static final String PLUS_VERSION = "2.1.0.0";
|
||||
public static final File RUNELITE_DIR = new File(System.getProperty("user.home"), ".runelite");
|
||||
public static final File PROFILES_DIR = new File(RUNELITE_DIR, "profiles");
|
||||
public static final File PLUGIN_DIR = new File(RUNELITE_DIR, "plugins");
|
||||
|
||||
@@ -32,23 +32,12 @@ import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.client.config.RuneLitePlusConfig;
|
||||
import net.runelite.http.api.RuneLiteAPI;
|
||||
|
||||
@Singleton
|
||||
@Slf4j
|
||||
public class RuneLiteProperties
|
||||
{
|
||||
private static final String RUNELITE_TITLE = "runelite.title";
|
||||
private static final String RUNELITE_VERSION = "runelite.version";
|
||||
private static final String RUNELIT_VERSION = "runelit.version";
|
||||
private static final String RUNESCAPE_VERSION = "runescape.version";
|
||||
private static final String DISCORD_APP_ID = "runelite.discord.appid";
|
||||
private static final String DISCORD_APP_ID_PLUS = "runelite.plus.discord.appid";
|
||||
private static final String DISCORD_INVITE = "runelite.discord.invite";
|
||||
private static final String GITHUB_LINK = "runelite.github.link";
|
||||
private static final String WIKI_LINK = "runelite.wiki.link";
|
||||
private static final String PATREON_LINK = "runelite.patreon.link";
|
||||
private static final String LAUNCHER_VERSION_PROPERTY = "runelite.launcher.version";
|
||||
|
||||
private final Properties properties = new Properties();
|
||||
|
||||
private final RuneLitePlusConfig runeLitePlusConfig;
|
||||
@@ -57,33 +46,16 @@ public class RuneLiteProperties
|
||||
public RuneLiteProperties(final RuneLitePlusConfig runeLiteConfig)
|
||||
{
|
||||
this.runeLitePlusConfig = runeLiteConfig;
|
||||
|
||||
try (InputStream in = getClass().getResourceAsStream("runelite.properties"))
|
||||
{
|
||||
properties.load(in);
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
log.warn("unable to load propertries", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public RuneLiteProperties()
|
||||
{
|
||||
runeLitePlusConfig = null;
|
||||
try (InputStream in = getClass().getResourceAsStream("runelite.properties"))
|
||||
{
|
||||
properties.load(in);
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
log.warn("unable to load propertries", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public String getTitle()
|
||||
{
|
||||
final StringBuilder sb = new StringBuilder(properties.getProperty(RUNELITE_TITLE));
|
||||
final StringBuilder sb = new StringBuilder("RuneLitePlus");
|
||||
String proxy;
|
||||
if ((proxy = System.getProperty("socksProxyHost")) != null)
|
||||
{
|
||||
@@ -94,59 +66,41 @@ public class RuneLiteProperties
|
||||
|
||||
public String getVersion()
|
||||
{
|
||||
return properties.getProperty(RUNELITE_VERSION);
|
||||
return RuneLiteAPI.getVersion();
|
||||
}
|
||||
|
||||
public String getRunelitVersion()
|
||||
public String getPlusVersion()
|
||||
{
|
||||
return properties.getProperty(RUNELIT_VERSION);
|
||||
return RuneLite.PLUS_VERSION;
|
||||
}
|
||||
|
||||
public String getRunescapeVersion()
|
||||
{
|
||||
return properties.getProperty(RUNESCAPE_VERSION);
|
||||
return "" + RuneLiteAPI.getRsVersion();
|
||||
}
|
||||
|
||||
public String getDiscordAppId()
|
||||
{
|
||||
if (this.runeLitePlusConfig == null)
|
||||
{
|
||||
return properties.getProperty(DISCORD_APP_ID);
|
||||
}
|
||||
|
||||
if (this.runeLitePlusConfig.customPresence())
|
||||
{
|
||||
return properties.getProperty(DISCORD_APP_ID_PLUS);
|
||||
}
|
||||
else
|
||||
{
|
||||
return properties.getProperty(DISCORD_APP_ID);
|
||||
}
|
||||
return "560644885250572289";
|
||||
}
|
||||
|
||||
public String getDiscordInvite()
|
||||
{
|
||||
return properties.getProperty(DISCORD_INVITE);
|
||||
return "https://discord.gg/HN5gf3m";
|
||||
}
|
||||
|
||||
public String getGithubLink()
|
||||
{
|
||||
return properties.getProperty(GITHUB_LINK);
|
||||
return "https://github.com/runelite-extended/runelite";
|
||||
}
|
||||
|
||||
public String getWikiLink()
|
||||
{
|
||||
return properties.getProperty(WIKI_LINK);
|
||||
return "https://github.com/runelite-extended/runelite/wiki";
|
||||
}
|
||||
|
||||
public String getPatreonLink()
|
||||
{
|
||||
return properties.getProperty(PATREON_LINK);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static String getLauncherVersion()
|
||||
{
|
||||
return System.getProperty(LAUNCHER_VERSION_PROPERTY);
|
||||
return "https://www.patreon.com/RuneLitePlus";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.info;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
import com.google.inject.Inject;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
@@ -123,6 +122,9 @@ public class InfoPanel extends PluginPanel
|
||||
JLabel version = new JLabel(htmlLabel("RuneLite version: ", runeLiteProperties.getVersion()));
|
||||
version.setFont(smallFont);
|
||||
|
||||
JLabel plusVersion = new JLabel(htmlLabel("RuneLitePlus version: ", runeLiteProperties.getPlusVersion()));
|
||||
version.setFont(smallFont);
|
||||
|
||||
JLabel revision = new JLabel();
|
||||
revision.setFont(smallFont);
|
||||
|
||||
@@ -134,10 +136,6 @@ public class InfoPanel extends PluginPanel
|
||||
|
||||
revision.setText(htmlLabel("Oldschool revision: ", engineVer));
|
||||
|
||||
JLabel launcher = new JLabel(htmlLabel("Launcher version: ", MoreObjects
|
||||
.firstNonNull(RuneLiteProperties.getLauncherVersion(), "Unknown")));
|
||||
launcher.setFont(smallFont);
|
||||
|
||||
loggedLabel.setForeground(ColorScheme.LIGHT_GRAY_COLOR);
|
||||
loggedLabel.setFont(smallFont);
|
||||
|
||||
@@ -153,8 +151,8 @@ public class InfoPanel extends PluginPanel
|
||||
});
|
||||
|
||||
versionPanel.add(version);
|
||||
versionPanel.add(plusVersion);
|
||||
versionPanel.add(revision);
|
||||
versionPanel.add(launcher);
|
||||
versionPanel.add(Box.createGlue());
|
||||
versionPanel.add(loggedLabel);
|
||||
versionPanel.add(emailLabel);
|
||||
|
||||
@@ -94,10 +94,6 @@ class PvpToolsPanel extends PluginPanel
|
||||
|
||||
revision.setText("Oldschool revision: ");
|
||||
|
||||
JLabel launcher = new JLabel(htmlLabel("Launcher version: ", MoreObjects
|
||||
.firstNonNull(RuneLiteProperties.getLauncherVersion(), "Unknown")));
|
||||
launcher.setFont(smallFont);
|
||||
|
||||
loggedLabel.setForeground(ColorScheme.LIGHT_GRAY_COLOR);
|
||||
loggedLabel.setFont(smallFont);
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@ public class RuneLiteSplashScreen
|
||||
panel.add(version, versionConstraints);
|
||||
|
||||
// version
|
||||
final JLabel litVersion = new JLabel("Plus Version : " + RuneLite.RUNELIT_VERSION);
|
||||
final JLabel litVersion = new JLabel("Plus Version : " + RuneLite.PLUS_VERSION);
|
||||
litVersion.setForeground(Color.GREEN);
|
||||
litVersion.setFont(FontManager.getRunescapeSmallFont());
|
||||
litVersion.setForeground(litVersion.getForeground().darker());
|
||||
|
||||
Reference in New Issue
Block a user