- Removed wildcard imports
This commit is contained in:
+1
-13
@@ -27,19 +27,7 @@ package net.runelite.client.plugins.runecraft;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import static net.runelite.api.ItemID.AIR_RUNE;
|
import static net.runelite.api.ItemID.*;
|
||||||
import static net.runelite.api.ItemID.BLOOD_RUNE;
|
|
||||||
import static net.runelite.api.ItemID.BODY_RUNE;
|
|
||||||
import static net.runelite.api.ItemID.CHAOS_RUNE;
|
|
||||||
import static net.runelite.api.ItemID.COSMIC_RUNE;
|
|
||||||
import static net.runelite.api.ItemID.DEATH_RUNE;
|
|
||||||
import static net.runelite.api.ItemID.EARTH_RUNE;
|
|
||||||
import static net.runelite.api.ItemID.FIRE_RUNE;
|
|
||||||
import static net.runelite.api.ItemID.LAW_RUNE;
|
|
||||||
import static net.runelite.api.ItemID.MIND_RUNE;
|
|
||||||
import static net.runelite.api.ItemID.NATURE_RUNE;
|
|
||||||
import static net.runelite.api.ItemID.SOUL_RUNE;
|
|
||||||
import static net.runelite.api.ItemID.WATER_RUNE;
|
|
||||||
import net.runelite.api.ObjectID;
|
import net.runelite.api.ObjectID;
|
||||||
|
|
||||||
public enum AbyssRifts
|
public enum AbyssRifts
|
||||||
|
|||||||
+1
@@ -218,6 +218,7 @@ public interface RunecraftConfig extends Config
|
|||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "Lavas",
|
keyName = "Lavas",
|
||||||
name = "Lavas",
|
name = "Lavas",
|
||||||
|
|||||||
+16
-10
@@ -1,40 +1,46 @@
|
|||||||
package net.runelite.client.plugins.runecraft;
|
package net.runelite.client.plugins.runecraft;
|
||||||
|
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Dimension;
|
||||||
|
import java.awt.Graphics2D;
|
||||||
|
import javax.inject.Inject;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import net.runelite.client.ui.overlay.Overlay;
|
import net.runelite.client.ui.overlay.Overlay;
|
||||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||||
import net.runelite.client.ui.overlay.components.ComponentOrientation;
|
import net.runelite.client.ui.overlay.components.ComponentOrientation;
|
||||||
import net.runelite.client.ui.overlay.components.LineComponent;
|
|
||||||
import net.runelite.client.ui.overlay.components.PanelComponent;
|
import net.runelite.client.ui.overlay.components.PanelComponent;
|
||||||
import net.runelite.client.ui.overlay.components.TitleComponent;
|
import net.runelite.client.ui.overlay.components.TitleComponent;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
public class RunecraftOverlay extends Overlay
|
||||||
import java.awt.*;
|
{
|
||||||
|
|
||||||
public class RunecraftOverlay extends Overlay {
|
|
||||||
private final RunecraftPlugin plugin;
|
private final RunecraftPlugin plugin;
|
||||||
private final Client client;
|
private final Client client;
|
||||||
private final PanelComponent panel = new PanelComponent();
|
private final PanelComponent panel = new PanelComponent();
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
RunecraftOverlay(RunecraftPlugin plugin, Client client) {
|
RunecraftOverlay(RunecraftPlugin plugin, Client client)
|
||||||
|
{
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.client = client;
|
this.client = client;
|
||||||
setPosition(OverlayPosition.CANVAS_TOP_RIGHT);
|
setPosition(OverlayPosition.CANVAS_TOP_RIGHT);
|
||||||
panel.setOrientation(ComponentOrientation.VERTICAL);
|
panel.setOrientation(ComponentOrientation.VERTICAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Dimension render(Graphics2D graphics) {
|
public Dimension render(Graphics2D graphics)
|
||||||
|
{
|
||||||
String text = "Pouch Has Degraded";
|
String text = "Pouch Has Degraded";
|
||||||
panel.getChildren().clear();
|
panel.getChildren().clear();
|
||||||
if(plugin.isDegradedPouchInInventory()) {
|
if (plugin.isDegradedPouchInInventory())
|
||||||
|
{
|
||||||
panel.getChildren().add(TitleComponent.builder()
|
panel.getChildren().add(TitleComponent.builder()
|
||||||
.text("Pouch Has Degraded")
|
.text("Pouch Has Degraded")
|
||||||
.color(Color.red)
|
.color(Color.red)
|
||||||
.build());
|
.build());
|
||||||
panel.setPreferredSize(new Dimension(graphics.getFontMetrics().stringWidth(text)+5, 5));
|
panel.setPreferredSize(new Dimension(graphics.getFontMetrics().stringWidth(text) + 5, 5));
|
||||||
return panel.render(graphics);
|
return panel.render(graphics);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+114
-53
@@ -26,19 +26,33 @@ package net.runelite.client.plugins.runecraft;
|
|||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.inject.Provides;
|
import com.google.inject.Provides;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import net.runelite.api.*;
|
import net.runelite.api.ChatMessageType;
|
||||||
import net.runelite.api.events.*;
|
import net.runelite.api.Client;
|
||||||
|
import net.runelite.api.DecorativeObject;
|
||||||
|
import net.runelite.api.EquipmentInventorySlot;
|
||||||
|
import net.runelite.api.GameState;
|
||||||
|
import net.runelite.api.InventoryID;
|
||||||
|
import net.runelite.api.Item;
|
||||||
|
import net.runelite.api.ItemID;
|
||||||
|
import net.runelite.api.MenuEntry;
|
||||||
|
import net.runelite.api.NPC;
|
||||||
|
import net.runelite.api.NpcID;
|
||||||
|
import net.runelite.api.events.ChatMessage;
|
||||||
|
import net.runelite.api.events.ConfigChanged;
|
||||||
|
import net.runelite.api.events.DecorativeObjectDespawned;
|
||||||
|
import net.runelite.api.events.DecorativeObjectSpawned;
|
||||||
|
import net.runelite.api.events.GameStateChanged;
|
||||||
|
import net.runelite.api.events.ItemContainerChanged;
|
||||||
|
import net.runelite.api.events.MenuEntryAdded;
|
||||||
|
import net.runelite.api.events.NpcDespawned;
|
||||||
|
import net.runelite.api.events.NpcSpawned;
|
||||||
import net.runelite.api.widgets.Widget;
|
import net.runelite.api.widgets.Widget;
|
||||||
import net.runelite.api.widgets.WidgetInfo;
|
import net.runelite.api.widgets.WidgetInfo;
|
||||||
import net.runelite.client.Notifier;
|
import net.runelite.client.Notifier;
|
||||||
@@ -47,10 +61,8 @@ import net.runelite.client.eventbus.Subscribe;
|
|||||||
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.ui.overlay.OverlayManager;
|
import net.runelite.client.ui.overlay.OverlayManager;
|
||||||
import net.runelite.client.util.Text;
|
|
||||||
import static net.runelite.client.util.MenuUtil.swap;
|
import static net.runelite.client.util.MenuUtil.swap;
|
||||||
|
import net.runelite.client.util.Text;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@PluginDescriptor(
|
@PluginDescriptor(
|
||||||
@@ -58,7 +70,8 @@ import static net.runelite.client.util.MenuUtil.swap;
|
|||||||
description = "Show minimap icons and clickboxes for abyssal rifts",
|
description = "Show minimap icons and clickboxes for abyssal rifts",
|
||||||
tags = {"abyssal", "minimap", "overlay", "rifts", "rc", "runecrafting"}
|
tags = {"abyssal", "minimap", "overlay", "rifts", "rc", "runecrafting"}
|
||||||
)
|
)
|
||||||
public class RunecraftPlugin extends Plugin {
|
public class RunecraftPlugin extends Plugin
|
||||||
|
{
|
||||||
private static final int[] CASTLE_WARS = {9776};
|
private static final int[] CASTLE_WARS = {9776};
|
||||||
private static final int[] FIRE_ALTAR = {10315};
|
private static final int[] FIRE_ALTAR = {10315};
|
||||||
|
|
||||||
@@ -107,19 +120,22 @@ public class RunecraftPlugin extends Plugin {
|
|||||||
private Notifier notifier;
|
private Notifier notifier;
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
RunecraftConfig getConfig(ConfigManager configManager) {
|
RunecraftConfig getConfig(ConfigManager configManager)
|
||||||
|
{
|
||||||
return configManager.getConfig(RunecraftConfig.class);
|
return configManager.getConfig(RunecraftConfig.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void startUp() throws Exception {
|
protected void startUp() throws Exception
|
||||||
|
{
|
||||||
overlayManager.add(abyssOverlay);
|
overlayManager.add(abyssOverlay);
|
||||||
abyssOverlay.updateConfig();
|
abyssOverlay.updateConfig();
|
||||||
overlayManager.add(runecraftOverlay);
|
overlayManager.add(runecraftOverlay);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void shutDown() throws Exception {
|
protected void shutDown() throws Exception
|
||||||
|
{
|
||||||
overlayManager.remove(abyssOverlay);
|
overlayManager.remove(abyssOverlay);
|
||||||
abyssObjects.clear();
|
abyssObjects.clear();
|
||||||
darkMage = null;
|
darkMage = null;
|
||||||
@@ -128,33 +144,41 @@ public class RunecraftPlugin extends Plugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onConfigChanged(ConfigChanged event) {
|
public void onConfigChanged(ConfigChanged event)
|
||||||
|
{
|
||||||
abyssOverlay.updateConfig();
|
abyssOverlay.updateConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onChatMessage(ChatMessage event) {
|
public void onChatMessage(ChatMessage event)
|
||||||
if (event.getType() != ChatMessageType.GAMEMESSAGE) {
|
{
|
||||||
|
if (event.getType() != ChatMessageType.GAMEMESSAGE)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.degradingNotification()) {
|
if (config.degradingNotification())
|
||||||
if (event.getMessage().contains(POUCH_DECAYED_MESSAGE)) {
|
{
|
||||||
|
if (event.getMessage().contains(POUCH_DECAYED_MESSAGE))
|
||||||
|
{
|
||||||
notifier.notify(POUCH_DECAYED_NOTIFICATION_MESSAGE);
|
notifier.notify(POUCH_DECAYED_NOTIFICATION_MESSAGE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onMenuEntryAdded(MenuEntryAdded entry) {
|
public void onMenuEntryAdded(MenuEntryAdded entry)
|
||||||
if (client.getGameState() != GameState.LOGGED_IN) {
|
{
|
||||||
|
if (client.getGameState() != GameState.LOGGED_IN)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget loginScreenOne = client.getWidget(WidgetInfo.LOGIN_CLICK_TO_PLAY_SCREEN);
|
Widget loginScreenOne = client.getWidget(WidgetInfo.LOGIN_CLICK_TO_PLAY_SCREEN);
|
||||||
Widget loginScreenTwo = client.getWidget(WidgetInfo.LOGIN_CLICK_TO_PLAY_SCREEN_MESSAGE_OF_THE_DAY);
|
Widget loginScreenTwo = client.getWidget(WidgetInfo.LOGIN_CLICK_TO_PLAY_SCREEN_MESSAGE_OF_THE_DAY);
|
||||||
|
|
||||||
if (loginScreenOne != null || loginScreenTwo != null) {
|
if (loginScreenOne != null || loginScreenTwo != null)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,33 +187,49 @@ public class RunecraftPlugin extends Plugin {
|
|||||||
|
|
||||||
|
|
||||||
Widget widgetBankTitleBar = client.getWidget(WidgetInfo.BANK_TITLE_BAR);
|
Widget widgetBankTitleBar = client.getWidget(WidgetInfo.BANK_TITLE_BAR);
|
||||||
if (isEssencePouch(target)) {
|
if (isEssencePouch(target))
|
||||||
if (widgetBankTitleBar == null || widgetBankTitleBar.isHidden()) { //swap pouches based on empty/full and in bank
|
{
|
||||||
|
if (widgetBankTitleBar == null || widgetBankTitleBar.isHidden())
|
||||||
|
{ //swap pouches based on empty/full and in bank
|
||||||
swap(client, "Empty", option, target);
|
swap(client, "Empty", option, target);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
swap(client, "Fill", option, target); //Due to RuneLite issues the "Deposit" menutext will always show even though it is on fill
|
swap(client, "Fill", option, target); //Due to RuneLite issues the "Deposit" menutext will always show even though it is on fill
|
||||||
}
|
}
|
||||||
} else if (target.contains("ring of dueling") && option.contains("withdraw")) { //withdraw-1 ring of dueling
|
}
|
||||||
swap(client, "withdraw-1", option, target);
|
else if (target.contains("ring of dueling") && option.contains("withdraw"))
|
||||||
} else if (target.contains("binding necklace") && option.contains("withdraw")) { //withdraw-1 binding necklace
|
{ //withdraw-1 ring of dueling
|
||||||
swap(client, "withdraw-1", option, target);
|
swap(client, "withdraw-1", option, target);
|
||||||
}
|
}
|
||||||
else if (target.contains("ring of dueling") && option.contains("remove")) {
|
else if (target.contains("binding necklace") && option.contains("withdraw"))
|
||||||
if (client.getLocalPlayer().getWorldLocation().getRegionID() != 10315) { //changes duel ring teleport options based on location
|
{ //withdraw-1 binding necklace
|
||||||
|
swap(client, "withdraw-1", option, target);
|
||||||
|
}
|
||||||
|
else if (target.contains("ring of dueling") && option.contains("remove"))
|
||||||
|
{
|
||||||
|
if (client.getLocalPlayer().getWorldLocation().getRegionID() != 10315)
|
||||||
|
{ //changes duel ring teleport options based on location
|
||||||
swap(client, "duel arena", option, target);
|
swap(client, "duel arena", option, target);
|
||||||
} else if (client.getLocalPlayer().getWorldLocation().getRegionID() == 10315) {
|
}
|
||||||
|
else if (client.getLocalPlayer().getWorldLocation().getRegionID() == 10315)
|
||||||
|
{
|
||||||
swap(client, "castle wars", option, target);
|
swap(client, "castle wars", option, target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(target.contains("crafting cape") && option.contains("remove")) { //teleport for crafting cape
|
else if (target.contains("crafting cape") && option.contains("remove"))
|
||||||
|
{ //teleport for crafting cape
|
||||||
swap(client, "Teleport", option, target);
|
swap(client, "Teleport", option, target);
|
||||||
} else if(target.contains("max cape") && option.contains("remove")) { //teleport for max cape
|
}
|
||||||
|
else if (target.contains("max cape") && option.contains("remove"))
|
||||||
|
{ //teleport for max cape
|
||||||
swap(client, "Crafting Guild", option, target);
|
swap(client, "Crafting Guild", option, target);
|
||||||
}
|
}
|
||||||
else if (target.contains("altar") && option.contains("craft")) // Don't accidentally click the altar to craft
|
else if (target.contains("altar") && option.contains("craft")) // Don't accidentally click the altar to craft
|
||||||
{
|
{
|
||||||
hide(option, target, true);
|
hide(option, target, true);
|
||||||
} else if (target.contains("pure")) // Don't accidentally use pure essence on altar
|
}
|
||||||
|
else if (target.contains("pure")) // Don't accidentally use pure essence on altar
|
||||||
{
|
{
|
||||||
hide("use", target, true);
|
hide("use", target, true);
|
||||||
hide("drop", target, true);
|
hide("drop", target, true);
|
||||||
@@ -197,18 +237,22 @@ public class RunecraftPlugin extends Plugin {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void hide(String option, String target, boolean contains) {
|
private void hide(String option, String target, boolean contains)
|
||||||
|
{
|
||||||
final MenuEntry[] entries = client.getMenuEntries();
|
final MenuEntry[] entries = client.getMenuEntries();
|
||||||
int index = searchIndex(entries, option, target, contains);
|
int index = searchIndex(entries, option, target, contains);
|
||||||
if (index < 0) {
|
if (index < 0)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MenuEntry[] newEntries = new MenuEntry[entries.length - 1];
|
MenuEntry[] newEntries = new MenuEntry[entries.length - 1];
|
||||||
int i2 = 0;
|
int i2 = 0;
|
||||||
|
|
||||||
for (int i = 0; i < entries.length - 1; i++) {
|
for (int i = 0; i < entries.length - 1; i++)
|
||||||
if (i == index) {
|
{
|
||||||
|
if (i == index)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -219,14 +263,17 @@ public class RunecraftPlugin extends Plugin {
|
|||||||
client.setMenuEntries(newEntries);
|
client.setMenuEntries(newEntries);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int searchIndex(MenuEntry[] entries, String option, String target, boolean contains) {
|
private int searchIndex(MenuEntry[] entries, String option, String target, boolean contains)
|
||||||
for (int i = entries.length - 1; i >= 0; i--) {
|
{
|
||||||
|
for (int i = entries.length - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
MenuEntry entry = entries[i];
|
MenuEntry entry = entries[i];
|
||||||
String entryOption = Text.removeTags(entry.getOption()).toLowerCase();
|
String entryOption = Text.removeTags(entry.getOption()).toLowerCase();
|
||||||
String entryTarget = Text.removeTags(entry.getTarget()).toLowerCase();
|
String entryTarget = Text.removeTags(entry.getTarget()).toLowerCase();
|
||||||
|
|
||||||
if (entryOption.contains(option.toLowerCase())
|
if (entryOption.contains(option.toLowerCase())
|
||||||
&& (entryTarget.equals(target) || (entryTarget.contains(target) && contains))) {
|
&& (entryTarget.equals(target) || (entryTarget.contains(target) && contains)))
|
||||||
|
{
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -235,28 +282,34 @@ public class RunecraftPlugin extends Plugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private boolean isEssencePouch(String target) {
|
private boolean isEssencePouch(String target)
|
||||||
|
{
|
||||||
return (target.equalsIgnoreCase("Small Pouch") || target.equalsIgnoreCase("Medium Pouch") || target.equalsIgnoreCase("Large Pouch") || target.equalsIgnoreCase("Giant Pouch"));
|
return (target.equalsIgnoreCase("Small Pouch") || target.equalsIgnoreCase("Medium Pouch") || target.equalsIgnoreCase("Large Pouch") || target.equalsIgnoreCase("Giant Pouch"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onDecorativeObjectSpawned(DecorativeObjectSpawned event) {
|
public void onDecorativeObjectSpawned(DecorativeObjectSpawned event)
|
||||||
|
{
|
||||||
DecorativeObject decorativeObject = event.getDecorativeObject();
|
DecorativeObject decorativeObject = event.getDecorativeObject();
|
||||||
if (AbyssRifts.getRift(decorativeObject.getId()) != null) {
|
if (AbyssRifts.getRift(decorativeObject.getId()) != null)
|
||||||
|
{
|
||||||
abyssObjects.add(decorativeObject);
|
abyssObjects.add(decorativeObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onDecorativeObjectDespawned(DecorativeObjectDespawned event) {
|
public void onDecorativeObjectDespawned(DecorativeObjectDespawned event)
|
||||||
|
{
|
||||||
DecorativeObject decorativeObject = event.getDecorativeObject();
|
DecorativeObject decorativeObject = event.getDecorativeObject();
|
||||||
abyssObjects.remove(decorativeObject);
|
abyssObjects.remove(decorativeObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onGameStateChanged(GameStateChanged event) {
|
public void onGameStateChanged(GameStateChanged event)
|
||||||
|
{
|
||||||
GameState gameState = event.getGameState();
|
GameState gameState = event.getGameState();
|
||||||
switch (gameState) {
|
switch (gameState)
|
||||||
|
{
|
||||||
case LOADING:
|
case LOADING:
|
||||||
abyssObjects.clear();
|
abyssObjects.clear();
|
||||||
break;
|
break;
|
||||||
@@ -269,12 +322,16 @@ public class RunecraftPlugin extends Plugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onItemContainerChanged(ItemContainerChanged event) {
|
public void onItemContainerChanged(ItemContainerChanged event)
|
||||||
if (event.getItemContainer() == client.getItemContainer(InventoryID.INVENTORY)) {
|
{
|
||||||
|
if (event.getItemContainer() == client.getItemContainer(InventoryID.INVENTORY))
|
||||||
|
{
|
||||||
|
|
||||||
final Item[] items = event.getItemContainer().getItems();
|
final Item[] items = event.getItemContainer().getItems();
|
||||||
degradedPouchInInventory = Stream.of(items).anyMatch(i -> DEGRADED_POUCHES.contains(i.getId()));
|
degradedPouchInInventory = Stream.of(items).anyMatch(i -> DEGRADED_POUCHES.contains(i.getId()));
|
||||||
} else if (event.getItemContainer() == client.getItemContainer(InventoryID.EQUIPMENT)) {
|
}
|
||||||
|
else if (event.getItemContainer() == client.getItemContainer(InventoryID.EQUIPMENT))
|
||||||
|
{
|
||||||
final Item[] items = event.getItemContainer().getItems();
|
final Item[] items = event.getItemContainer().getItems();
|
||||||
wearingTiara = config.Lavas() && items[EquipmentInventorySlot.HEAD.getSlotIdx()].getId() == ItemID.FIRE_TIARA;
|
wearingTiara = config.Lavas() && items[EquipmentInventorySlot.HEAD.getSlotIdx()].getId() == ItemID.FIRE_TIARA;
|
||||||
wearingCape = config.Lavas() && items[EquipmentInventorySlot.CAPE.getSlotIdx()].getId() == ItemID.RUNECRAFT_CAPE || items[EquipmentInventorySlot.CAPE.getSlotIdx()].getId() == ItemID.RUNECRAFT_CAPET;
|
wearingCape = config.Lavas() && items[EquipmentInventorySlot.CAPE.getSlotIdx()].getId() == ItemID.RUNECRAFT_CAPE || items[EquipmentInventorySlot.CAPE.getSlotIdx()].getId() == ItemID.RUNECRAFT_CAPET;
|
||||||
@@ -283,17 +340,21 @@ public class RunecraftPlugin extends Plugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onNpcSpawned(NpcSpawned event) {
|
public void onNpcSpawned(NpcSpawned event)
|
||||||
|
{
|
||||||
final NPC npc = event.getNpc();
|
final NPC npc = event.getNpc();
|
||||||
if (npc.getId() == NpcID.DARK_MAGE) {
|
if (npc.getId() == NpcID.DARK_MAGE)
|
||||||
|
{
|
||||||
darkMage = npc;
|
darkMage = npc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onNpcDespawned(NpcDespawned event) {
|
public void onNpcDespawned(NpcDespawned event)
|
||||||
|
{
|
||||||
final NPC npc = event.getNpc();
|
final NPC npc = event.getNpc();
|
||||||
if (npc == darkMage) {
|
if (npc == darkMage)
|
||||||
|
{
|
||||||
darkMage = null;
|
darkMage = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user