mlm plugin: move idle notification from idle notifier to mlm plugin

This commit is contained in:
Twiglet1022
2019-06-08 23:48:47 +01:00
parent 3b0f1d2a63
commit 72a7e05eac
4 changed files with 42 additions and 12 deletions

View File

@@ -188,18 +188,6 @@ public class IdleNotifierPlugin extends Plugin
case MINING_3A_PICKAXE:
case DENSE_ESSENCE_CHIPPING:
case DENSE_ESSENCE_CHISELING:
/* Mining(Motherlode) */
case MINING_MOTHERLODE_BRONZE:
case MINING_MOTHERLODE_IRON:
case MINING_MOTHERLODE_STEEL:
case MINING_MOTHERLODE_BLACK:
case MINING_MOTHERLODE_MITHRIL:
case MINING_MOTHERLODE_ADAMANT:
case MINING_MOTHERLODE_RUNE:
case MINING_MOTHERLODE_DRAGON:
case MINING_MOTHERLODE_DRAGON_ORN:
case MINING_MOTHERLODE_INFERNAL:
case MINING_MOTHERLODE_3A:
/* Herblore */
case HERBLORE_PESTLE_AND_MORTAR:
case HERBLORE_POTIONMAKING:

View File

@@ -121,4 +121,14 @@ public interface MotherlodeConfig extends Config
{
return true;
}
@ConfigItem(
keyName = "notifyOnIdle",
name = "Idle notification",
description = "Sends a notification when the player stops mining"
)
default boolean notifyOnIdle()
{
return false;
}
}

View File

@@ -95,6 +95,7 @@ import net.runelite.api.events.WidgetLoaded;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetID;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.Notifier;
import net.runelite.client.callback.ClientThread;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
@@ -156,6 +157,9 @@ public class MotherlodePlugin extends Plugin
@Inject
private ClientThread clientThread;
@Inject
private Notifier notifier;
@Getter(AccessLevel.PACKAGE)
private boolean inMlm;
@@ -423,6 +427,7 @@ public class MotherlodePlugin extends Plugin
lastAnimating = null;
isMining = false;
resetIdleChecks();
sendIdleNotification();
}
}
else
@@ -445,6 +450,7 @@ public class MotherlodePlugin extends Plugin
{
isMining = false;
resetIdleChecks();
sendIdleNotification();
}
}
@@ -457,6 +463,16 @@ public class MotherlodePlugin extends Plugin
targetVeinLocation = null;
}
private void sendIdleNotification()
{
if (!config.notifyOnIdle())
{
return;
}
notifier.notify(client.getLocalPlayer().getName() + " has stopped mining!");
}
@Subscribe
public void onWallObjectSpawned(WallObjectSpawned event)
{
@@ -475,6 +491,7 @@ public class MotherlodePlugin extends Plugin
{
isMining = false;
resetIdleChecks();
sendIdleNotification();
}
}

View File

@@ -39,6 +39,9 @@ import net.runelite.api.Varbits;
import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.ItemContainerChanged;
import net.runelite.api.events.VarbitChanged;
import net.runelite.client.Notifier;
import net.runelite.client.config.ChatColorConfig;
import net.runelite.client.config.RuneLiteConfig;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -87,6 +90,18 @@ public class MotherlodePluginTest
@Bind
private ScheduledExecutorService scheduledExecutorService;
@Mock
@Bind
private ChatColorConfig chatColorConfig;
@Mock
@Bind
private RuneLiteConfig runeliteConfig;
@Mock
@Bind
private Notifier notifier;
@Before
public void before()
{