Add notifications for NMZ power-up spawns
This commit is contained in:
@@ -47,11 +47,44 @@ public interface NightmareZoneConfig extends Config
|
|||||||
return true;
|
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(
|
@ConfigItem(
|
||||||
keyName = "overloadnotification",
|
keyName = "overloadnotification",
|
||||||
name = "Overload notification",
|
name = "Overload notification",
|
||||||
description = "Toggles notifications when your overload runs out",
|
description = "Toggles notifications when your overload runs out",
|
||||||
position = 2
|
position = 5
|
||||||
)
|
)
|
||||||
default boolean overloadNotification()
|
default boolean overloadNotification()
|
||||||
{
|
{
|
||||||
@@ -62,7 +95,7 @@ public interface NightmareZoneConfig extends Config
|
|||||||
keyName = "absorptionnotification",
|
keyName = "absorptionnotification",
|
||||||
name = "Absorption notification",
|
name = "Absorption notification",
|
||||||
description = "Toggles notifications when your absorption points gets below your threshold",
|
description = "Toggles notifications when your absorption points gets below your threshold",
|
||||||
position = 3
|
position = 6
|
||||||
)
|
)
|
||||||
default boolean absorptionNotification()
|
default boolean absorptionNotification()
|
||||||
{
|
{
|
||||||
@@ -73,7 +106,7 @@ public interface NightmareZoneConfig extends Config
|
|||||||
keyName = "absorptionthreshold",
|
keyName = "absorptionthreshold",
|
||||||
name = "Absorption Threshold",
|
name = "Absorption Threshold",
|
||||||
description = "The amount of absorption points to send a notification at",
|
description = "The amount of absorption points to send a notification at",
|
||||||
position = 4
|
position = 7
|
||||||
)
|
)
|
||||||
default int absorptionThreshold()
|
default int absorptionThreshold()
|
||||||
{
|
{
|
||||||
@@ -84,7 +117,7 @@ public interface NightmareZoneConfig extends Config
|
|||||||
keyName = "absorptioncoloroverthreshold",
|
keyName = "absorptioncoloroverthreshold",
|
||||||
name = "Color above threshold",
|
name = "Color above threshold",
|
||||||
description = "Configures the color for the absorption widget when above the threshold",
|
description = "Configures the color for the absorption widget when above the threshold",
|
||||||
position = 5
|
position = 8
|
||||||
)
|
)
|
||||||
default Color absorptionColorAboveThreshold()
|
default Color absorptionColorAboveThreshold()
|
||||||
{
|
{
|
||||||
@@ -95,7 +128,7 @@ public interface NightmareZoneConfig extends Config
|
|||||||
keyName = "absorptioncolorbelowthreshold",
|
keyName = "absorptioncolorbelowthreshold",
|
||||||
name = "Color below threshold",
|
name = "Color below threshold",
|
||||||
description = "Configures the color for the absorption widget when below the threshold",
|
description = "Configures the color for the absorption widget when below the threshold",
|
||||||
position = 6
|
position = 9
|
||||||
)
|
)
|
||||||
default Color absorptionColorBelowThreshold()
|
default Color absorptionColorBelowThreshold()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -105,16 +105,42 @@ public class NightmareZonePlugin extends Plugin
|
|||||||
public void onChatMessage(ChatMessage event)
|
public void onChatMessage(ChatMessage event)
|
||||||
{
|
{
|
||||||
if (event.getType() != ChatMessageType.SERVER
|
if (event.getType() != ChatMessageType.SERVER
|
||||||
|| !isInNightmareZone()
|
|| !isInNightmareZone())
|
||||||
|| !config.overloadNotification())
|
|
||||||
{
|
{
|
||||||
return;
|
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."))
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user