Enforce our presence

If you don't like it, you can start to.
This commit is contained in:
zeruth
2019-06-06 21:43:30 -04:00
parent 97b91aee36
commit 398a254641
2 changed files with 11 additions and 61 deletions

View File

@@ -34,22 +34,11 @@ import net.runelite.client.config.Range;
@ConfigGroup("runeliteplus") @ConfigGroup("runeliteplus")
public interface RuneLitePlusConfig extends Config public interface RuneLitePlusConfig extends Config
{ {
@ConfigItem(
position = 0,
keyName = "customPresence",
name = "RL+ Presence",
description = "Represent RL+ with a custom icon and discord presence."
)
default boolean customPresence()
{
return false;
}
@ConfigItem( @ConfigItem(
keyName = "enableOpacity", keyName = "enableOpacity",
name = "Enable opacity", name = "Enable opacity",
description = "Enables opacity for the whole window.<br>NOTE: This only stays enabled if your pc supports this!", description = "Enables opacity for the whole window.<br>NOTE: This only stays enabled if your pc supports this!",
position = 1 position = 0
) )
default boolean enableOpacity() default boolean enableOpacity()
{ {
@@ -64,7 +53,7 @@ public interface RuneLitePlusConfig extends Config
keyName = "opacityPercentage", keyName = "opacityPercentage",
name = "Opacity percentage", name = "Opacity percentage",
description = "Changes the opacity of the window if opacity is enabled", description = "Changes the opacity of the window if opacity is enabled",
position = 2 position = 1
) )
default int opacityPercentage() default int opacityPercentage()
{ {
@@ -75,7 +64,7 @@ public interface RuneLitePlusConfig extends Config
keyName = "keyboardPin", keyName = "keyboardPin",
name = "Keyboard bank pin", name = "Keyboard bank pin",
description = "Enables you to type your bank pin", description = "Enables you to type your bank pin",
position = 3 position = 2
) )
default boolean keyboardPin() default boolean keyboardPin()
{ {
@@ -86,7 +75,7 @@ public interface RuneLitePlusConfig extends Config
keyName = "logOpt", keyName = "logOpt",
name = "Send logs", name = "Send logs",
description = "Send logs to help us analyze errors", description = "Send logs to help us analyze errors",
position = 4 position = 3
) )
default boolean logOpt() default boolean logOpt()
{ {

View File

@@ -160,32 +160,19 @@ public class RuneLitePlusPlugin extends Plugin
@Override @Override
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
ClientUI.currentPresenceName = ("RuneLitePlus");
ClientUI.frame.setTitle(ClientUI.currentPresenceName);
RuneLiteProperties.discordAppID = rlPlusDiscordApp;
discordService.close();
discordService.init();
entered = -1; entered = -1;
enterIdx = 0; enterIdx = 0;
if (getConfig(configManager).customPresence())
{
ClientUI.currentPresenceName = ("RuneLitePlus");
ClientUI.frame.setTitle(ClientUI.currentPresenceName);
}
if (config.logOpt()) if (config.logOpt())
{ {
Sentry.init("https://f0ed76be2fe847f8b9eb3620fa55d729@sentry.io/1468399?stacktrace.app.packages=net.runelite.client"); Sentry.init("https://f0ed76be2fe847f8b9eb3620fa55d729@sentry.io/1468399?stacktrace.app.packages=net.runelite.client");
} }
if (config.customPresence())
{
RuneLiteProperties.discordAppID = rlPlusDiscordApp;
discordService.close();
discordService.init();
}
else
{
RuneLiteProperties.discordAppID = rlDiscordApp;
discordService.close();
discordService.init();
}
} }
@Subscribe @Subscribe
@@ -196,33 +183,7 @@ public class RuneLitePlusPlugin extends Plugin
return; return;
} }
if (event.getKey().equals("customPresence")) if (!config.keyboardPin())
{
if (config.customPresence())
{
ClientUI.currentPresenceName = ("RuneLitePlus");
ClientUI.frame.setTitle(ClientUI.currentPresenceName);
}
else
{
ClientUI.currentPresenceName = ("RuneLite");
ClientUI.frame.setTitle(ClientUI.currentPresenceName);
}
if (config.customPresence())
{
RuneLiteProperties.discordAppID = rlPlusDiscordApp;
discordService.close();
discordService.init();
}
else
{
RuneLiteProperties.discordAppID = rlDiscordApp;
discordService.close();
discordService.init();
}
}
else if (!config.keyboardPin())
{ {
entered = -1; entered = -1;
enterIdx = 0; enterIdx = 0;