Refactor RL+
This commit is contained in:
@@ -33,13 +33,16 @@ import net.runelite.client.config.ConfigItem;
|
|||||||
@ConfigGroup("runeliteplus")
|
@ConfigGroup("runeliteplus")
|
||||||
public interface RuneLitePlusConfig extends Config
|
public interface RuneLitePlusConfig extends Config
|
||||||
{
|
{
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 0,
|
position = 0,
|
||||||
keyName = "customPresence",
|
keyName = "customPresence",
|
||||||
name = "RL+ Presence",
|
name = "RL+ Presence",
|
||||||
description = "Represent RL+ with a custom icon and discord presence."
|
description = "Represent RL+ with a custom icon and discord presence."
|
||||||
)
|
)
|
||||||
default boolean customPresence() { return false; }
|
default boolean customPresence()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "enableOpacity",
|
keyName = "enableOpacity",
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ package net.runelite.client.plugins.runeliteplus;
|
|||||||
|
|
||||||
|
|
||||||
import com.google.inject.Provides;
|
import com.google.inject.Provides;
|
||||||
|
import javax.inject.Inject;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.runelite.api.events.ConfigChanged;
|
import net.runelite.api.events.ConfigChanged;
|
||||||
import net.runelite.client.RuneLiteProperties;
|
import net.runelite.client.RuneLiteProperties;
|
||||||
@@ -39,8 +40,6 @@ import net.runelite.client.plugins.PluginDescriptor;
|
|||||||
import net.runelite.client.plugins.PluginType;
|
import net.runelite.client.plugins.PluginType;
|
||||||
import net.runelite.client.ui.ClientUI;
|
import net.runelite.client.ui.ClientUI;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
|
|
||||||
@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
|
||||||
@@ -67,7 +66,7 @@ public class RuneLitePlusPlugin extends Plugin
|
|||||||
|
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
RuneLitePlusConfig getConfig(ConfigManager configManager)
|
RuneLitePlusConfig getConfig(ConfigManager configManager)
|
||||||
{
|
{
|
||||||
return configManager.getConfig(RuneLitePlusConfig.class);
|
return configManager.getConfig(RuneLitePlusConfig.class);
|
||||||
}
|
}
|
||||||
@@ -75,16 +74,20 @@ public class RuneLitePlusPlugin extends Plugin
|
|||||||
@Override
|
@Override
|
||||||
protected void startUp() throws Exception
|
protected void startUp() throws Exception
|
||||||
{
|
{
|
||||||
if (getConfig(configManager).customPresence()) {
|
if (getConfig(configManager).customPresence())
|
||||||
|
{
|
||||||
ClientUI.currentPresenceName = ("RuneLitePlus");
|
ClientUI.currentPresenceName = ("RuneLitePlus");
|
||||||
ClientUI.frame.setTitle(ClientUI.currentPresenceName);
|
ClientUI.frame.setTitle(ClientUI.currentPresenceName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.customPresence()) {
|
if (config.customPresence())
|
||||||
|
{
|
||||||
RuneLiteProperties.discordAppID = rlPlusDiscordApp;
|
RuneLiteProperties.discordAppID = rlPlusDiscordApp;
|
||||||
discordService.close();
|
discordService.close();
|
||||||
discordService.init();
|
discordService.init();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
RuneLiteProperties.discordAppID = rlDiscordApp;
|
RuneLiteProperties.discordAppID = rlDiscordApp;
|
||||||
discordService.close();
|
discordService.close();
|
||||||
discordService.init();
|
discordService.init();
|
||||||
@@ -92,21 +95,29 @@ public class RuneLitePlusPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
protected void onConfigChanged(ConfigChanged event) {
|
protected void onConfigChanged(ConfigChanged event)
|
||||||
if (event.getKey().equals("customPresence")) {
|
{
|
||||||
if (config.customPresence()) {
|
if (event.getKey().equals("customPresence"))
|
||||||
|
{
|
||||||
|
if (config.customPresence())
|
||||||
|
{
|
||||||
ClientUI.currentPresenceName = ("RuneLitePlus");
|
ClientUI.currentPresenceName = ("RuneLitePlus");
|
||||||
ClientUI.frame.setTitle(ClientUI.currentPresenceName);
|
ClientUI.frame.setTitle(ClientUI.currentPresenceName);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
ClientUI.currentPresenceName = ("RuneLite");
|
ClientUI.currentPresenceName = ("RuneLite");
|
||||||
ClientUI.frame.setTitle(ClientUI.currentPresenceName);
|
ClientUI.frame.setTitle(ClientUI.currentPresenceName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.customPresence()) {
|
if (config.customPresence())
|
||||||
|
{
|
||||||
RuneLiteProperties.discordAppID = rlPlusDiscordApp;
|
RuneLiteProperties.discordAppID = rlPlusDiscordApp;
|
||||||
discordService.close();
|
discordService.close();
|
||||||
discordService.init();
|
discordService.init();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
RuneLiteProperties.discordAppID = rlDiscordApp;
|
RuneLiteProperties.discordAppID = rlDiscordApp;
|
||||||
discordService.close();
|
discordService.close();
|
||||||
discordService.init();
|
discordService.init();
|
||||||
|
|||||||
Reference in New Issue
Block a user