npcunaggroarea: add notification when timer runs out
This commit is contained in:
@@ -115,4 +115,15 @@ public interface NpcAggroAreaConfig extends Config
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "sendNotification",
|
||||
name = "Send notification",
|
||||
description = "Send a notification when the timer runs out",
|
||||
position = 7
|
||||
)
|
||||
default boolean sendNotification()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,6 +86,10 @@ class NpcAggroAreaOverlay extends Overlay
|
||||
outlineColor.getBlue(),
|
||||
100);
|
||||
}
|
||||
else
|
||||
{
|
||||
plugin.doNotification();
|
||||
}
|
||||
|
||||
renderPath(graphics, lines, outlineColor);
|
||||
return null;
|
||||
|
||||
@@ -27,6 +27,7 @@ package net.runelite.client.plugins.npcunaggroarea;
|
||||
import java.awt.Color;
|
||||
import javax.inject.Singleton;
|
||||
import lombok.AccessLevel;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.api.geometry.Geometry;
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.common.base.Strings;
|
||||
@@ -56,6 +57,7 @@ import net.runelite.api.events.ConfigChanged;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.events.GameTick;
|
||||
import net.runelite.api.events.NpcSpawned;
|
||||
import net.runelite.client.Notifier;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.game.ItemManager;
|
||||
@@ -116,6 +118,9 @@ public class NpcAggroAreaPlugin extends Plugin
|
||||
@Inject
|
||||
private ConfigManager configManager;
|
||||
|
||||
@Inject
|
||||
private Notifier notifier;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private final WorldPoint[] safeCenters = new WorldPoint[2];
|
||||
|
||||
@@ -137,12 +142,15 @@ public class NpcAggroAreaPlugin extends Plugin
|
||||
private boolean showNotWorkingOverlay;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean hideOverlayHint;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean sendNotification;
|
||||
|
||||
private WorldPoint lastPlayerLocation;
|
||||
private WorldPoint previousUnknownCenter;
|
||||
private boolean loggingIn;
|
||||
private List<String> npcNamePatterns;
|
||||
private boolean notWorkingOverlayShown = false;
|
||||
private boolean hasSentNotification = false;
|
||||
|
||||
@Provides
|
||||
NpcAggroAreaConfig provideConfig(ConfigManager configManager)
|
||||
@@ -259,6 +267,7 @@ public class NpcAggroAreaPlugin extends Plugin
|
||||
BufferedImage image = itemManager.getImage(ItemID.ENSOULED_DEMON_HEAD);
|
||||
currentTimer = new AggressionTimer(duration, image, this, active && this.showTimer);
|
||||
infoBoxManager.addInfoBox(currentTimer);
|
||||
hasSentNotification = false;
|
||||
}
|
||||
|
||||
private void resetTimer()
|
||||
@@ -417,6 +426,9 @@ public class NpcAggroAreaPlugin extends Plugin
|
||||
npcNamePatterns = NAME_SPLITTER.splitToList(this.configNpcNamePatterns);
|
||||
recheckActive();
|
||||
break;
|
||||
case "sendNotification":
|
||||
hasSentNotification = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -507,6 +519,17 @@ public class NpcAggroAreaPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
void doNotification()
|
||||
{
|
||||
if (hasSentNotification)
|
||||
{
|
||||
return;
|
||||
}
|
||||
final Player local = client.getLocalPlayer();
|
||||
hasSentNotification = true;
|
||||
notifier.notify("[" + local.getName() + "]'s aggression timer has run out!");
|
||||
}
|
||||
|
||||
private void updateConfig()
|
||||
{
|
||||
this.alwaysActive = config.alwaysActive();
|
||||
@@ -516,5 +539,6 @@ public class NpcAggroAreaPlugin extends Plugin
|
||||
this.aggroAreaColor = config.aggroAreaColor();
|
||||
this.showNotWorkingOverlay = config.showNotWorkingOverlay();
|
||||
this.hideOverlayHint = config.hideOverlayHint();
|
||||
this.sendNotification = config.sendNotification();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user