'Globalize' RL+ config (#908)

* Fix tabs in Runelite config

* Move RL+ config

* Move some items to runelite.properties

* 'Globalize' RL+ config

* Move enabling external plugins to RL+ config

* Fix default presence

* Fix master branch errors

* Fix guicing in test

* Remove non final discordAppID
This commit is contained in:
sdburns1998
2019-07-06 16:38:57 +02:00
committed by Lucwousin
parent 1c5502401e
commit f8003f1d03
14 changed files with 212 additions and 202 deletions

View File

@@ -41,6 +41,7 @@ import net.runelite.client.chat.ChatMessageManager;
import net.runelite.client.config.ChatColorConfig; import net.runelite.client.config.ChatColorConfig;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.config.RuneLiteConfig; import net.runelite.client.config.RuneLiteConfig;
import net.runelite.client.config.RuneLitePlusConfig;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.EventBus;
import net.runelite.client.game.ItemManager; import net.runelite.client.game.ItemManager;
import net.runelite.client.menus.MenuManager; import net.runelite.client.menus.MenuManager;
@@ -117,6 +118,13 @@ public class RuneLiteModule extends AbstractModule
return configManager.getConfig(RuneLiteConfig.class); return configManager.getConfig(RuneLiteConfig.class);
} }
@Provides
@Singleton
RuneLitePlusConfig providePlusConfig(ConfigManager configManager)
{
return configManager.getConfig(RuneLitePlusConfig.class);
}
@Provides @Provides
@Singleton @Singleton
ChatColorConfig provideChatColorConfig(ConfigManager configManager) ChatColorConfig provideChatColorConfig(ConfigManager configManager)

View File

