Add notifications for NMZ power-up spawns

This commit is contained in:
Lyn Levenick
2018-03-26 16:26:55 -05:00
committed by Adam
parent dc4a668d31
commit f1e8a4db2e
2 changed files with 68 additions and 9 deletions

View File

@@ -47,11 +47,44 @@ public interface NightmareZoneConfig extends Config
return true;
}
@ConfigItem(
keyName = "powersurgenotification",
name = "Power surge notification",
description = "Toggles notifications when a power surge power-up appears",
position = 2
)
default boolean powerSurgeNotification()
{
return false;
}
@ConfigItem(
keyName = "recurrentdamagenotification",
name = "Recurrent damage notification",
description = "Toggles notifications when a recurrent damage power-up appears",
position = 3
)
default boolean recurrentDamageNotification()
{
return false;
}
@ConfigItem(
keyName = "zappernotification",
name = "Zapper notification",
description = "Toggles notifications when a zapper power-up appears",
position = 4
)
default boolean zapperNotification()
{
return false;
}
@ConfigItem(
keyName = "overloadnotification",
name = "Overload notification",
description = "Toggles notifications when your overload runs out",
position = 2
position = 5
)
default boolean overloadNotification()
{
@@ -62,7 +95,7 @@ public interface NightmareZoneConfig extends Config
keyName = "absorptionnotification",
name = "Absorption notification",
description = "Toggles notifications when your absorption points gets below your threshold",
position = 3
position = 6
)
default boolean absorptionNotification()
{
@@ -73,7 +106,7 @@ public interface NightmareZoneConfig extends Config
keyName = "absorptionthreshold",
name = "Absorption Threshold",
description = "The amount of absorption points to send a notification at",
position = 4
position = 7
)
default int absorptionThreshold()
{
@@ -84,7 +117,7 @@ public interface NightmareZoneConfig extends Config
keyName = "absorptioncoloroverthreshold",
name = "Color above threshold",
description = "Configures the color for the absorption widget when above the threshold",
position = 5
position = 8
)
default Color absorptionColorAboveThreshold()
{
@@ -95,7 +128,7 @@ public interface NightmareZoneConfig extends Config
keyName = "absorptioncolorbelowthreshold",
name = "Color below threshold",
description = "Configures the color for the absorption widget when below the threshold",
position = 6
position = 9
)
default Color absorptionColorBelowThreshold()
{

View File

@@ -105,16 +105,42 @@ public class NightmareZonePlugin extends Plugin
public void onChatMessage(ChatMessage event)
{
if (event.getType() != ChatMessageType.SERVER
|| !isInNightmareZone()
|| !config.overloadNotification())
|| !isInNightmareZone())
{
return;
}
String msg = Text.removeTags(event.getMessage()); //remove color and linebreaks
String msg = Text.removeTags(event.getMessage()); //remove color
if (msg.contains("The effects of overload have worn off, and you feel normal again."))
{
notifier.notify("Your overload has worn off");
if (config.overloadNotification())
{
notifier.notify("Your overload has worn off");
}
}
else if (msg.contains("A power-up has spawned:"))
{
if (msg.contains("Power surge"))
{
if (config.powerSurgeNotification())
{
notifier.notify(msg);
}
}
else if (msg.contains("Recurrent damage"))
{
if (config.recurrentDamageNotification())
{
notifier.notify(msg);
}
}
else if (msg.contains("Zapper"))
{
if (config.zapperNotification())
{
notifier.notify(msg);
}
}
}
}