added heat notification too

This commit is contained in:
Vanillj
2022-06-20 18:23:05 +02:00
parent 14066e0b9a
commit 89e86656e0
2 changed files with 33 additions and 11 deletions

View File

@@ -14,7 +14,18 @@ public interface EasyGiantsFoundryConfig extends Config {
description = "Configures whether to notify you when you are about to finish a stage.", description = "Configures whether to notify you when you are about to finish a stage.",
position = 0 position = 0
) )
default boolean showGiantsFoundryNotifications() default boolean showGiantsFoundryStageNotifications()
{
return true;
}
@ConfigItem(
keyName = "giantsFoundryHeatNotification",
name = "Enable heat notifications",
description = "Configures whether to notify you when you are about to run out of heat.",
position = 1
)
default boolean showGiantsFoundryHeatNotifications()
{ {
return true; return true;
} }

View File

@@ -42,6 +42,8 @@ public class EasyGiantsFoundryPlugin extends Plugin
private boolean enableStageNotifications; private boolean enableStageNotifications;
private boolean enableHeatNotifications;
@Inject @Inject
private EasyGiantsFoundryState state; private EasyGiantsFoundryState state;
@@ -71,7 +73,8 @@ public class EasyGiantsFoundryPlugin extends Plugin
{ {
overlayManager.add(overlay2d); overlayManager.add(overlay2d);
overlayManager.add(overlay3d); overlayManager.add(overlay3d);
enableStageNotifications = config.showGiantsFoundryNotifications(); enableStageNotifications = config.showGiantsFoundryStageNotifications();
enableHeatNotifications = config.showGiantsFoundryHeatNotifications();
} }
@Override @Override
@@ -124,14 +127,17 @@ public class EasyGiantsFoundryPlugin extends Plugin
@Subscribe @Subscribe
public void onStatChanged(StatChanged statChanged) public void onStatChanged(StatChanged statChanged)
{ {
if (state.isEnabled() && if (state.isEnabled() && state.getCurrentStage() != null)
enableStageNotifications &&
state.getCurrentStage() != null &&
helper.getActionsLeftInStage() == 1 &&
(oldStage == null || oldStage != state.getCurrentStage()))
{ {
notifier.notify("About to finish the current stage!"); if (enableStageNotifications && helper.getActionsLeftInStage() == 1 && (oldStage == null || oldStage != state.getCurrentStage()))
oldStage = state.getCurrentStage(); {
notifier.notify("About to finish the current stage!");
oldStage = state.getCurrentStage();
}
else if (enableHeatNotifications && helper.getActionsForHeatLevel() == 1)
{
notifier.notify("About to run out of heat!");
}
} }
} }
@@ -215,9 +221,14 @@ public class EasyGiantsFoundryPlugin extends Plugin
return; return;
} }
if (config.showGiantsFoundryNotifications() != enableStageNotifications) if (config.showGiantsFoundryStageNotifications() != enableStageNotifications)
{ {
enableStageNotifications = config.showGiantsFoundryNotifications(); enableStageNotifications = config.showGiantsFoundryStageNotifications();
}
if (config.showGiantsFoundryHeatNotifications() != enableHeatNotifications)
{
enableHeatNotifications = config.showGiantsFoundryHeatNotifications();
} }
} }