Merge pull request #922 from ThatGamerBlue/aggro-timers-notification
npcunaggroarea: add notification when timer runs out
This commit is contained in:
@@ -115,4 +115,15 @@ public interface NpcAggroAreaConfig extends Config
|
|||||||
{
|
{
|
||||||
return false;
|
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(),
|
outlineColor.getBlue(),
|
||||||
100);
|
100);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
plugin.doNotification();
|
||||||
|
}
|
||||||
|
|
||||||
renderPath(graphics, lines, outlineColor);
|
renderPath(graphics, lines, outlineColor);
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ package net.runelite.client.plugins.npcunaggroarea;
|
|||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
|
import net.runelite.api.Player;
|
||||||
import net.runelite.api.geometry.Geometry;
|
import net.runelite.api.geometry.Geometry;
|
||||||
import com.google.common.base.Splitter;
|
import com.google.common.base.Splitter;
|
||||||
import com.google.common.base.Strings;
|
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.GameStateChanged;
|
||||||
import net.runelite.api.events.GameTick;
|
import net.runelite.api.events.GameTick;
|
||||||
import net.runelite.api.events.NpcSpawned;
|
import net.runelite.api.events.NpcSpawned;
|
||||||
|
import net.runelite.client.Notifier;
|
||||||
import net.runelite.client.config.ConfigManager;
|
import net.runelite.client.config.ConfigManager;
|
||||||
import net.runelite.client.eventbus.Subscribe;
|
import net.runelite.client.eventbus.Subscribe;
|
||||||
import net.runelite.client.game.ItemManager;
|
import net.runelite.client.game.ItemManager;
|
||||||
@@ -116,6 +118,9 @@ public class NpcAggroAreaPlugin extends Plugin
|
|||||||
@Inject
|
@Inject
|
||||||
private ConfigManager configManager;
|
private ConfigManager configManager;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private Notifier notifier;
|
||||||
|
|
||||||
@Getter(AccessLevel.PACKAGE)
|
@Getter(AccessLevel.PACKAGE)
|
||||||
private final WorldPoint[] safeCenters = new WorldPoint[2];
|
private final WorldPoint[] safeCenters = new WorldPoint[2];
|
||||||
|
|
||||||
@@ -137,12 +142,15 @@ public class NpcAggroAreaPlugin extends Plugin
|
|||||||
private boolean showNotWorkingOverlay;
|
private boolean showNotWorkingOverlay;
|
||||||
@Getter(AccessLevel.PACKAGE)
|
@Getter(AccessLevel.PACKAGE)
|
||||||
private boolean hideOverlayHint;
|
private boolean hideOverlayHint;
|
||||||
|
@Getter(AccessLevel.PACKAGE)
|
||||||
|
private boolean sendNotification;
|
||||||
|
|
||||||
private WorldPoint lastPlayerLocation;
|
private WorldPoint lastPlayerLocation;
|
||||||
private WorldPoint previousUnknownCenter;
|
private WorldPoint previousUnknownCenter;
|
||||||
private boolean loggingIn;
|
private boolean loggingIn;
|
||||||
private List<String> npcNamePatterns;
|
private List<String> npcNamePatterns;
|
||||||
private boolean notWorkingOverlayShown = false;
|
private boolean notWorkingOverlayShown = false;
|
||||||
|
private boolean hasSentNotification = false;
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
NpcAggroAreaConfig provideConfig(ConfigManager configManager)
|
NpcAggroAreaConfig provideConfig(ConfigManager configManager)
|
||||||
@@ -259,6 +267,7 @@ public class NpcAggroAreaPlugin extends Plugin
|
|||||||
BufferedImage image = itemManager.getImage(ItemID.ENSOULED_DEMON_HEAD);
|
BufferedImage image = itemManager.getImage(ItemID.ENSOULED_DEMON_HEAD);
|
||||||
currentTimer = new AggressionTimer(duration, image, this, active && this.showTimer);
|
currentTimer = new AggressionTimer(duration, image, this, active && this.showTimer);
|
||||||
infoBoxManager.addInfoBox(currentTimer);
|
infoBoxManager.addInfoBox(currentTimer);
|
||||||
|
hasSentNotification = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void resetTimer()
|
private void resetTimer()
|
||||||
@@ -417,6 +426,9 @@ public class NpcAggroAreaPlugin extends Plugin
|
|||||||
npcNamePatterns = NAME_SPLITTER.splitToList(this.configNpcNamePatterns);
|
npcNamePatterns = NAME_SPLITTER.splitToList(this.configNpcNamePatterns);
|
||||||
recheckActive();
|
recheckActive();
|
||||||
break;
|
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()
|
private void updateConfig()
|
||||||
{
|
{
|
||||||
this.alwaysActive = config.alwaysActive();
|
this.alwaysActive = config.alwaysActive();
|
||||||
@@ -516,5 +539,6 @@ public class NpcAggroAreaPlugin extends Plugin
|
|||||||
this.aggroAreaColor = config.aggroAreaColor();
|
this.aggroAreaColor = config.aggroAreaColor();
|
||||||
this.showNotWorkingOverlay = config.showNotWorkingOverlay();
|
this.showNotWorkingOverlay = config.showNotWorkingOverlay();
|
||||||
this.hideOverlayHint = config.hideOverlayHint();
|
this.hideOverlayHint = config.hideOverlayHint();
|
||||||
|
this.sendNotification = config.sendNotification();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user