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.",
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;
}

View File

@@ -42,6 +42,8 @@ public class EasyGiantsFoundryPlugin extends Plugin
private boolean enableStageNotifications;
private boolean enableHeatNotifications;
@Inject
private EasyGiantsFoundryState state;
@@ -71,7 +73,8 @@ public class EasyGiantsFoundryPlugin extends Plugin
{
overlayManager.add(overlay2d);
overlayManager.add(overlay3d);
enableStageNotifications = config.showGiantsFoundryNotifications();
enableStageNotifications = config.showGiantsFoundryStageNotifications();
enableHeatNotifications = config.showGiantsFoundryHeatNotifications();
}
@Override
@@ -124,15 +127,18 @@ public class EasyGiantsFoundryPlugin extends Plugin
@Subscribe
public void onStatChanged(StatChanged statChanged)
{
if (state.isEnabled() &&
enableStageNotifications &&
state.getCurrentStage() != null &&
helper.getActionsLeftInStage() == 1 &&
(oldStage == null || oldStage != state.getCurrentStage()))
if (state.isEnabled() && state.getCurrentStage() != null)
{
if (enableStageNotifications && helper.getActionsLeftInStage() == 1 && (oldStage == null || 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!");
}
}
}
@Subscribe
@@ -215,9 +221,14 @@ public class EasyGiantsFoundryPlugin extends Plugin
return;
}
if (config.showGiantsFoundryNotifications() != enableStageNotifications)
if (config.showGiantsFoundryStageNotifications() != enableStageNotifications)
{
enableStageNotifications = config.showGiantsFoundryNotifications();
enableStageNotifications = config.showGiantsFoundryStageNotifications();
}
if (config.showGiantsFoundryHeatNotifications() != enableHeatNotifications)
{
enableHeatNotifications = config.showGiantsFoundryHeatNotifications();
}
}