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

View File

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

View File

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