@@ -31,17 +31,18 @@ import javax.annotation.Nullable;
import javax.inject.Inject; 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.plugins.runeliteplus.RuneLitePlusPlugin; import net.runelite.client.config.RuneLitePlusConfig;
@Singleton @Singleton
@Slf4j @Slf4j
public class RuneLiteProperties public class RuneLiteProperties
{ {
public static String discordAppID = "409416265891971072";
private static final String RUNELITE_TITLE = "runelite.title"; private static final String RUNELITE_TITLE = "runelite.title";
private static final String RUNELITE_VERSION = "runelite.version"; 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 RUNESCAPE_VERSION = "runescape.version";
private static final String DISCORD_APP_ID = "runelite.discord.appid"; 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 DISCORD_INVITE = "runelite.discord.invite";
private static final String GITHUB_LINK = "runelite.github.link"; private static final String GITHUB_LINK = "runelite.github.link";
private static final String WIKI_LINK = "runelite.wiki.link"; private static final String WIKI_LINK = "runelite.wiki.link";
@@ -50,9 +51,26 @@ public class RuneLiteProperties
private final Properties properties = new Properties(); private final Properties properties = new Properties();
private final RuneLitePlusConfig runeLitePlusConfig;
@Inject @Inject
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() public RuneLiteProperties()
{ {
runeLitePlusConfig = null;
try (InputStream in = getClass().getResourceAsStream("runelite.properties")) try (InputStream in = getClass().getResourceAsStream("runelite.properties"))
{ {
properties.load(in); properties.load(in);
@@ -79,6 +97,11 @@ public class RuneLiteProperties
return properties.getProperty(RUNELITE_VERSION); return properties.getProperty(RUNELITE_VERSION);
} }
public String getRunelitVersion()
{
return properties.getProperty(RUNELIT_VERSION);
}
public String getRunescapeVersion() public String getRunescapeVersion()
{ {
return properties.getProperty(RUNESCAPE_VERSION); return properties.getProperty(RUNESCAPE_VERSION);
@@ -86,9 +109,14 @@ public class RuneLiteProperties
public String getDiscordAppId() public String getDiscordAppId()
{ {
if (RuneLitePlusPlugin.customPresenceEnabled) if (this.runeLitePlusConfig == null)
{ {
return properties.getProperty(RuneLitePlusPlugin.rlPlusDiscordApp); return properties.getProperty(DISCORD_APP_ID);
}
if (this.runeLitePlusConfig.customPresence())
{
return properties.getProperty(DISCORD_APP_ID_PLUS);
} }
else else
{ {

View File

@@ -33,10 +33,10 @@ import net.runelite.client.ui.FontManager;
public interface RuneLiteConfig extends Config public interface RuneLiteConfig extends Config
{ {
@ConfigItem( @ConfigItem(
keyName = "gameSize", keyName = "gameSize",
name = "Game size", name = "Game size",
description = "The game will resize to this resolution upon starting the client", description = "The game will resize to this resolution upon starting the client",
position = 10 position = 10
) )
default Dimension gameSize() default Dimension gameSize()
{ {
@@ -44,10 +44,10 @@ public interface RuneLiteConfig extends Config
} }
@ConfigItem( @ConfigItem(
keyName = "automaticResizeType", keyName = "automaticResizeType",
name = "Resize type", name = "Resize type",
description = "Choose how the window should resize when opening and closing panels", description = "Choose how the window should resize when opening and closing panels",
position = 11 position = 11
) )
default ExpandResizeType automaticResizeType() default ExpandResizeType automaticResizeType()
{ {
@@ -55,10 +55,10 @@ public interface RuneLiteConfig extends Config
} }
@ConfigItem( @ConfigItem(
keyName = "lockWindowSize", keyName = "lockWindowSize",
name = "Lock window size", name = "Lock window size",
description = "Determines if the window resizing is allowed or not", description = "Determines if the window resizing is allowed or not",
position = 12 position = 12
) )
default boolean lockWindowSize() default boolean lockWindowSize()
{ {
@@ -66,21 +66,10 @@ public interface RuneLiteConfig extends Config
} }
@ConfigItem( @ConfigItem(
keyName = "enablePlugins", keyName = "containInScreen",
name = "Enable loading of external plugins", name = "Contain in screen",
description = "Enable loading of external plugins", description = "Makes the client stay contained in the screen when attempted to move out of it.<br>Note: Only works if custom chrome is enabled.",
position = 10 position = 13
)
default boolean enablePlugins()
{
return false;
}
@ConfigItem(
keyName = "containInScreen",
name = "Contain in screen",
description = "Makes the client stay contained in the screen when attempted to move out of it.<br>Note: Only works if custom chrome is enabled.",
position = 13
) )
default boolean containInScreen() default boolean containInScreen()
{ {
@@ -88,10 +77,10 @@ public interface RuneLiteConfig extends Config
} }
@ConfigItem( @ConfigItem(
keyName = "rememberScreenBounds", keyName = "rememberScreenBounds",
name = "Remember client position", name = "Remember client position",
description = "Save the position and size of the client after exiting", description = "Save the position and size of the client after exiting",
position = 14 position = 14
) )
default boolean rememberScreenBounds() default boolean rememberScreenBounds()
{ {
@@ -99,11 +88,11 @@ public interface RuneLiteConfig extends Config
} }
@ConfigItem( @ConfigItem(
keyName = "uiEnableCustomChrome", keyName = "uiEnableCustomChrome",
name = "Enable custom window chrome", name = "Enable custom window chrome",
description = "Use Runelite's custom window title and borders.", description = "Use Runelite's custom window title and borders.",
warning = "Please restart your client after changing this setting", warning = "Please restart your client after changing this setting",
position = 15 position = 15
) )
default boolean enableCustomChrome() default boolean enableCustomChrome()
{ {
@@ -111,10 +100,10 @@ public interface RuneLiteConfig extends Config
} }
@ConfigItem( @ConfigItem(
keyName = "gameAlwaysOnTop", keyName = "gameAlwaysOnTop",
name = "Enable client always on top", name = "Enable client always on top",
description = "The game will always be on the top of the screen", description = "The game will always be on the top of the screen",
position = 16 position = 16
) )
default boolean gameAlwaysOnTop() default boolean gameAlwaysOnTop()
{ {
@@ -122,10 +111,10 @@ public interface RuneLiteConfig extends Config
} }
@ConfigItem( @ConfigItem(
keyName = "warningOnExit", keyName = "warningOnExit",
name = "Display warning on exit", name = "Display warning on exit",
description = "Toggles a warning popup when trying to exit the client", description = "Toggles a warning popup when trying to exit the client",
position = 17 position = 17
) )
default WarningOnExit warningOnExit() default WarningOnExit warningOnExit()
{ {
@@ -133,10 +122,10 @@ public interface RuneLiteConfig extends Config
} }
@ConfigItem( @ConfigItem(
keyName = "usernameInTitle", keyName = "usernameInTitle",
name = "Show display name in title", name = "Show display name in title",
description = "Toggles displaying of local player's display name in client title", description = "Toggles displaying of local player's display name in client title",
position = 18 position = 18
) )
default boolean usernameInTitle() default boolean usernameInTitle()
{ {
@@ -144,10 +133,10 @@ public interface RuneLiteConfig extends Config
} }
@ConfigItem( @ConfigItem(
keyName = "notificationTray", keyName = "notificationTray",
name = "Enable tray notifications", name = "Enable tray notifications",
description = "Enables tray notifications", description = "Enables tray notifications",
position = 20 position = 20
) )
default boolean enableTrayNotifications() default boolean enableTrayNotifications()
{ {
@@ -155,10 +144,10 @@ public interface RuneLiteConfig extends Config
} }
@ConfigItem( @ConfigItem(
keyName = "notificationRequestFocus", keyName = "notificationRequestFocus",
name = "Request focus on notification", name = "Request focus on notification",
description = "Toggles window focus request", description = "Toggles window focus request",
position = 21 position = 21
) )
default boolean requestFocusOnNotification() default boolean requestFocusOnNotification()
{ {
@@ -166,10 +155,10 @@ public interface RuneLiteConfig extends Config
} }
@ConfigItem( @ConfigItem(
keyName = "notificationSound", keyName = "notificationSound",
name = "Enable sound on notifications", name = "Enable sound on notifications",
description = "Enables the playing of a beep sound when notifications are displayed", description = "Enables the playing of a beep sound when notifications are displayed",
position = 22 position = 22
) )
default boolean enableNotificationSound() default boolean enableNotificationSound()
{ {
@@ -177,10 +166,10 @@ public interface RuneLiteConfig extends Config
} }
@ConfigItem( @ConfigItem(
keyName = "notificationGameMessage", keyName = "notificationGameMessage",
name = "Enable game message notifications", name = "Enable game message notifications",
description = "Puts a notification message in the chatbox", description = "Puts a notification message in the chatbox",
position = 23 position = 23
) )
default boolean enableGameMessageNotification() default boolean enableGameMessageNotification()
{ {
@@ -188,10 +177,10 @@ public interface RuneLiteConfig extends Config
} }
@ConfigItem( @ConfigItem(
keyName = "notificationFlash", keyName = "notificationFlash",
name = "Enable flash notification", name = "Enable flash notification",
description = "Flashes the game frame as a notification", description = "Flashes the game frame as a notification",
position = 24 position = 24
) )
default FlashNotification flashNotification() default FlashNotification flashNotification()
{ {
@@ -199,10 +188,10 @@ public interface RuneLiteConfig extends Config
} }
@ConfigItem( @ConfigItem(
keyName = "notificationFocused", keyName = "notificationFocused",
name = "Send notifications when focused", name = "Send notifications when focused",
description = "Toggles all notifications for when the client is focused", description = "Toggles all notifications for when the client is focused",
position = 25 position = 25
) )
default boolean sendNotificationsWhenFocused() default boolean sendNotificationsWhenFocused()
{ {
@@ -221,10 +210,10 @@ public interface RuneLiteConfig extends Config
} }
@ConfigItem( @ConfigItem(
keyName = "fontType", keyName = "fontType",
name = "Dynamic Overlay Font", name = "Dynamic Overlay Font",
description = "Configures what font type is used for in-game overlays such as player name, ground items, etc.", description = "Configures what font type is used for in-game overlays such as player name, ground items, etc.",
position = 30 position = 30
) )
default FontType fontType() default FontType fontType()
{ {
@@ -232,10 +221,10 @@ public interface RuneLiteConfig extends Config
} }
@ConfigItem( @ConfigItem(
keyName = "tooltipFontType", keyName = "tooltipFontType",
name = "Tooltip Font", name = "Tooltip Font",
description = "Configures what font type is used for in-game tooltips such as food stats, NPC names, etc.", description = "Configures what font type is used for in-game tooltips such as food stats, NPC names, etc.",
position = 31 position = 31
) )
default FontType tooltipFontType() default FontType tooltipFontType()
{ {
@@ -243,10 +232,10 @@ public interface RuneLiteConfig extends Config
} }
@ConfigItem( @ConfigItem(
keyName = "interfaceFontType", keyName = "interfaceFontType",
name = "Interface Overlay Font", name = "Interface Overlay Font",
description = "Configures what font type is used for in-game interface overlays such as panels, opponent info, clue scrolls etc.", description = "Configures what font type is used for in-game interface overlays such as panels, opponent info, clue scrolls etc.",
position = 32 position = 32
) )
default FontType interfaceFontType() default FontType interfaceFontType()
{ {
@@ -254,10 +243,10 @@ public interface RuneLiteConfig extends Config
} }
@ConfigItem( @ConfigItem(
keyName = "menuEntryShift", keyName = "menuEntryShift",
name = "Require Shift for overlay menu", name = "Require Shift for overlay menu",
description = "Overlay right-click menu will require shift to be added", description = "Overlay right-click menu will require shift to be added",
position = 33 position = 33
) )
default boolean menuEntryShift() default boolean menuEntryShift()
{ {
@@ -265,10 +254,10 @@ public interface RuneLiteConfig extends Config
} }
@ConfigItem( @ConfigItem(
keyName = "infoBoxVertical", keyName = "infoBoxVertical",
name = "Display infoboxes vertically", name = "Display infoboxes vertically",
description = "Toggles the infoboxes to display vertically", description = "Toggles the infoboxes to display vertically",
position = 40 position = 40
) )
default boolean infoBoxVertical() default boolean infoBoxVertical()
{ {
@@ -276,10 +265,10 @@ public interface RuneLiteConfig extends Config
} }
@ConfigItem( @ConfigItem(
keyName = "infoBoxWrap", keyName = "infoBoxWrap",
name = "Infobox wrap count", name = "Infobox wrap count",
description = "Configures the amount of infoboxes shown before wrapping", description = "Configures the amount of infoboxes shown before wrapping",
position = 41 position = 41
) )
default int infoBoxWrap() default int infoBoxWrap()
{ {
@@ -287,22 +276,22 @@ public interface RuneLiteConfig extends Config
} }
@ConfigItem( @ConfigItem(
keyName = "infoBoxSize", keyName = "infoBoxSize",
name = "Infobox size (px)", name = "Infobox size (px)",
description = "Configures the size of each infobox in pixels", description = "Configures the size of each infobox in pixels",
position = 42 position = 42
) )
default int infoBoxSize() default int infoBoxSize()
{ {
return 35; return 35;
} }
@Range( max = 100, min = 0 ) @Range(max = 100, min = 0)
@ConfigItem( @ConfigItem(
keyName = "volume", keyName = "volume",
name = "Runelite Volume", name = "Runelite Volume",
description = "Sets the volume of custom Runelite sounds (not the client sounds)", description = "Sets the volume of custom Runelite sounds (not the client sounds)",
position = 43 position = 43
) )
default int volume() default int volume()
{ {

View File

@@ -24,7 +24,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
package net.runelite.client.plugins.runeliteplus; package net.runelite.client.config;
import net.runelite.client.config.Config; import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup; import net.runelite.client.config.ConfigGroup;
@@ -81,4 +81,15 @@ public interface RuneLitePlusConfig extends Config
{ {
return false; return false;
} }
@ConfigItem(
keyName = "enablePlugins",
name = "Enable loading of external plugins",
description = "Enable loading of external plugins",
position = 10
)
default boolean enablePlugins()
{
return false;
}
} }

View File

@@ -106,7 +106,7 @@ public class DiscordService implements AutoCloseable
discordEventHandlers.joinGame = this::joinGame; discordEventHandlers.joinGame = this::joinGame;
discordEventHandlers.spectateGame = this::spectateGame; discordEventHandlers.spectateGame = this::spectateGame;
discordEventHandlers.joinRequest = this::joinRequest; discordEventHandlers.joinRequest = this::joinRequest;
discordRPC.Discord_Initialize(RuneLiteProperties.discordAppID, discordEventHandlers, true, null); discordRPC.Discord_Initialize(runeLiteProperties.getDiscordAppId(), discordEventHandlers, true, null);
executorService.scheduleAtFixedRate(discordRPC::Discord_RunCallbacks, 0, 2, TimeUnit.SECONDS); executorService.scheduleAtFixedRate(discordRPC::Discord_RunCallbacks, 0, 2, TimeUnit.SECONDS);
} }

View File

@@ -2,7 +2,6 @@ package net.runelite.client.plugins;
public enum PluginType public enum PluginType
{ {
RUNELITPLUS,
PVM, PVM,
PVP, PVP,
SKILLING, SKILLING,

View File

@@ -45,7 +45,7 @@ import lombok.extern.slf4j.Slf4j;
import net.runelite.client.RuneLite; import net.runelite.client.RuneLite;
import net.runelite.client.config.Config; import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.config.RuneLiteConfig; import net.runelite.client.config.RuneLitePlusConfig;
@Singleton @Singleton
@Slf4j @Slf4j
@@ -53,7 +53,7 @@ public class PluginWatcher extends Thread
{ {
private static final File BASE = RuneLite.PLUGIN_DIR; private static final File BASE = RuneLite.PLUGIN_DIR;
private final RuneLiteConfig runeliteConfig; private final RuneLitePlusConfig runelitePlusConfig;
private final PluginManager pluginManager; private final PluginManager pluginManager;
private final WatchService watchService; private final WatchService watchService;
private final WatchKey watchKey; private final WatchKey watchKey;
@@ -62,9 +62,9 @@ public class PluginWatcher extends Thread
private ConfigManager configManager; private ConfigManager configManager;
@Inject @Inject
public PluginWatcher(RuneLiteConfig runeliteConfig, PluginManager pluginManager) throws IOException public PluginWatcher(RuneLitePlusConfig runelitePlusConfig, PluginManager pluginManager) throws IOException
{ {
this.runeliteConfig = runeliteConfig; this.runelitePlusConfig = runelitePlusConfig;
this.pluginManager = pluginManager; this.pluginManager = pluginManager;
setName("Plugin Watcher"); setName("Plugin Watcher");
@@ -84,7 +84,7 @@ public class PluginWatcher extends Thread
@Override @Override
public void run() public void run()
{ {
if (runeliteConfig.enablePlugins()) if (runelitePlusConfig.enablePlugins())
{ {
scan(); scan();
} }
@@ -96,7 +96,7 @@ public class PluginWatcher extends Thread
WatchKey key = watchService.take(); WatchKey key = watchService.take();
Thread.sleep(50); Thread.sleep(50);
if (!runeliteConfig.enablePlugins()) if (!runelitePlusConfig.enablePlugins())
{ {
key.reset(); key.reset();
continue; continue;

View File

@@ -93,6 +93,7 @@ import net.runelite.client.config.Keybind;
import net.runelite.client.config.ModifierlessKeybind; import net.runelite.client.config.ModifierlessKeybind;
import net.runelite.client.config.Range; import net.runelite.client.config.Range;
import net.runelite.client.config.RuneLiteConfig; import net.runelite.client.config.RuneLiteConfig;
import net.runelite.client.config.RuneLitePlusConfig;
import net.runelite.client.config.Stub; import net.runelite.client.config.Stub;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
@@ -126,11 +127,13 @@ public class ConfigPanel extends PluginPanel
private static final String RUNELITE_GROUP_NAME = RuneLiteConfig.class.getAnnotation(ConfigGroup.class).value(); private static final String RUNELITE_GROUP_NAME = RuneLiteConfig.class.getAnnotation(ConfigGroup.class).value();
private static final String PINNED_PLUGINS_CONFIG_KEY = "pinnedPlugins"; private static final String PINNED_PLUGINS_CONFIG_KEY = "pinnedPlugins";
private static final String RUNELITE_PLUGIN = "RuneLite"; private static final String RUNELITE_PLUGIN = "RuneLite";
private static final String RUNELITEPLUS_PLUGIN = "RuneLitePlus";
private static final String CHAT_COLOR_PLUGIN = "Chat Color"; private static final String CHAT_COLOR_PLUGIN = "Chat Color";
private final PluginManager pluginManager; private final PluginManager pluginManager;
private final ConfigManager configManager; private final ConfigManager configManager;
private final ScheduledExecutorService executorService; private final ScheduledExecutorService executorService;
private final RuneLiteConfig runeLiteConfig; private final RuneLiteConfig runeLiteConfig;
private final RuneLitePlusConfig runeLitePlusConfig;
private final ChatColorConfig chatColorConfig; private final ChatColorConfig chatColorConfig;
public static List<PluginListItem> pluginList = new ArrayList<>(); public static List<PluginListItem> pluginList = new ArrayList<>();
@@ -150,13 +153,14 @@ public class ConfigPanel extends PluginPanel
} }
ConfigPanel(PluginManager pluginManager, ConfigManager configManager, ScheduledExecutorService executorService, ConfigPanel(PluginManager pluginManager, ConfigManager configManager, ScheduledExecutorService executorService,
RuneLiteConfig runeLiteConfig, ChatColorConfig chatColorConfig) RuneLiteConfig runeLiteConfig, RuneLitePlusConfig runeLitePlusConfig, ChatColorConfig chatColorConfig)
{ {
super(false); super(false);
this.pluginManager = pluginManager; this.pluginManager = pluginManager;
this.configManager = configManager; this.configManager = configManager;
this.executorService = executorService; this.executorService = executorService;
this.runeLiteConfig = runeLiteConfig; this.runeLiteConfig = runeLiteConfig;
this.runeLitePlusConfig = runeLitePlusConfig;
this.chatColorConfig = chatColorConfig; this.chatColorConfig = chatColorConfig;
searchBar.setIcon(IconTextField.Icon.SEARCH); searchBar.setIcon(IconTextField.Icon.SEARCH);
@@ -261,22 +265,13 @@ public class ConfigPanel extends PluginPanel
runeLite.nameLabel.setForeground(Color.WHITE); runeLite.nameLabel.setForeground(Color.WHITE);
pluginList.add(runeLite); pluginList.add(runeLite);
List<PluginListItem> runeLitePlus = new ArrayList<>(); // set RuneLitePlus config on top, as it should always have been
// populate pluginList with all external Plugins final PluginListItem runeLitePlus = new PluginListItem(this, configManager, runeLitePlusConfig,
pluginManager.getPlugins().stream() configManager.getConfigDescriptor(runeLitePlusConfig),
.filter(plugin -> plugin.getClass().getAnnotation(PluginDescriptor.class).type().equals(PluginType.RUNELITPLUS)) RUNELITEPLUS_PLUGIN, "RuneLitePlus client settings", "client");
.forEach(plugin -> runeLitePlus.setPinned(pinnedPlugins.contains(RUNELITEPLUS_PLUGIN));
{ runeLitePlus.nameLabel.setForeground(Color.WHITE);
final PluginDescriptor descriptor = plugin.getClass().getAnnotation(PluginDescriptor.class); pluginList.add(runeLitePlus);
final Config config = pluginManager.getPluginConfigProxy(plugin);
final ConfigDescriptor configDescriptor = config == null ? null : configManager.getConfigDescriptor(config);
final PluginListItem listItem = new PluginListItem(this, configManager, plugin, descriptor, config, configDescriptor);
listItem.setPinned(pinnedPlugins.contains(listItem.getName()));
runeLitePlus.add(listItem);
});
runeLitePlus.sort(Comparator.comparing(PluginListItem::getName));
pluginList.addAll(runeLitePlus);
List<PluginListItem> externalPlugins = new ArrayList<>(); List<PluginListItem> externalPlugins = new ArrayList<>();
// populate pluginList with all external Plugins // populate pluginList with all external Plugins
@@ -418,15 +413,18 @@ public class ConfigPanel extends PluginPanel
void refreshPluginList() void refreshPluginList()
{ {
// update enabled / disabled status of all items if (pluginManager != null)
pluginList.forEach(listItem ->
{ {
final Plugin plugin = listItem.getPlugin(); // update enabled / disabled status of all items
if (plugin != null) pluginList.forEach(listItem ->
{ {
listItem.setPluginEnabled(pluginManager.isPluginEnabled(plugin)); final Plugin plugin = listItem.getPlugin();
} if (plugin != null)
}); {
listItem.setPluginEnabled(pluginManager.isPluginEnabled(plugin));
}
});
}
if (showingPluginList) if (showingPluginList)
{ {

View File

@@ -33,6 +33,7 @@ import net.runelite.api.MenuAction;
import net.runelite.client.config.ChatColorConfig; import net.runelite.client.config.ChatColorConfig;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.config.RuneLiteConfig; import net.runelite.client.config.RuneLiteConfig;
import net.runelite.client.config.RuneLitePlusConfig;
import net.runelite.client.eventbus.Subscribe; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.OverlayMenuClicked; import net.runelite.client.events.OverlayMenuClicked;
import net.runelite.client.events.PluginChanged; import net.runelite.client.events.PluginChanged;
@@ -69,6 +70,9 @@ public class ConfigPlugin extends Plugin
@Inject @Inject
private RuneLiteConfig runeLiteConfig; private RuneLiteConfig runeLiteConfig;
@Inject
private RuneLitePlusConfig runeLitePlusConfig;
@Inject @Inject
private ChatColorConfig chatColorConfig; private ChatColorConfig chatColorConfig;
@@ -78,7 +82,7 @@ public class ConfigPlugin extends Plugin
@Override @Override
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
configPanel = new ConfigPanel(pluginManager, configManager, executorService, runeLiteConfig, chatColorConfig); configPanel = new ConfigPanel(pluginManager, configManager, executorService, runeLiteConfig, runeLitePlusConfig, chatColorConfig);
final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "config_icon.png"); final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "config_icon.png");

View File

@@ -177,9 +177,15 @@ public class PluginSorterPlugin extends Plugin
private void showPlugins() private void showPlugins()
{ {
List<PluginListItem> tempList = new ArrayList<>(); List<PluginListItem> tempList = new ArrayList<>(ConfigPanel.pluginList);
tempList.addAll(ConfigPanel.pluginList); if (tempList.size() > 0)
tempList.addAll(1, removedPlugins); {
tempList.addAll(1, removedPlugins);
}
else
{
tempList.addAll(removedPlugins);
}
ConfigPanel.pluginList = tempList; ConfigPanel.pluginList = tempList;
} }

View File

@@ -26,8 +26,6 @@
*/ */
package net.runelite.client.plugins.runeliteplus; package net.runelite.client.plugins.runeliteplus;
import com.google.inject.Provides;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import javax.inject.Inject; import javax.inject.Inject;
@@ -40,22 +38,19 @@ import net.runelite.api.widgets.WidgetID;
import net.runelite.api.widgets.WidgetInfo; import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.RuneLiteProperties; import net.runelite.client.RuneLiteProperties;
import net.runelite.client.callback.ClientThread; import net.runelite.client.callback.ClientThread;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.RuneLitePlusConfig;
import net.runelite.client.discord.DiscordService; import net.runelite.client.discord.DiscordService;
import net.runelite.client.eventbus.Subscribe; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.input.KeyListener; import net.runelite.client.input.KeyListener;
import net.runelite.client.input.KeyManager; import net.runelite.client.input.KeyManager;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.ui.ClientUI; import net.runelite.client.ui.ClientUI;
@PluginDescriptor( @PluginDescriptor(
loadWhenOutdated = true, // prevent users from disabling loadWhenOutdated = true, // prevent users from disabling
hidden = true, // prevent users from disabling hidden = true, // prevent users from disabling
name = "RuneLitePlus", name = "RunelitePlus"
description = "Configures various aspects of RuneLitePlus",
type = PluginType.RUNELITPLUS
) )
@Singleton @Singleton
@Slf4j @Slf4j
@@ -96,38 +91,14 @@ public class RuneLitePlusPlugin extends Plugin
} }
} }
/* Can't feed this as args to runscript? @Inject
private static final int[] widgetArgs = new int[] private RuneLiteProperties runeLiteProperties;
{
WidgetInfo.BANK_PIN_EXIT_BUTTON.getId(),
WidgetInfo.BANK_PIN_FORGOT_BUTTON.getId(),
WidgetInfo.BANK_PIN_1.getId(),
WidgetInfo.BANK_PIN_2.getId(),
WidgetInfo.BANK_PIN_3.getId(),
WidgetInfo.BANK_PIN_4.getId(),
WidgetInfo.BANK_PIN_5.getId(),
WidgetInfo.BANK_PIN_6.getId(),
WidgetInfo.BANK_PIN_7.getId(),
WidgetInfo.BANK_PIN_8.getId(),
WidgetInfo.BANK_PIN_9.getId(),
WidgetInfo.BANK_PIN_0.getId(),
WidgetInfo.BANK_PIN_EXIT_BUTTON.getId(),
WidgetInfo.BANK_PIN_FORGOT_BUTTON.getId(),
WidgetInfo.BANK_PIN_FIRST_ENTERED.getId(),
WidgetInfo.BANK_PIN_SECOND_ENTERED.getId(),
WidgetInfo.BANK_PIN_THIRD_ENTERED.getId(),
WidgetInfo.BANK_PIN_FOURTH_ENTERED.getId(),
WidgetInfo.BANK_PIN_INSTRUCTION_TEXT.getId()
};*/
public static boolean customPresenceEnabled = false;
public static final String rlPlusDiscordApp = "560644885250572289";
private static final String rlDiscordApp = "409416265891971072";
@Inject @Inject
public RuneLitePlusConfig config; private RuneLitePlusConfig config;
@Inject @Inject
public DiscordService discordService; private DiscordService discordService;
@Inject @Inject
private KeyManager keyManager; private KeyManager keyManager;
@@ -138,12 +109,6 @@ public class RuneLitePlusPlugin extends Plugin
@Inject @Inject
private ClientThread clientThread; private ClientThread clientThread;
@Provides
RuneLitePlusConfig getConfig(ConfigManager configManager)
{
return configManager.getConfig(RuneLitePlusConfig.class);
}
private RuneLitePlusKeyListener keyListener = new RuneLitePlusKeyListener(); private RuneLitePlusKeyListener keyListener = new RuneLitePlusKeyListener();
private int entered = -1; private int entered = -1;
private int enterIdx; private int enterIdx;
@@ -156,11 +121,11 @@ public class RuneLitePlusPlugin extends Plugin
{ {
ClientUI.currentPresenceName = ("RuneLitePlus"); ClientUI.currentPresenceName = ("RuneLitePlus");
ClientUI.frame.setTitle(ClientUI.currentPresenceName); ClientUI.frame.setTitle(ClientUI.currentPresenceName);
RuneLiteProperties.discordAppID = rlPlusDiscordApp;
discordService.close();
discordService.init();
} }
discordService.close();
discordService.init();
entered = -1; entered = -1;
enterIdx = 0; enterIdx = 0;
expectInput = false; expectInput = false;
@@ -180,7 +145,6 @@ public class RuneLitePlusPlugin extends Plugin
{ {
ClientUI.currentPresenceName = ("RuneLitePlus"); ClientUI.currentPresenceName = ("RuneLitePlus");
ClientUI.frame.setTitle(ClientUI.currentPresenceName); ClientUI.frame.setTitle(ClientUI.currentPresenceName);
RuneLiteProperties.discordAppID = rlPlusDiscordApp;
discordService.close(); discordService.close();
discordService.init(); discordService.init();
} }
@@ -188,7 +152,6 @@ public class RuneLitePlusPlugin extends Plugin
{ {
ClientUI.currentPresenceName = ("RuneLite"); ClientUI.currentPresenceName = ("RuneLite");
ClientUI.frame.setTitle(ClientUI.currentPresenceName); ClientUI.frame.setTitle(ClientUI.currentPresenceName);
RuneLiteProperties.discordAppID = rlDiscordApp;
discordService.close(); discordService.close();
discordService.init(); discordService.init();
} }

View File

@@ -40,7 +40,6 @@ import javax.swing.JProgressBar;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.plaf.basic.BasicProgressBarUI; import javax.swing.plaf.basic.BasicProgressBarUI;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.runelite.client.RuneLite;
import net.runelite.client.RuneLiteProperties; import net.runelite.client.RuneLiteProperties;
import net.runelite.client.util.SwingUtil; import net.runelite.client.util.SwingUtil;
import org.pushingpixels.substance.internal.SubstanceSynapse; import org.pushingpixels.substance.internal.SubstanceSynapse;
@@ -57,11 +56,9 @@ public class RuneLiteSplashScreen
public JFrame frame; public JFrame frame;
public JPanel panel = new JPanel(); public JPanel panel = new JPanel();
public JLabel messageLabel; private JLabel messageLabel;
public JLabel subMessageLabel; private JLabel subMessageLabel;
public JProgressBar progressBar = new JProgressBar(); private JProgressBar progressBar = new JProgressBar();
private int currentStep;
/** /**
* This is not done in the constructor in order to avoid processing in case the user chooses to not load * This is not done in the constructor in order to avoid processing in case the user chooses to not load
@@ -130,7 +127,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 : " + runeLiteProperties.getRunelitVersion());
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());

View File

@@ -2,7 +2,9 @@ runelite.title=RuneLite
runelite.version=${project.version} runelite.version=${project.version}
runescape.version=${rs.version} runescape.version=${rs.version}
runelite.discord.appid=409416265891971072 runelite.discord.appid=409416265891971072
runelite.plus.discord.appid=560644885250572289
runelite.discord.invite=https://discord.gg/HN5gf3m runelite.discord.invite=https://discord.gg/HN5gf3m
runelite.github.link=https://github.com/runelite-extended/runelite runelite.github.link=https://github.com/runelite-extended/runelite
runelite.wiki.link=https://github.com/runelite-extended/runelite/wiki runelite.wiki.link=https://github.com/runelite-extended/runelite/wiki
runelite.patreon.link=https://www.patreon.com/RuneLitePlus runelite.patreon.link=https://www.patreon.com/RuneLitePlus
runelit.version =2.0.1-1

View File

@@ -36,6 +36,7 @@ import net.runelite.api.MessageNode;
import net.runelite.api.events.ChatMessage; import net.runelite.api.events.ChatMessage;
import net.runelite.client.Notifier; import net.runelite.client.Notifier;
import net.runelite.client.chat.ChatMessageManager; import net.runelite.client.chat.ChatMessageManager;
import net.runelite.client.config.RuneLitePlusConfig;
import net.runelite.client.util.Text; import net.runelite.client.util.Text;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import org.junit.Before; import org.junit.Before;
@@ -66,6 +67,10 @@ public class ChatNotificationsPluginTest
@Bind @Bind
private Notifier notifier; private Notifier notifier;
@Mock
@Bind
private RuneLitePlusConfig runeLitePlusConfig;
@Inject @Inject
private ChatNotificationsPlugin chatNotificationsPlugin; private ChatNotificationsPlugin chatNotificationsPlugin;