Merge pull request #14 from Vanillj/Threshold

Added stage and heat threshold
This commit is contained in:
Patrick Watts
2022-07-11 17:44:33 +04:00
committed by GitHub
2 changed files with 28 additions and 5 deletions

View File

@@ -39,11 +39,33 @@ public interface EasyGiantsFoundryConfig extends Config {
return true; return true;
} }
@ConfigItem(
keyName = "giantsFoundryStageThreshold",
name = "Stage threshold notification",
description = "The number of actions left required for the notification.",
position = 2,
section = notificationList
)
default int StageNotificationsThreshold() {
return 1;
}
@ConfigItem(
keyName = "giantsFoundryHeatThreshold",
name = "Heat threshold notification",
description = "The heat level left required for the notification.",
position = 3,
section = notificationList
)
default int HeatNotificationsThreshold() {
return 1;
}
@ConfigItem( @ConfigItem(
keyName = "bonusNotification", keyName = "bonusNotification",
name = "Notify bonus", name = "Notify bonus",
description = "Notifies when bonus appears", description = "Notifies when bonus appears",
position = 2, position = 4,
section = notificationList section = notificationList
) )
default boolean bonusNotification() { default boolean bonusNotification() {
@@ -54,7 +76,7 @@ public interface EasyGiantsFoundryConfig extends Config {
keyName = "bonusSound", keyName = "bonusSound",
name = "Bonus sound", name = "Bonus sound",
description = "Plays a sound when bonus appears", description = "Plays a sound when bonus appears",
position = 3, position = 5,
section = notificationList section = notificationList
) )
default boolean bonusSoundNotify() { default boolean bonusSoundNotify() {
@@ -65,7 +87,7 @@ public interface EasyGiantsFoundryConfig extends Config {
keyName = SOUND_ID, keyName = SOUND_ID,
name = "Bonus sound ID", name = "Bonus sound ID",
description = "Sound Effect ID to play when bonus appears", description = "Sound Effect ID to play when bonus appears",
position = 4, position = 6,
section = notificationList section = notificationList
) )
default int soundId() { default int soundId() {

View File

@@ -154,13 +154,14 @@ public class EasyGiantsFoundryPlugin extends Plugin
} }
if (config.showGiantsFoundryStageNotifications() && if (config.showGiantsFoundryStageNotifications() &&
helper.getActionsLeftInStage() == 1 && helper.getActionsLeftInStage() == config.StageNotificationsThreshold() &&
(oldStage == null || oldStage != state.getCurrentStage())) (oldStage == null || oldStage != state.getCurrentStage()))
{ {
notifier.notify("About to finish the current stage!"); notifier.notify("About to finish the current stage!");
oldStage = state.getCurrentStage(); oldStage = state.getCurrentStage();
} }
else if (config.showGiantsFoundryHeatNotifications() && helper.getActionsForHeatLevel() == 1) else if (config.showGiantsFoundryHeatNotifications() &&
helper.getActionsForHeatLevel() == config.HeatNotificationsThreshold())
{ {
notifier.notify("About to run out of heat!"); notifier.notify("About to run out of heat!");
} }