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");
|
this.notifyIconPath = RuneLite.RUNELITE_DIR.toPath().resolve("icon.png");
|
||||||
|
|
||||||
// First check if we are running in launcher
|
// First check if we are running in launcher
|
||||||
this.terminalNotifierAvailable =
|
this.terminalNotifierAvailable = true;
|
||||||
!Strings.isNullOrEmpty(RuneLiteProperties.getLauncherVersion())
|
|
||||||
&& isTerminalNotifierAvailable();
|
|
||||||
|
|
||||||
storeIcon();
|
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.tooltip.TooltipOverlay;
|
||||||
import net.runelite.client.ui.overlay.worldmap.WorldMapOverlay;
|
import net.runelite.client.ui.overlay.worldmap.WorldMapOverlay;
|
||||||
import net.runelite.client.ws.PartyService;
|
import net.runelite.client.ws.PartyService;
|
||||||
|
import net.runelite.http.api.RuneLiteAPI;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class RuneLite
|
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 RUNELITE_DIR = new File(System.getProperty("user.home"), ".runelite");
|
||||||
public static final File PROFILES_DIR = new File(RUNELITE_DIR, "profiles");
|
public static final File PROFILES_DIR = new File(RUNELITE_DIR, "profiles");
|
||||||
public static final File PLUGIN_DIR = new File(RUNELITE_DIR, "plugins");
|
public static final File PLUGIN_DIR = new File(RUNELITE_DIR, "plugins");
|
||||||
|
|||||||
@@ -32,23 +32,12 @@ import javax.inject.Inject;
|
|||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.runelite.client.config.RuneLitePlusConfig;
|
import net.runelite.client.config.RuneLitePlusConfig;
|
||||||
|
import net.runelite.http.api.RuneLiteAPI;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class RuneLiteProperties
|
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 Properties properties = new Properties();
|
||||||
|
|
||||||
private final RuneLitePlusConfig runeLitePlusConfig;
|
private final RuneLitePlusConfig runeLitePlusConfig;
|
||||||
@@ -57,33 +46,16 @@ public class RuneLiteProperties
|
|||||||
public RuneLiteProperties(final RuneLitePlusConfig runeLiteConfig)
|
public RuneLiteProperties(final RuneLitePlusConfig runeLiteConfig)
|
||||||
{
|
{
|
||||||
this.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()
|
public RuneLiteProperties()
|
||||||
{
|
{
|
||||||
runeLitePlusConfig = null;
|
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()
|
public String getTitle()
|
||||||
{
|
{
|
||||||
final StringBuilder sb = new StringBuilder(properties.getProperty(RUNELITE_TITLE));
|
final StringBuilder sb = new StringBuilder("RuneLitePlus");
|
||||||
String proxy;
|
String proxy;
|
||||||
if ((proxy = System.getProperty("socksProxyHost")) != null)
|
if ((proxy = System.getProperty("socksProxyHost")) != null)
|
||||||
{
|
{
|
||||||
@@ -94,59 +66,41 @@ public class RuneLiteProperties
|
|||||||
|
|
||||||
public String getVersion()
|
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()
|
public String getRunescapeVersion()
|
||||||
{
|
{
|
||||||
return properties.getProperty(RUNESCAPE_VERSION);
|
return "" + RuneLiteAPI.getRsVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDiscordAppId()
|
public String getDiscordAppId()
|
||||||
{
|
{
|
||||||
if (this.runeLitePlusConfig == null)
|
return "560644885250572289";
|
||||||
{
|
|
||||||
return properties.getProperty(DISCORD_APP_ID);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.runeLitePlusConfig.customPresence())
|
|
||||||
{
|
|
||||||
return properties.getProperty(DISCORD_APP_ID_PLUS);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return properties.getProperty(DISCORD_APP_ID);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDiscordInvite()
|
public String getDiscordInvite()
|
||||||
{
|
{
|
||||||
return properties.getProperty(DISCORD_INVITE);
|
return "https://discord.gg/HN5gf3m";
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getGithubLink()
|
public String getGithubLink()
|
||||||
{
|
{
|
||||||
return properties.getProperty(GITHUB_LINK);
|
return "https://github.com/runelite-extended/runelite";
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getWikiLink()
|
public String getWikiLink()
|
||||||
{
|
{
|
||||||
return properties.getProperty(WIKI_LINK);
|
return "https://github.com/runelite-extended/runelite/wiki";
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPatreonLink()
|
public String getPatreonLink()
|
||||||
{
|
{
|
||||||
return properties.getProperty(PATREON_LINK);
|
return "https://www.patreon.com/RuneLitePlus";
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
public static String getLauncherVersion()
|
|
||||||
{
|
|
||||||
return System.getProperty(LAUNCHER_VERSION_PROPERTY);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,6 @@
|
|||||||
*/
|
*/
|
||||||
package net.runelite.client.plugins.info;
|
package net.runelite.client.plugins.info;
|
||||||
|
|
||||||
import com.google.common.base.MoreObjects;
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import java.awt.BorderLayout;
|
import java.awt.BorderLayout;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
@@ -123,6 +122,9 @@ public class InfoPanel extends PluginPanel
|
|||||||
JLabel version = new JLabel(htmlLabel("RuneLite version: ", runeLiteProperties.getVersion()));
|
JLabel version = new JLabel(htmlLabel("RuneLite version: ", runeLiteProperties.getVersion()));
|
||||||
version.setFont(smallFont);
|
version.setFont(smallFont);
|
||||||
|
|
||||||
|
JLabel plusVersion = new JLabel(htmlLabel("RuneLitePlus version: ", runeLiteProperties.getPlusVersion()));
|
||||||
|
version.setFont(smallFont);
|
||||||
|
|
||||||
JLabel revision = new JLabel();
|
JLabel revision = new JLabel();
|
||||||
revision.setFont(smallFont);
|
revision.setFont(smallFont);
|
||||||
|
|
||||||
@@ -134,10 +136,6 @@ public class InfoPanel extends PluginPanel
|
|||||||
|
|
||||||
revision.setText(htmlLabel("Oldschool revision: ", engineVer));
|
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.setForeground(ColorScheme.LIGHT_GRAY_COLOR);
|
||||||
loggedLabel.setFont(smallFont);
|
loggedLabel.setFont(smallFont);
|
||||||
|
|
||||||
@@ -153,8 +151,8 @@ public class InfoPanel extends PluginPanel
|
|||||||
});
|
});
|
||||||
|
|
||||||
versionPanel.add(version);
|
versionPanel.add(version);
|
||||||
|
versionPanel.add(plusVersion);
|
||||||
versionPanel.add(revision);
|
versionPanel.add(revision);
|
||||||
versionPanel.add(launcher);
|
|
||||||
versionPanel.add(Box.createGlue());
|
versionPanel.add(Box.createGlue());
|
||||||
versionPanel.add(loggedLabel);
|
versionPanel.add(loggedLabel);
|
||||||
versionPanel.add(emailLabel);
|
versionPanel.add(emailLabel);
|
||||||
|
|||||||
@@ -94,10 +94,6 @@ class PvpToolsPanel extends PluginPanel
|
|||||||
|
|
||||||
revision.setText("Oldschool revision: ");
|
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.setForeground(ColorScheme.LIGHT_GRAY_COLOR);
|
||||||
loggedLabel.setFont(smallFont);
|
loggedLabel.setFont(smallFont);
|
||||||
|
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ public class RuneLiteSplashScreen
|
|||||||
panel.add(version, versionConstraints);
|
panel.add(version, versionConstraints);
|
||||||
|
|
||||||
// version
|
// 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.setForeground(Color.GREEN);
|
||||||
litVersion.setFont(FontManager.getRunescapeSmallFont());
|
litVersion.setFont(FontManager.getRunescapeSmallFont());
|
||||||
litVersion.setForeground(litVersion.getForeground().darker());
|
litVersion.setForeground(litVersion.getForeground().darker());
|
||||||
|
|||||||
Reference in New Issue
Block a user