Add ability to disable HP and Prayer notifications (#2007)

- Change default HP and Prayer threshold to 0
- When threshold is 0, don't send notification
- Add description how to disable/enable pray/hp notifications
This commit is contained in:
Reasel
2018-04-27 03:37:34 -07:00
committed by Tomas Slusny
parent f4d158846e
commit f035881b2a
2 changed files with 12 additions and 4 deletions

View File

@@ -71,22 +71,22 @@ public interface IdleNotifierConfig extends Config
@ConfigItem( @ConfigItem(
keyName = "hitpoints", keyName = "hitpoints",
name = "Hitpoints Notification Threshold", name = "Hitpoints Notification Threshold",
description = "The amount of hitpoints to send a notification at", description = "The amount of hitpoints to send a notification at. A value of 0 will disable notification.",
position = 4 position = 4
) )
default int getHitpointsThreshold() default int getHitpointsThreshold()
{ {
return 15; return 0;
} }
@ConfigItem( @ConfigItem(
keyName = "prayer", keyName = "prayer",
name = "Prayer Notification Threshold", name = "Prayer Notification Threshold",
description = "The amount of prayer points to send a notification at", description = "The amount of prayer points to send a notification at. A value of 0 will disable notification.",
position = 5 position = 5
) )
default int getPrayerThreshold() default int getPrayerThreshold()
{ {
return 15; return 0;
} }
} }

View File

@@ -251,6 +251,10 @@ public class IdleNotifierPlugin extends Plugin
private boolean checkLowHitpoints() private boolean checkLowHitpoints()
{ {
if (config.getHitpointsThreshold() == 0)
{
return false;
}
if (client.getRealSkillLevel(Skill.HITPOINTS) > config.getHitpointsThreshold()) if (client.getRealSkillLevel(Skill.HITPOINTS) > config.getHitpointsThreshold())
{ {
if (client.getBoostedSkillLevel(Skill.HITPOINTS) <= config.getHitpointsThreshold()) if (client.getBoostedSkillLevel(Skill.HITPOINTS) <= config.getHitpointsThreshold())
@@ -272,6 +276,10 @@ public class IdleNotifierPlugin extends Plugin
private boolean checkLowPrayer() private boolean checkLowPrayer()
{ {
if (config.getPrayerThreshold() == 0)
{
return false;
}
if (client.getRealSkillLevel(Skill.PRAYER) > config.getPrayerThreshold()) if (client.getRealSkillLevel(Skill.PRAYER) > config.getPrayerThreshold())
{ {
if (client.getBoostedSkillLevel(Skill.PRAYER) <= config.getPrayerThreshold()) if (client.getBoostedSkillLevel(Skill.PRAYER) <= config.getPrayerThreshold())