mlm plugin: move idle notification from idle notifier to mlm plugin
This commit is contained in:
@@ -188,18 +188,6 @@ public class IdleNotifierPlugin extends Plugin
|
|||||||
case MINING_3A_PICKAXE:
|
case MINING_3A_PICKAXE:
|
||||||
case DENSE_ESSENCE_CHIPPING:
|
case DENSE_ESSENCE_CHIPPING:
|
||||||
case DENSE_ESSENCE_CHISELING:
|
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 */
|
/* Herblore */
|
||||||
case HERBLORE_PESTLE_AND_MORTAR:
|
case HERBLORE_PESTLE_AND_MORTAR:
|
||||||
case HERBLORE_POTIONMAKING:
|
case HERBLORE_POTIONMAKING:
|
||||||
|
|||||||
@@ -121,4 +121,14 @@ public interface MotherlodeConfig extends Config
|
|||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "notifyOnIdle",
|
||||||
|
name = "Idle notification",
|
||||||
|
description = "Sends a notification when the player stops mining"
|
||||||
|
)
|
||||||
|
default boolean notifyOnIdle()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ import net.runelite.api.events.WidgetLoaded;
|
|||||||
import net.runelite.api.widgets.Widget;
|
import net.runelite.api.widgets.Widget;
|
||||||
import net.runelite.api.widgets.WidgetID;
|
import net.runelite.api.widgets.WidgetID;
|
||||||
import net.runelite.api.widgets.WidgetInfo;
|
import net.runelite.api.widgets.WidgetInfo;
|
||||||
|
import net.runelite.client.Notifier;
|
||||||
import net.runelite.client.callback.ClientThread;
|
import net.runelite.client.callback.ClientThread;
|
||||||
import net.runelite.client.config.ConfigManager;
|
import net.runelite.client.config.ConfigManager;
|
||||||
import net.runelite.client.eventbus.Subscribe;
|
import net.runelite.client.eventbus.Subscribe;
|
||||||
@@ -156,6 +157,9 @@ public class MotherlodePlugin extends Plugin
|
|||||||
@Inject
|
@Inject
|
||||||
private ClientThread clientThread;
|
private ClientThread clientThread;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private Notifier notifier;
|
||||||
|
|
||||||
@Getter(AccessLevel.PACKAGE)
|
@Getter(AccessLevel.PACKAGE)
|
||||||
private boolean inMlm;
|
private boolean inMlm;
|
||||||
|
|
||||||
@@ -423,6 +427,7 @@ public class MotherlodePlugin extends Plugin
|
|||||||
lastAnimating = null;
|
lastAnimating = null;
|
||||||
isMining = false;
|
isMining = false;
|
||||||
resetIdleChecks();
|
resetIdleChecks();
|
||||||
|
sendIdleNotification();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -445,6 +450,7 @@ public class MotherlodePlugin extends Plugin
|
|||||||
{
|
{
|
||||||
isMining = false;
|
isMining = false;
|
||||||
resetIdleChecks();
|
resetIdleChecks();
|
||||||
|
sendIdleNotification();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -457,6 +463,16 @@ public class MotherlodePlugin extends Plugin
|
|||||||
targetVeinLocation = null;
|
targetVeinLocation = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void sendIdleNotification()
|
||||||
|
{
|
||||||
|
if (!config.notifyOnIdle())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
notifier.notify(client.getLocalPlayer().getName() + " has stopped mining!");
|
||||||
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onWallObjectSpawned(WallObjectSpawned event)
|
public void onWallObjectSpawned(WallObjectSpawned event)
|
||||||
{
|
{
|
||||||
@@ -475,6 +491,7 @@ public class MotherlodePlugin extends Plugin
|
|||||||
{
|
{
|
||||||
isMining = false;
|
isMining = false;
|
||||||
resetIdleChecks();
|
resetIdleChecks();
|
||||||
|
sendIdleNotification();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,9 @@ import net.runelite.api.Varbits;
|
|||||||
import net.runelite.api.events.GameStateChanged;
|
import net.runelite.api.events.GameStateChanged;
|
||||||
import net.runelite.api.events.ItemContainerChanged;
|
import net.runelite.api.events.ItemContainerChanged;
|
||||||
import net.runelite.api.events.VarbitChanged;
|
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.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
@@ -87,6 +90,18 @@ public class MotherlodePluginTest
|
|||||||
@Bind
|
@Bind
|
||||||
private ScheduledExecutorService scheduledExecutorService;
|
private ScheduledExecutorService scheduledExecutorService;
|
||||||
|
|
||||||
|
@Mock
|
||||||
|
@Bind
|
||||||
|
private ChatColorConfig chatColorConfig;
|
||||||
|
|
||||||
|
@Mock
|
||||||
|
@Bind
|
||||||
|
private RuneLiteConfig runeliteConfig;
|
||||||
|
|
||||||
|
@Mock
|
||||||
|
@Bind
|
||||||
|
private Notifier notifier;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void before()
|
public void before()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user