impling plugin: add notify option for impling spawns

This commit is contained in:
Matthew Jacques
2019-11-05 23:49:41 +00:00
committed by Adam
parent a7e8871393
commit cb032ab609
3 changed files with 50 additions and 28 deletions

View File

@@ -36,15 +36,22 @@ import net.runelite.client.config.ConfigItem;
@ConfigGroup("implings")
public interface ImplingsConfig extends Config
{
enum ImplingMode
{
NONE,
HIGHLIGHT,
NOTIFY
}
@ConfigItem(
position = 1,
keyName = "showbaby",
name = "Show Baby implings",
description = "Configures whether or not Baby impling tags are displayed"
)
default boolean showBaby()
default ImplingMode showBaby()
{
return false;
return ImplingMode.NONE;
}
@ConfigItem(
@@ -64,9 +71,9 @@ public interface ImplingsConfig extends Config
name = "Show Young implings",
description = "Configures whether or not Young impling tags are displayed"
)
default boolean showYoung()
default ImplingMode showYoung()
{
return false;
return ImplingMode.NONE;
}
@ConfigItem(
@@ -86,9 +93,9 @@ public interface ImplingsConfig extends Config
name = "Show Gourmet implings",
description = "Configures whether or not Gourmet impling tags are displayed"
)
default boolean showGourmet()
default ImplingMode showGourmet()
{
return false;
return ImplingMode.NONE;
}
@ConfigItem(
@@ -108,9 +115,9 @@ public interface ImplingsConfig extends Config
name = "Show Earth implings",
description = "Configures whether or not Earth impling tags are displayed"
)
default boolean showEarth()
default ImplingMode showEarth()
{
return false;
return ImplingMode.NONE;
}
@ConfigItem(
@@ -130,9 +137,9 @@ public interface ImplingsConfig extends Config
name = "Show Essence implings",
description = "Configures whether or not Essence impling tags are displayed"
)
default boolean showEssence()
default ImplingMode showEssence()
{
return false;
return ImplingMode.NONE;
}
@ConfigItem(
@@ -152,9 +159,9 @@ public interface ImplingsConfig extends Config
name = "Show Eclectic implings",
description = "Configures whether or not Eclectic impling tags are displayed"
)
default boolean showEclectic()
default ImplingMode showEclectic()
{
return false;
return ImplingMode.NONE;
}
@ConfigItem(
@@ -174,9 +181,9 @@ public interface ImplingsConfig extends Config
name = "Show Nature implings",
description = "Configures whether or not Nature impling tags are displayed"
)
default boolean showNature()
default ImplingMode showNature()
{
return false;
return ImplingMode.NONE;
}
@ConfigItem(
@@ -196,9 +203,9 @@ public interface ImplingsConfig extends Config
name = "Show Magpie implings",
description = "Configures whether or not Magpie impling tags are displayed"
)
default boolean showMagpie()
default ImplingMode showMagpie()
{
return false;
return ImplingMode.NONE;
}
@ConfigItem(
@@ -218,9 +225,9 @@ public interface ImplingsConfig extends Config
name = "Show Ninja implings",
description = "Configures whether or not Ninja impling tags are displayed"
)
default boolean showNinja()
default ImplingMode showNinja()
{
return false;
return ImplingMode.NONE;
}
@ConfigItem(
@@ -240,9 +247,9 @@ public interface ImplingsConfig extends Config
name = "Show Crystal implings",
description = "Configures whether or not Crystal implings are displayed"
)
default boolean showCrystal()
default ImplingMode showCrystal()
{
return false;
return ImplingMode.NONE;
}
@ConfigItem(
@@ -262,9 +269,9 @@ public interface ImplingsConfig extends Config
name = "Show Dragon implings",
description = "Configures whether or not Dragon impling tags are displayed"
)
default boolean showDragon()
default ImplingMode showDragon()
{
return true;
return ImplingMode.HIGHLIGHT;
}
@ConfigItem(
@@ -284,9 +291,9 @@ public interface ImplingsConfig extends Config
name = "Show Lucky implings",
description = "Configures whether or not Lucky impling tags are displayed"
)
default boolean showLucky()
default ImplingMode showLucky()
{
return true;
return ImplingMode.HIGHLIGHT;
}
@ConfigItem(

View File

@@ -87,7 +87,7 @@ public class ImplingsOverlay extends Overlay
{
for (ImplingSpawn spawn : ImplingSpawn.values())
{
if (!plugin.showImplingType(spawn.getType()))
if (plugin.showImplingType(spawn.getType()) == ImplingsConfig.ImplingMode.NONE)
{
continue;
}

View File

@@ -37,6 +37,7 @@ import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.NpcChanged;
import net.runelite.api.events.NpcDespawned;
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.plugins.Plugin;
@@ -65,6 +66,9 @@ public class ImplingsPlugin extends Plugin
@Inject
private ImplingsConfig config;
@Inject
private Notifier notifier;
@Provides
ImplingsConfig getConfig(ConfigManager configManager)
{
@@ -94,6 +98,11 @@ public class ImplingsPlugin extends Plugin
if (impling != null)
{
if (showImplingType(impling.getImplingType()) == ImplingsConfig.ImplingMode.NOTIFY)
{
notifier.notify(impling.getImplingType().getName() + " impling is in the area");
}
implings.add(npc);
}
}
@@ -106,6 +115,11 @@ public class ImplingsPlugin extends Plugin
if (impling != null && !implings.contains(npc))
{
if (showImplingType(impling.getImplingType()) == ImplingsConfig.ImplingMode.NOTIFY)
{
notifier.notify(impling.getImplingType().getName() + " impling is in the area");
}
implings.add(npc);
}
}
@@ -139,10 +153,11 @@ public class ImplingsPlugin extends Plugin
return false;
}
return showImplingType(impling.getImplingType());
ImplingsConfig.ImplingMode impMode = showImplingType(impling.getImplingType());
return impMode == ImplingsConfig.ImplingMode.HIGHLIGHT || impMode == ImplingsConfig.ImplingMode.NOTIFY;
}
boolean showImplingType(ImplingType implingType)
ImplingsConfig.ImplingMode showImplingType(ImplingType implingType)
{
switch (implingType)
{
@@ -171,7 +186,7 @@ public class ImplingsPlugin extends Plugin
case LUCKY:
return config.showLucky();
default:
return false;
return ImplingsConfig.ImplingMode.NONE;
}
}