idlenotifier: adds notification to wildy resource door, resolves #1389 (#1420)

* clanchatplugin: fix issue 1407, UnsupportedOperationException

* Fixed concurrentmodification exception

* Created notification in idle notifications

* idlenotifier: adds notification to wildy resource door, resolves #1389

* Created notification in idle notifications

* idlenotifier: adds notification to wildy resource door, resolves #1389

* Added region check & fetched upstream

* removed unused variable

* removed extra whitespace

* refactor for future wall checks
This commit is contained in:
Damhan Richardson
2019-08-23 01:25:08 +01:00
committed by Kyle
parent b57a682ce7
commit 6280bcbba3
2 changed files with 41 additions and 0 deletions

View File

@@ -242,4 +242,17 @@ public interface IdleNotifierConfig extends Config
return false; return false;
} }
@ConfigItem(
keyName = "resourceDoor",
name = "Resource Door Notifier",
position = 20,
description = "Notifies if the wilderness resource area door is opened",
group = "PvP"
)
default boolean notifyResourceDoor()
{
return false;
}
} }

View File

@@ -58,6 +58,7 @@ import net.runelite.api.SkullIcon;
import net.runelite.api.VarPlayer; import net.runelite.api.VarPlayer;
import net.runelite.api.Varbits; import net.runelite.api.Varbits;
import net.runelite.api.WorldType; import net.runelite.api.WorldType;
import net.runelite.api.WallObject;
import net.runelite.api.events.AnimationChanged; import net.runelite.api.events.AnimationChanged;
import net.runelite.api.events.ConfigChanged; import net.runelite.api.events.ConfigChanged;
import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.GameStateChanged;
@@ -66,6 +67,7 @@ import net.runelite.api.events.HitsplatApplied;
import net.runelite.api.events.InteractingChanged; import net.runelite.api.events.InteractingChanged;
import net.runelite.api.events.ItemContainerChanged; import net.runelite.api.events.ItemContainerChanged;
import net.runelite.api.events.PlayerSpawned; import net.runelite.api.events.PlayerSpawned;
import net.runelite.api.events.WallObjectSpawned;
import net.runelite.api.events.SpotAnimationChanged; import net.runelite.api.events.SpotAnimationChanged;
import net.runelite.client.Notifier; import net.runelite.client.Notifier;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
@@ -75,6 +77,7 @@ import net.runelite.client.game.SoundManager;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.util.PvPUtil; import net.runelite.client.util.PvPUtil;
import org.apache.commons.lang3.ArrayUtils;
@PluginDescriptor( @PluginDescriptor(
name = "Idle Notifier", name = "Idle Notifier",
@@ -95,6 +98,8 @@ public class IdleNotifierPlugin extends Plugin
private static final String FISHING_SPOT = "Fishing spot"; private static final String FISHING_SPOT = "Fishing spot";
private static final int RESOURCE_AREA_REGION = 12605;
private static final Set<Integer> nominalAnimations = new ImmutableSet.Builder<Integer>() private static final Set<Integer> nominalAnimations = new ImmutableSet.Builder<Integer>()
.addAll( .addAll(
Arrays.asList( Arrays.asList(
@@ -258,6 +263,7 @@ public class IdleNotifierPlugin extends Plugin
private boolean interactingNotified; private boolean interactingNotified;
private SkullIcon lastTickSkull = null; private SkullIcon lastTickSkull = null;
private boolean isFirstTick = true; private boolean isFirstTick = true;
private boolean resourceDoorReady = false;
@Setter(AccessLevel.PACKAGE) @Setter(AccessLevel.PACKAGE)
private boolean animationIdle; private boolean animationIdle;
@@ -284,6 +290,7 @@ public class IdleNotifierPlugin extends Plugin
private boolean getSpecSound; private boolean getSpecSound;
private boolean getOverSpecEnergy; private boolean getOverSpecEnergy;
private boolean notifyPkers; private boolean notifyPkers;
private boolean notifyResourceDoor;
private boolean outOfItemsIdle; private boolean outOfItemsIdle;
@Provides @Provides
@@ -344,6 +351,19 @@ public class IdleNotifierPlugin extends Plugin
} }
} }
private void onWallObjectSpawned(WallObjectSpawned event)
{
WallObject wall = event.getWallObject();
if (regionCheck())
{
if (this.notifyResourceDoor && wall.getId() == 83 && resourceDoorReady)
{
notifier.notify("Door warning! The resource area door has been opened!");
}
}
}
private void onItemContainerChanged(ItemContainerChanged event) private void onItemContainerChanged(ItemContainerChanged event)
{ {
ItemContainer itemContainer = event.getItemContainer(); ItemContainer itemContainer = event.getItemContainer();
@@ -498,6 +518,7 @@ public class IdleNotifierPlugin extends Plugin
ready = false; ready = false;
resetTimers(); resetTimers();
} }
resourceDoorReady = true;
break; break;
} }
@@ -911,6 +932,11 @@ public class IdleNotifierPlugin extends Plugin
} }
} }
private boolean regionCheck()
{
return ArrayUtils.contains(client.getMapRegions(), RESOURCE_AREA_REGION);
}
private void notifyWith(Player local, String message) private void notifyWith(Player local, String message)
{ {
notifier.notify("[" + local.getName() + "] " + message); notifier.notify("[" + local.getName() + "] " + message);
@@ -934,6 +960,7 @@ public class IdleNotifierPlugin extends Plugin
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged); eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(AnimationChanged.class, this, this::onAnimationChanged); eventBus.subscribe(AnimationChanged.class, this, this::onAnimationChanged);
eventBus.subscribe(PlayerSpawned.class, this, this::onPlayerSpawned); eventBus.subscribe(PlayerSpawned.class, this, this::onPlayerSpawned);
eventBus.subscribe(WallObjectSpawned.class, this, this::onWallObjectSpawned);
eventBus.subscribe(ItemContainerChanged.class, this, this::onItemContainerChanged); eventBus.subscribe(ItemContainerChanged.class, this, this::onItemContainerChanged);
eventBus.subscribe(InteractingChanged.class, this, this::onInteractingChanged); eventBus.subscribe(InteractingChanged.class, this, this::onInteractingChanged);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged); eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
@@ -972,6 +999,7 @@ public class IdleNotifierPlugin extends Plugin
this.getSpecSound = config.getSpecSound(); this.getSpecSound = config.getSpecSound();
this.getOverSpecEnergy = config.getOverSpecEnergy(); this.getOverSpecEnergy = config.getOverSpecEnergy();
this.notifyPkers = config.notifyPkers(); this.notifyPkers = config.notifyPkers();
this.notifyResourceDoor = config.notifyResourceDoor();
this.outOfItemsIdle = config.outOfItemsIdle(); this.outOfItemsIdle = config.outOfItemsIdle();
} }
} }