Add Subscribe annotations for default lifecycle events

This commit is contained in:
Lucwousin
2019-11-16 15:48:09 +01:00
parent 4fa3a73eb9
commit 6632376d0f
194 changed files with 1617 additions and 3191 deletions

View File

@@ -341,11 +341,12 @@ public interface Client extends GameShell
* Gets the logged in player instance. * Gets the logged in player instance.
* *
* @return the logged in player * @return the logged in player
* * <p>
* (getLocalPlayerIndex returns the local index, useful for menus/interacting) * (getLocalPlayerIndex returns the local index, useful for menus/interacting)
*/ */
@Nullable @Nullable
Player getLocalPlayer(); Player getLocalPlayer();
int getLocalPlayerIndex(); int getLocalPlayerIndex();
/** /**
@@ -957,36 +958,42 @@ public interface Client extends GameShell
/** /**
* Gets the music volume * Gets the music volume
*
* @return volume 0-255 inclusive * @return volume 0-255 inclusive
*/ */
int getMusicVolume(); int getMusicVolume();
/** /**
* Sets the music volume * Sets the music volume
*
* @param volume 0-255 inclusive * @param volume 0-255 inclusive
*/ */
void setMusicVolume(int volume); void setMusicVolume(int volume);
/** /**
* Gets the sound effect volume * Gets the sound effect volume
*
* @return volume 0-127 inclusive * @return volume 0-127 inclusive
*/ */
int getSoundEffectVolume(); int getSoundEffectVolume();
/** /**
* Sets the sound effect volume * Sets the sound effect volume
*
* @param volume 0-127 inclusive * @param volume 0-127 inclusive
*/ */
void setSoundEffectVolume(int volume); void setSoundEffectVolume(int volume);
/** /**
* Gets the area sound effect volume * Gets the area sound effect volume
*
* @return volume 0-127 inclusive * @return volume 0-127 inclusive
*/ */
int getAreaSoundEffectVolume(); int getAreaSoundEffectVolume();
/** /**
* Sets the area sound effect volume * Sets the area sound effect volume
*
* @param volume 0-127 inclusive * @param volume 0-127 inclusive
*/ */
void setAreaSoundEffectVolume(int volume); void setAreaSoundEffectVolume(int volume);
@@ -1865,8 +1872,6 @@ public interface Client extends GameShell
/** /**
* Scales values from pixels onto canvas * Scales values from pixels onto canvas
* *
* @see net.runelite.client.util.ImageUtil#resizeSprite(Client, Sprite, int, int)
*
* @param canvas the array we're writing to * @param canvas the array we're writing to
* @param pixels pixels to draw * @param pixels pixels to draw
* @param color should be 0 * @param color should be 0
@@ -1879,12 +1884,13 @@ public interface Client extends GameShell
* @param pixelWidth pretty much horizontal scale * @param pixelWidth pretty much horizontal scale
* @param pixelHeight pretty much vertical scale * @param pixelHeight pretty much vertical scale
* @param oldWidth old width * @param oldWidth old width
* @see net.runelite.client.util.ImageUtil#resizeSprite(Client, Sprite, int, int)
*/ */
void scaleSprite(int[] canvas, int[] pixels, int color, int pixelX, int pixelY, int canvasIdx, int canvasOffset, int newWidth, int newHeight, int pixelWidth, int pixelHeight, int oldWidth); void scaleSprite(int[] canvas, int[] pixels, int color, int pixelX, int pixelY, int canvasIdx, int canvasOffset, int newWidth, int newHeight, int pixelWidth, int pixelHeight, int oldWidth);
/** /**
* Get the MenuEntry at client.getMenuOptionCount() - 1 * Get the MenuEntry at client.getMenuOptionCount() - 1
* * <p>
* This is useful so you don't have to use getMenuEntries, * This is useful so you don't have to use getMenuEntries,
* which will create a big array, when you only want to change * which will create a big array, when you only want to change
* the left click one. * the left click one.
@@ -1893,7 +1899,7 @@ public interface Client extends GameShell
/** /**
* Set the MenuEntry at client.getMenuOptionCount() - 1 * Set the MenuEntry at client.getMenuOptionCount() - 1
* * <p>
* This is useful so you don't have to use setMenuEntries, * This is useful so you don't have to use setMenuEntries,
* which will arraycopy a big array to several smaller arrays lol, * which will arraycopy a big array to several smaller arrays lol,
* when you only want to change the left click one. * when you only want to change the left click one.

View File

@@ -98,13 +98,14 @@ public enum InventoryID
public static InventoryID getValue(int value) public static InventoryID getValue(int value)
{ {
for (InventoryID e: InventoryID.values()) for (InventoryID e : InventoryID.values())
{ {
if (e.id == value) if (e.id == value)
{ {
return e; return e;
} }
} }
return null;
throw new IllegalArgumentException("No InventoryID with id " + value + " exists");
} }
} }

View File

@@ -24,17 +24,15 @@
*/ */
package net.runelite.client.plugins.account; package net.runelite.client.plugins.account;
import java.util.concurrent.ScheduledExecutorService;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.runelite.client.account.AccountSession; import net.runelite.client.account.AccountSession;
import net.runelite.client.account.SessionManager; import net.runelite.client.account.SessionManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.SessionOpen; import net.runelite.client.events.SessionOpen;
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.ClientToolbar;
@PluginDescriptor( @PluginDescriptor(
name = "Account", name = "Account",
@@ -49,33 +47,7 @@ public class AccountPlugin extends Plugin
@Inject @Inject
private SessionManager sessionManager; private SessionManager sessionManager;
@Inject @Subscribe
private ClientToolbar clientToolbar;
@Inject
private ScheduledExecutorService executor;
@Inject
private EventBus eventBus;
@Override
protected void startUp() throws Exception
{
addSubscriptions();
}
@Override
protected void shutDown() throws Exception
{
eventBus.unregister(this);
}
private void addSubscriptions()
{
eventBus.subscribe(SessionOpen.class, this, this::onSessionOpen);
}
private void onSessionOpen(SessionOpen sessionOpen) private void onSessionOpen(SessionOpen sessionOpen)
{ {
AccountSession session = sessionManager.getAccountSession(); AccountSession session = sessionManager.getAccountSession();

View File

@@ -40,11 +40,12 @@ import net.runelite.api.QuestState;
import net.runelite.api.ScriptID; import net.runelite.api.ScriptID;
import net.runelite.api.VarPlayer; import net.runelite.api.VarPlayer;
import net.runelite.api.events.WidgetLoaded; import net.runelite.api.events.WidgetLoaded;
import net.runelite.api.util.Text;
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.callback.ClientThread; import net.runelite.client.callback.ClientThread;
import net.runelite.client.eventbus.EventBus; 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.plugins.achievementdiary.diaries.ArdougneDiaryRequirement; import net.runelite.client.plugins.achievementdiary.diaries.ArdougneDiaryRequirement;
@@ -59,7 +60,6 @@ import net.runelite.client.plugins.achievementdiary.diaries.MorytaniaDiaryRequir
import net.runelite.client.plugins.achievementdiary.diaries.VarrockDiaryRequirement; import net.runelite.client.plugins.achievementdiary.diaries.VarrockDiaryRequirement;
import net.runelite.client.plugins.achievementdiary.diaries.WesternDiaryRequirement; import net.runelite.client.plugins.achievementdiary.diaries.WesternDiaryRequirement;
import net.runelite.client.plugins.achievementdiary.diaries.WildernessDiaryRequirement; import net.runelite.client.plugins.achievementdiary.diaries.WildernessDiaryRequirement;
import net.runelite.api.util.Text;
@Slf4j @Slf4j
@PluginDescriptor( @PluginDescriptor(
@@ -79,21 +79,17 @@ public class DiaryRequirementsPlugin extends Plugin
@Inject @Inject
private ClientThread clientThread; private ClientThread clientThread;
@Inject
private EventBus eventBus;
@Override @Override
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
eventBus.subscribe(WidgetLoaded.class, this, this::onWidgetLoaded);
} }
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
} }
@Subscribe
private void onWidgetLoaded(final WidgetLoaded event) private void onWidgetLoaded(final WidgetLoaded event)
{ {
if (event.getGroupId() == WidgetID.DIARY_QUEST_GROUP_ID) if (event.getGroupId() == WidgetID.DIARY_QUEST_GROUP_ID)

View File

@@ -71,6 +71,7 @@ import net.runelite.api.events.WallObjectSpawned;
import net.runelite.client.Notifier; import net.runelite.client.Notifier;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.EventBus;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.ConfigChanged;
import net.runelite.client.game.AgilityShortcut; import net.runelite.client.game.AgilityShortcut;
import net.runelite.client.game.ItemManager; import net.runelite.client.game.ItemManager;
@@ -170,7 +171,6 @@ public class AgilityPlugin extends Plugin
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
updateConfig(); updateConfig();
addSubscriptions();
if (config.showShortcutLevel()) if (config.showShortcutLevel())
{ {
@@ -185,7 +185,6 @@ public class AgilityPlugin extends Plugin
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
eventBus.unregister(MENU_SUBS); eventBus.unregister(MENU_SUBS);
overlayManager.remove(agilityOverlay); overlayManager.remove(agilityOverlay);
@@ -196,34 +195,13 @@ public class AgilityPlugin extends Plugin
agilityLevel = 0; agilityLevel = 0;
} }
private void addSubscriptions()
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventBus.subscribe(StatChanged .class, this, this::onStatChanged);
eventBus.subscribe(ItemSpawned.class, this, this::onItemSpawned);
eventBus.subscribe(ItemDespawned.class, this, this::onItemDespawned);
eventBus.subscribe(GameTick.class, this, this::onGameTick);
eventBus.subscribe(GameObjectSpawned.class, this, this::onGameObjectSpawned);
eventBus.subscribe(GameObjectChanged.class, this, this::onGameObjectChanged);
eventBus.subscribe(GameObjectDespawned.class, this, this::onGameObjectDespawned);
eventBus.subscribe(GroundObjectSpawned.class, this, this::onGroundObjectSpawned);
eventBus.subscribe(GroundObjectChanged.class, this, this::onGroundObjectChanged);
eventBus.subscribe(GroundObjectDespawned.class, this, this::onGroundObjectDespawned);
eventBus.subscribe(WallObjectSpawned.class, this, this::onWallObjectSpawned);
eventBus.subscribe(WallObjectChanged.class, this, this::onWallObjectChanged);
eventBus.subscribe(WallObjectDespawned.class, this, this::onWallObjectDespawned);
eventBus.subscribe(DecorativeObjectSpawned.class, this, this::onDecorativeObjectSpawned);
eventBus.subscribe(DecorativeObjectChanged.class, this, this::onDecorativeObjectChanged);
eventBus.subscribe(DecorativeObjectDespawned.class, this, this::onDecorativeObjectDespawned);
}
private void addMenuSubscriptions() private void addMenuSubscriptions()
{ {
eventBus.subscribe(BeforeRender.class, MENU_SUBS, this::onBeforeRender); eventBus.subscribe(BeforeRender.class, MENU_SUBS, this::onBeforeRender);
eventBus.subscribe(MenuOpened.class, MENU_SUBS, this::onMenuOpened); eventBus.subscribe(MenuOpened.class, MENU_SUBS, this::onMenuOpened);
} }
@Subscribe
private void onGameStateChanged(GameStateChanged event) private void onGameStateChanged(GameStateChanged event)
{ {
switch (event.getGameState()) switch (event.getGameState())
@@ -248,6 +226,7 @@ public class AgilityPlugin extends Plugin
} }
} }
@Subscribe
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (!event.getGroup().equals("agility")) if (!event.getGroup().equals("agility"))
@@ -293,6 +272,7 @@ public class AgilityPlugin extends Plugin
this.showAgilityArenaTimer = config.showAgilityArenaTimer(); this.showAgilityArenaTimer = config.showAgilityArenaTimer();
} }
@Subscribe
public void onStatChanged(StatChanged statChanged) public void onStatChanged(StatChanged statChanged)
{ {
if (statChanged.getSkill() != AGILITY) if (statChanged.getSkill() != AGILITY)
@@ -335,6 +315,7 @@ public class AgilityPlugin extends Plugin
} }
} }
@Subscribe
private void onItemSpawned(ItemSpawned itemSpawned) private void onItemSpawned(ItemSpawned itemSpawned)
{ {
if (obstacles.isEmpty()) if (obstacles.isEmpty())
@@ -351,12 +332,14 @@ public class AgilityPlugin extends Plugin
} }
} }
@Subscribe
private void onItemDespawned(ItemDespawned itemDespawned) private void onItemDespawned(ItemDespawned itemDespawned)
{ {
final Tile tile = itemDespawned.getTile(); final Tile tile = itemDespawned.getTile();
marksOfGrace.remove(tile); marksOfGrace.remove(tile);
} }
@Subscribe
private void onGameTick(GameTick tick) private void onGameTick(GameTick tick)
{ {
if (isInAgilityArena()) if (isInAgilityArena())
@@ -408,61 +391,73 @@ public class AgilityPlugin extends Plugin
infoBoxManager.addInfoBox(new AgilityArenaTimer(this, itemManager.getImage(AGILITY_ARENA_TICKET))); infoBoxManager.addInfoBox(new AgilityArenaTimer(this, itemManager.getImage(AGILITY_ARENA_TICKET)));
} }
@Subscribe
private void onGameObjectSpawned(GameObjectSpawned event) private void onGameObjectSpawned(GameObjectSpawned event)
{ {
onTileObject(event.getTile(), null, event.getGameObject()); onTileObject(event.getTile(), null, event.getGameObject());
} }
@Subscribe
private void onGameObjectChanged(GameObjectChanged event) private void onGameObjectChanged(GameObjectChanged event)
{ {
onTileObject(event.getTile(), event.getPrevious(), event.getGameObject()); onTileObject(event.getTile(), event.getPrevious(), event.getGameObject());
} }
@Subscribe
private void onGameObjectDespawned(GameObjectDespawned event) private void onGameObjectDespawned(GameObjectDespawned event)
{ {
onTileObject(event.getTile(), event.getGameObject(), null); onTileObject(event.getTile(), event.getGameObject(), null);
} }
@Subscribe
private void onGroundObjectSpawned(GroundObjectSpawned event) private void onGroundObjectSpawned(GroundObjectSpawned event)
{ {
onTileObject(event.getTile(), null, event.getGroundObject()); onTileObject(event.getTile(), null, event.getGroundObject());
} }
@Subscribe
private void onGroundObjectChanged(GroundObjectChanged event) private void onGroundObjectChanged(GroundObjectChanged event)
{ {
onTileObject(event.getTile(), event.getPrevious(), event.getGroundObject()); onTileObject(event.getTile(), event.getPrevious(), event.getGroundObject());
} }
@Subscribe
private void onGroundObjectDespawned(GroundObjectDespawned event) private void onGroundObjectDespawned(GroundObjectDespawned event)
{ {
onTileObject(event.getTile(), event.getGroundObject(), null); onTileObject(event.getTile(), event.getGroundObject(), null);
} }
@Subscribe
private void onWallObjectSpawned(WallObjectSpawned event) private void onWallObjectSpawned(WallObjectSpawned event)
{ {
onTileObject(event.getTile(), null, event.getWallObject()); onTileObject(event.getTile(), null, event.getWallObject());
} }
@Subscribe
private void onWallObjectChanged(WallObjectChanged event) private void onWallObjectChanged(WallObjectChanged event)
{ {
onTileObject(event.getTile(), event.getPrevious(), event.getWallObject()); onTileObject(event.getTile(), event.getPrevious(), event.getWallObject());
} }
@Subscribe
private void onWallObjectDespawned(WallObjectDespawned event) private void onWallObjectDespawned(WallObjectDespawned event)
{ {
onTileObject(event.getTile(), event.getWallObject(), null); onTileObject(event.getTile(), event.getWallObject(), null);
} }
@Subscribe
private void onDecorativeObjectSpawned(DecorativeObjectSpawned event) private void onDecorativeObjectSpawned(DecorativeObjectSpawned event)
{ {
onTileObject(event.getTile(), null, event.getDecorativeObject()); onTileObject(event.getTile(), null, event.getDecorativeObject());
} }
@Subscribe
private void onDecorativeObjectChanged(DecorativeObjectChanged event) private void onDecorativeObjectChanged(DecorativeObjectChanged event)
{ {
onTileObject(event.getTile(), event.getPrevious(), event.getDecorativeObject()); onTileObject(event.getTile(), event.getPrevious(), event.getDecorativeObject());
} }
@Subscribe
private void onDecorativeObjectDespawned(DecorativeObjectDespawned event) private void onDecorativeObjectDespawned(DecorativeObjectDespawned event)
{ {
onTileObject(event.getTile(), event.getDecorativeObject(), null); onTileObject(event.getTile(), event.getDecorativeObject(), null);

View File

@@ -51,6 +51,7 @@ import net.runelite.api.events.NpcSpawned;
import net.runelite.api.events.ProjectileMoved; import net.runelite.api.events.ProjectileMoved;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.EventBus;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
@@ -122,9 +123,6 @@ public class HydraPlugin extends Plugin
{ {
initConfig(); initConfig();
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
inHydraInstance = checkArea(); inHydraInstance = checkArea();
lastAttackTick = -1; lastAttackTick = -1;
poisonProjectiles.clear(); poisonProjectiles.clear();
@@ -133,7 +131,6 @@ public class HydraPlugin extends Plugin
@Override @Override
protected void shutDown() protected void shutDown()
{ {
eventBus.unregister(this);
eventBus.unregister("fight"); eventBus.unregister("fight");
eventBus.unregister("npcSpawned"); eventBus.unregister("npcSpawned");
@@ -165,6 +162,7 @@ public class HydraPlugin extends Plugin
eventBus.subscribe(ChatMessage.class, "fight", this::onChatMessage); eventBus.subscribe(ChatMessage.class, "fight", this::onChatMessage);
} }
@Subscribe
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (!event.getGroup().equals("betterHydra")) if (!event.getGroup().equals("betterHydra"))
@@ -207,6 +205,7 @@ public class HydraPlugin extends Plugin
} }
} }
@Subscribe
private void onGameStateChanged(GameStateChanged state) private void onGameStateChanged(GameStateChanged state)
{ {
if (state.getGameState() != GameState.LOGGED_IN) if (state.getGameState() != GameState.LOGGED_IN)

View File

@@ -31,11 +31,11 @@ import net.runelite.api.Client;
import net.runelite.api.EquipmentInventorySlot; import net.runelite.api.EquipmentInventorySlot;
import net.runelite.api.InventoryID; import net.runelite.api.InventoryID;
import net.runelite.api.Item; import net.runelite.api.Item;
import net.runelite.api.ItemDefinition;
import net.runelite.api.ItemContainer; import net.runelite.api.ItemContainer;
import net.runelite.api.ItemDefinition;
import net.runelite.api.events.ItemContainerChanged; import net.runelite.api.events.ItemContainerChanged;
import net.runelite.client.callback.ClientThread; import net.runelite.client.callback.ClientThread;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.game.ItemManager; import net.runelite.client.game.ItemManager;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
@@ -61,15 +61,11 @@ public class AmmoPlugin extends Plugin
@Inject @Inject
private ItemManager itemManager; private ItemManager itemManager;
@Inject
private EventBus eventBus;
private AmmoCounter counterBox; private AmmoCounter counterBox;
@Override @Override
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
eventBus.subscribe(ItemContainerChanged.class, this, this::onItemContainerChanged);
clientThread.invokeLater(() -> clientThread.invokeLater(() ->
{ {
@@ -85,12 +81,11 @@ public class AmmoPlugin extends Plugin
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
infoBoxManager.removeInfoBox(counterBox); infoBoxManager.removeInfoBox(counterBox);
counterBox = null; counterBox = null;
} }
@Subscribe
private void onItemContainerChanged(ItemContainerChanged event) private void onItemContainerChanged(ItemContainerChanged event)
{ {
if (event.getItemContainer() != client.getItemContainer(InventoryID.EQUIPMENT)) if (event.getItemContainer() != client.getItemContainer(InventoryID.EQUIPMENT))

View File

@@ -28,9 +28,9 @@ import com.google.inject.Provides;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
import net.runelite.api.Client; import net.runelite.api.Client;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
@@ -51,9 +51,6 @@ public class AnimationSmoothingPlugin extends Plugin
@Inject @Inject
private AnimationSmoothingConfig config; private AnimationSmoothingConfig config;
@Inject
private EventBus eventBus;
@Provides @Provides
AnimationSmoothingConfig getConfig(ConfigManager configManager) AnimationSmoothingConfig getConfig(ConfigManager configManager)
{ {
@@ -63,22 +60,19 @@ public class AnimationSmoothingPlugin extends Plugin
@Override @Override
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
update(); update();
} }
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
client.setInterpolatePlayerAnimations(false); client.setInterpolatePlayerAnimations(false);
client.setInterpolateNpcAnimations(false); client.setInterpolateNpcAnimations(false);
client.setInterpolateObjectAnimations(false); client.setInterpolateObjectAnimations(false);
client.setInterpolateWidgetAnimations(false); client.setInterpolateWidgetAnimations(false);
} }
@Subscribe
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (event.getGroup().equals(CONFIG_GROUP)) if (event.getGroup().equals(CONFIG_GROUP))

View File

@@ -34,7 +34,7 @@ import net.runelite.api.events.FocusChanged;
import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.GameStateChanged;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.config.Keybind; import net.runelite.client.config.Keybind;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.ConfigChanged;
import net.runelite.client.input.KeyManager; import net.runelite.client.input.KeyManager;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
@@ -71,15 +71,9 @@ public class AntiDragPlugin extends Plugin
@Inject @Inject
private OverlayManager overlayManager; private OverlayManager overlayManager;
@Inject
private ConfigManager configManager;
@Inject @Inject
private KeyManager keyManager; private KeyManager keyManager;
@Inject
private EventBus eventBus;
@Provides @Provides
AntiDragConfig getConfig(ConfigManager configManager) AntiDragConfig getConfig(ConfigManager configManager)
{ {
@@ -96,8 +90,6 @@ public class AntiDragPlugin extends Plugin
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
overlay.setColor(config.color()); overlay.setColor(config.color());
addSubscriptions();
updateConfig(); updateConfig();
updateKeyListeners(); updateKeyListeners();
@@ -110,8 +102,6 @@ public class AntiDragPlugin extends Plugin
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
client.setInventoryDragDelay(DEFAULT_DELAY); client.setInventoryDragDelay(DEFAULT_DELAY);
keyManager.unregisterKeyListener(holdListener); keyManager.unregisterKeyListener(holdListener);
keyManager.unregisterKeyListener(toggleListener); keyManager.unregisterKeyListener(toggleListener);
@@ -120,13 +110,7 @@ public class AntiDragPlugin extends Plugin
clientUI.resetCursor(); clientUI.resetCursor();
} }
private void addSubscriptions() @Subscribe
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(FocusChanged.class, this, this::onFocusChanged);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
}
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (event.getGroup().equals("antiDrag")) if (event.getGroup().equals("antiDrag"))
@@ -158,6 +142,7 @@ public class AntiDragPlugin extends Plugin
} }
} }
@Subscribe
private void onGameStateChanged(GameStateChanged event) private void onGameStateChanged(GameStateChanged event)
{ {
if (event.getGameState() == GameState.LOGIN_SCREEN) if (event.getGameState() == GameState.LOGIN_SCREEN)
@@ -179,6 +164,7 @@ public class AntiDragPlugin extends Plugin
this.selectedCursor = config.selectedCursor(); this.selectedCursor = config.selectedCursor();
} }
@Subscribe
private void onFocusChanged(FocusChanged focusChanged) private void onFocusChanged(FocusChanged focusChanged)
{ {
if (!focusChanged.isFocused() && config.reqFocus() && !config.alwaysOn()) if (!focusChanged.isFocused() && config.reqFocus() && !config.alwaysOn())

View File

@@ -54,7 +54,7 @@ import net.runelite.api.events.ProjectileMoved;
import net.runelite.api.events.ProjectileSpawned; import net.runelite.api.events.ProjectileSpawned;
import net.runelite.client.Notifier; import net.runelite.client.Notifier;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
@@ -84,8 +84,6 @@ public class AoeWarningPlugin extends Plugin
private BombOverlay bombOverlay; private BombOverlay bombOverlay;
@Inject @Inject
private Client client; private Client client;
@Inject
private EventBus eventbus;
@Getter(AccessLevel.PACKAGE) @Getter(AccessLevel.PACKAGE)
private List<WorldPoint> lightningTrail = new ArrayList<>(); private List<WorldPoint> lightningTrail = new ArrayList<>();
@Getter(AccessLevel.PACKAGE) @Getter(AccessLevel.PACKAGE)
@@ -167,7 +165,6 @@ public class AoeWarningPlugin extends Plugin
protected void startUp() protected void startUp()
{ {
updateConfig(); updateConfig();
addSubscriptions();
overlayManager.add(coreOverlay); overlayManager.add(coreOverlay);
overlayManager.add(bombOverlay); overlayManager.add(bombOverlay);
reset(); reset();
@@ -179,20 +176,9 @@ public class AoeWarningPlugin extends Plugin
overlayManager.remove(coreOverlay); overlayManager.remove(coreOverlay);
overlayManager.remove(bombOverlay); overlayManager.remove(bombOverlay);
reset(); reset();
eventbus.unregister(this);
}
private void addSubscriptions()
{
eventbus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventbus.subscribe(ProjectileMoved.class, this, this::onProjectileMoved);
eventbus.subscribe(GameObjectSpawned.class, this, this::onGameObjectSpawned);
eventbus.subscribe(GameObjectDespawned.class, this, this::onGameObjectDespawned);
eventbus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventbus.subscribe(GameTick.class, this, this::onGameTick);
eventbus.subscribe(ProjectileSpawned.class, this, this::onProjectileSpawned);
} }
@Subscribe
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (!event.getGroup().equals("aoe")) if (!event.getGroup().equals("aoe"))
@@ -203,6 +189,7 @@ public class AoeWarningPlugin extends Plugin
updateConfig(); updateConfig();
} }
@Subscribe
private void onProjectileSpawned(ProjectileSpawned event) private void onProjectileSpawned(ProjectileSpawned event)
{ {
final Projectile projectile = event.getProjectile(); final Projectile projectile = event.getProjectile();
@@ -231,6 +218,7 @@ public class AoeWarningPlugin extends Plugin
} }
} }
@Subscribe
private void onProjectileMoved(ProjectileMoved event) private void onProjectileMoved(ProjectileMoved event)
{ {
if (projectiles.isEmpty()) if (projectiles.isEmpty())
@@ -249,6 +237,7 @@ public class AoeWarningPlugin extends Plugin
}); });
} }
@Subscribe
private void onGameObjectSpawned(GameObjectSpawned event) private void onGameObjectSpawned(GameObjectSpawned event)
{ {
final GameObject gameObject = event.getGameObject(); final GameObject gameObject = event.getGameObject();
@@ -283,6 +272,7 @@ public class AoeWarningPlugin extends Plugin
} }
} }
@Subscribe
private void onGameObjectDespawned(GameObjectDespawned event) private void onGameObjectDespawned(GameObjectDespawned event)
{ {
final GameObject gameObject = event.getGameObject(); final GameObject gameObject = event.getGameObject();
@@ -304,6 +294,7 @@ public class AoeWarningPlugin extends Plugin
} }
} }
@Subscribe
private void onGameStateChanged(GameStateChanged event) private void onGameStateChanged(GameStateChanged event)
{ {
if (event.getGameState() == GameState.LOGGED_IN) if (event.getGameState() == GameState.LOGGED_IN)
@@ -313,6 +304,7 @@ public class AoeWarningPlugin extends Plugin
reset(); reset();
} }
@Subscribe
private void onGameTick(GameTick event) private void onGameTick(GameTick event)
{ {
lightningTrail.clear(); lightningTrail.clear();

View File

@@ -30,17 +30,16 @@ import com.google.common.collect.Table;
import com.google.inject.Provides; import com.google.inject.Provides;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import javax.annotation.Nullable;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
import lombok.AccessLevel; import lombok.AccessLevel;
import lombok.Getter; import lombok.Getter;
import javax.annotation.Nullable;
import net.runelite.api.Client; import net.runelite.api.Client;
import net.runelite.api.GameState; import net.runelite.api.GameState;
import net.runelite.api.Skill; import net.runelite.api.Skill;
import net.runelite.api.VarPlayer; import net.runelite.api.VarPlayer;
import net.runelite.api.Varbits; import net.runelite.api.Varbits;
import net.runelite.client.events.ConfigChanged;
import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.VarbitChanged; import net.runelite.api.events.VarbitChanged;
import net.runelite.api.events.WidgetHiddenChanged; import net.runelite.api.events.WidgetHiddenChanged;
@@ -51,7 +50,8 @@ import net.runelite.api.widgets.WidgetInfo;
import static net.runelite.api.widgets.WidgetInfo.TO_GROUP; import static net.runelite.api.widgets.WidgetInfo.TO_GROUP;
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.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
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 static net.runelite.client.plugins.attackstyles.AttackStyle.CASTING; import static net.runelite.client.plugins.attackstyles.AttackStyle.CASTING;
@@ -90,9 +90,6 @@ public class AttackStylesPlugin extends Plugin
@Inject @Inject
private AttackStylesOverlay overlay; private AttackStylesOverlay overlay;
@Inject
private EventBus eventBus;
@Provides @Provides
AttackStylesConfig provideConfig(ConfigManager configManager) AttackStylesConfig provideConfig(ConfigManager configManager)
{ {
@@ -114,7 +111,6 @@ public class AttackStylesPlugin extends Plugin
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
updateConfig(); updateConfig();
addSubscriptions();
overlayManager.add(overlay); overlayManager.add(overlay);
@@ -142,24 +138,13 @@ public class AttackStylesPlugin extends Plugin
@Override @Override
protected void shutDown() protected void shutDown()
{ {
eventBus.unregister(this);
overlayManager.remove(overlay); overlayManager.remove(overlay);
hideWarnedStyles(false); hideWarnedStyles(false);
processWidgets(); processWidgets();
hideWidget(client.getWidget(WidgetInfo.COMBAT_AUTO_RETALIATE), false); hideWidget(client.getWidget(WidgetInfo.COMBAT_AUTO_RETALIATE), false);
} }
private void addSubscriptions() @Nullable
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(WidgetHiddenChanged.class, this, this::onWidgetHiddenChanged);
eventBus.subscribe(WidgetLoaded.class, this, this::onWidgetLoaded);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventBus.subscribe(VarbitChanged.class, this, this::onVarbitChanged);
}
@Nullable
public AttackStyle getAttackStyle() public AttackStyle getAttackStyle()
{ {
return attackStyle; return attackStyle;
@@ -170,6 +155,7 @@ public class AttackStylesPlugin extends Plugin
return warnedSkillSelected; return warnedSkillSelected;
} }
@Subscribe
private void onWidgetHiddenChanged(WidgetHiddenChanged event) private void onWidgetHiddenChanged(WidgetHiddenChanged event)
{ {
if (event.getWidget().isSelfHidden() || TO_GROUP(event.getWidget().getId()) != COMBAT_GROUP_ID) if (event.getWidget().isSelfHidden() || TO_GROUP(event.getWidget().getId()) != COMBAT_GROUP_ID)
@@ -180,6 +166,7 @@ public class AttackStylesPlugin extends Plugin
processWidgets(); processWidgets();
} }
@Subscribe
private void onWidgetLoaded(WidgetLoaded event) private void onWidgetLoaded(WidgetLoaded event)
{ {
if (event.getGroupId() != COMBAT_GROUP_ID) if (event.getGroupId() != COMBAT_GROUP_ID)
@@ -207,6 +194,7 @@ public class AttackStylesPlugin extends Plugin
hideWidget(client.getWidget(WidgetInfo.COMBAT_AUTO_RETALIATE), this.hideAutoRetaliate); hideWidget(client.getWidget(WidgetInfo.COMBAT_AUTO_RETALIATE), this.hideAutoRetaliate);
} }
@Subscribe
private void onGameStateChanged(GameStateChanged event) private void onGameStateChanged(GameStateChanged event)
{ {
if (event.getGameState() == GameState.LOGGED_IN) if (event.getGameState() == GameState.LOGGED_IN)
@@ -215,6 +203,7 @@ public class AttackStylesPlugin extends Plugin
} }
} }
@Subscribe
void onVarbitChanged(VarbitChanged event) void onVarbitChanged(VarbitChanged event)
{ {
int currentAttackStyleVarbit = client.getVar(VarPlayer.ATTACK_STYLE); int currentAttackStyleVarbit = client.getVar(VarPlayer.ATTACK_STYLE);
@@ -240,6 +229,7 @@ public class AttackStylesPlugin extends Plugin
} }
} }
@Subscribe
void onConfigChanged(ConfigChanged event) void onConfigChanged(ConfigChanged event)
{ {
if (event.getGroup().equals("attackIndicator")) if (event.getGroup().equals("attackIndicator"))

View File

@@ -66,7 +66,7 @@ import net.runelite.api.widgets.WidgetID;
import net.runelite.api.widgets.WidgetInfo; import net.runelite.api.widgets.WidgetInfo;
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.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.ConfigChanged;
import net.runelite.client.game.ItemManager; import net.runelite.client.game.ItemManager;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
@@ -133,9 +133,6 @@ public class BankPlugin extends Plugin
@Inject @Inject
private BankSearch bankSearch; private BankSearch bankSearch;
@Inject
private EventBus eventBus;
@Inject @Inject
private ContainerCalculation bankCalculation; private ContainerCalculation bankCalculation;
@@ -166,30 +163,18 @@ public class BankPlugin extends Plugin
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
updateConfig(); updateConfig();
addSubscriptions(); searchString = "";
} }
@Override @Override
protected void shutDown() protected void shutDown()
{ {
eventBus.unregister(this);
clientThread.invokeLater(() -> bankSearch.reset(false)); clientThread.invokeLater(() -> bankSearch.reset(false));
forceRightClickFlag = false; forceRightClickFlag = false;
itemQuantities = null; itemQuantities = null;
} }
private void addSubscriptions() @Subscribe
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(MenuShouldLeftClick.class, this, this::onMenuShouldLeftClick);
eventBus.subscribe(MenuEntryAdded.class, this, this::onMenuEntryAdded);
eventBus.subscribe(ScriptCallbackEvent.class, this, this::onScriptCallbackEvent);
eventBus.subscribe(WidgetLoaded.class, this, this::onWidgetLoaded);
eventBus.subscribe(ItemContainerChanged.class, this, this::onItemContainerChanged);
eventBus.subscribe(VarClientStrChanged.class, this, this::onVarClientStrChanged);
searchString = "";
}
private void onMenuShouldLeftClick(MenuShouldLeftClick event) private void onMenuShouldLeftClick(MenuShouldLeftClick event)
{ {
if (!forceRightClickFlag) if (!forceRightClickFlag)
@@ -211,6 +196,7 @@ public class BankPlugin extends Plugin
} }
} }
@Subscribe
private void onMenuEntryAdded(MenuEntryAdded event) private void onMenuEntryAdded(MenuEntryAdded event)
{ {
if ((event.getOption().equals(DEPOSIT_WORN) && this.rightClickBankEquip) if ((event.getOption().equals(DEPOSIT_WORN) && this.rightClickBankEquip)
@@ -221,6 +207,7 @@ public class BankPlugin extends Plugin
} }
} }
@Subscribe
private void onScriptCallbackEvent(ScriptCallbackEvent event) private void onScriptCallbackEvent(ScriptCallbackEvent event)
{ {
if (event.getEventName().equals("bankPinButtons") && this.largePinNumbers) if (event.getEventName().equals("bankPinButtons") && this.largePinNumbers)
@@ -265,6 +252,7 @@ public class BankPlugin extends Plugin
} }
} }
@Subscribe
private void onWidgetLoaded(WidgetLoaded event) private void onWidgetLoaded(WidgetLoaded event)
{ {
if (event.getGroupId() != WidgetID.SEED_VAULT_GROUP_ID || !config.seedVaultValue()) if (event.getGroupId() != WidgetID.SEED_VAULT_GROUP_ID || !config.seedVaultValue())
@@ -275,6 +263,7 @@ public class BankPlugin extends Plugin
updateSeedVaultTotal(); updateSeedVaultTotal();
} }
@Subscribe
public void onVarClientStrChanged(VarClientStrChanged event) public void onVarClientStrChanged(VarClientStrChanged event)
{ {
String searchVar = client.getVar(VarClientStr.INPUT_TEXT); String searchVar = client.getVar(VarClientStr.INPUT_TEXT);
@@ -302,6 +291,7 @@ public class BankPlugin extends Plugin
} }
} }
@Subscribe
public void onItemContainerChanged(ItemContainerChanged event) public void onItemContainerChanged(ItemContainerChanged event)
{ {
int containerId = event.getContainerId(); int containerId = event.getContainerId();
@@ -427,6 +417,7 @@ public class BankPlugin extends Plugin
return itemContainer.getItems(); return itemContainer.getItems();
} }
@Subscribe
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (!event.getGroup().equals("bank")) if (!event.getGroup().equals("bank"))

View File

@@ -52,7 +52,6 @@ import net.runelite.api.ItemID;
import net.runelite.api.MenuOpcode; import net.runelite.api.MenuOpcode;
import net.runelite.api.VarClientInt; import net.runelite.api.VarClientInt;
import net.runelite.api.VarClientStr; import net.runelite.api.VarClientStr;
import net.runelite.client.events.ConfigChanged;
import net.runelite.api.events.DraggingWidgetChanged; import net.runelite.api.events.DraggingWidgetChanged;
import net.runelite.api.events.FocusChanged; import net.runelite.api.events.FocusChanged;
import net.runelite.api.events.GameTick; import net.runelite.api.events.GameTick;
@@ -68,7 +67,8 @@ import net.runelite.api.widgets.WidgetID;
import net.runelite.api.widgets.WidgetInfo; import net.runelite.api.widgets.WidgetInfo;
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.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.game.ItemManager; import net.runelite.client.game.ItemManager;
import net.runelite.client.game.SpriteManager; import net.runelite.client.game.SpriteManager;
import net.runelite.client.game.chatbox.ChatboxPanelManager; import net.runelite.client.game.chatbox.ChatboxPanelManager;
@@ -146,9 +146,6 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis
@Inject @Inject
private SpriteManager spriteManager; private SpriteManager spriteManager;
@Inject
private EventBus eventBus;
@Inject @Inject
private ConfigManager configManager; private ConfigManager configManager;
@@ -166,7 +163,6 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis
@Override @Override
public void startUp() public void startUp()
{ {
addSubscriptions();
cleanConfig(); cleanConfig();
keyManager.registerKeyListener(this); keyManager.registerKeyListener(this);
@@ -231,8 +227,6 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis
@Override @Override
public void shutDown() public void shutDown()
{ {
eventBus.unregister(this);
keyManager.unregisterKeyListener(this); keyManager.unregisterKeyListener(this);
mouseManager.unregisterMouseWheelListener(this); mouseManager.unregisterMouseWheelListener(this);
clientThread.invokeLater(tabInterface::destroy); clientThread.invokeLater(tabInterface::destroy);
@@ -242,26 +236,14 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis
itemQuantities.clear(); itemQuantities.clear();
} }
private void addSubscriptions() private boolean isSearching()
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(ScriptCallbackEvent.class, this, this::onScriptCallbackEvent);
eventBus.subscribe(MenuEntryAdded.class, this, this::onMenuEntryAdded);
eventBus.subscribe(MenuOptionClicked.class, this, this::onMenuOptionClicked);
eventBus.subscribe(GameTick.class, this, this::onGameTick);
eventBus.subscribe(DraggingWidgetChanged.class, this, this::onDraggingWidgetChanged);
eventBus.subscribe(WidgetLoaded.class, this, this::onWidgetLoaded);
eventBus.subscribe(FocusChanged.class, this, this::onFocusChanged);
eventBus.subscribe(ItemContainerChanged.class, this, this::onItemContainerChanged);
}
private boolean isSearching()
{ {
return client.getVar(VarClientInt.INPUT_TYPE) == InputType.SEARCH.getType() return client.getVar(VarClientInt.INPUT_TYPE) == InputType.SEARCH.getType()
|| (client.getVar(VarClientInt.INPUT_TYPE) <= 0 || (client.getVar(VarClientInt.INPUT_TYPE) <= 0
&& client.getVar(VarClientStr.INPUT_TEXT) != null && client.getVar(VarClientStr.INPUT_TEXT).length() > 0); && client.getVar(VarClientStr.INPUT_TEXT) != null && client.getVar(VarClientStr.INPUT_TEXT).length() > 0);
} }
@Subscribe
private void onScriptCallbackEvent(ScriptCallbackEvent event) private void onScriptCallbackEvent(ScriptCallbackEvent event)
{ {
String eventName = event.getEventName(); String eventName = event.getEventName();
@@ -371,6 +353,7 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis
} }
} }
@Subscribe
private void onMenuEntryAdded(MenuEntryAdded event) private void onMenuEntryAdded(MenuEntryAdded event)
{ {
if (event.getParam1() == WidgetInfo.BANK_ITEM_CONTAINER.getId() if (event.getParam1() == WidgetInfo.BANK_ITEM_CONTAINER.getId()
@@ -401,6 +384,7 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis
tabInterface.handleAdd(event); tabInterface.handleAdd(event);
} }
@Subscribe
private void onMenuOptionClicked(MenuOptionClicked event) private void onMenuOptionClicked(MenuOptionClicked event)
{ {
if (event.getParam1() == WidgetInfo.BANK_ITEM_CONTAINER.getId() if (event.getParam1() == WidgetInfo.BANK_ITEM_CONTAINER.getId()
@@ -476,6 +460,7 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis
} }
} }
@Subscribe
private void onItemContainerChanged(ItemContainerChanged event) private void onItemContainerChanged(ItemContainerChanged event)
{ {
if (event.getContainerId() == InventoryID.BANK.getId()) if (event.getContainerId() == InventoryID.BANK.getId())
@@ -491,6 +476,7 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis
} }
} }
@Subscribe
private void onConfigChanged(ConfigChanged configChanged) private void onConfigChanged(ConfigChanged configChanged)
{ {
if (configChanged.getGroup().equals("banktags") && configChanged.getKey().equals("useTabs")) if (configChanged.getGroup().equals("banktags") && configChanged.getKey().equals("useTabs"))
@@ -506,16 +492,19 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis
} }
} }
@Subscribe
private void onGameTick(GameTick event) private void onGameTick(GameTick event)
{ {
tabInterface.update(); tabInterface.update();
} }
@Subscribe
private void onDraggingWidgetChanged(DraggingWidgetChanged event) private void onDraggingWidgetChanged(DraggingWidgetChanged event)
{ {
tabInterface.handleDrag(event.isDraggingWidget(), shiftPressed); tabInterface.handleDrag(event.isDraggingWidget(), shiftPressed);
} }
@Subscribe
private void onWidgetLoaded(WidgetLoaded event) private void onWidgetLoaded(WidgetLoaded event)
{ {
if (event.getGroupId() == WidgetID.BANK_GROUP_ID) if (event.getGroupId() == WidgetID.BANK_GROUP_ID)
@@ -524,6 +513,7 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis
} }
} }
@Subscribe
private void onFocusChanged(FocusChanged event) private void onFocusChanged(FocusChanged event)
{ {
if (!event.isFocused()) if (!event.isFocused())

View File

@@ -51,7 +51,7 @@ import net.runelite.client.chat.ChatMessageBuilder;
import net.runelite.client.chat.ChatMessageManager; import net.runelite.client.chat.ChatMessageManager;
import net.runelite.client.chat.QueuedMessage; import net.runelite.client.chat.QueuedMessage;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
@@ -92,9 +92,6 @@ public class BanListPlugin extends Plugin
@Inject @Inject
private ChatMessageManager chatMessageManager; private ChatMessageManager chatMessageManager;
@Inject
private EventBus eventBus;
private String tobNames = ""; private String tobNames = "";
private boolean enableWDRScam; private boolean enableWDRScam;
private boolean enableWDRToxic; private boolean enableWDRToxic;
@@ -112,7 +109,6 @@ public class BanListPlugin extends Plugin
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
updateConfig(); updateConfig();
addSubscriptions();
manualBans.addAll(Text.fromCSV(Text.standardize(config.getBannedPlayers()))); manualBans.addAll(Text.fromCSV(Text.standardize(config.getBannedPlayers())));
@@ -123,22 +119,13 @@ public class BanListPlugin extends Plugin
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
wdrScamSet.clear(); wdrScamSet.clear();
wdrToxicSet.clear(); wdrToxicSet.clear();
runeWatchSet.clear(); runeWatchSet.clear();
manualBans.clear(); manualBans.clear();
} }
private void addSubscriptions() @Subscribe
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(WidgetHiddenChanged.class, this, this::onWidgetHiddenChanged);
eventBus.subscribe(ClanMemberJoined.class, this, this::onClanMemberJoined);
eventBus.subscribe(WidgetLoaded.class, this, this::onWidgetLoaded);
eventBus.subscribe(GameTick.class, this, this::onGameTick);
}
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (event.getGroup().equals("banlist") && event.getKey().equals("bannedPlayers")) if (event.getGroup().equals("banlist") && event.getKey().equals("bannedPlayers"))
@@ -163,6 +150,7 @@ public class BanListPlugin extends Plugin
/** /**
* Event to keep making sure player names are highlighted red in clan chat, since the red name goes away frequently * Event to keep making sure player names are highlighted red in clan chat, since the red name goes away frequently
*/ */
@Subscribe
private void onWidgetHiddenChanged(WidgetHiddenChanged widgetHiddenChanged) private void onWidgetHiddenChanged(WidgetHiddenChanged widgetHiddenChanged)
{ {
if (client.getGameState() != GameState.LOGGED_IN if (client.getGameState() != GameState.LOGGED_IN
@@ -183,6 +171,7 @@ public class BanListPlugin extends Plugin
}); });
} }
@Subscribe
private void onClanMemberJoined(ClanMemberJoined event) private void onClanMemberJoined(ClanMemberJoined event)
{ {
ClanMember member = event.getMember(); ClanMember member = event.getMember();
@@ -213,6 +202,7 @@ public class BanListPlugin extends Plugin
/** /**
* If a trade window is opened and the person trading us is on the list, modify "trading with" * If a trade window is opened and the person trading us is on the list, modify "trading with"
*/ */
@Subscribe
private void onWidgetLoaded(WidgetLoaded widgetLoaded) private void onWidgetLoaded(WidgetLoaded widgetLoaded)
{ {
if (this.highlightInTrade && widgetLoaded.getGroupId() == PLAYER_TRADE_SCREEN_GROUP_ID) if (this.highlightInTrade && widgetLoaded.getGroupId() == PLAYER_TRADE_SCREEN_GROUP_ID)
@@ -234,6 +224,7 @@ public class BanListPlugin extends Plugin
} }
} }
@Subscribe
private void onGameTick(GameTick event) private void onGameTick(GameTick event)
{ {
final Widget raidingParty = client.getWidget(WidgetInfo.THEATRE_OF_BLOOD_RAIDING_PARTY); final Widget raidingParty = client.getWidget(WidgetInfo.THEATRE_OF_BLOOD_RAIDING_PARTY);

View File

@@ -82,7 +82,7 @@ import net.runelite.client.chat.ChatMessageBuilder;
import net.runelite.client.chat.ChatMessageManager; import net.runelite.client.chat.ChatMessageManager;
import net.runelite.client.chat.QueuedMessage; import net.runelite.client.chat.QueuedMessage;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.ConfigChanged;
import net.runelite.client.game.ItemManager; import net.runelite.client.game.ItemManager;
import net.runelite.client.input.KeyListener; import net.runelite.client.input.KeyListener;
@@ -155,9 +155,6 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
@Inject @Inject
private KeyManager keyManager; private KeyManager keyManager;
@Inject
private EventBus eventBus;
@Getter @Getter
private boolean inGame = false; private boolean inGame = false;
@@ -309,7 +306,6 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
updateConfig(); updateConfig();
addSubscriptions();
font = FontManager.getRunescapeFont().deriveFont(Font.BOLD, 24); font = FontManager.getRunescapeFont().deriveFont(Font.BOLD, 24);
torsoImage = itemManager.getImage(ItemID.FIGHTER_TORSO); torsoImage = itemManager.getImage(ItemID.FIGHTER_TORSO);
@@ -327,8 +323,6 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
overlayManager.remove(widgetsOverlay); overlayManager.remove(widgetsOverlay);
overlayManager.remove(sceneOverlay); overlayManager.remove(sceneOverlay);
keyManager.unregisterKeyListener(this); keyManager.unregisterKeyListener(this);
@@ -349,25 +343,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
menu.clearHiddenMenus(); menu.clearHiddenMenus();
} }
private void addSubscriptions() @Override
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(WidgetLoaded.class, this, this::onWidgetLoaded);
eventBus.subscribe(ChatMessage.class, this, this::onChatMessage);
eventBus.subscribe(ItemSpawned.class, this, this::onItemSpawned);
eventBus.subscribe(ItemDespawned.class, this, this::onItemDespawned);
eventBus.subscribe(GameTick.class, this, this::onGameTick);
eventBus.subscribe(NpcSpawned.class, this, this::onNpcSpawned);
eventBus.subscribe(NpcDespawned.class, this, this::onNpcDespawned);
eventBus.subscribe(BeforeRender.class, this, this::onBeforeRender);
eventBus.subscribe(MenuEntryAdded.class, this, this::onMenuEntryAdded);
eventBus.subscribe(MenuOptionClicked.class, this, this::onMenuOptionClicked);
eventBus.subscribe(InteractingChanged.class, this, this::onInteractingChanged);
eventBus.subscribe(ProjectileSpawned.class, this, this::onProjectileSpawned);
eventBus.subscribe(VarbitChanged.class, this, this::onVarbitChanged);
}
@Override
public void keyTyped(KeyEvent e) public void keyTyped(KeyEvent e)
{ {
} }
@@ -400,6 +376,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
} }
} }
@Subscribe
private void onConfigChanged(ConfigChanged configChanged) private void onConfigChanged(ConfigChanged configChanged)
{ {
//not client thread be careful //not client thread be careful
@@ -510,6 +487,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
this.showEggCountOverlay = config.showEggCountOverlay(); this.showEggCountOverlay = config.showEggCountOverlay();
} }
@Subscribe
private void onWidgetLoaded(WidgetLoaded event) private void onWidgetLoaded(WidgetLoaded event)
{ {
switch (event.getGroupId()) switch (event.getGroupId())
@@ -580,6 +558,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
} }
} }
@Subscribe
private void onChatMessage(ChatMessage chatMessage) private void onChatMessage(ChatMessage chatMessage)
{ {
if (!chatMessage.getType().equals(ChatMessageType.GAMEMESSAGE)) if (!chatMessage.getType().equals(ChatMessageType.GAMEMESSAGE))
@@ -629,7 +608,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
{ {
String[] tokens = message.split(" "); String[] tokens = message.split(" ");
int time = wave == null ? -1 : (int)wave.getWaveTimer().getElapsedTime(); int time = wave == null ? -1 : (int) wave.getWaveTimer().getElapsedTime();
switch (tokens[4]) switch (tokens[4])
{ {
@@ -663,6 +642,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
} }
} }
@Subscribe
private void onItemSpawned(ItemSpawned itemSpawned) private void onItemSpawned(ItemSpawned itemSpawned)
{ {
if (!isInGame()) if (!isInGame())
@@ -682,6 +662,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
} }
} }
@Subscribe
private void onItemDespawned(ItemDespawned itemDespawned) private void onItemDespawned(ItemDespawned itemDespawned)
{ {
if (!isInGame()) if (!isInGame())
@@ -732,6 +713,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
} }
} }
@Subscribe
private void onGameTick(GameTick event) private void onGameTick(GameTick event)
{ {
// Keep in mind isInGame is delayed by a tick when a wave ends // Keep in mind isInGame is delayed by a tick when a wave ends
@@ -763,6 +745,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
} }
} }
@Subscribe
private void onNpcSpawned(NpcSpawned event) private void onNpcSpawned(NpcSpawned event)
{ {
if (!isInGame()) if (!isInGame())
@@ -785,6 +768,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
} }
} }
@Subscribe
private void onNpcDespawned(NpcDespawned event) private void onNpcDespawned(NpcDespawned event)
{ {
if (!isInGame()) if (!isInGame())
@@ -800,6 +784,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
// This was almost certainly a waste of time to get working, because almost nobody // This was almost certainly a waste of time to get working, because almost nobody
// actually uses the horn of glory. At least now there shouldn't be anyone complaining // actually uses the horn of glory. At least now there shouldn't be anyone complaining
// about the horn of glory breaking anything and everything that should never break. // about the horn of glory breaking anything and everything that should never break.
@Subscribe
private void onBeforeRender(BeforeRender event) private void onBeforeRender(BeforeRender event)
{ {
if (!isInGame()) if (!isInGame())
@@ -973,6 +958,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
// onMenuEntryAdded is being used for conditional entry changes that are not // onMenuEntryAdded is being used for conditional entry changes that are not
// easily achievable using MenuManager, all other changes use MenuManager in // easily achievable using MenuManager, all other changes use MenuManager in
// the BarbarianAssaultMenu/Menus classes // the BarbarianAssaultMenu/Menus classes
@Subscribe
private void onMenuEntryAdded(MenuEntryAdded event) private void onMenuEntryAdded(MenuEntryAdded event)
{ {
if (!isInGame()) if (!isInGame())
@@ -1163,6 +1149,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
client.setMenuEntries(menu.toArray(new MenuEntry[0])); client.setMenuEntries(menu.toArray(new MenuEntry[0]));
} }
@Subscribe
private void onMenuOptionClicked(MenuOptionClicked event) private void onMenuOptionClicked(MenuOptionClicked event)
{ {
if (!isInGame() && getRole() != null) if (!isInGame() && getRole() != null)
@@ -1195,6 +1182,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
} }
// Interacting changed has a slight delay until after the hitsplat is applied // Interacting changed has a slight delay until after the hitsplat is applied
@Subscribe
private void onInteractingChanged(InteractingChanged event) private void onInteractingChanged(InteractingChanged event)
{ {
if (!isInGame() || getRole() != Role.HEALER) if (!isInGame() || getRole() != Role.HEALER)
@@ -1225,11 +1213,12 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
} }
else if (StringUtils.equals(opponent.getName(), "Penance Healer")) else if (StringUtils.equals(opponent.getName(), "Penance Healer"))
{ {
lastInteracted = ((NPC)opponent).getIndex(); lastInteracted = ((NPC) opponent).getIndex();
} }
} }
@Subscribe
private void onProjectileSpawned(ProjectileSpawned event) private void onProjectileSpawned(ProjectileSpawned event)
{ {
if (!isInGame()) if (!isInGame())
@@ -1246,10 +1235,11 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
String name = target.getName(); String name = target.getName();
if ("Penance Fighter".equals(name) || "Penance Ranger".equals(name)) if ("Penance Fighter".equals(name) || "Penance Ranger".equals(name))
{ {
projectiles.put(((NPC)target).getIndex(), event.getProjectile()); projectiles.put(((NPC) target).getIndex(), event.getProjectile());
} }
} }
@Subscribe
private void onVarbitChanged(VarbitChanged event) private void onVarbitChanged(VarbitChanged event)
{ {
int newInGameBit = client.getVar(Varbits.IN_GAME_BA); int newInGameBit = client.getVar(Varbits.IN_GAME_BA);

View File

@@ -54,7 +54,7 @@ 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.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.ConfigChanged;
import net.runelite.client.game.SpriteManager; import net.runelite.client.game.SpriteManager;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
@@ -125,9 +125,6 @@ public class BarrowsPlugin extends Plugin
@Inject @Inject
private BarrowsConfig config; private BarrowsConfig config;
@Inject
private EventBus eventBus;
@Provides @Provides
BarrowsConfig provideConfig(ConfigManager configManager) BarrowsConfig provideConfig(ConfigManager configManager)
{ {
@@ -150,7 +147,6 @@ public class BarrowsPlugin extends Plugin
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
updateConfig(); updateConfig();
addSubscriptions();
overlayManager.add(barrowsOverlay); overlayManager.add(barrowsOverlay);
overlayManager.add(brotherOverlay); overlayManager.add(brotherOverlay);
@@ -159,8 +155,6 @@ public class BarrowsPlugin extends Plugin
@Override @Override
protected void shutDown() protected void shutDown()
{ {
eventBus.unregister(this);
overlayManager.remove(barrowsOverlay); overlayManager.remove(barrowsOverlay);
overlayManager.remove(brotherOverlay); overlayManager.remove(brotherOverlay);
walls.clear(); walls.clear();
@@ -183,19 +177,7 @@ public class BarrowsPlugin extends Plugin
} }
} }
private void addSubscriptions() @Subscribe
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(WallObjectSpawned.class, this, this::onWallObjectSpawned);
eventBus.subscribe(WallObjectChanged.class, this, this::onWallObjectChanged);
eventBus.subscribe(WallObjectDespawned.class, this, this::onWallObjectDespawned);
eventBus.subscribe(GameObjectSpawned.class, this, this::onGameObjectSpawned);
eventBus.subscribe(GameObjectChanged.class, this, this::onGameObjectChanged);
eventBus.subscribe(GameObjectDespawned.class, this, this::onGameObjectDespawned);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventBus.subscribe(WidgetLoaded.class, this, this::onWidgetLoaded);
}
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (event.getGroup().equals("barrows")) if (event.getGroup().equals("barrows"))
@@ -219,6 +201,7 @@ public class BarrowsPlugin extends Plugin
this.showPrayerDrainTimer = config.showPrayerDrainTimer(); this.showPrayerDrainTimer = config.showPrayerDrainTimer();
} }
@Subscribe
private void onWallObjectSpawned(WallObjectSpawned event) private void onWallObjectSpawned(WallObjectSpawned event)
{ {
WallObject wallObject = event.getWallObject(); WallObject wallObject = event.getWallObject();
@@ -228,6 +211,7 @@ public class BarrowsPlugin extends Plugin
} }
} }
@Subscribe
private void onWallObjectChanged(WallObjectChanged event) private void onWallObjectChanged(WallObjectChanged event)
{ {
WallObject previous = event.getPrevious(); WallObject previous = event.getPrevious();
@@ -240,12 +224,14 @@ public class BarrowsPlugin extends Plugin
} }
} }
@Subscribe
private void onWallObjectDespawned(WallObjectDespawned event) private void onWallObjectDespawned(WallObjectDespawned event)
{ {
WallObject wallObject = event.getWallObject(); WallObject wallObject = event.getWallObject();
walls.remove(wallObject); walls.remove(wallObject);
} }
@Subscribe
private void onGameObjectSpawned(GameObjectSpawned event) private void onGameObjectSpawned(GameObjectSpawned event)
{ {
GameObject gameObject = event.getGameObject(); GameObject gameObject = event.getGameObject();
@@ -255,6 +241,7 @@ public class BarrowsPlugin extends Plugin
} }
} }
@Subscribe
private void onGameObjectChanged(GameObjectChanged event) private void onGameObjectChanged(GameObjectChanged event)
{ {
GameObject previous = event.getPrevious(); GameObject previous = event.getPrevious();
@@ -267,12 +254,14 @@ public class BarrowsPlugin extends Plugin
} }
} }
@Subscribe
private void onGameObjectDespawned(GameObjectDespawned event) private void onGameObjectDespawned(GameObjectDespawned event)
{ {
GameObject gameObject = event.getGameObject(); GameObject gameObject = event.getGameObject();
ladders.remove(gameObject); ladders.remove(gameObject);
} }
@Subscribe
private void onGameStateChanged(GameStateChanged event) private void onGameStateChanged(GameStateChanged event)
{ {
if (event.getGameState() == GameState.LOADING) if (event.getGameState() == GameState.LOADING)
@@ -297,6 +286,7 @@ public class BarrowsPlugin extends Plugin
} }
} }
@Subscribe
private void onWidgetLoaded(WidgetLoaded event) private void onWidgetLoaded(WidgetLoaded event)
{ {
if (event.getGroupId() == WidgetID.BARROWS_PUZZLE_GROUP_ID) if (event.getGroupId() == WidgetID.BARROWS_PUZZLE_GROUP_ID)

View File

@@ -40,6 +40,7 @@ import net.runelite.api.events.GameTick;
import net.runelite.api.util.Text; import net.runelite.api.util.Text;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.EventBus;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.ConfigChanged;
import net.runelite.client.menus.AbstractComparableEntry; import net.runelite.client.menus.AbstractComparableEntry;
import net.runelite.client.menus.MenuManager; import net.runelite.client.menus.MenuManager;
@@ -99,8 +100,6 @@ public class BlackjackPlugin extends Plugin
@Override @Override
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
menuManager.addPriorityEntry(KNOCKOUT_BANDIT); menuManager.addPriorityEntry(KNOCKOUT_BANDIT);
menuManager.addPriorityEntry(KNOCKOUT_MENAPHITE); menuManager.addPriorityEntry(KNOCKOUT_MENAPHITE);
this.pickpocketOnAggro = config.pickpocketOnAggro(); this.pickpocketOnAggro = config.pickpocketOnAggro();
@@ -113,10 +112,10 @@ public class BlackjackPlugin extends Plugin
menuManager.removePriorityEntry(PICKPOCKET_MENAPHITE); menuManager.removePriorityEntry(PICKPOCKET_MENAPHITE);
menuManager.removePriorityEntry(KNOCKOUT_BANDIT); menuManager.removePriorityEntry(KNOCKOUT_BANDIT);
menuManager.removePriorityEntry(KNOCKOUT_MENAPHITE); menuManager.removePriorityEntry(KNOCKOUT_MENAPHITE);
eventBus.unregister(this);
eventBus.unregister("poll"); eventBus.unregister("poll");
} }
@Subscribe
private void onGameStateChanged(GameStateChanged event) private void onGameStateChanged(GameStateChanged event)
{ {
if (event.getGameState() != GameState.LOGGED_IN || !ArrayUtils.contains(client.getMapRegions(), POLLNIVNEACH_REGION)) if (event.getGameState() != GameState.LOGGED_IN || !ArrayUtils.contains(client.getMapRegions(), POLLNIVNEACH_REGION))
@@ -129,6 +128,7 @@ public class BlackjackPlugin extends Plugin
eventBus.subscribe(ChatMessage.class, "poll", this::onChatMessage); eventBus.subscribe(ChatMessage.class, "poll", this::onChatMessage);
} }
@Subscribe
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (event.getGroup().equals("blackjack")) if (event.getGroup().equals("blackjack"))

View File

@@ -46,7 +46,7 @@ import net.runelite.api.util.Text;
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.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.ConfigChanged;
import net.runelite.client.game.ItemManager; import net.runelite.client.game.ItemManager;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
@@ -97,9 +97,6 @@ public class BlastFurnacePlugin extends Plugin
@Inject @Inject
private BlastFurnaceConfig config; private BlastFurnaceConfig config;
@Inject
private EventBus eventBus;
@Getter(AccessLevel.PACKAGE) @Getter(AccessLevel.PACKAGE)
private boolean showConveyorBelt; private boolean showConveyorBelt;
@Getter(AccessLevel.PACKAGE) @Getter(AccessLevel.PACKAGE)
@@ -109,7 +106,6 @@ public class BlastFurnacePlugin extends Plugin
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
updateConfig(); updateConfig();
addSubscriptions();
overlayManager.add(overlay); overlayManager.add(overlay);
overlayManager.add(cofferOverlay); overlayManager.add(cofferOverlay);
@@ -119,8 +115,6 @@ public class BlastFurnacePlugin extends Plugin
@Override @Override
protected void shutDown() protected void shutDown()
{ {
eventBus.unregister(this);
infoBoxManager.removeIf(ForemanTimer.class::isInstance); infoBoxManager.removeIf(ForemanTimer.class::isInstance);
overlayManager.remove(overlay); overlayManager.remove(overlay);
overlayManager.remove(cofferOverlay); overlayManager.remove(cofferOverlay);
@@ -130,21 +124,13 @@ public class BlastFurnacePlugin extends Plugin
foremanTimer = null; foremanTimer = null;
} }
private void addSubscriptions() @Provides
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(GameObjectSpawned.class, this, this::onGameObjectSpawned);
eventBus.subscribe(GameObjectDespawned.class, this, this::onGameObjectDespawned);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventBus.subscribe(GameTick.class, this, this::onGameTick);
}
@Provides
BlastFurnaceConfig provideConfig(ConfigManager configManager) BlastFurnaceConfig provideConfig(ConfigManager configManager)
{ {
return configManager.getConfig(BlastFurnaceConfig.class); return configManager.getConfig(BlastFurnaceConfig.class);
} }
@Subscribe
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (event.getGroup().equals("blastfurnace")) if (event.getGroup().equals("blastfurnace"))
@@ -153,6 +139,7 @@ public class BlastFurnacePlugin extends Plugin
} }
} }
@Subscribe
private void onGameObjectSpawned(GameObjectSpawned event) private void onGameObjectSpawned(GameObjectSpawned event)
{ {
GameObject gameObject = event.getGameObject(); GameObject gameObject = event.getGameObject();
@@ -169,6 +156,7 @@ public class BlastFurnacePlugin extends Plugin
} }
} }
@Subscribe
private void onGameObjectDespawned(GameObjectDespawned event) private void onGameObjectDespawned(GameObjectDespawned event)
{ {
GameObject gameObject = event.getGameObject(); GameObject gameObject = event.getGameObject();
@@ -185,6 +173,7 @@ public class BlastFurnacePlugin extends Plugin
} }
} }
@Subscribe
private void onGameStateChanged(GameStateChanged event) private void onGameStateChanged(GameStateChanged event)
{ {
if (event.getGameState() == GameState.LOADING) if (event.getGameState() == GameState.LOADING)
@@ -194,6 +183,7 @@ public class BlastFurnacePlugin extends Plugin
} }
} }
@Subscribe
private void onGameTick(GameTick event) private void onGameTick(GameTick event)
{ {
Widget npcDialog = client.getWidget(WidgetInfo.DIALOG_NPC_TEXT); Widget npcDialog = client.getWidget(WidgetInfo.DIALOG_NPC_TEXT);

View File

@@ -42,7 +42,7 @@ import net.runelite.api.events.GameTick;
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.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; 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;
@@ -73,9 +73,6 @@ public class BlastMinePlugin extends Plugin
@Inject @Inject
private BlastMinePluginConfig config; private BlastMinePluginConfig config;
@Inject
private EventBus eventBus;
@Provides @Provides
BlastMinePluginConfig getConfig(ConfigManager configManager) BlastMinePluginConfig getConfig(ConfigManager configManager)
{ {
@@ -99,7 +96,6 @@ public class BlastMinePlugin extends Plugin
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
updateConfig(); updateConfig();
addSubscriptions();
overlayManager.add(blastMineRockOverlay); overlayManager.add(blastMineRockOverlay);
overlayManager.add(blastMineOreCountOverlay); overlayManager.add(blastMineOreCountOverlay);
@@ -108,8 +104,6 @@ public class BlastMinePlugin extends Plugin
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
overlayManager.remove(blastMineRockOverlay); overlayManager.remove(blastMineRockOverlay);
overlayManager.remove(blastMineOreCountOverlay); overlayManager.remove(blastMineOreCountOverlay);
final Widget blastMineWidget = client.getWidget(WidgetInfo.BLAST_MINE); final Widget blastMineWidget = client.getWidget(WidgetInfo.BLAST_MINE);
@@ -120,13 +114,7 @@ public class BlastMinePlugin extends Plugin
} }
} }
private void addSubscriptions() @Subscribe
{
eventBus.subscribe(GameObjectSpawned.class, this, this::onGameObjectSpawned);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventBus.subscribe(GameTick.class, this, this::onGameTick);
}
private void onGameObjectSpawned(GameObjectSpawned event) private void onGameObjectSpawned(GameObjectSpawned event)
{ {
final GameObject gameObject = event.getGameObject(); final GameObject gameObject = event.getGameObject();
@@ -145,6 +133,7 @@ public class BlastMinePlugin extends Plugin
} }
} }
@Subscribe
private void onGameStateChanged(GameStateChanged event) private void onGameStateChanged(GameStateChanged event)
{ {
if (event.getGameState() == GameState.LOADING) if (event.getGameState() == GameState.LOADING)
@@ -153,6 +142,7 @@ public class BlastMinePlugin extends Plugin
} }
} }
@Subscribe
private void onGameTick(GameTick gameTick) private void onGameTick(GameTick gameTick)
{ {
if (rocks.isEmpty()) if (rocks.isEmpty())

View File

@@ -39,13 +39,13 @@ import net.runelite.api.Client;
import net.runelite.api.Constants; import net.runelite.api.Constants;
import net.runelite.api.Prayer; import net.runelite.api.Prayer;
import net.runelite.api.Skill; import net.runelite.api.Skill;
import net.runelite.client.events.ConfigChanged;
import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.GameTick; import net.runelite.api.events.GameTick;
import net.runelite.api.events.StatChanged; import net.runelite.api.events.StatChanged;
import net.runelite.client.Notifier; import net.runelite.client.Notifier;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.game.SkillIconManager; import net.runelite.client.game.SkillIconManager;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
@@ -98,8 +98,6 @@ public class BoostsPlugin extends Plugin
private SkillIconManager skillIconManager; private SkillIconManager skillIconManager;
@Inject @Inject
private CombatIconsOverlay combatIconsOverlay; private CombatIconsOverlay combatIconsOverlay;
@Inject
private EventBus eventBus;
private boolean isChangedDown = false; private boolean isChangedDown = false;
private boolean isChangedUp = false; private boolean isChangedUp = false;
@@ -135,7 +133,6 @@ public class BoostsPlugin extends Plugin
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
updateConfig(); updateConfig();
addSubscriptions();
overlayManager.add(boostsOverlay); overlayManager.add(boostsOverlay);
overlayManager.add(combatIconsOverlay); overlayManager.add(combatIconsOverlay);
@@ -159,7 +156,6 @@ public class BoostsPlugin extends Plugin
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
overlayManager.remove(boostsOverlay); overlayManager.remove(boostsOverlay);
overlayManager.remove(combatIconsOverlay); overlayManager.remove(combatIconsOverlay);
infoBoxManager.removeIf(t -> t instanceof BoostIndicator || t instanceof StatChangeIndicator); infoBoxManager.removeIf(t -> t instanceof BoostIndicator || t instanceof StatChangeIndicator);
@@ -170,14 +166,7 @@ public class BoostsPlugin extends Plugin
isChangedDown = false; isChangedDown = false;
} }
private void addSubscriptions() @Subscribe
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventBus.subscribe(StatChanged.class, this, this::onStatChanged);
eventBus.subscribe(GameTick.class, this, this::onGameTick);
}
private void onGameStateChanged(GameStateChanged event) private void onGameStateChanged(GameStateChanged event)
{ {
switch (event.getGameState()) switch (event.getGameState())
@@ -190,6 +179,7 @@ public class BoostsPlugin extends Plugin
} }
} }
@Subscribe
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (!event.getGroup().equals("boosts")) if (!event.getGroup().equals("boosts"))
@@ -211,6 +201,7 @@ public class BoostsPlugin extends Plugin
} }
} }
@Subscribe
private void onStatChanged(StatChanged statChanged) private void onStatChanged(StatChanged statChanged)
{ {
Skill skill = statChanged.getSkill(); Skill skill = statChanged.getSkill();
@@ -260,6 +251,7 @@ public class BoostsPlugin extends Plugin
} }
} }
@Subscribe
private void onGameTick(GameTick event) private void onGameTick(GameTick event)
{ {
lastTickMillis = System.currentTimeMillis(); lastTickMillis = System.currentTimeMillis();

View File

@@ -30,7 +30,7 @@ import javax.inject.Singleton;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.runelite.api.NPC; import net.runelite.api.NPC;
import net.runelite.api.events.NpcDespawned; import net.runelite.api.events.NpcDespawned;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.game.ItemManager; import net.runelite.client.game.ItemManager;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
@@ -51,22 +51,18 @@ public class BossTimersPlugin extends Plugin
@Inject @Inject
private ItemManager itemManager; private ItemManager itemManager;
@Inject
private EventBus eventBus;
@Override @Override
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
eventBus.subscribe(NpcDespawned.class, this, this::onNpcDespawned);
} }
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
infoBoxManager.removeIf(t -> t instanceof RespawnTimer); infoBoxManager.removeIf(t -> t instanceof RespawnTimer);
} }
@Subscribe
private void onNpcDespawned(NpcDespawned npcDespawned) private void onNpcDespawned(NpcDespawned npcDespawned)
{ {
NPC npc = npcDespawned.getNpc(); NPC npc = npcDespawned.getNpc();

View File

@@ -39,7 +39,7 @@ import net.runelite.api.events.ChatMessage;
import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.GameStateChanged;
import net.runelite.api.util.Text; import net.runelite.api.util.Text;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.game.ItemManager; import net.runelite.client.game.ItemManager;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
@@ -76,9 +76,6 @@ public class BossTimeTrackerPlugin extends Plugin
@Inject @Inject
private ConfigManager configManager; private ConfigManager configManager;
@Inject
private EventBus eventBus;
@Getter @Getter
private BossTimeTracker timer; private BossTimeTracker timer;
@@ -90,9 +87,9 @@ public class BossTimeTrackerPlugin extends Plugin
@Override @Override
public void startUp() public void startUp()
{ {
addSubscriptions();
} }
@Subscribe
public void onGameStateChanged(GameStateChanged event) public void onGameStateChanged(GameStateChanged event)
{ {
switch (event.getGameState()) switch (event.getGameState())
@@ -125,6 +122,7 @@ public class BossTimeTrackerPlugin extends Plugin
} }
} }
@Subscribe
public void onChatMessage(ChatMessage event) public void onChatMessage(ChatMessage event)
{ {
if (event.getType() != ChatMessageType.GAMEMESSAGE && event.getType() != ChatMessageType.SPAM) if (event.getType() != ChatMessageType.GAMEMESSAGE && event.getType() != ChatMessageType.SPAM)
@@ -242,19 +240,12 @@ public class BossTimeTrackerPlugin extends Plugin
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
removeTimer(); removeTimer();
resetConfig(); resetConfig();
resetVars(); resetVars();
} }
private void addSubscriptions() private void loadConfig()
{
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventBus.subscribe(ChatMessage.class, this, this::onChatMessage);
}
private void loadConfig()
{ {
startTime = configManager.getConfiguration(CONFIG_GROUP, CONFIG_TIME, Instant.class); startTime = configManager.getConfiguration(CONFIG_GROUP, CONFIG_TIME, Instant.class);
started = configManager.getConfiguration(CONFIG_GROUP, CONFIG_STARTED, Boolean.class); started = configManager.getConfiguration(CONFIG_GROUP, CONFIG_STARTED, Boolean.class);

View File

@@ -1,10 +1,18 @@
package net.runelite.client.plugins.bronzeman; package net.runelite.client.plugins.bronzeman;
import java.awt.image.BufferedImage;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.File; import java.io.File;
import java.io.FileReader; import java.io.FileReader;
import java.io.InputStream; import java.io.InputStream;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import javax.imageio.ImageIO;
import javax.inject.Inject;
import lombok.Getter; import lombok.Getter;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Client; import net.runelite.api.Client;
@@ -19,19 +27,11 @@ 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.RuneLite; import net.runelite.client.RuneLite;
import net.runelite.client.eventbus.EventBus; 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.plugins.PluginType; import net.runelite.client.plugins.PluginType;
import net.runelite.client.ui.overlay.OverlayManager; import net.runelite.client.ui.overlay.OverlayManager;
import javax.imageio.ImageIO;
import javax.inject.Inject;
import java.awt.image.BufferedImage;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
/** /**
* @author Seth Davis * @author Seth Davis
@@ -52,9 +52,6 @@ public class BronzemanPlugin extends Plugin
@Inject @Inject
private Client client; private Client client;
@Inject
private EventBus eventBus;
@Inject @Inject
private OverlayManager overlayManager; private OverlayManager overlayManager;
@@ -74,7 +71,6 @@ public class BronzemanPlugin extends Plugin
@Override @Override
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
addSubscriptions();
loadUnlockImage(); loadUnlockImage();
unlockedItems = new ArrayList<>(); unlockedItems = new ArrayList<>();
overlayManager.add(bronzemanOverlay); overlayManager.add(bronzemanOverlay);
@@ -83,23 +79,14 @@ public class BronzemanPlugin extends Plugin
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
unlockedItems = null; unlockedItems = null;
overlayManager.remove(bronzemanOverlay); overlayManager.remove(bronzemanOverlay);
} }
private void addSubscriptions() /**
{
eventBus.subscribe(ItemContainerChanged.class, this, this::onItemContainerChanged);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventBus.subscribe(GameTick.class, this, this::onGameTick);
eventBus.subscribe(WidgetLoaded.class, this, this::onWidgetLoaded);
}
/**
* Loads players unlocks on login * Loads players unlocks on login
**/ **/
@Subscribe
public void onGameStateChanged(GameStateChanged e) public void onGameStateChanged(GameStateChanged e)
{ {
if (e.getGameState() == GameState.LOGGED_IN) if (e.getGameState() == GameState.LOGGED_IN)
@@ -111,6 +98,7 @@ public class BronzemanPlugin extends Plugin
/** /**
* Unlocks all new items that are currently not unlocked * Unlocks all new items that are currently not unlocked
**/ **/
@Subscribe
public void onItemContainerChanged(ItemContainerChanged e) public void onItemContainerChanged(ItemContainerChanged e)
{ {
for (Item i : e.getItemContainer().getItems()) for (Item i : e.getItemContainer().getItems())
@@ -134,6 +122,7 @@ public class BronzemanPlugin extends Plugin
} }
} }
@Subscribe
public void onWidgetLoaded(WidgetLoaded e) public void onWidgetLoaded(WidgetLoaded e)
{ {
switch (e.getGroupId()) switch (e.getGroupId())
@@ -151,6 +140,7 @@ public class BronzemanPlugin extends Plugin
/** /**
* Handles greying out items in the GrandExchange * Handles greying out items in the GrandExchange
**/ **/
@Subscribe
public void onGameTick(GameTick e) public void onGameTick(GameTick e)
{ {
if (grandExchangeWindow == null || grandExchangeChatBox == null || grandExchangeWindow.isHidden()) if (grandExchangeWindow == null || grandExchangeChatBox == null || grandExchangeWindow.isHidden())

View File

@@ -48,7 +48,6 @@ import static net.runelite.api.ProjectileID.CANNONBALL;
import static net.runelite.api.ProjectileID.GRANITE_CANNONBALL; import static net.runelite.api.ProjectileID.GRANITE_CANNONBALL;
import net.runelite.api.coords.WorldPoint; import net.runelite.api.coords.WorldPoint;
import net.runelite.api.events.ChatMessage; import net.runelite.api.events.ChatMessage;
import net.runelite.client.events.ConfigChanged;
import net.runelite.api.events.GameObjectSpawned; import net.runelite.api.events.GameObjectSpawned;
import net.runelite.api.events.GameTick; import net.runelite.api.events.GameTick;
import net.runelite.api.events.ItemContainerChanged; import net.runelite.api.events.ItemContainerChanged;
@@ -56,7 +55,8 @@ import net.runelite.api.events.ProjectileSpawned;
import net.runelite.client.Notifier; 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.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.game.ItemManager; import net.runelite.client.game.ItemManager;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
@@ -107,8 +107,6 @@ public class CannonPlugin extends Plugin
private Client client; private Client client;
@Inject @Inject
private ClientThread clientThread; private ClientThread clientThread;
@Inject
private EventBus eventbus;
private boolean lock; private boolean lock;
private boolean showEmptyCannonNotification; private boolean showEmptyCannonNotification;
private boolean showInfobox; private boolean showInfobox;
@@ -131,7 +129,6 @@ public class CannonPlugin extends Plugin
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
updateConfig(); updateConfig();
addSubscriptions();
overlayManager.add(cannonOverlay); overlayManager.add(cannonOverlay);
overlayManager.add(cannonSpotOverlay); overlayManager.add(cannonSpotOverlay);
@@ -141,8 +138,6 @@ public class CannonPlugin extends Plugin
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventbus.unregister(this);
cannonSpotOverlay.setHidden(true); cannonSpotOverlay.setHidden(true);
overlayManager.remove(cannonOverlay); overlayManager.remove(cannonOverlay);
overlayManager.remove(cannonSpotOverlay); overlayManager.remove(cannonSpotOverlay);
@@ -155,16 +150,7 @@ public class CannonPlugin extends Plugin
spotPoints.clear(); spotPoints.clear();
} }
private void addSubscriptions() @Subscribe
{
eventbus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventbus.subscribe(ItemContainerChanged.class, this, this::onItemContainerChanged);
eventbus.subscribe(GameObjectSpawned.class, this, this::onGameObjectSpawned);
eventbus.subscribe(ProjectileSpawned.class, this, this::onProjectileSpawned);
eventbus.subscribe(ChatMessage.class, this, this::onChatMessage);
eventbus.subscribe(GameTick.class, this, this::onGameTick);
}
private void onItemContainerChanged(ItemContainerChanged event) private void onItemContainerChanged(ItemContainerChanged event)
{ {
if (event.getItemContainer() != client.getItemContainer(InventoryID.INVENTORY)) if (event.getItemContainer() != client.getItemContainer(InventoryID.INVENTORY))
@@ -175,6 +161,7 @@ public class CannonPlugin extends Plugin
cannonSpotOverlay.setHidden(!ItemUtil.containsAllItemIds(event.getItemContainer().getItems(), CANNON_PARTS)); cannonSpotOverlay.setHidden(!ItemUtil.containsAllItemIds(event.getItemContainer().getItems(), CANNON_PARTS));
} }
@Subscribe
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (event.getGroup().equals("cannon")) if (event.getGroup().equals("cannon"))
@@ -218,6 +205,7 @@ public class CannonPlugin extends Plugin
} }
} }
@Subscribe
private void onGameObjectSpawned(GameObjectSpawned event) private void onGameObjectSpawned(GameObjectSpawned event)
{ {
final GameObject gameObject = event.getGameObject(); final GameObject gameObject = event.getGameObject();
@@ -232,6 +220,7 @@ public class CannonPlugin extends Plugin
} }
} }
@Subscribe
private void onProjectileSpawned(ProjectileSpawned event) private void onProjectileSpawned(ProjectileSpawned event)
{ {
final Projectile projectile = event.getProjectile(); final Projectile projectile = event.getProjectile();
@@ -247,6 +236,7 @@ public class CannonPlugin extends Plugin
} }
} }
@Subscribe
private void onChatMessage(ChatMessage event) private void onChatMessage(ChatMessage event)
{ {
if (event.getType() != ChatMessageType.SPAM && event.getType() != ChatMessageType.GAMEMESSAGE) if (event.getType() != ChatMessageType.SPAM && event.getType() != ChatMessageType.GAMEMESSAGE)
@@ -330,6 +320,7 @@ public class CannonPlugin extends Plugin
} }
} }
@Subscribe
private void onGameTick(GameTick event) private void onGameTick(GameTick event)
{ {
skipProjectileCheckThisTick = false; skipProjectileCheckThisTick = false;

View File

@@ -37,7 +37,7 @@ import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.GameTick; import net.runelite.api.events.GameTick;
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.eventbus.EventBus; 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;
@@ -59,33 +59,20 @@ public class CerberusPlugin extends Plugin
@Inject @Inject
private CerberusOverlay overlay; private CerberusOverlay overlay;
@Inject
private EventBus eventBus;
@Override @Override
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
overlayManager.add(overlay); overlayManager.add(overlay);
addSubscriptions();
} }
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
overlayManager.remove(overlay); overlayManager.remove(overlay);
ghosts.clear(); ghosts.clear();
} }
private void addSubscriptions() @Subscribe
{
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventBus.subscribe(NpcSpawned.class, this, this::onNpcSpawned);
eventBus.subscribe(NpcDespawned.class, this, this::onNpcDespawned);
eventBus.subscribe(GameTick.class, this, this::onGameTick);
}
private void onGameStateChanged(GameStateChanged event) private void onGameStateChanged(GameStateChanged event)
{ {
GameState gameState = event.getGameState(); GameState gameState = event.getGameState();
@@ -95,17 +82,20 @@ public class CerberusPlugin extends Plugin
} }
} }
@Subscribe
private void onNpcSpawned(final NpcSpawned event) private void onNpcSpawned(final NpcSpawned event)
{ {
final NPC npc = event.getNpc(); final NPC npc = event.getNpc();
CerberusGhost.fromNPC(npc).ifPresent(ghost -> ghosts.add(npc)); CerberusGhost.fromNPC(npc).ifPresent(ghost -> ghosts.add(npc));
} }
@Subscribe
private void onNpcDespawned(final NpcDespawned event) private void onNpcDespawned(final NpcDespawned event)
{ {
ghosts.remove(event.getNpc()); ghosts.remove(event.getNpc());
} }
@Subscribe
void onGameTick(GameTick gameTick) void onGameTick(GameTick gameTick)
{ {
if (ghosts.isEmpty()) if (ghosts.isEmpty())

View File

@@ -38,7 +38,7 @@ import net.runelite.api.widgets.WidgetSizeMode;
import net.runelite.api.widgets.WidgetType; import net.runelite.api.widgets.WidgetType;
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.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
@@ -55,14 +55,10 @@ public class ChatboxPerformancePlugin extends Plugin
@Inject @Inject
private ClientThread clientThread; private ClientThread clientThread;
@Inject
private EventBus eventBus;
@Inject @Inject
private ChatboxPerformanceConfig config; private ChatboxPerformanceConfig config;
private boolean transparentChatBox; @Subscribe
public void onConfigChanged(ConfigChanged event) public void onConfigChanged(ConfigChanged event)
{ {
if (event.getGroup().equals("chatboxperformance")) if (event.getGroup().equals("chatboxperformance"))
@@ -80,7 +76,6 @@ public class ChatboxPerformancePlugin extends Plugin
@Override @Override
public void startUp() public void startUp()
{ {
addSubscriptions();
if (client.getGameState() == GameState.LOGGED_IN) if (client.getGameState() == GameState.LOGGED_IN)
{ {
clientThread.invokeLater(() -> client.runScript(ScriptID.MESSAGE_LAYER_CLOSE, 0, 0)); clientThread.invokeLater(() -> client.runScript(ScriptID.MESSAGE_LAYER_CLOSE, 0, 0));
@@ -94,21 +89,9 @@ public class ChatboxPerformancePlugin extends Plugin
{ {
clientThread.invokeLater(() -> client.runScript(ScriptID.MESSAGE_LAYER_CLOSE, 0, 0)); clientThread.invokeLater(() -> client.runScript(ScriptID.MESSAGE_LAYER_CLOSE, 0, 0));
} }
eventBus.unregister(this);
}
private void addSubscriptions()
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(ScriptCallbackEvent.class, this, this::onScriptCallbackEvent);
}
private void updateConfig()
{
this.transparentChatBox = config.transparentChatBox();
} }
@Subscribe
private void onScriptCallbackEvent(ScriptCallbackEvent ev) private void onScriptCallbackEvent(ScriptCallbackEvent ev)
{ {
if (!"chatboxBackgroundBuilt".equals(ev.getEventName())) if (!"chatboxBackgroundBuilt".equals(ev.getEventName()))

View File

@@ -48,6 +48,7 @@ import net.runelite.api.events.ChatMessage;
import net.runelite.api.events.GameTick; import net.runelite.api.events.GameTick;
import net.runelite.api.events.VarbitChanged; import net.runelite.api.events.VarbitChanged;
import net.runelite.api.events.WidgetLoaded; import net.runelite.api.events.WidgetLoaded;
import static net.runelite.api.util.Text.sanitize;
import net.runelite.api.vars.AccountType; import net.runelite.api.vars.AccountType;
import net.runelite.api.widgets.Widget; import net.runelite.api.widgets.Widget;
import static net.runelite.api.widgets.WidgetID.KILL_LOGS_GROUP_ID; import static net.runelite.api.widgets.WidgetID.KILL_LOGS_GROUP_ID;
@@ -58,14 +59,13 @@ import net.runelite.client.chat.ChatCommandManager;
import net.runelite.client.chat.ChatMessageBuilder; import net.runelite.client.chat.ChatMessageBuilder;
import net.runelite.client.chat.ChatMessageManager; import net.runelite.client.chat.ChatMessageManager;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ChatInput; import net.runelite.client.events.ChatInput;
import net.runelite.client.game.ItemManager; import net.runelite.client.game.ItemManager;
import net.runelite.client.input.KeyManager; import net.runelite.client.input.KeyManager;
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.QuantityFormatter; import net.runelite.client.util.QuantityFormatter;
import static net.runelite.api.util.Text.sanitize;
import net.runelite.http.api.chat.ChatClient; import net.runelite.http.api.chat.ChatClient;
import net.runelite.http.api.chat.Duels; import net.runelite.http.api.chat.Duels;
import net.runelite.http.api.hiscore.HiscoreClient; import net.runelite.http.api.hiscore.HiscoreClient;
@@ -145,13 +145,9 @@ public class ChatCommandsPlugin extends Plugin
@Inject @Inject
private ChatKeyboardListener chatKeyboardListener; private ChatKeyboardListener chatKeyboardListener;
@Inject
private EventBus eventBus;
@Override @Override
public void startUp() public void startUp()
{ {
addSubscriptions();
keyManager.registerKeyListener(chatKeyboardListener); keyManager.registerKeyListener(chatKeyboardListener);
@@ -170,8 +166,6 @@ public class ChatCommandsPlugin extends Plugin
@Override @Override
public void shutDown() public void shutDown()
{ {
eventBus.unregister(this);
lastBossKill = null; lastBossKill = null;
keyManager.unregisterKeyListener(chatKeyboardListener); keyManager.unregisterKeyListener(chatKeyboardListener);
@@ -188,15 +182,7 @@ public class ChatCommandsPlugin extends Plugin
chatCommandManager.unregisterCommand(DUEL_ARENA_COMMAND); chatCommandManager.unregisterCommand(DUEL_ARENA_COMMAND);
} }
private void addSubscriptions() @Provides
{
eventBus.subscribe(ChatMessage.class, this, this::onChatMessage);
eventBus.subscribe(GameTick.class, this, this::onGameTick);
eventBus.subscribe(WidgetLoaded.class, this, this::onWidgetLoaded);
eventBus.subscribe(VarbitChanged.class, this, this::onVarbitChanged);
}
@Provides
ChatCommandsConfig provideConfig(ConfigManager configManager) ChatCommandsConfig provideConfig(ConfigManager configManager)
{ {
return configManager.getConfig(ChatCommandsConfig.class); return configManager.getConfig(ChatCommandsConfig.class);
@@ -228,6 +214,7 @@ public class ChatCommandsPlugin extends Plugin
return personalBest == null ? 0 : personalBest; return personalBest == null ? 0 : personalBest;
} }
@Subscribe
void onChatMessage(ChatMessage chatMessage) void onChatMessage(ChatMessage chatMessage)
{ {
if (chatMessage.getType() != ChatMessageType.TRADE if (chatMessage.getType() != ChatMessageType.TRADE
@@ -361,6 +348,7 @@ public class ChatCommandsPlugin extends Plugin
} }
} }
@Subscribe
private void onGameTick(GameTick event) private void onGameTick(GameTick event)
{ {
if (!logKills) if (!logKills)
@@ -397,6 +385,7 @@ public class ChatCommandsPlugin extends Plugin
} }
} }
@Subscribe
private void onWidgetLoaded(WidgetLoaded widget) private void onWidgetLoaded(WidgetLoaded widget)
{ {
// don't load kc if in an instance, if the player is in another players poh // don't load kc if in an instance, if the player is in another players poh
@@ -409,6 +398,7 @@ public class ChatCommandsPlugin extends Plugin
logKills = true; logKills = true;
} }
@Subscribe
private void onVarbitChanged(VarbitChanged varbitChanged) private void onVarbitChanged(VarbitChanged varbitChanged)
{ {
hiscoreEndpoint = getLocalHiscoreEndpointType(); hiscoreEndpoint = getLocalHiscoreEndpointType();
@@ -446,6 +436,7 @@ public class ChatCommandsPlugin extends Plugin
return true; return true;
} }
@Subscribe
private void killCountLookup(ChatMessage chatMessage, String message) private void killCountLookup(ChatMessage chatMessage, String message)
{ {
if (!config.killcount()) if (!config.killcount())
@@ -533,6 +524,7 @@ public class ChatCommandsPlugin extends Plugin
return true; return true;
} }
@Subscribe
private void duelArenaLookup(ChatMessage chatMessage, String message) private void duelArenaLookup(ChatMessage chatMessage, String message)
{ {
if (!config.duels()) if (!config.duels())
@@ -590,6 +582,7 @@ public class ChatCommandsPlugin extends Plugin
client.refreshChat(); client.refreshChat();
} }
@Subscribe
private void questPointsLookup(ChatMessage chatMessage, String message) private void questPointsLookup(ChatMessage chatMessage, String message)
{ {
if (!config.qp()) if (!config.qp())
@@ -658,6 +651,7 @@ public class ChatCommandsPlugin extends Plugin
return true; return true;
} }
@Subscribe
private void gambleCountLookup(ChatMessage chatMessage, String message) private void gambleCountLookup(ChatMessage chatMessage, String message)
{ {
if (!config.gc()) if (!config.gc())
@@ -729,6 +723,7 @@ public class ChatCommandsPlugin extends Plugin
} }
@Subscribe
private void personalBestLookup(ChatMessage chatMessage, String message) private void personalBestLookup(ChatMessage chatMessage, String message)
{ {
if (!config.pb()) if (!config.pb())
@@ -825,6 +820,7 @@ public class ChatCommandsPlugin extends Plugin
* @param chatMessage The chat message containing the command. * @param chatMessage The chat message containing the command.
* @param message The chat message * @param message The chat message
*/ */
@Subscribe
private void itemPriceLookup(ChatMessage chatMessage, String message) private void itemPriceLookup(ChatMessage chatMessage, String message)
{ {
if (!config.price()) if (!config.price())
@@ -896,6 +892,7 @@ public class ChatCommandsPlugin extends Plugin
* @param chatMessage The chat message containing the command. * @param chatMessage The chat message containing the command.
* @param message The chat message * @param message The chat message
*/ */
@Subscribe
private void playerSkillLookup(ChatMessage chatMessage, String message) private void playerSkillLookup(ChatMessage chatMessage, String message)
{ {
if (!config.lvl()) if (!config.lvl())
@@ -970,6 +967,7 @@ public class ChatCommandsPlugin extends Plugin
} }
} }
@Subscribe
private void combatLevelLookup(ChatMessage chatMessage, String message) private void combatLevelLookup(ChatMessage chatMessage, String message)
{ {
if (!config.lvl()) if (!config.lvl())
@@ -1055,6 +1053,7 @@ public class ChatCommandsPlugin extends Plugin
} }
} }
@Subscribe
private void clueLookup(ChatMessage chatMessage, String message) private void clueLookup(ChatMessage chatMessage, String message)
{ {
if (!config.clue()) if (!config.clue())

View File

@@ -42,12 +42,12 @@ import net.runelite.api.ChatMessageType;
import net.runelite.api.Client; import net.runelite.api.Client;
import net.runelite.api.MessageNode; import net.runelite.api.MessageNode;
import net.runelite.api.Player; import net.runelite.api.Player;
import net.runelite.client.events.ConfigChanged;
import net.runelite.api.events.OverheadTextChanged; import net.runelite.api.events.OverheadTextChanged;
import net.runelite.api.events.ScriptCallbackEvent; import net.runelite.api.events.ScriptCallbackEvent;
import net.runelite.api.util.Text; import net.runelite.api.util.Text;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
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 org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@@ -76,9 +76,6 @@ public class ChatFilterPlugin extends Plugin
@Inject @Inject
private ChatFilterConfig config; private ChatFilterConfig config;
@Inject
private EventBus eventBus;
@Setter(AccessLevel.PACKAGE) @Setter(AccessLevel.PACKAGE)
private ChatFilterType filterType; private ChatFilterType filterType;
@Setter(AccessLevel.PACKAGE) @Setter(AccessLevel.PACKAGE)
@@ -100,7 +97,6 @@ public class ChatFilterPlugin extends Plugin
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
updateConfig(); updateConfig();
addSubscriptions();
updateFilteredPatterns(); updateFilteredPatterns();
client.refreshChat(); client.refreshChat();
@@ -109,19 +105,11 @@ public class ChatFilterPlugin extends Plugin
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
filteredPatterns.clear(); filteredPatterns.clear();
client.refreshChat(); client.refreshChat();
} }
private void addSubscriptions() @Subscribe
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(ScriptCallbackEvent.class, this, this::onScriptCallbackEvent);
eventBus.subscribe(OverheadTextChanged.class, this, this::onOverheadTextChanged);
}
private void onScriptCallbackEvent(ScriptCallbackEvent event) private void onScriptCallbackEvent(ScriptCallbackEvent event)
{ {
if (!"chatFilterCheck".equals(event.getEventName())) if (!"chatFilterCheck".equals(event.getEventName()))
@@ -185,6 +173,7 @@ public class ChatFilterPlugin extends Plugin
} }
} }
@Subscribe
private void onOverheadTextChanged(OverheadTextChanged event) private void onOverheadTextChanged(OverheadTextChanged event)
{ {
if (!(event.getActor() instanceof Player) || event.getActor().getName() == null || !shouldFilterPlayerMessage(event.getActor().getName())) if (!(event.getActor() instanceof Player) || event.getActor().getName() == null || !shouldFilterPlayerMessage(event.getActor().getName()))
@@ -267,6 +256,7 @@ public class ChatFilterPlugin extends Plugin
.forEach(filteredPatterns::add); .forEach(filteredPatterns::add);
} }
@Subscribe
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (!"chatfilter".equals(event.getGroup())) if (!"chatfilter".equals(event.getGroup()))

View File

@@ -46,7 +46,7 @@ import net.runelite.client.callback.ClientThread;
import net.runelite.client.chat.ChatMessageManager; import net.runelite.client.chat.ChatMessageManager;
import net.runelite.client.chat.QueuedMessage; import net.runelite.client.chat.QueuedMessage;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.ConfigChanged;
import net.runelite.client.input.KeyListener; import net.runelite.client.input.KeyListener;
import net.runelite.client.input.KeyManager; import net.runelite.client.input.KeyManager;
@@ -85,9 +85,6 @@ public class ChatHistoryPlugin extends Plugin implements KeyListener
@Inject @Inject
private ChatMessageManager chatMessageManager; private ChatMessageManager chatMessageManager;
@Inject
private EventBus eventBus;
private boolean retainChatHistory; private boolean retainChatHistory;
private boolean pmTargetCycling; private boolean pmTargetCycling;
@@ -101,7 +98,6 @@ public class ChatHistoryPlugin extends Plugin implements KeyListener
protected void startUp() protected void startUp()
{ {
updateConfig(); updateConfig();
addSubscriptions();
messageQueue = EvictingQueue.create(100); messageQueue = EvictingQueue.create(100);
friends = new ArrayDeque<>(FRIENDS_MAX_SIZE + 1); friends = new ArrayDeque<>(FRIENDS_MAX_SIZE + 1);
@@ -111,8 +107,6 @@ public class ChatHistoryPlugin extends Plugin implements KeyListener
@Override @Override
protected void shutDown() protected void shutDown()
{ {
eventBus.unregister(this);
messageQueue.clear(); messageQueue.clear();
messageQueue = null; messageQueue = null;
friends.clear(); friends.clear();
@@ -120,13 +114,7 @@ public class ChatHistoryPlugin extends Plugin implements KeyListener
keyManager.unregisterKeyListener(this); keyManager.unregisterKeyListener(this);
} }
private void addSubscriptions() @Subscribe
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(ChatMessage.class, this, this::onChatMessage);
eventBus.subscribe(MenuOptionClicked.class, this, this::onMenuOptionClicked);
}
private void onChatMessage(ChatMessage chatMessage) private void onChatMessage(ChatMessage chatMessage)
{ {
// Start sending old messages right after the welcome message, as that is most reliable source // Start sending old messages right after the welcome message, as that is most reliable source
@@ -183,6 +171,7 @@ public class ChatHistoryPlugin extends Plugin implements KeyListener
} }
} }
@Subscribe
private void onMenuOptionClicked(MenuOptionClicked event) private void onMenuOptionClicked(MenuOptionClicked event)
{ {
String menuOption = event.getOption(); String menuOption = event.getOption();
@@ -280,6 +269,7 @@ public class ChatHistoryPlugin extends Plugin implements KeyListener
return friends.getLast(); return friends.getLast();
} }
@Subscribe
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (!"chathistory".equals(event.getGroup())) if (!"chathistory".equals(event.getGroup()))

View File

@@ -47,7 +47,7 @@ import net.runelite.client.RuneLiteProperties;
import net.runelite.client.chat.ChatColorType; import net.runelite.client.chat.ChatColorType;
import net.runelite.client.chat.ChatMessageManager; import net.runelite.client.chat.ChatMessageManager;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
@@ -73,9 +73,6 @@ public class ChatNotificationsPlugin extends Plugin
@Inject @Inject
private Notifier notifier; private Notifier notifier;
@Inject
private EventBus eventBus;
//Custom Highlights //Custom Highlights
private Pattern usernameMatcher = null; private Pattern usernameMatcher = null;
private String usernameReplacer = ""; private String usernameReplacer = "";
@@ -102,7 +99,6 @@ public class ChatNotificationsPlugin extends Plugin
public void startUp() public void startUp()
{ {
updateConfig(); updateConfig();
addSubscriptions();
updateHighlights(); updateHighlights();
} }
@@ -110,18 +106,10 @@ public class ChatNotificationsPlugin extends Plugin
@Override @Override
public void shutDown() public void shutDown()
{ {
eventBus.unregister(this);
this.privateMessageHashes.clear(); this.privateMessageHashes.clear();
} }
private void addSubscriptions() @Subscribe
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventBus.subscribe(ChatMessage.class, this, this::onChatMessage);
}
private void onGameStateChanged(GameStateChanged event) private void onGameStateChanged(GameStateChanged event)
{ {
switch (event.getGameState()) switch (event.getGameState())
@@ -133,6 +121,7 @@ public class ChatNotificationsPlugin extends Plugin
} }
} }
@Subscribe
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (event.getGroup().equals("chatnotification")) if (event.getGroup().equals("chatnotification"))
@@ -159,6 +148,7 @@ public class ChatNotificationsPlugin extends Plugin
} }
} }
@Subscribe
void onChatMessage(ChatMessage chatMessage) void onChatMessage(ChatMessage chatMessage)
{ {
MessageNode messageNode = chatMessage.getMessageNode(); MessageNode messageNode = chatMessage.getMessageNode();
@@ -280,6 +270,7 @@ public class ChatNotificationsPlugin extends Plugin
return (message.getName() + message.getMessage()).hashCode(); return (message.getName() + message.getMessage()).hashCode();
} }
@Subscribe
private void sendNotification(ChatMessage message) private void sendNotification(ChatMessage message)
{ {
String name = Text.removeTags(message.getName()); String name = Text.removeTags(message.getName());

View File

@@ -26,6 +26,7 @@ import net.runelite.client.callback.ClientThread;
import net.runelite.client.chat.ChatMessageManager; import net.runelite.client.chat.ChatMessageManager;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.EventBus;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.ConfigChanged;
import net.runelite.client.input.KeyListener; import net.runelite.client.input.KeyListener;
import net.runelite.client.input.KeyManager; import net.runelite.client.input.KeyManager;
@@ -84,8 +85,6 @@ public class ChatTranslationPlugin extends Plugin implements KeyListener
@Override @Override
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
translator.setInLang(config.publicTargetLanguage()); translator.setInLang(config.publicTargetLanguage());
translator.setOutLang(config.playerTargetLanguage()); translator.setOutLang(config.playerTargetLanguage());
@@ -115,7 +114,6 @@ public class ChatTranslationPlugin extends Plugin implements KeyListener
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
eventBus.unregister(OPTION); eventBus.unregister(OPTION);
eventBus.unregister(PUBLIC); eventBus.unregister(PUBLIC);
menuManager.removePlayerMenuItem(TRANSLATE); menuManager.removePlayerMenuItem(TRANSLATE);
@@ -123,6 +121,7 @@ public class ChatTranslationPlugin extends Plugin implements KeyListener
playerNames.clear(); playerNames.clear();
} }
@Subscribe
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (!event.getGroup().equals("chattranslation")) if (!event.getGroup().equals("chattranslation"))
@@ -227,6 +226,7 @@ public class ChatTranslationPlugin extends Plugin implements KeyListener
config.playerNames(Text.toCSV(playerNames)); config.playerNames(Text.toCSV(playerNames));
} }
@Subscribe
private void onChatMessage(ChatMessage chatMessage) private void onChatMessage(ChatMessage chatMessage)
{ {
if (client.getGameState() != GameState.LOADING && client.getGameState() != GameState.LOGGED_IN) if (client.getGameState() != GameState.LOADING && client.getGameState() != GameState.LOGGED_IN)

View File

@@ -57,7 +57,6 @@ import net.runelite.api.events.ChatMessage;
import net.runelite.api.events.ClanChanged; import net.runelite.api.events.ClanChanged;
import net.runelite.api.events.ClanMemberJoined; import net.runelite.api.events.ClanMemberJoined;
import net.runelite.api.events.ClanMemberLeft; import net.runelite.api.events.ClanMemberLeft;
import net.runelite.client.events.ConfigChanged;
import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.GameTick; import net.runelite.api.events.GameTick;
import net.runelite.api.events.PlayerDespawned; import net.runelite.api.events.PlayerDespawned;
@@ -71,7 +70,8 @@ import net.runelite.api.widgets.WidgetType;
import net.runelite.client.callback.ClientThread; import net.runelite.client.callback.ClientThread;
import net.runelite.client.chat.ChatMessageBuilder; import net.runelite.client.chat.ChatMessageBuilder;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.game.ClanManager; import net.runelite.client.game.ClanManager;
import net.runelite.client.game.SpriteManager; import net.runelite.client.game.SpriteManager;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
@@ -114,9 +114,6 @@ public class ClanChatPlugin extends Plugin
@Inject @Inject
private ClientThread clientThread; private ClientThread clientThread;
@Inject
private EventBus eventBus;
private List<String> chats = new ArrayList<>(); private List<String> chats = new ArrayList<>();
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@@ -155,7 +152,6 @@ public class ClanChatPlugin extends Plugin
public void startUp() public void startUp()
{ {
updateConfig(); updateConfig();
addSubscriptions();
chats = new ArrayList<>(Text.fromCSV(this.chatsData)); chats = new ArrayList<>(Text.fromCSV(this.chatsData));
} }
@@ -163,28 +159,12 @@ public class ClanChatPlugin extends Plugin
@Override @Override
public void shutDown() public void shutDown()
{ {
eventBus.unregister(this);
clanMembers.clear(); clanMembers.clear();
removeClanCounter(); removeClanCounter();
resetClanChats(); resetClanChats();
} }
private void addSubscriptions() @Subscribe
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(ClanMemberJoined.class, this, this::onClanMemberJoined);
eventBus.subscribe(ClanMemberLeft.class, this, this::onClanMemberLeft);
eventBus.subscribe(GameTick.class, this, this::onGameTick);
eventBus.subscribe(VarClientStrChanged.class, this, this::onVarClientStrChanged);
eventBus.subscribe(ChatMessage.class, this, this::onChatMessage);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventBus.subscribe(PlayerSpawned.class, this, this::onPlayerSpawned);
eventBus.subscribe(PlayerDespawned.class, this, this::onPlayerDespawned);
eventBus.subscribe(ClanChanged.class, this, this::onClanChanged);
eventBus.subscribe(ScriptCallbackEvent.class, this, this::onScriptCallbackEvent);
}
private void onConfigChanged(ConfigChanged configChanged) private void onConfigChanged(ConfigChanged configChanged)
{ {
if (configChanged.getGroup().equals("clanchat")) if (configChanged.getGroup().equals("clanchat"))
@@ -207,6 +187,7 @@ public class ClanChatPlugin extends Plugin
} }
} }
@Subscribe
private void onClanMemberJoined(ClanMemberJoined event) private void onClanMemberJoined(ClanMemberJoined event)
{ {
final ClanMember member = event.getMember(); final ClanMember member = event.getMember();
@@ -252,6 +233,7 @@ public class ClanChatPlugin extends Plugin
} }
} }
@Subscribe
private void onClanMemberLeft(ClanMemberLeft event) private void onClanMemberLeft(ClanMemberLeft event)
{ {
final ClanMember member = event.getMember(); final ClanMember member = event.getMember();
@@ -295,6 +277,7 @@ public class ClanChatPlugin extends Plugin
} }
} }
@Subscribe
private void onGameTick(GameTick gameTick) private void onGameTick(GameTick gameTick)
{ {
if (client.getGameState() != GameState.LOGGED_IN) if (client.getGameState() != GameState.LOGGED_IN)
@@ -434,6 +417,7 @@ public class ClanChatPlugin extends Plugin
clanJoinMessages.addLast(clanJoinMessage); clanJoinMessages.addLast(clanJoinMessage);
} }
@Subscribe
private void onVarClientStrChanged(VarClientStrChanged strChanged) private void onVarClientStrChanged(VarClientStrChanged strChanged)
{ {
if (strChanged.getIndex() == VarClientStr.RECENT_CLAN_CHAT.getIndex() && this.recentChats) if (strChanged.getIndex() == VarClientStr.RECENT_CLAN_CHAT.getIndex() && this.recentChats)
@@ -442,6 +426,7 @@ public class ClanChatPlugin extends Plugin
} }
} }
@Subscribe
private void onChatMessage(ChatMessage chatMessage) private void onChatMessage(ChatMessage chatMessage)
{ {
if (client.getGameState() != GameState.LOADING && client.getGameState() != GameState.LOGGED_IN) if (client.getGameState() != GameState.LOADING && client.getGameState() != GameState.LOGGED_IN)
@@ -483,6 +468,7 @@ public class ClanChatPlugin extends Plugin
insertClanRankIcon(chatMessage); insertClanRankIcon(chatMessage);
} }
@Subscribe
private void onGameStateChanged(GameStateChanged state) private void onGameStateChanged(GameStateChanged state)
{ {
GameState gameState = state.getGameState(); GameState gameState = state.getGameState();
@@ -496,6 +482,7 @@ public class ClanChatPlugin extends Plugin
} }
} }
@Subscribe
private void onPlayerSpawned(PlayerSpawned event) private void onPlayerSpawned(PlayerSpawned event)
{ {
final Player local = client.getLocalPlayer(); final Player local = client.getLocalPlayer();
@@ -508,6 +495,7 @@ public class ClanChatPlugin extends Plugin
} }
} }
@Subscribe
private void onPlayerDespawned(PlayerDespawned event) private void onPlayerDespawned(PlayerDespawned event)
{ {
if (clanMembers.remove(event.getPlayer()) && clanMembers.isEmpty()) if (clanMembers.remove(event.getPlayer()) && clanMembers.isEmpty())
@@ -516,6 +504,7 @@ public class ClanChatPlugin extends Plugin
} }
} }
@Subscribe
private void onClanChanged(ClanChanged event) private void onClanChanged(ClanChanged event)
{ {
if (event.isJoined()) if (event.isJoined())
@@ -531,6 +520,7 @@ public class ClanChatPlugin extends Plugin
activityBuffer.clear(); activityBuffer.clear();
} }
@Subscribe
private void onScriptCallbackEvent(ScriptCallbackEvent scriptCallbackEvent) private void onScriptCallbackEvent(ScriptCallbackEvent scriptCallbackEvent)
{ {
if (!scriptCallbackEvent.getEventName().equalsIgnoreCase("clanchatInput")) if (!scriptCallbackEvent.getEventName().equalsIgnoreCase("clanchatInput"))
@@ -548,6 +538,7 @@ public class ClanChatPlugin extends Plugin
return clanMembers.size(); return clanMembers.size();
} }
@Subscribe
private void insertClanRankIcon(final ChatMessage message) private void insertClanRankIcon(final ChatMessage message)
{ {
final ClanMemberRank rank = clanManager.getRank(message.getName()); final ClanMemberRank rank = clanManager.getRank(message.getName());

View File

@@ -17,7 +17,7 @@ import net.runelite.api.coords.WorldPoint;
import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.GameTick; import net.runelite.api.events.GameTick;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
@@ -52,9 +52,6 @@ public class ClanManModePlugin extends Plugin
@Inject @Inject
private Client client; private Client client;
@Inject
private EventBus eventBus;
@Getter(AccessLevel.PACKAGE) @Getter(AccessLevel.PACKAGE)
private boolean highlightAttackable; private boolean highlightAttackable;
@Getter(AccessLevel.PACKAGE) @Getter(AccessLevel.PACKAGE)
@@ -103,7 +100,6 @@ public class ClanManModePlugin extends Plugin
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
updateConfig(); updateConfig();
addSubscriptions();
overlayManager.add(ClanManModeOverlay); overlayManager.add(ClanManModeOverlay);
overlayManager.add(ClanManModeTileOverlay); overlayManager.add(ClanManModeTileOverlay);
@@ -113,8 +109,6 @@ public class ClanManModePlugin extends Plugin
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
overlayManager.remove(ClanManModeOverlay); overlayManager.remove(ClanManModeOverlay);
overlayManager.remove(ClanManModeTileOverlay); overlayManager.remove(ClanManModeTileOverlay);
overlayManager.remove(ClanManModeMinimapOverlay); overlayManager.remove(ClanManModeMinimapOverlay);
@@ -126,13 +120,7 @@ public class ClanManModePlugin extends Plugin
inwildy = 0; inwildy = 0;
} }
private void addSubscriptions() @Subscribe
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventBus.subscribe(GameTick.class, this, this::onGameTick);
}
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (!"clanmanmode".equals(event.getGroup())) if (!"clanmanmode".equals(event.getGroup()))
@@ -143,6 +131,7 @@ public class ClanManModePlugin extends Plugin
updateConfig(); updateConfig();
} }
@Subscribe
private void onGameStateChanged(GameStateChanged gameStateChanged) private void onGameStateChanged(GameStateChanged gameStateChanged)
{ {
if (gameStateChanged.getGameState() == GameState.LOGIN_SCREEN || gameStateChanged.getGameState() == GameState.HOPPING) if (gameStateChanged.getGameState() == GameState.LOGIN_SCREEN || gameStateChanged.getGameState() == GameState.HOPPING)
@@ -151,6 +140,7 @@ public class ClanManModePlugin extends Plugin
} }
} }
@Subscribe
private void onGameTick(GameTick event) private void onGameTick(GameTick event)
{ {
ticks++; ticks++;

View File

@@ -60,7 +60,6 @@ import net.runelite.api.TileObject;
import net.runelite.api.coords.LocalPoint; import net.runelite.api.coords.LocalPoint;
import net.runelite.api.coords.WorldPoint; import net.runelite.api.coords.WorldPoint;
import net.runelite.api.events.ChatMessage; import net.runelite.api.events.ChatMessage;
import net.runelite.client.events.ConfigChanged;
import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.GameTick; import net.runelite.api.events.GameTick;
import net.runelite.api.events.ItemContainerChanged; import net.runelite.api.events.ItemContainerChanged;
@@ -68,11 +67,13 @@ import net.runelite.api.events.MenuOptionClicked;
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.api.events.WidgetLoaded; import net.runelite.api.events.WidgetLoaded;
import net.runelite.api.util.Text;
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.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.game.ItemManager; import net.runelite.client.game.ItemManager;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
@@ -101,7 +102,6 @@ import net.runelite.client.ui.overlay.components.TextComponent;
import net.runelite.client.ui.overlay.worldmap.WorldMapPointManager; import net.runelite.client.ui.overlay.worldmap.WorldMapPointManager;
import net.runelite.client.util.ImageUtil; import net.runelite.client.util.ImageUtil;
import net.runelite.client.util.ItemUtil; import net.runelite.client.util.ItemUtil;
import net.runelite.api.util.Text;
@PluginDescriptor( @PluginDescriptor(
name = "Clue Scroll", name = "Clue Scroll",
@@ -166,9 +166,6 @@ public class ClueScrollPlugin extends Plugin
@Inject @Inject
private WorldMapPointManager worldMapPointManager; private WorldMapPointManager worldMapPointManager;
@Inject
private EventBus eventBus;
private BufferedImage emoteImage; private BufferedImage emoteImage;
private BufferedImage mapArrow; private BufferedImage mapArrow;
private Integer clueItemId; private Integer clueItemId;
@@ -193,7 +190,6 @@ public class ClueScrollPlugin extends Plugin
@Override @Override
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
addSubscriptions();
this.displayHintArrows = config.displayHintArrows(); this.displayHintArrows = config.displayHintArrows();
overlayManager.add(clueScrollOverlay); overlayManager.add(clueScrollOverlay);
@@ -205,8 +201,6 @@ public class ClueScrollPlugin extends Plugin
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
overlayManager.remove(clueScrollOverlay); overlayManager.remove(clueScrollOverlay);
overlayManager.remove(clueScrollEmoteOverlay); overlayManager.remove(clueScrollEmoteOverlay);
overlayManager.remove(clueScrollWorldOverlay); overlayManager.remove(clueScrollWorldOverlay);
@@ -217,19 +211,7 @@ public class ClueScrollPlugin extends Plugin
resetClue(true); resetClue(true);
} }
private void addSubscriptions() @Subscribe
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(ChatMessage.class, this, this::onChatMessage);
eventBus.subscribe(MenuOptionClicked.class, this, this::onMenuOptionClicked);
eventBus.subscribe(ItemContainerChanged.class, this, this::onItemContainerChanged);
eventBus.subscribe(NpcSpawned.class, this, this::onNpcSpawned);
eventBus.subscribe(NpcDespawned.class, this, this::onNpcDespawned);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventBus.subscribe(GameTick.class, this, this::onGameTick);
eventBus.subscribe(WidgetLoaded.class, this, this::onWidgetLoaded);
}
private void onChatMessage(ChatMessage event) private void onChatMessage(ChatMessage event)
{ {
if (event.getType() != ChatMessageType.GAMEMESSAGE && event.getType() != ChatMessageType.SPAM) if (event.getType() != ChatMessageType.GAMEMESSAGE && event.getType() != ChatMessageType.SPAM)
@@ -255,6 +237,7 @@ public class ClueScrollPlugin extends Plugin
} }
} }
@Subscribe
private void onMenuOptionClicked(final MenuOptionClicked event) private void onMenuOptionClicked(final MenuOptionClicked event)
{ {
if ("read".equalsIgnoreCase(event.getOption())) if ("read".equalsIgnoreCase(event.getOption()))
@@ -269,6 +252,7 @@ public class ClueScrollPlugin extends Plugin
} }
} }
@Subscribe
private void onItemContainerChanged(final ItemContainerChanged event) private void onItemContainerChanged(final ItemContainerChanged event)
{ {
if (event.getItemContainer() == client.getItemContainer(InventoryID.EQUIPMENT)) if (event.getItemContainer() == client.getItemContainer(InventoryID.EQUIPMENT))
@@ -309,12 +293,14 @@ public class ClueScrollPlugin extends Plugin
} }
} }
@Subscribe
private void onNpcSpawned(final NpcSpawned event) private void onNpcSpawned(final NpcSpawned event)
{ {
final NPC npc = event.getNpc(); final NPC npc = event.getNpc();
checkClueNPCs(clue, npc); checkClueNPCs(clue, npc);
} }
@Subscribe
private void onNpcDespawned(final NpcDespawned event) private void onNpcDespawned(final NpcDespawned event)
{ {
final boolean removed = npcsToMark.remove(event.getNpc()); final boolean removed = npcsToMark.remove(event.getNpc());
@@ -333,6 +319,7 @@ public class ClueScrollPlugin extends Plugin
} }
} }
@Subscribe
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (event.getGroup().equals("cluescroll")) if (event.getGroup().equals("cluescroll"))
@@ -345,6 +332,7 @@ public class ClueScrollPlugin extends Plugin
} }
} }
@Subscribe
private void onGameStateChanged(final GameStateChanged event) private void onGameStateChanged(final GameStateChanged event)
{ {
if (event.getGameState() == GameState.LOGIN_SCREEN) if (event.getGameState() == GameState.LOGIN_SCREEN)
@@ -353,6 +341,7 @@ public class ClueScrollPlugin extends Plugin
} }
} }
@Subscribe
private void onGameTick(final GameTick event) private void onGameTick(final GameTick event)
{ {
objectsToMark.clear(); objectsToMark.clear();
@@ -431,6 +420,7 @@ public class ClueScrollPlugin extends Plugin
updateClue(findClueScroll()); updateClue(findClueScroll());
} }
@Subscribe
private void onWidgetLoaded(WidgetLoaded event) private void onWidgetLoaded(WidgetLoaded event)
{ {
if (event.getGroupId() < WidgetID.BEGINNER_CLUE_MAP_CHAMPIONS_GUILD if (event.getGroupId() < WidgetID.BEGINNER_CLUE_MAP_CHAMPIONS_GUILD

View File

@@ -56,6 +56,7 @@ import net.runelite.api.events.HitsplatApplied;
import net.runelite.api.kit.KitType; import net.runelite.api.kit.KitType;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.EventBus;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
@@ -266,7 +267,6 @@ public class CombatCounter extends Plugin
private void addSubscriptions() private void addSubscriptions()
{ {
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(AnimationChanged.class, this, this::onAnimationChanged); eventBus.subscribe(AnimationChanged.class, this, this::onAnimationChanged);
eventBus.subscribe(GameTick.class, this, this::onGameTick); eventBus.subscribe(GameTick.class, this, this::onGameTick);
eventBus.subscribe(HitsplatApplied.class, this, this::onHitsplatApplied); eventBus.subscribe(HitsplatApplied.class, this, this::onHitsplatApplied);
@@ -654,6 +654,7 @@ public class CombatCounter extends Plugin
return 2 + (int) Math.floor((3d + distance) / 6d); return 2 + (int) Math.floor((3d + distance) / 6d);
} }
@Subscribe
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (event.getGroup().equals("combatcounter")) if (event.getGroup().equals("combatcounter"))

View File

@@ -38,14 +38,14 @@ import net.runelite.api.Experience;
import net.runelite.api.GameState; import net.runelite.api.GameState;
import net.runelite.api.Skill; import net.runelite.api.Skill;
import net.runelite.api.WorldType; import net.runelite.api.WorldType;
import net.runelite.client.events.ConfigChanged;
import net.runelite.api.events.GameTick; import net.runelite.api.events.GameTick;
import net.runelite.api.events.ScriptCallbackEvent; import net.runelite.api.events.ScriptCallbackEvent;
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.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.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
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;
@@ -84,9 +84,6 @@ public class CombatLevelPlugin extends Plugin
@Inject @Inject
private OverlayManager overlayManager; private OverlayManager overlayManager;
@Inject
private EventBus eventBus;
@Getter(AccessLevel.PACKAGE) @Getter(AccessLevel.PACKAGE)
private boolean showLevelsUntil; private boolean showLevelsUntil;
private boolean wildernessAttackLevelRange; private boolean wildernessAttackLevelRange;
@@ -101,7 +98,6 @@ public class CombatLevelPlugin extends Plugin
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
updateConfig(); updateConfig();
addSubscriptions();
overlayManager.add(overlay); overlayManager.add(overlay);
@@ -114,8 +110,6 @@ public class CombatLevelPlugin extends Plugin
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
overlayManager.remove(overlay); overlayManager.remove(overlay);
Widget combatLevelWidget = client.getWidget(WidgetInfo.COMBAT_LEVEL); Widget combatLevelWidget = client.getWidget(WidgetInfo.COMBAT_LEVEL);
@@ -132,13 +126,7 @@ public class CombatLevelPlugin extends Plugin
shutDownAttackLevelRange(); shutDownAttackLevelRange();
} }
private void addSubscriptions() @Subscribe
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(GameTick.class, this, this::onGameTick);
eventBus.subscribe(ScriptCallbackEvent.class, this, this::onScriptCallbackEvent);
}
private void onGameTick(GameTick event) private void onGameTick(GameTick event)
{ {
if (client.getGameState() != GameState.LOGGED_IN) if (client.getGameState() != GameState.LOGGED_IN)
@@ -165,6 +153,7 @@ public class CombatLevelPlugin extends Plugin
combatLevelWidget.setText("Combat Lvl: " + DECIMAL_FORMAT.format(combatLevelPrecise)); combatLevelWidget.setText("Combat Lvl: " + DECIMAL_FORMAT.format(combatLevelPrecise));
} }
@Subscribe
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (!CONFIG_GROUP.equals(event.getGroup()) || !ATTACK_RANGE_CONFIG_KEY.equals(event.getKey())) if (!CONFIG_GROUP.equals(event.getGroup()) || !ATTACK_RANGE_CONFIG_KEY.equals(event.getKey()))
@@ -184,6 +173,7 @@ public class CombatLevelPlugin extends Plugin
} }
} }
@Subscribe
private void onScriptCallbackEvent(ScriptCallbackEvent event) private void onScriptCallbackEvent(ScriptCallbackEvent event)
{ {
if (this.wildernessAttackLevelRange if (this.wildernessAttackLevelRange

View File

@@ -35,9 +35,9 @@ import net.runelite.client.RuneLite;
import net.runelite.client.callback.ClientThread; import net.runelite.client.callback.ClientThread;
import net.runelite.client.config.ChatColorConfig; import net.runelite.client.config.ChatColorConfig;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.config.RuneLiteConfig;
import net.runelite.client.config.OpenOSRSConfig; import net.runelite.client.config.OpenOSRSConfig;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.config.RuneLiteConfig;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.OverlayMenuClicked; import net.runelite.client.events.OverlayMenuClicked;
import net.runelite.client.events.PluginChanged; import net.runelite.client.events.PluginChanged;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
@@ -84,16 +84,12 @@ public class ConfigPlugin extends Plugin
@Inject @Inject
private ColorPickerManager colorPickerManager; private ColorPickerManager colorPickerManager;
@Inject
private EventBus eventBus;
private ConfigPanel configPanel; private ConfigPanel configPanel;
private NavigationButton navButton; private NavigationButton navButton;
@Override @Override
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
addSubscriptions();
configPanel = new ConfigPanel(pluginManager, configManager, executorService, runeLiteConfig, OpenOSRSConfig, chatColorConfig, colorPickerManager); configPanel = new ConfigPanel(pluginManager, configManager, executorService, runeLiteConfig, OpenOSRSConfig, chatColorConfig, colorPickerManager);
@@ -112,8 +108,6 @@ public class ConfigPlugin extends Plugin
@Override @Override
public void shutDown() throws Exception public void shutDown() throws Exception
{ {
eventBus.unregister(this);
clientToolbar.removeNavigation(navButton); clientToolbar.removeNavigation(navButton);
RuneLite.getInjector().getInstance(ClientThread.class).invokeLater(() -> RuneLite.getInjector().getInstance(ClientThread.class).invokeLater(() ->
{ {
@@ -133,17 +127,13 @@ public class ConfigPlugin extends Plugin
}); });
} }
private void addSubscriptions() @Subscribe
{
eventBus.subscribe(PluginChanged.class, this, this::onPluginChanged);
eventBus.subscribe(OverlayMenuClicked.class, this, this::onOverlayMenuClicked);
}
private void onPluginChanged(PluginChanged event) private void onPluginChanged(PluginChanged event)
{ {
SwingUtilities.invokeLater(configPanel::refreshPluginList); SwingUtilities.invokeLater(configPanel::refreshPluginList);
} }
@Subscribe
private void onOverlayMenuClicked(OverlayMenuClicked overlayMenuClicked) private void onOverlayMenuClicked(OverlayMenuClicked overlayMenuClicked)
{ {
OverlayMenuEntry overlayMenuEntry = overlayMenuClicked.getEntry(); OverlayMenuEntry overlayMenuEntry = overlayMenuClicked.getEntry();

View File

@@ -44,7 +44,7 @@ import net.runelite.api.events.ChatMessage;
import net.runelite.api.events.GameTick; import net.runelite.api.events.GameTick;
import net.runelite.api.events.SpotAnimationChanged; import net.runelite.api.events.SpotAnimationChanged;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.ConfigChanged;
import net.runelite.client.events.OverlayMenuClicked; import net.runelite.client.events.OverlayMenuClicked;
import net.runelite.client.game.ItemManager; import net.runelite.client.game.ItemManager;
@@ -83,9 +83,6 @@ public class CookingPlugin extends Plugin
@Inject @Inject
private ItemManager itemManager; private ItemManager itemManager;
@Inject
private EventBus eventBus;
@Getter(AccessLevel.PACKAGE) @Getter(AccessLevel.PACKAGE)
private CookingSession session; private CookingSession session;
@@ -103,7 +100,6 @@ public class CookingPlugin extends Plugin
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
updateConfig(); updateConfig();
addSubscriptions();
session = null; session = null;
overlayManager.add(overlay); overlayManager.add(overlay);
@@ -112,22 +108,12 @@ public class CookingPlugin extends Plugin
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
infoBoxManager.removeIf(FermentTimer.class::isInstance); infoBoxManager.removeIf(FermentTimer.class::isInstance);
overlayManager.remove(overlay); overlayManager.remove(overlay);
session = null; session = null;
} }
private void addSubscriptions() @Subscribe
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(GameTick.class, this, this::onGameTick);
eventBus.subscribe(SpotAnimationChanged.class, this, this::onSpotAnimationChanged);
eventBus.subscribe(ChatMessage.class, this, this::onChatMessage);
eventBus.subscribe(OverlayMenuClicked.class, this, this::onOverlayMenuClicked);
}
private void onOverlayMenuClicked(OverlayMenuClicked overlayMenuClicked) private void onOverlayMenuClicked(OverlayMenuClicked overlayMenuClicked)
{ {
OverlayMenuEntry overlayMenuEntry = overlayMenuClicked.getEntry(); OverlayMenuEntry overlayMenuEntry = overlayMenuClicked.getEntry();
@@ -139,6 +125,7 @@ public class CookingPlugin extends Plugin
} }
} }
@Subscribe
private void onGameTick(GameTick gameTick) private void onGameTick(GameTick gameTick)
{ {
if (session == null || this.statTimeout == 0) if (session == null || this.statTimeout == 0)
@@ -155,6 +142,7 @@ public class CookingPlugin extends Plugin
} }
} }
@Subscribe
void onSpotAnimationChanged(SpotAnimationChanged graphicChanged) void onSpotAnimationChanged(SpotAnimationChanged graphicChanged)
{ {
Player player = client.getLocalPlayer(); Player player = client.getLocalPlayer();
@@ -184,6 +172,7 @@ public class CookingPlugin extends Plugin
} }
} }
@Subscribe
void onChatMessage(ChatMessage event) void onChatMessage(ChatMessage event)
{ {
if (event.getType() != ChatMessageType.SPAM) if (event.getType() != ChatMessageType.SPAM)
@@ -221,6 +210,7 @@ public class CookingPlugin extends Plugin
} }
} }
@Subscribe
private void onConfigChanged(ConfigChanged configChanged) private void onConfigChanged(ConfigChanged configChanged)
{ {
if (configChanged.getGroup().equals("cooking")) if (configChanged.getGroup().equals("cooking"))

View File

@@ -51,7 +51,7 @@ import net.runelite.client.chat.ChatMessageBuilder;
import net.runelite.client.chat.ChatMessageManager; import net.runelite.client.chat.ChatMessageManager;
import net.runelite.client.chat.QueuedMessage; import net.runelite.client.chat.QueuedMessage;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
@@ -100,9 +100,6 @@ public class CorpPlugin extends Plugin
@Inject @Inject
private CorpConfig config; private CorpConfig config;
@Inject
private EventBus eventBus;
private boolean leftClickCore; private boolean leftClickCore;
@Getter(AccessLevel.PACKAGE) @Getter(AccessLevel.PACKAGE)
private boolean showDamage; private boolean showDamage;
@@ -117,7 +114,6 @@ public class CorpPlugin extends Plugin
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
updateConfig(); updateConfig();
addSubscriptions();
overlayManager.add(corpOverlay); overlayManager.add(corpOverlay);
overlayManager.add(coreOverlay); overlayManager.add(coreOverlay);
@@ -126,8 +122,6 @@ public class CorpPlugin extends Plugin
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
overlayManager.remove(corpOverlay); overlayManager.remove(corpOverlay);
overlayManager.remove(coreOverlay); overlayManager.remove(coreOverlay);
@@ -137,17 +131,7 @@ public class CorpPlugin extends Plugin
players.clear(); players.clear();
} }
private void addSubscriptions() @Subscribe
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventBus.subscribe(NpcSpawned.class, this, this::onNpcSpawned);
eventBus.subscribe(NpcDespawned.class, this, this::onNpcDespawned);
eventBus.subscribe(HitsplatApplied.class, this, this::onHitsplatApplied);
eventBus.subscribe(InteractingChanged.class, this, this::onInteractingChanged);
eventBus.subscribe(MenuEntryAdded.class, this, this::onMenuEntryAdded);
}
private void onGameStateChanged(GameStateChanged gameStateChanged) private void onGameStateChanged(GameStateChanged gameStateChanged)
{ {
if (gameStateChanged.getGameState() == GameState.LOADING) if (gameStateChanged.getGameState() == GameState.LOADING)
@@ -156,6 +140,7 @@ public class CorpPlugin extends Plugin
} }
} }
@Subscribe
private void onNpcSpawned(NpcSpawned npcSpawned) private void onNpcSpawned(NpcSpawned npcSpawned)
{ {
NPC npc = npcSpawned.getNpc(); NPC npc = npcSpawned.getNpc();
@@ -175,6 +160,7 @@ public class CorpPlugin extends Plugin
} }
} }
@Subscribe
private void onNpcDespawned(NpcDespawned npcDespawned) private void onNpcDespawned(NpcDespawned npcDespawned)
{ {
NPC npc = npcDespawned.getNpc(); NPC npc = npcDespawned.getNpc();
@@ -211,6 +197,7 @@ public class CorpPlugin extends Plugin
} }
} }
@Subscribe
private void onHitsplatApplied(HitsplatApplied hitsplatApplied) private void onHitsplatApplied(HitsplatApplied hitsplatApplied)
{ {
Actor actor = hitsplatApplied.getActor(); Actor actor = hitsplatApplied.getActor();
@@ -229,6 +216,7 @@ public class CorpPlugin extends Plugin
totalDamage += hitsplatApplied.getHitsplat().getAmount(); totalDamage += hitsplatApplied.getHitsplat().getAmount();
} }
@Subscribe
private void onInteractingChanged(InteractingChanged interactingChanged) private void onInteractingChanged(InteractingChanged interactingChanged)
{ {
Actor source = interactingChanged.getSource(); Actor source = interactingChanged.getSource();
@@ -242,6 +230,7 @@ public class CorpPlugin extends Plugin
players.add(source); players.add(source);
} }
@Subscribe
private void onMenuEntryAdded(MenuEntryAdded event) private void onMenuEntryAdded(MenuEntryAdded event)
{ {
if (event.getOpcode() != NPC_SECOND_OPTION.getId() if (event.getOpcode() != NPC_SECOND_OPTION.getId()
@@ -261,6 +250,7 @@ public class CorpPlugin extends Plugin
event.setModified(); event.setModified();
} }
@Subscribe
private void onConfigChanged(ConfigChanged configChanged) private void onConfigChanged(ConfigChanged configChanged)
{ {
if (configChanged.getGroup().equals("corp")) if (configChanged.getGroup().equals("corp"))

View File

@@ -66,6 +66,7 @@ import net.runelite.api.util.Text;
import net.runelite.client.chat.ChatMessageManager; import net.runelite.client.chat.ChatMessageManager;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.EventBus;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
@@ -162,7 +163,6 @@ public class CoxPlugin extends Plugin
protected void startUp() protected void startUp()
{ {
updateConfig(); updateConfig();
addSubscriptions();
overlayManager.add(coxOverlay); overlayManager.add(coxOverlay);
overlayManager.add(coxInfoBox); overlayManager.add(coxInfoBox);
handCripple = false; handCripple = false;
@@ -178,22 +178,11 @@ public class CoxPlugin extends Plugin
@Override @Override
protected void shutDown() protected void shutDown()
{ {
eventBus.unregister(this);
overlayManager.remove(coxOverlay); overlayManager.remove(coxOverlay);
overlayManager.remove(coxInfoBox); overlayManager.remove(coxInfoBox);
} }
private void addSubscriptions() @Subscribe
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(ChatMessage.class, this, this::onChatMessage);
eventBus.subscribe(ProjectileSpawned.class, this, this::onProjectileSpawned);
eventBus.subscribe(SpotAnimationChanged.class, this, this::onSpotAnimationChanged);
eventBus.subscribe(NpcSpawned.class, this, this::onNpcSpawned);
eventBus.subscribe(NpcDespawned.class, this, this::onNpcDespawned);
eventBus.subscribe(GameTick.class, this, this::onGameTick);
}
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (event.getGroup().equals("Cox")) if (event.getGroup().equals("Cox"))
@@ -202,6 +191,7 @@ public class CoxPlugin extends Plugin
} }
} }
@Subscribe
private void onChatMessage(ChatMessage event) private void onChatMessage(ChatMessage event)
{ {
if (!inRaid()) if (!inRaid())
@@ -274,6 +264,7 @@ public class CoxPlugin extends Plugin
} }
} }
@Subscribe
private void onProjectileSpawned(ProjectileSpawned event) private void onProjectileSpawned(ProjectileSpawned event)
{ {
if (!inRaid()) if (!inRaid())
@@ -299,6 +290,7 @@ public class CoxPlugin extends Plugin
} }
} }
@Subscribe
private void onSpotAnimationChanged(SpotAnimationChanged event) private void onSpotAnimationChanged(SpotAnimationChanged event)
{ {
if (!inRaid()) if (!inRaid())
@@ -332,6 +324,7 @@ public class CoxPlugin extends Plugin
} }
} }
@Subscribe
private void onNpcSpawned(NpcSpawned event) private void onNpcSpawned(NpcSpawned event)
{ {
if (!inRaid()) if (!inRaid())
@@ -376,6 +369,7 @@ public class CoxPlugin extends Plugin
} }
} }
@Subscribe
private void onNpcDespawned(NpcDespawned event) private void onNpcDespawned(NpcDespawned event)
{ {
if (!inRaid()) if (!inRaid())
@@ -423,6 +417,7 @@ public class CoxPlugin extends Plugin
} }
} }
@Subscribe
private void onGameTick(GameTick event) private void onGameTick(GameTick event)
{ {
if (!inRaid()) if (!inRaid())

View File

@@ -36,7 +36,7 @@ import javax.sound.sampled.LineUnavailableException;
import javax.sound.sampled.UnsupportedAudioFileException; import javax.sound.sampled.UnsupportedAudioFileException;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
@@ -57,9 +57,6 @@ public class CustomCursorPlugin extends Plugin
@Inject @Inject
private CustomCursorConfig config; private CustomCursorConfig config;
@Inject
private EventBus eventBus;
private Clip skillSpecsRage; private Clip skillSpecsRage;
private int volume = 35; private int volume = 35;
@@ -72,7 +69,6 @@ public class CustomCursorPlugin extends Plugin
@Override @Override
protected void startUp() protected void startUp()
{ {
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
updateCursor(); updateCursor();
try (AudioInputStream ais = AudioSystem.getAudioInputStream(this.getClass().getResourceAsStream("specs-rage.wav"))) try (AudioInputStream ais = AudioSystem.getAudioInputStream(this.getClass().getResourceAsStream("specs-rage.wav")))
@@ -93,11 +89,10 @@ public class CustomCursorPlugin extends Plugin
@Override @Override
protected void shutDown() protected void shutDown()
{ {
eventBus.unregister(this);
clientUI.resetCursor(); clientUI.resetCursor();
} }
@Subscribe
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (event.getGroup().equals("customcursor") && event.getKey().equals("cursorStyle")) if (event.getGroup().equals("customcursor") && event.getKey().equals("cursorStyle"))

View File

@@ -43,7 +43,7 @@ import net.runelite.client.chat.ChatMessageBuilder;
import net.runelite.client.chat.ChatMessageManager; import net.runelite.client.chat.ChatMessageManager;
import net.runelite.client.chat.QueuedMessage; import net.runelite.client.chat.QueuedMessage;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
@@ -80,9 +80,6 @@ public class DailyTasksPlugin extends Plugin
@Inject @Inject
private ChatMessageManager chatMessageManager; private ChatMessageManager chatMessageManager;
@Inject
private EventBus eventBus;
private long lastReset; private long lastReset;
private boolean loggingIn; private boolean loggingIn;
@@ -106,7 +103,6 @@ public class DailyTasksPlugin extends Plugin
public void startUp() public void startUp()
{ {
updateConfig(); updateConfig();
addSubscriptions();
loggingIn = true; loggingIn = true;
} }
@@ -114,19 +110,10 @@ public class DailyTasksPlugin extends Plugin
@Override @Override
public void shutDown() public void shutDown()
{ {
eventBus.unregister(this);
eventBus.unregister(this);
lastReset = 0L; lastReset = 0L;
} }
private void addSubscriptions() @Subscribe
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventBus.subscribe(GameTick.class, this, this::onGameTick);
}
private void onGameStateChanged(GameStateChanged event) private void onGameStateChanged(GameStateChanged event)
{ {
if (event.getGameState() == GameState.LOGGING_IN) if (event.getGameState() == GameState.LOGGING_IN)
@@ -135,6 +122,7 @@ public class DailyTasksPlugin extends Plugin
} }
} }
@Subscribe
private void onGameTick(GameTick event) private void onGameTick(GameTick event)
{ {
long currentTime = System.currentTimeMillis(); long currentTime = System.currentTimeMillis();
@@ -310,6 +298,7 @@ public class DailyTasksPlugin extends Plugin
.build()); .build());
} }
@Subscribe
private void onConfigChanged(ConfigChanged configChanged) private void onConfigChanged(ConfigChanged configChanged)
{ {
if (configChanged.getGroup().equals("dailytaskindicators")) if (configChanged.getGroup().equals("dailytaskindicators"))

View File

@@ -44,7 +44,6 @@ import net.runelite.api.MenuEntry;
import net.runelite.api.MenuOpcode; import net.runelite.api.MenuOpcode;
import net.runelite.api.Player; import net.runelite.api.Player;
import net.runelite.api.coords.WorldPoint; import net.runelite.api.coords.WorldPoint;
import net.runelite.client.events.ConfigChanged;
import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.GameTick; import net.runelite.api.events.GameTick;
import net.runelite.api.events.ItemDespawned; import net.runelite.api.events.ItemDespawned;
@@ -58,6 +57,8 @@ import net.runelite.api.util.Text;
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.EventBus; import net.runelite.client.eventbus.EventBus;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.game.ItemManager; import net.runelite.client.game.ItemManager;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
@@ -122,6 +123,7 @@ public class DeathIndicatorPlugin extends Plugin
private Instant lastDeathTime; private Instant lastDeathTime;
private int lastDeathWorld; private int lastDeathWorld;
private int despawnIdx = 0; private int despawnIdx = 0;
@Provides @Provides
DeathIndicatorConfig deathIndicatorConfig(ConfigManager configManager) DeathIndicatorConfig deathIndicatorConfig(ConfigManager configManager)
{ {
@@ -131,7 +133,10 @@ public class DeathIndicatorPlugin extends Plugin
@Override @Override
protected void startUp() protected void startUp()
{ {
addSubscriptions(); if (config.permaBones())
{
addBoneSubs();
}
if (!hasDied()) if (!hasDied())
{ {
@@ -165,7 +170,6 @@ public class DeathIndicatorPlugin extends Plugin
@Override @Override
protected void shutDown() protected void shutDown()
{ {
eventBus.unregister(this);
eventBus.unregister(BONES); eventBus.unregister(BONES);
if (client.hasHintArrow()) if (client.hasHintArrow())
@@ -194,18 +198,6 @@ public class DeathIndicatorPlugin extends Plugin
bones.clear(client.getScene()); bones.clear(client.getScene());
} }
private void addSubscriptions()
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(LocalPlayerDeath.class, this, this::onLocalPlayerDeath);
eventBus.subscribe(GameTick.class, this, this::onGameTick);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
if (config.permaBones())
{
addBoneSubs();
}
}
private void addBoneSubs() private void addBoneSubs()
{ {
eventBus.subscribe(ItemDespawned.class, BONES, this::onItemDespawn); eventBus.subscribe(ItemDespawned.class, BONES, this::onItemDespawn);
@@ -301,6 +293,7 @@ public class DeathIndicatorPlugin extends Plugin
} }
} }
@Subscribe
private void onLocalPlayerDeath(LocalPlayerDeath death) private void onLocalPlayerDeath(LocalPlayerDeath death)
{ {
if (client.isInInstancedRegion()) if (client.isInInstancedRegion())
@@ -319,6 +312,7 @@ public class DeathIndicatorPlugin extends Plugin
lastDeathTime = Instant.now(); lastDeathTime = Instant.now();
} }
@Subscribe
private void onGameTick(GameTick event) private void onGameTick(GameTick event)
{ {
// Check if player respawned in a death respawn location // Check if player respawned in a death respawn location
@@ -383,6 +377,7 @@ public class DeathIndicatorPlugin extends Plugin
} }
} }
@Subscribe
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (event.getGroup().equals("deathIndicator")) if (event.getGroup().equals("deathIndicator"))
@@ -436,6 +431,7 @@ public class DeathIndicatorPlugin extends Plugin
} }
} }
@Subscribe
private void onGameStateChanged(GameStateChanged event) private void onGameStateChanged(GameStateChanged event)
{ {
switch (event.getGameState()) switch (event.getGameState())

View File

@@ -34,7 +34,7 @@ import net.runelite.api.GameState;
import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.GameStateChanged;
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.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.SessionOpen; import net.runelite.client.events.SessionOpen;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
@@ -57,9 +57,6 @@ public class DefaultWorldPlugin extends Plugin
@Inject @Inject
private DefaultWorldConfig config; private DefaultWorldConfig config;
@Inject
private EventBus eventBus;
@Inject @Inject
private ClientThread clientThread; private ClientThread clientThread;
@@ -72,7 +69,6 @@ public class DefaultWorldPlugin extends Plugin
@Override @Override
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
addSubscriptions();
worldChangeRequired = true; worldChangeRequired = true;
applyWorld(); applyWorld();
@@ -81,30 +77,24 @@ public class DefaultWorldPlugin extends Plugin
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
worldChangeRequired = true; worldChangeRequired = true;
changeWorld(worldCache); changeWorld(worldCache);
} }
private void addSubscriptions() @Provides
{
eventBus.subscribe(SessionOpen.class, this, this::onSessionOpen);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
}
@Provides
DefaultWorldConfig getConfig(ConfigManager configManager) DefaultWorldConfig getConfig(ConfigManager configManager)
{ {
return configManager.getConfig(DefaultWorldConfig.class); return configManager.getConfig(DefaultWorldConfig.class);
} }
@Subscribe
private void onSessionOpen(SessionOpen event) private void onSessionOpen(SessionOpen event)
{ {
worldChangeRequired = true; worldChangeRequired = true;
applyWorld(); applyWorld();
} }
@Subscribe
private void onGameStateChanged(GameStateChanged event) private void onGameStateChanged(GameStateChanged event)
{ {
applyWorld(); applyWorld();

View File

@@ -58,7 +58,7 @@ import net.runelite.api.events.PlayerDespawned;
import net.runelite.api.events.PlayerSpawned; import net.runelite.api.events.PlayerSpawned;
import net.runelite.api.events.ProjectileSpawned; import net.runelite.api.events.ProjectileSpawned;
import net.runelite.client.callback.ClientThread; import net.runelite.client.callback.ClientThread;
import net.runelite.client.eventbus.EventBus; 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;
@@ -85,9 +85,6 @@ public class DemonicGorillaPlugin extends Plugin
@Inject @Inject
private ClientThread clientThread; private ClientThread clientThread;
@Inject
private EventBus eventBus;
@Getter(AccessLevel.PACKAGE) @Getter(AccessLevel.PACKAGE)
private Map<NPC, DemonicGorilla> gorillas; private Map<NPC, DemonicGorilla> gorillas;
@@ -100,7 +97,6 @@ public class DemonicGorillaPlugin extends Plugin
@Override @Override
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
addSubscriptions();
overlayManager.add(overlay); overlayManager.add(overlay);
gorillas = new HashMap<>(); gorillas = new HashMap<>();
recentBoulders = new ArrayList<>(); recentBoulders = new ArrayList<>();
@@ -112,7 +108,6 @@ public class DemonicGorillaPlugin extends Plugin
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
overlayManager.remove(overlay); overlayManager.remove(overlay);
gorillas = null; gorillas = null;
recentBoulders = null; recentBoulders = null;
@@ -120,19 +115,7 @@ public class DemonicGorillaPlugin extends Plugin
memorizedPlayers = null; memorizedPlayers = null;
} }
private void addSubscriptions() private void clear()
{
eventBus.subscribe(ProjectileSpawned.class, this, this::onProjectileSpawned);
eventBus.subscribe(HitsplatApplied.class, this, this::onHitsplatApplied);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventBus.subscribe(PlayerSpawned.class, this, this::onPlayerSpawned);
eventBus.subscribe(PlayerDespawned.class, this, this::onPlayerDespawned);
eventBus.subscribe(NpcSpawned.class, this, this::onNpcSpawned);
eventBus.subscribe(NpcDespawned.class, this, this::onNpcDespawned);
eventBus.subscribe(GameTick.class, this, this::onGameTick);
}
private void clear()
{ {
recentBoulders.clear(); recentBoulders.clear();
pendingAttacks.clear(); pendingAttacks.clear();
@@ -548,6 +531,7 @@ public class DemonicGorillaPlugin extends Plugin
} }
} }
@Subscribe
private void onProjectileSpawned(ProjectileSpawned event) private void onProjectileSpawned(ProjectileSpawned event)
{ {
final Projectile projectile = event.getProjectile(); final Projectile projectile = event.getProjectile();
@@ -627,6 +611,7 @@ public class DemonicGorillaPlugin extends Plugin
} }
} }
@Subscribe
private void onHitsplatApplied(HitsplatApplied event) private void onHitsplatApplied(HitsplatApplied event)
{ {
if (gorillas.isEmpty()) if (gorillas.isEmpty())
@@ -655,6 +640,7 @@ public class DemonicGorillaPlugin extends Plugin
} }
} }
@Subscribe
private void onGameStateChanged(GameStateChanged event) private void onGameStateChanged(GameStateChanged event)
{ {
GameState gs = event.getGameState(); GameState gs = event.getGameState();
@@ -666,6 +652,7 @@ public class DemonicGorillaPlugin extends Plugin
} }
} }
@Subscribe
private void onPlayerSpawned(PlayerSpawned event) private void onPlayerSpawned(PlayerSpawned event)
{ {
if (gorillas.isEmpty()) if (gorillas.isEmpty())
@@ -677,6 +664,7 @@ public class DemonicGorillaPlugin extends Plugin
memorizedPlayers.put(player, new MemorizedPlayer(player)); memorizedPlayers.put(player, new MemorizedPlayer(player));
} }
@Subscribe
private void onPlayerDespawned(PlayerDespawned event) private void onPlayerDespawned(PlayerDespawned event)
{ {
if (gorillas.isEmpty()) if (gorillas.isEmpty())
@@ -687,6 +675,7 @@ public class DemonicGorillaPlugin extends Plugin
memorizedPlayers.remove(event.getPlayer()); memorizedPlayers.remove(event.getPlayer());
} }
@Subscribe
private void onNpcSpawned(NpcSpawned event) private void onNpcSpawned(NpcSpawned event)
{ {
NPC npc = event.getNpc(); NPC npc = event.getNpc();
@@ -703,6 +692,7 @@ public class DemonicGorillaPlugin extends Plugin
} }
} }
@Subscribe
private void onNpcDespawned(NpcDespawned event) private void onNpcDespawned(NpcDespawned event)
{ {
if (gorillas.remove(event.getNpc()) != null && gorillas.isEmpty()) if (gorillas.remove(event.getNpc()) != null && gorillas.isEmpty())
@@ -711,6 +701,7 @@ public class DemonicGorillaPlugin extends Plugin
} }
} }
@Subscribe
private void onGameTick(GameTick event) private void onGameTick(GameTick event)
{ {
checkGorillaAttacks(); checkGorillaAttacks();

View File

@@ -50,6 +50,7 @@ import net.runelite.api.events.VarbitChanged;
import net.runelite.api.kit.KitType; import net.runelite.api.kit.KitType;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.EventBus;
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.ClientToolbar; import net.runelite.client.ui.ClientToolbar;
@@ -142,7 +143,6 @@ public class DevToolsPlugin extends Plugin
@Override @Override
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
addSubscriptions();
players = new DevToolsButton("Players"); players = new DevToolsButton("Players");
npcs = new DevToolsButton("NPCs"); npcs = new DevToolsButton("NPCs");
@@ -206,8 +206,6 @@ public class DevToolsPlugin extends Plugin
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
overlayManager.remove(overlay); overlayManager.remove(overlay);
overlayManager.remove(locationOverlay); overlayManager.remove(locationOverlay);
overlayManager.remove(sceneOverlay); overlayManager.remove(sceneOverlay);
@@ -218,14 +216,7 @@ public class DevToolsPlugin extends Plugin
clientToolbar.removeNavigation(navButton); clientToolbar.removeNavigation(navButton);
} }
private void addSubscriptions() @Subscribe
{
eventBus.subscribe(CommandExecuted.class, this, this::onCommandExecuted);
eventBus.subscribe(MenuEntryAdded.class, this, this::onMenuEntryAdded);
eventBus.subscribe(AreaSoundEffectPlayed.class, this, this::onAreaSoundEffectPlayed);
eventBus.subscribe(SoundEffectPlayed.class, this, this::onSoundEffectPlayed);
}
private void onCommandExecuted(CommandExecuted commandExecuted) private void onCommandExecuted(CommandExecuted commandExecuted)
{ {
String[] args = commandExecuted.getArguments(); String[] args = commandExecuted.getArguments();
@@ -379,6 +370,7 @@ public class DevToolsPlugin extends Plugin
} }
} }
@Subscribe
private void onMenuEntryAdded(MenuEntryAdded entry) private void onMenuEntryAdded(MenuEntryAdded entry)
{ {
if (!examine.isActive()) if (!examine.isActive())
@@ -414,6 +406,7 @@ public class DevToolsPlugin extends Plugin
} }
} }
@Subscribe
private void onSoundEffectPlayed(SoundEffectPlayed event) private void onSoundEffectPlayed(SoundEffectPlayed event)
{ {
if (!getSoundEffects().isActive() || soundEffectOverlay == null) if (!getSoundEffects().isActive() || soundEffectOverlay == null)
@@ -424,6 +417,7 @@ public class DevToolsPlugin extends Plugin
soundEffectOverlay.onSoundEffectPlayed(event); soundEffectOverlay.onSoundEffectPlayed(event);
} }
@Subscribe
private void onAreaSoundEffectPlayed(AreaSoundEffectPlayed event) private void onAreaSoundEffectPlayed(AreaSoundEffectPlayed event)
{ {
if (!getSoundEffects().isActive() || soundEffectOverlay == null) if (!getSoundEffects().isActive() || soundEffectOverlay == null)

View File

@@ -46,7 +46,6 @@ import net.runelite.api.GameState;
import net.runelite.api.Skill; import net.runelite.api.Skill;
import net.runelite.api.WorldType; import net.runelite.api.WorldType;
import net.runelite.api.coords.WorldPoint; import net.runelite.api.coords.WorldPoint;
import net.runelite.client.events.ConfigChanged;
import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.StatChanged; import net.runelite.api.events.StatChanged;
import net.runelite.api.events.VarbitChanged; import net.runelite.api.events.VarbitChanged;
@@ -56,7 +55,8 @@ import net.runelite.client.discord.DiscordService;
import net.runelite.client.discord.events.DiscordJoinGame; import net.runelite.client.discord.events.DiscordJoinGame;
import net.runelite.client.discord.events.DiscordJoinRequest; import net.runelite.client.discord.events.DiscordJoinRequest;
import net.runelite.client.discord.events.DiscordReady; import net.runelite.client.discord.events.DiscordReady;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.events.PartyChanged; import net.runelite.client.events.PartyChanged;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
@@ -107,9 +107,6 @@ public class DiscordPlugin extends Plugin
@Inject @Inject
private WSClient wsClient; private WSClient wsClient;
@Inject
private EventBus eventBus;
private final Map<Skill, Integer> skillExp = new HashMap<>(); private final Map<Skill, Integer> skillExp = new HashMap<>();
private NavigationButton discordButton; private NavigationButton discordButton;
private boolean loginFlag; private boolean loginFlag;
@@ -137,7 +134,6 @@ public class DiscordPlugin extends Plugin
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
updateConfig(); updateConfig();
addSubscriptions();
final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "discord.png"); final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "discord.png");
@@ -163,30 +159,13 @@ public class DiscordPlugin extends Plugin
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
clientToolbar.removeNavigation(discordButton); clientToolbar.removeNavigation(discordButton);
discordState.reset(); discordState.reset();
partyService.changeParty(null); partyService.changeParty(null);
wsClient.unregisterMessage(DiscordUserInfo.class); wsClient.unregisterMessage(DiscordUserInfo.class);
} }
private void addSubscriptions() @Subscribe
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventBus.subscribe(StatChanged.class, this, this::onStatChanged);
eventBus.subscribe(VarbitChanged.class, this, this::onVarbitChanged);
eventBus.subscribe(DiscordReady.class, this, this::onDiscordReady);
eventBus.subscribe(DiscordJoinRequest.class, this, this::onDiscordJoinRequest);
eventBus.subscribe(DiscordJoinGame.class, this, this::onDiscordJoinGame);
eventBus.subscribe(DiscordUserInfo.class, this, this::onDiscordUserInfo);
eventBus.subscribe(UserJoin.class, this, this::onUserJoin);
eventBus.subscribe(UserSync.class, this, this::onUserSync);
eventBus.subscribe(UserPart.class, this, this::onUserPart);
eventBus.subscribe(PartyChanged.class, this, this::onPartyChanged);
}
private void onGameStateChanged(GameStateChanged event) private void onGameStateChanged(GameStateChanged event)
{ {
switch (event.getGameState()) switch (event.getGameState())
@@ -210,6 +189,7 @@ public class DiscordPlugin extends Plugin
checkForAreaUpdate(); checkForAreaUpdate();
} }
@Subscribe
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (event.getGroup().equalsIgnoreCase("discord")) if (event.getGroup().equalsIgnoreCase("discord"))
@@ -222,6 +202,7 @@ public class DiscordPlugin extends Plugin
} }
} }
@Subscribe
private void onStatChanged(StatChanged statChanged) private void onStatChanged(StatChanged statChanged)
{ {
final Skill skill = statChanged.getSkill(); final Skill skill = statChanged.getSkill();
@@ -241,6 +222,7 @@ public class DiscordPlugin extends Plugin
} }
} }
@Subscribe
private void onVarbitChanged(VarbitChanged event) private void onVarbitChanged(VarbitChanged event)
{ {
if (!this.showRaidingActivity) if (!this.showRaidingActivity)
@@ -256,11 +238,13 @@ public class DiscordPlugin extends Plugin
} }
} }
@Subscribe
private void onDiscordReady(DiscordReady event) private void onDiscordReady(DiscordReady event)
{ {
partyService.setUsername(event.getUsername() + "#" + event.getDiscriminator()); partyService.setUsername(event.getUsername() + "#" + event.getDiscriminator());
} }
@Subscribe
private void onDiscordJoinRequest(DiscordJoinRequest request) private void onDiscordJoinRequest(DiscordJoinRequest request)
{ {
log.debug("Got discord join request {}", request); log.debug("Got discord join request {}", request);
@@ -272,6 +256,7 @@ public class DiscordPlugin extends Plugin
} }
} }
@Subscribe
private void onDiscordJoinGame(DiscordJoinGame joinGame) private void onDiscordJoinGame(DiscordJoinGame joinGame)
{ {
log.debug("Got discord join game {}", joinGame); log.debug("Got discord join game {}", joinGame);
@@ -280,6 +265,7 @@ public class DiscordPlugin extends Plugin
updatePresence(); updatePresence();
} }
@Subscribe
private void onDiscordUserInfo(final DiscordUserInfo event) private void onDiscordUserInfo(final DiscordUserInfo event)
{ {
final PartyMember memberById = partyService.getMemberById(event.getMemberId()); final PartyMember memberById = partyService.getMemberById(event.getMemberId());
@@ -339,11 +325,13 @@ public class DiscordPlugin extends Plugin
}); });
} }
@Subscribe
private void onUserJoin(final UserJoin event) private void onUserJoin(final UserJoin event)
{ {
updatePresence(); updatePresence();
} }
@Subscribe
private void onUserSync(final UserSync event) private void onUserSync(final UserSync event)
{ {
final PartyMember localMember = partyService.getLocalMember(); final PartyMember localMember = partyService.getLocalMember();
@@ -359,11 +347,13 @@ public class DiscordPlugin extends Plugin
} }
} }
@Subscribe
private void onUserPart(final UserPart event) private void onUserPart(final UserPart event)
{ {
updatePresence(); updatePresence();
} }
@Subscribe
private void onPartyChanged(final PartyChanged event) private void onPartyChanged(final PartyChanged event)
{ {
updatePresence(); updatePresence();

View File

@@ -40,9 +40,8 @@ import net.runelite.api.Player;
import net.runelite.api.coords.WorldPoint; import net.runelite.api.coords.WorldPoint;
import net.runelite.api.events.GameTick; import net.runelite.api.events.GameTick;
import net.runelite.api.util.Text; import net.runelite.api.util.Text;
import net.runelite.client.Notifier;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
@@ -74,15 +73,11 @@ public class DropPartyPlugin extends Plugin
@Getter(AccessLevel.PACKAGE) @Getter(AccessLevel.PACKAGE)
private Color overlayColor; private Color overlayColor;
@Inject
private Notifier notifier;
@Inject @Inject
private OverlayManager overlayManager; private OverlayManager overlayManager;
@Inject @Inject
private DropPartyOverlay coreOverlay; private DropPartyOverlay coreOverlay;
@Inject @Inject
private EventBus eventbus;
@Inject
private Client client; private Client client;
@Getter(AccessLevel.PACKAGE) @Getter(AccessLevel.PACKAGE)
private int fontStyle; private int fontStyle;
@@ -99,7 +94,6 @@ public class DropPartyPlugin extends Plugin
protected void startUp() protected void startUp()
{ {
updateConfig(); updateConfig();
addSubscriptions();
overlayManager.add(coreOverlay); overlayManager.add(coreOverlay);
reset(); reset();
} }
@@ -109,16 +103,9 @@ public class DropPartyPlugin extends Plugin
{ {
overlayManager.remove(coreOverlay); overlayManager.remove(coreOverlay);
reset(); reset();
eventbus.unregister(this);
} }
private void addSubscriptions() @Subscribe
{
eventbus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventbus.subscribe(GameTick.class, this, this::onGameTick);
}
private void onGameTick(GameTick event) private void onGameTick(GameTick event)
{ {
shuffleList(); shuffleList();
@@ -181,6 +168,7 @@ public class DropPartyPlugin extends Plugin
} }
@Subscribe
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (!event.getGroup().equals("drop")) if (!event.getGroup().equals("drop"))

View File

@@ -55,6 +55,7 @@ import net.runelite.api.kit.KitType;
import net.runelite.api.util.Text; import net.runelite.api.util.Text;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.EventBus;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.ConfigChanged;
import net.runelite.client.game.ItemManager; import net.runelite.client.game.ItemManager;
import net.runelite.client.menus.MenuManager; import net.runelite.client.menus.MenuManager;
@@ -163,9 +164,9 @@ public class DynamicMaxHit extends Plugin
eventBus.subscribe(SpotAnimationChanged.class, this, this::onSpotAnimationChanged); eventBus.subscribe(SpotAnimationChanged.class, this, this::onSpotAnimationChanged);
eventBus.subscribe(ChatMessage.class, this, this::onChatMessage); eventBus.subscribe(ChatMessage.class, this, this::onChatMessage);
eventBus.subscribe(PlayerMenuOptionClicked.class, this, this::onPlayerMenuOptionClicked); eventBus.subscribe(PlayerMenuOptionClicked.class, this, this::onPlayerMenuOptionClicked);
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
} }
@Subscribe
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (!event.getGroup().equals("dynamicMaxHit")) if (!event.getGroup().equals("dynamicMaxHit"))

View File

@@ -42,7 +42,7 @@ import net.runelite.api.events.ChatMessage;
import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.OverheadTextChanged; import net.runelite.api.events.OverheadTextChanged;
import net.runelite.client.chat.ChatMessageManager; import net.runelite.client.chat.ChatMessageManager;
import net.runelite.client.eventbus.EventBus; 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.util.ImageUtil; import net.runelite.client.util.ImageUtil;
@@ -65,31 +65,20 @@ public class EmojiPlugin extends Plugin
@Inject @Inject
private ChatMessageManager chatMessageManager; private ChatMessageManager chatMessageManager;
@Inject
private EventBus eventBus;
private int modIconsStart = -1; private int modIconsStart = -1;
@Override @Override
protected void startUp() protected void startUp()
{ {
loadEmojiIcons(); loadEmojiIcons();
addSubscriptions();
} }
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
}
private void addSubscriptions()
{
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventBus.subscribe(ChatMessage.class, this, this::onChatMessage);
eventBus.subscribe(OverheadTextChanged.class, this, this::onOverheadTextChanged);
} }
@Subscribe
void onGameStateChanged(GameStateChanged gameStateChanged) void onGameStateChanged(GameStateChanged gameStateChanged)
{ {
if (gameStateChanged.getGameState() == GameState.LOGGED_IN) if (gameStateChanged.getGameState() == GameState.LOGGED_IN)
@@ -130,6 +119,7 @@ public class EmojiPlugin extends Plugin
client.setModIcons(newModIcons); client.setModIcons(newModIcons);
} }
@Subscribe
void onChatMessage(ChatMessage chatMessage) void onChatMessage(ChatMessage chatMessage)
{ {
if (client.getGameState() != GameState.LOGGED_IN || modIconsStart == -1) if (client.getGameState() != GameState.LOGGED_IN || modIconsStart == -1)
@@ -164,6 +154,7 @@ public class EmojiPlugin extends Plugin
client.refreshChat(); client.refreshChat();
} }
@Subscribe
private void onOverheadTextChanged(final OverheadTextChanged event) private void onOverheadTextChanged(final OverheadTextChanged event)
{ {
if (!(event.getActor() instanceof Player)) if (!(event.getActor() instanceof Player))

View File

@@ -36,11 +36,11 @@ import net.runelite.api.Client;
import net.runelite.api.GameState; import net.runelite.api.GameState;
import net.runelite.api.Player; import net.runelite.api.Player;
import net.runelite.api.coords.WorldPoint; import net.runelite.api.coords.WorldPoint;
import net.runelite.client.events.ConfigChanged;
import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.GameStateChanged;
import net.runelite.api.util.Text; import net.runelite.api.util.Text;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
@@ -59,9 +59,6 @@ public class EntityHiderPlugin extends Plugin
@Inject @Inject
private EntityHiderConfig config; private EntityHiderConfig config;
@Inject
private EventBus eventBus;
@Provides @Provides
EntityHiderConfig provideConfig(ConfigManager configManager) EntityHiderConfig provideConfig(ConfigManager configManager)
{ {
@@ -72,18 +69,12 @@ public class EntityHiderPlugin extends Plugin
protected void startUp() protected void startUp()
{ {
updateConfig(); updateConfig();
addSubscriptions();
Text.fromCSV(config.hideNPCsNames()).forEach(client::addHiddenNpcName); Text.fromCSV(config.hideNPCsNames()).forEach(client::addHiddenNpcName);
Text.fromCSV(config.hideNPCsOnDeath()).forEach(client::addHiddenNpcDeath); Text.fromCSV(config.hideNPCsOnDeath()).forEach(client::addHiddenNpcDeath);
} }
private void addSubscriptions() @Subscribe
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
}
public void onConfigChanged(ConfigChanged event) public void onConfigChanged(ConfigChanged event)
{ {
if (event.getGroup().equals("entityhider")) if (event.getGroup().equals("entityhider"))
@@ -121,6 +112,7 @@ public class EntityHiderPlugin extends Plugin
} }
} }
@Subscribe
public void onGameStateChanged(GameStateChanged event) public void onGameStateChanged(GameStateChanged event)
{ {
if (event.getGameState() == GameState.LOGGED_IN) if (event.getGameState() == GameState.LOGGED_IN)
@@ -158,8 +150,6 @@ public class EntityHiderPlugin extends Plugin
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
client.setIsHidingEntities(false); client.setIsHidingEntities(false);
client.setPlayersHidden(false); client.setPlayersHidden(false);

View File

@@ -51,7 +51,7 @@ import net.runelite.client.chat.ChatMessageBuilder;
import net.runelite.client.chat.ChatMessageManager; import net.runelite.client.chat.ChatMessageManager;
import net.runelite.client.chat.QueuedMessage; import net.runelite.client.chat.QueuedMessage;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.ConfigChanged;
import net.runelite.client.game.ItemManager; import net.runelite.client.game.ItemManager;
import net.runelite.client.menus.MenuManager; import net.runelite.client.menus.MenuManager;
@@ -94,9 +94,6 @@ public class EquipmentInspectorPlugin extends Plugin
@Inject @Inject
private ClientToolbar pluginToolbar; private ClientToolbar pluginToolbar;
@Inject
private EventBus eventBus;
private NavigationButton navButton; private NavigationButton navButton;
private EquipmentInspectorPanel equipmentInspectorPanel; private EquipmentInspectorPanel equipmentInspectorPanel;
private int TotalPrice = 0; private int TotalPrice = 0;
@@ -119,7 +116,6 @@ public class EquipmentInspectorPlugin extends Plugin
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
updateConfig(); updateConfig();
addSubscriptions();
equipmentInspectorPanel = injector.getInstance(EquipmentInspectorPanel.class); equipmentInspectorPanel = injector.getInstance(EquipmentInspectorPanel.class);
if (client != null) if (client != null)
@@ -143,18 +139,11 @@ public class EquipmentInspectorPlugin extends Plugin
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
menuManager.removePlayerMenuItem(INSPECT_EQUIPMENT); menuManager.removePlayerMenuItem(INSPECT_EQUIPMENT);
pluginToolbar.removeNavigation(navButton); pluginToolbar.removeNavigation(navButton);
} }
private void addSubscriptions() @Subscribe
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(PlayerMenuOptionClicked.class, this, this::onPlayerMenuOptionClicked);
}
private void onPlayerMenuOptionClicked(PlayerMenuOptionClicked event) private void onPlayerMenuOptionClicked(PlayerMenuOptionClicked event)
{ {
if (event.getMenuOption().equals(INSPECT_EQUIPMENT)) if (event.getMenuOption().equals(INSPECT_EQUIPMENT))
@@ -305,6 +294,7 @@ public class EquipmentInspectorPlugin extends Plugin
} }
} }
@Subscribe
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (event.getGroup().equalsIgnoreCase("equipmentinspector")) if (event.getGroup().equalsIgnoreCase("equipmentinspector"))

View File

@@ -54,7 +54,7 @@ import net.runelite.client.chat.ChatColorType;
import net.runelite.client.chat.ChatMessageBuilder; import net.runelite.client.chat.ChatMessageBuilder;
import net.runelite.client.chat.ChatMessageManager; import net.runelite.client.chat.ChatMessageManager;
import net.runelite.client.chat.QueuedMessage; import net.runelite.client.chat.QueuedMessage;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.game.ItemManager; import net.runelite.client.game.ItemManager;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
@@ -102,33 +102,23 @@ public class ExaminePlugin extends Plugin
@Inject @Inject
private ScheduledExecutorService executor; private ScheduledExecutorService executor;
@Inject
private EventBus eventBus;
@Override @Override
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
addSubscriptions();
} }
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
}
private void addSubscriptions()
{
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventBus.subscribe(MenuOptionClicked.class, this, this::onMenuOptionClicked);
eventBus.subscribe(ChatMessage.class, this, this::onChatMessage);
} }
@Subscribe
private void onGameStateChanged(GameStateChanged event) private void onGameStateChanged(GameStateChanged event)
{ {
pending.clear(); pending.clear();
} }
@Subscribe
void onMenuOptionClicked(MenuOptionClicked event) void onMenuOptionClicked(MenuOptionClicked event)
{ {
if (!event.getOption().equals("Examine")) if (!event.getOption().equals("Examine"))
@@ -190,6 +180,7 @@ public class ExaminePlugin extends Plugin
pending.push(pendingExamine); pending.push(pendingExamine);
} }
@Subscribe
void onChatMessage(ChatMessage event) void onChatMessage(ChatMessage event)
{ {
ExamineType type; ExamineType type;
@@ -292,7 +283,7 @@ public class ExaminePlugin extends Plugin
Widget widgetItem = widget.getChild(1); Widget widgetItem = widget.getChild(1);
if (widgetItem != null) if (widgetItem != null)
{ {
return new int[]{widgetItem.getItemQuantity(), widgetItem.getItemId()}; return new int[] {widgetItem.getItemQuantity(), widgetItem.getItemId()};
} }
} }
else if (WidgetInfo.SMITHING_INVENTORY_ITEMS_CONTAINER.getGroupId() == widgetGroup) else if (WidgetInfo.SMITHING_INVENTORY_ITEMS_CONTAINER.getGroupId() == widgetGroup)
@@ -300,7 +291,7 @@ public class ExaminePlugin extends Plugin
Widget widgetItem = widget.getChild(2); Widget widgetItem = widget.getChild(2);
if (widgetItem != null) if (widgetItem != null)
{ {
return new int[]{widgetItem.getItemQuantity(), widgetItem.getItemId()}; return new int[] {widgetItem.getItemQuantity(), widgetItem.getItemId()};
} }
} }
else if (WidgetInfo.BANK_INVENTORY_ITEMS_CONTAINER.getGroupId() == widgetGroup else if (WidgetInfo.BANK_INVENTORY_ITEMS_CONTAINER.getGroupId() == widgetGroup
@@ -309,7 +300,7 @@ public class ExaminePlugin extends Plugin
Widget widgetItem = widget.getChild(actionParam); Widget widgetItem = widget.getChild(actionParam);
if (widgetItem != null) if (widgetItem != null)
{ {
return new int[]{widgetItem.getItemQuantity(), widgetItem.getItemId()}; return new int[] {widgetItem.getItemQuantity(), widgetItem.getItemId()};
} }
} }
else if (WidgetInfo.BANK_ITEM_CONTAINER.getGroupId() == widgetGroup else if (WidgetInfo.BANK_ITEM_CONTAINER.getGroupId() == widgetGroup
@@ -324,7 +315,7 @@ public class ExaminePlugin extends Plugin
if (actionParam < children.length) if (actionParam < children.length)
{ {
Widget widgetItem = children[actionParam]; Widget widgetItem = children[actionParam];
return new int[]{widgetItem.getItemQuantity(), widgetItem.getItemId()}; return new int[] {widgetItem.getItemQuantity(), widgetItem.getItemId()};
} }
} }
else if (WidgetInfo.SHOP_ITEMS_CONTAINER.getGroupId() == widgetGroup) else if (WidgetInfo.SHOP_ITEMS_CONTAINER.getGroupId() == widgetGroup)
@@ -333,7 +324,7 @@ public class ExaminePlugin extends Plugin
if (actionParam < children.length) if (actionParam < children.length)
{ {
Widget widgetItem = children[actionParam]; Widget widgetItem = children[actionParam];
return new int[]{1, widgetItem.getItemId()}; return new int[] {1, widgetItem.getItemId()};
} }
} }
else if (WidgetInfo.CLUE_SCROLL_REWARD_ITEM_CONTAINER.getGroupId() == widgetGroup) else if (WidgetInfo.CLUE_SCROLL_REWARD_ITEM_CONTAINER.getGroupId() == widgetGroup)
@@ -342,7 +333,7 @@ public class ExaminePlugin extends Plugin
if (actionParam < children.length) if (actionParam < children.length)
{ {
Widget widgetItem = children[actionParam]; Widget widgetItem = children[actionParam];
return new int[]{widgetItem.getItemQuantity(), widgetItem.getItemId()}; return new int[] {widgetItem.getItemQuantity(), widgetItem.getItemId()};
} }
} }
else if (WidgetInfo.LOOTING_BAG_CONTAINER.getGroupId() == widgetGroup) else if (WidgetInfo.LOOTING_BAG_CONTAINER.getGroupId() == widgetGroup)
@@ -351,7 +342,7 @@ public class ExaminePlugin extends Plugin
if (actionParam < children.length) if (actionParam < children.length)
{ {
Widget widgetItem = children[actionParam]; Widget widgetItem = children[actionParam];
return new int[]{widgetItem.getItemQuantity(), widgetItem.getItemId()}; return new int[] {widgetItem.getItemQuantity(), widgetItem.getItemId()};
} }
} }
else if (WidgetID.SEED_VAULT_GROUP_ID == widgetGroup) else if (WidgetID.SEED_VAULT_GROUP_ID == widgetGroup)
@@ -360,7 +351,7 @@ public class ExaminePlugin extends Plugin
if (actionParam < children.length) if (actionParam < children.length)
{ {
Widget widgetItem = children[actionParam]; Widget widgetItem = children[actionParam];
return new int[]{widgetItem.getItemQuantity(), widgetItem.getItemId()}; return new int[] {widgetItem.getItemQuantity(), widgetItem.getItemId()};
} }
} }
else if (WidgetID.SEED_VAULT_INVENTORY_GROUP_ID == widgetGroup) else if (WidgetID.SEED_VAULT_INVENTORY_GROUP_ID == widgetGroup)
@@ -369,7 +360,7 @@ public class ExaminePlugin extends Plugin
if (actionParam < children.length) if (actionParam < children.length)
{ {
Widget widgetItem = children[actionParam]; Widget widgetItem = children[actionParam];
return new int[]{widgetItem.getItemQuantity(), widgetItem.getItemId()}; return new int[] {widgetItem.getItemQuantity(), widgetItem.getItemId()};
} }
} }

View File

@@ -51,7 +51,7 @@ 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.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.ConfigChanged;
import net.runelite.client.game.NPCManager; import net.runelite.client.game.NPCManager;
import net.runelite.client.game.XpDropEvent; import net.runelite.client.game.XpDropEvent;
@@ -80,8 +80,6 @@ public class XpDropPlugin extends Plugin
private OverlayManager overlayManager; private OverlayManager overlayManager;
@Inject @Inject
private XpDropOverlay overlay; private XpDropOverlay overlay;
@Inject
private EventBus eventBus;
@Getter(AccessLevel.PACKAGE) @Getter(AccessLevel.PACKAGE)
private int damage = 0; private int damage = 0;
@@ -119,7 +117,6 @@ public class XpDropPlugin extends Plugin
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
updateConfig(); updateConfig();
addSubscriptions();
damageMode = config.showdamagedrops(); damageMode = config.showdamagedrops();
@@ -132,21 +129,10 @@ public class XpDropPlugin extends Plugin
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
overlayManager.remove(overlay); overlayManager.remove(overlay);
} }
private void addSubscriptions() @Subscribe
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventBus.subscribe(WidgetHiddenChanged.class, this, this::onWidgetHiddenChanged);
eventBus.subscribe(GameTick.class, this, this::onGameTick);
eventBus.subscribe(XpDropEvent.class, this, this::onXpDropEvent);
eventBus.subscribe(ScriptCallbackEvent.class, this, this::onScriptCallbackEvent);
}
private void onXpDropEvent(XpDropEvent event) private void onXpDropEvent(XpDropEvent event)
{ {
previousExpGained = event.getExp(); previousExpGained = event.getExp();
@@ -154,6 +140,7 @@ public class XpDropPlugin extends Plugin
hasDropped = true; hasDropped = true;
} }
@Subscribe
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (!event.getGroup().equals("xpdrop")) if (!event.getGroup().equals("xpdrop"))
@@ -183,12 +170,14 @@ public class XpDropPlugin extends Plugin
} }
} }
@Subscribe
private void onGameStateChanged(GameStateChanged event) private void onGameStateChanged(GameStateChanged event)
{ {
tickShow = 0; tickShow = 0;
damage = 0; damage = 0;
} }
@Subscribe
private void onWidgetHiddenChanged(WidgetHiddenChanged event) private void onWidgetHiddenChanged(WidgetHiddenChanged event)
{ {
Widget widget = event.getWidget(); Widget widget = event.getWidget();
@@ -316,6 +305,7 @@ public class XpDropPlugin extends Plugin
return null; return null;
} }
@Subscribe
private void onGameTick(GameTick tick) private void onGameTick(GameTick tick)
{ {
lastOpponent = client.getLocalPlayer().getInteracting(); lastOpponent = client.getLocalPlayer().getInteracting();
@@ -351,6 +341,7 @@ public class XpDropPlugin extends Plugin
client.runScript(XPDROP_DISABLED, lastSkill.ordinal(), previousExpGained); client.runScript(XPDROP_DISABLED, lastSkill.ordinal(), previousExpGained);
} }
@Subscribe
private void onScriptCallbackEvent(ScriptCallbackEvent e) private void onScriptCallbackEvent(ScriptCallbackEvent e)
{ {
if (this.showdamagedrops == XpDropConfig.DamageMode.NONE) if (this.showdamagedrops == XpDropConfig.DamageMode.NONE)

View File

@@ -55,7 +55,7 @@ import net.runelite.api.widgets.WidgetInfo;
import net.runelite.api.widgets.WidgetType; import net.runelite.api.widgets.WidgetType;
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.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.ConfigChanged;
import net.runelite.client.game.chatbox.ChatboxPanelManager; import net.runelite.client.game.chatbox.ChatboxPanelManager;
import net.runelite.client.game.chatbox.ChatboxTextInput; import net.runelite.client.game.chatbox.ChatboxTextInput;
@@ -71,9 +71,9 @@ import net.runelite.client.plugins.PluginDescriptor;
@Singleton @Singleton
public class FairyRingPlugin extends Plugin public class FairyRingPlugin extends Plugin
{ {
private static final String[] leftDial = new String[]{"A", "D", "C", "B"}; private static final String[] leftDial = new String[] {"A", "D", "C", "B"};
private static final String[] middleDial = new String[]{"I", "L", "K", "J"}; private static final String[] middleDial = new String[] {"I", "L", "K", "J"};
private static final String[] rightDial = new String[]{"P", "S", "R", "Q"}; private static final String[] rightDial = new String[] {"P", "S", "R", "Q"};
private static final int ENTRY_PADDING = 3; private static final int ENTRY_PADDING = 3;
@@ -92,9 +92,6 @@ public class FairyRingPlugin extends Plugin
@Inject @Inject
private ClientThread clientThread; private ClientThread clientThread;
@Inject
private EventBus eventBus;
private ChatboxTextInput searchInput = null; private ChatboxTextInput searchInput = null;
private Widget searchBtn; private Widget searchBtn;
private Collection<CodeWidgets> codes = null; private Collection<CodeWidgets> codes = null;
@@ -118,23 +115,14 @@ public class FairyRingPlugin extends Plugin
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
this.autoOpen = config.autoOpen(); this.autoOpen = config.autoOpen();
addSubscriptions();
} }
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
}
private void addSubscriptions()
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(VarbitChanged.class, this, this::onVarbitChanged);
eventBus.subscribe(WidgetLoaded.class, this, this::onWidgetLoaded);
eventBus.subscribe(GameTick.class, this, this::onGameTick);
} }
@Subscribe
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (!event.getGroup().equals("fairyrings")) if (!event.getGroup().equals("fairyrings"))
@@ -151,11 +139,13 @@ public class FairyRingPlugin extends Plugin
return configManager.getConfig(FairyRingConfig.class); return configManager.getConfig(FairyRingConfig.class);
} }
@Subscribe
private void onVarbitChanged(VarbitChanged event) private void onVarbitChanged(VarbitChanged event)
{ {
setWidgetTextToDestination(); setWidgetTextToDestination();
} }
@Subscribe
private void onWidgetLoaded(WidgetLoaded widgetLoaded) private void onWidgetLoaded(WidgetLoaded widgetLoaded)
{ {
if (widgetLoaded.getGroupId() == WidgetID.FAIRY_RING_PANEL_GROUP_ID) if (widgetLoaded.getGroupId() == WidgetID.FAIRY_RING_PANEL_GROUP_ID)
@@ -242,6 +232,7 @@ public class FairyRingPlugin extends Plugin
.build(); .build();
} }
@Subscribe
private void onGameTick(GameTick t) private void onGameTick(GameTick t)
{ {
// This has to happen because the only widget that gets hidden is the tli one // This has to happen because the only widget that gets hidden is the tli one

View File

@@ -35,9 +35,9 @@ import java.util.function.Supplier;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
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.task.Schedule; import net.runelite.client.task.Schedule;
@@ -69,9 +69,6 @@ public class FeedPlugin extends Plugin
@Inject @Inject
private FeedClient feedClient; private FeedClient feedClient;
@Inject
private EventBus eventBus;
private FeedPanel feedPanel; private FeedPanel feedPanel;
private NavigationButton navButton; private NavigationButton navButton;
@@ -91,8 +88,6 @@ public class FeedPlugin extends Plugin
@Override @Override
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
feedPanel = new FeedPanel(config, feedSupplier); feedPanel = new FeedPanel(config, feedSupplier);
final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "icon.png"); final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "icon.png");
@@ -111,7 +106,6 @@ public class FeedPlugin extends Plugin
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
clientToolbar.removeNavigation(navButton); clientToolbar.removeNavigation(navButton);
} }
@@ -120,6 +114,7 @@ public class FeedPlugin extends Plugin
feedPanel.rebuildFeed(); feedPanel.rebuildFeed();
} }
@Subscribe
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (event.getGroup().equals("feed")) if (event.getGroup().equals("feed"))

View File

@@ -51,7 +51,7 @@ import net.runelite.api.events.GameTick;
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.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.ConfigChanged;
import net.runelite.client.game.NPCManager; import net.runelite.client.game.NPCManager;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
@@ -130,8 +130,6 @@ public class FightCavePlugin extends Plugin
private FightCaveOverlay fightCaveOverlay; private FightCaveOverlay fightCaveOverlay;
@Inject @Inject
private FightCaveConfig config; private FightCaveConfig config;
@Inject
private EventBus eventBus;
@Getter(AccessLevel.PACKAGE) @Getter(AccessLevel.PACKAGE)
private Set<FightCaveContainer> fightCaveContainer = new HashSet<>(); private Set<FightCaveContainer> fightCaveContainer = new HashSet<>();
@Getter(AccessLevel.PACKAGE) @Getter(AccessLevel.PACKAGE)
@@ -172,7 +170,6 @@ public class FightCavePlugin extends Plugin
public void startUp() public void startUp()
{ {
updateConfig(); updateConfig();
addSubscriptions();
if (client.getGameState() == GameState.LOGGED_IN && regionCheck()) if (client.getGameState() == GameState.LOGGED_IN && regionCheck())
{ {
@@ -185,23 +182,12 @@ public class FightCavePlugin extends Plugin
@Override @Override
public void shutDown() public void shutDown()
{ {
eventBus.unregister(this);
overlayManager.remove(waveOverlay); overlayManager.remove(waveOverlay);
overlayManager.remove(fightCaveOverlay); overlayManager.remove(fightCaveOverlay);
currentWave = -1; currentWave = -1;
} }
private void addSubscriptions() @Subscribe
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(ChatMessage.class, this, this::onChatMessage);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventBus.subscribe(NpcSpawned.class, this, this::onNpcSpawned);
eventBus.subscribe(NpcDespawned.class, this, this::onNpcDespawned);
eventBus.subscribe(GameTick.class, this, this::onGameTick);
}
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (!event.getGroup().equals("fightcave")) if (!event.getGroup().equals("fightcave"))
@@ -212,6 +198,7 @@ public class FightCavePlugin extends Plugin
updateConfig(); updateConfig();
} }
@Subscribe
private void onChatMessage(ChatMessage event) private void onChatMessage(ChatMessage event)
{ {
if (!validRegion) if (!validRegion)
@@ -229,6 +216,7 @@ public class FightCavePlugin extends Plugin
currentWave = Integer.parseInt(waveMatcher.group(1)); currentWave = Integer.parseInt(waveMatcher.group(1));
} }
@Subscribe
private void onGameStateChanged(GameStateChanged event) private void onGameStateChanged(GameStateChanged event)
{ {
if (event.getGameState() != GameState.LOGGED_IN) if (event.getGameState() != GameState.LOGGED_IN)
@@ -252,6 +240,7 @@ public class FightCavePlugin extends Plugin
fightCaveContainer.clear(); fightCaveContainer.clear();
} }
@Subscribe
private void onNpcSpawned(NpcSpawned event) private void onNpcSpawned(NpcSpawned event)
{ {
if (!validRegion) if (!validRegion)
@@ -276,6 +265,7 @@ public class FightCavePlugin extends Plugin
} }
} }
@Subscribe
private void onNpcDespawned(NpcDespawned event) private void onNpcDespawned(NpcDespawned event)
{ {
if (!validRegion) if (!validRegion)
@@ -300,6 +290,7 @@ public class FightCavePlugin extends Plugin
} }
} }
@Subscribe
private void onGameTick(GameTick Event) private void onGameTick(GameTick Event)
{ {
if (!validRegion) if (!validRegion)

View File

@@ -65,7 +65,7 @@ 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.Notifier;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.ConfigChanged;
import net.runelite.client.events.OverlayMenuClicked; import net.runelite.client.events.OverlayMenuClicked;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
@@ -135,9 +135,6 @@ public class FishingPlugin extends Plugin
@Inject @Inject
private FishingSpotMinimapOverlay fishingSpotMinimapOverlay; private FishingSpotMinimapOverlay fishingSpotMinimapOverlay;
@Inject
private EventBus eventBus;
private boolean trawlerNotificationSent; private boolean trawlerNotificationSent;
@Provides @Provides
@@ -172,7 +169,6 @@ public class FishingPlugin extends Plugin
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
updateConfig(); updateConfig();
addSubscriptions();
overlayManager.add(overlay); overlayManager.add(overlay);
overlayManager.add(spotOverlay); overlayManager.add(spotOverlay);
@@ -182,8 +178,6 @@ public class FishingPlugin extends Plugin
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
spotOverlay.setHidden(true); spotOverlay.setHidden(true);
fishingSpotMinimapOverlay.setHidden(true); fishingSpotMinimapOverlay.setHidden(true);
overlayManager.remove(overlay); overlayManager.remove(overlay);
@@ -196,21 +190,7 @@ public class FishingPlugin extends Plugin
trawlerStartTime = null; trawlerStartTime = null;
} }
private void addSubscriptions() @Subscribe
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventBus.subscribe(ItemContainerChanged.class, this, this::onItemContainerChanged);
eventBus.subscribe(ChatMessage.class, this, this::onChatMessage);
eventBus.subscribe(InteractingChanged.class, this, this::onInteractingChanged);
eventBus.subscribe(GameTick.class, this, this::onGameTick);
eventBus.subscribe(NpcSpawned.class, this, this::onNpcSpawned);
eventBus.subscribe(NpcDespawned.class, this, this::onNpcDespawned);
eventBus.subscribe(VarbitChanged.class, this, this::onVarbitChanged);
eventBus.subscribe(WidgetLoaded.class, this, this::onWidgetLoaded);
eventBus.subscribe(OverlayMenuClicked.class, this, this::onOverlayMenuClicked);
}
private void onOverlayMenuClicked(OverlayMenuClicked overlayMenuClicked) private void onOverlayMenuClicked(OverlayMenuClicked overlayMenuClicked)
{ {
OverlayMenuEntry overlayMenuEntry = overlayMenuClicked.getEntry(); OverlayMenuEntry overlayMenuEntry = overlayMenuClicked.getEntry();
@@ -222,6 +202,7 @@ public class FishingPlugin extends Plugin
} }
} }
@Subscribe
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (!event.getGroup().equals("fishing")) if (!event.getGroup().equals("fishing"))
@@ -232,6 +213,7 @@ public class FishingPlugin extends Plugin
updateConfig(); updateConfig();
} }
@Subscribe
private void onGameStateChanged(GameStateChanged gameStateChanged) private void onGameStateChanged(GameStateChanged gameStateChanged)
{ {
GameState gameState = gameStateChanged.getGameState(); GameState gameState = gameStateChanged.getGameState();
@@ -242,6 +224,7 @@ public class FishingPlugin extends Plugin
} }
} }
@Subscribe
private void onItemContainerChanged(ItemContainerChanged event) private void onItemContainerChanged(ItemContainerChanged event)
{ {
if (event.getItemContainer() != client.getItemContainer(InventoryID.INVENTORY) if (event.getItemContainer() != client.getItemContainer(InventoryID.INVENTORY)
@@ -263,6 +246,7 @@ public class FishingPlugin extends Plugin
fishingSpotMinimapOverlay.setHidden(!showOverlays); fishingSpotMinimapOverlay.setHidden(!showOverlays);
} }
@Subscribe
private void onChatMessage(ChatMessage event) private void onChatMessage(ChatMessage event)
{ {
if (event.getType() != ChatMessageType.SPAM) if (event.getType() != ChatMessageType.SPAM)
@@ -279,6 +263,7 @@ public class FishingPlugin extends Plugin
} }
} }
@Subscribe
private void onInteractingChanged(InteractingChanged event) private void onInteractingChanged(InteractingChanged event)
{ {
if (event.getSource() != client.getLocalPlayer()) if (event.getSource() != client.getLocalPlayer())
@@ -314,6 +299,7 @@ public class FishingPlugin extends Plugin
return ItemUtil.containsAnyItemId(itemContainer.getItems(), FISHING_TOOLS); return ItemUtil.containsAnyItemId(itemContainer.getItems(), FISHING_TOOLS);
} }
@Subscribe
private void onGameTick(GameTick event) private void onGameTick(GameTick event)
{ {
// Reset fishing session // Reset fishing session
@@ -354,6 +340,7 @@ public class FishingPlugin extends Plugin
} }
} }
@Subscribe
private void onNpcSpawned(NpcSpawned event) private void onNpcSpawned(NpcSpawned event)
{ {
final NPC npc = event.getNpc(); final NPC npc = event.getNpc();
@@ -367,6 +354,7 @@ public class FishingPlugin extends Plugin
inverseSortSpotDistanceFromPlayer(); inverseSortSpotDistanceFromPlayer();
} }
@Subscribe
private void onNpcDespawned(NpcDespawned npcDespawned) private void onNpcDespawned(NpcDespawned npcDespawned)
{ {
final NPC npc = npcDespawned.getNpc(); final NPC npc = npcDespawned.getNpc();
@@ -380,6 +368,7 @@ public class FishingPlugin extends Plugin
} }
} }
@Subscribe
private void onVarbitChanged(VarbitChanged event) private void onVarbitChanged(VarbitChanged event)
{ {
if (!this.trawlerNotification || client.getGameState() != GameState.LOGGED_IN) if (!this.trawlerNotification || client.getGameState() != GameState.LOGGED_IN)
@@ -404,6 +393,7 @@ public class FishingPlugin extends Plugin
} }
} }
@Subscribe
private void onWidgetLoaded(WidgetLoaded event) private void onWidgetLoaded(WidgetLoaded event)
{ {
if (event.getGroupId() == WidgetID.FISHING_TRAWLER_GROUP_ID) if (event.getGroupId() == WidgetID.FISHING_TRAWLER_GROUP_ID)

View File

@@ -31,7 +31,7 @@ import lombok.AccessLevel;
import lombok.Getter; import lombok.Getter;
import net.runelite.api.events.FocusChanged; import net.runelite.api.events.FocusChanged;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
@@ -74,9 +74,6 @@ public class FpsPlugin extends Plugin
@Inject @Inject
private FpsConfig fpsConfig; private FpsConfig fpsConfig;
@Inject
private EventBus eventBus;
@Getter(AccessLevel.PACKAGE) @Getter(AccessLevel.PACKAGE)
private FpsLimitMode limitMode; private FpsLimitMode limitMode;
@@ -89,6 +86,7 @@ public class FpsPlugin extends Plugin
return configManager.getConfig(FpsConfig.class); return configManager.getConfig(FpsConfig.class);
} }
@Subscribe
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (event.getGroup().equals(CONFIG_GROUP_KEY)) if (event.getGroup().equals(CONFIG_GROUP_KEY))
@@ -100,6 +98,7 @@ public class FpsPlugin extends Plugin
} }
} }
@Subscribe
private void onFocusChanged(FocusChanged event) private void onFocusChanged(FocusChanged event)
{ {
drawListener.onFocusChanged(event); drawListener.onFocusChanged(event);
@@ -109,7 +108,6 @@ public class FpsPlugin extends Plugin
@Override @Override
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
addSubscriptions();
limitMode = fpsConfig.limitMode(); limitMode = fpsConfig.limitMode();
drawFps = fpsConfig.drawFps(); drawFps = fpsConfig.drawFps();
@@ -121,15 +119,8 @@ public class FpsPlugin extends Plugin
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
overlayManager.remove(overlay); overlayManager.remove(overlay);
drawManager.unregisterEveryFrameListener(drawListener); drawManager.unregisterEveryFrameListener(drawListener);
} }
private void addSubscriptions()
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(FocusChanged.class, this, this::onFocusChanged);
}
} }

View File

@@ -44,7 +44,7 @@ import net.runelite.api.events.LocalPlayerDeath;
import net.runelite.api.events.NpcDespawned; import net.runelite.api.events.NpcDespawned;
import net.runelite.api.events.SpotAnimationChanged; import net.runelite.api.events.SpotAnimationChanged;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
@@ -78,8 +78,6 @@ public class FreezeTimersPlugin extends Plugin
private FreezeTimersOverlay overlay; private FreezeTimersOverlay overlay;
@Inject @Inject
private FreezeTimersConfig config; private FreezeTimersConfig config;
@Inject
private EventBus eventBus;
@Getter(AccessLevel.PACKAGE) @Getter(AccessLevel.PACKAGE)
private boolean showPlayers; private boolean showPlayers;
@@ -103,14 +101,12 @@ public class FreezeTimersPlugin extends Plugin
public void startUp() public void startUp()
{ {
updateConfig(); updateConfig();
addSubscriptions();
overlayManager.add(overlay); overlayManager.add(overlay);
} }
public void shutDown() public void shutDown()
{ {
eventBus.unregister(this);
overlayManager.remove(overlay); overlayManager.remove(overlay);
} }
@@ -120,16 +116,7 @@ public class FreezeTimersPlugin extends Plugin
return configManager.getConfig(FreezeTimersConfig.class); return configManager.getConfig(FreezeTimersConfig.class);
} }
private void addSubscriptions() @Subscribe
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(SpotAnimationChanged.class, this, this::onSpotAnimationChanged);
eventBus.subscribe(GameTick.class, this, this::onGameTick);
eventBus.subscribe(LocalPlayerDeath.class, this, this::onLocalPlayerDeath);
eventBus.subscribe(NpcDespawned.class, this, this::onNpcDespawned);
eventBus.subscribe(ChatMessage.class, this, this::onChatMessage);
}
public void onSpotAnimationChanged(SpotAnimationChanged graphicChanged) public void onSpotAnimationChanged(SpotAnimationChanged graphicChanged)
{ {
final int oldGraphic = prayerTracker.getSpotanimLastTick(graphicChanged.getActor()); final int oldGraphic = prayerTracker.getSpotanimLastTick(graphicChanged.getActor());
@@ -165,6 +152,7 @@ public class FreezeTimersPlugin extends Plugin
currentTime + length); currentTime + length);
} }
@Subscribe
public void onGameTick(GameTick tickEvent) public void onGameTick(GameTick tickEvent)
{ {
prayerTracker.gameTick(); prayerTracker.gameTick();
@@ -207,6 +195,7 @@ public class FreezeTimersPlugin extends Plugin
} }
} }
@Subscribe
private void onLocalPlayerDeath(LocalPlayerDeath event) private void onLocalPlayerDeath(LocalPlayerDeath event)
{ {
final Player localPlayer = client.getLocalPlayer(); final Player localPlayer = client.getLocalPlayer();
@@ -223,6 +212,7 @@ public class FreezeTimersPlugin extends Plugin
} }
} }
@Subscribe
public void onNpcDespawned(NpcDespawned event) public void onNpcDespawned(NpcDespawned event)
{ {
if (!isAtVorkath()) if (!isAtVorkath())
@@ -244,6 +234,7 @@ public class FreezeTimersPlugin extends Plugin
} }
} }
@Subscribe
public void onChatMessage(ChatMessage event) public void onChatMessage(ChatMessage event)
{ {
if (event.getType() != ChatMessageType.GAMEMESSAGE if (event.getType() != ChatMessageType.GAMEMESSAGE
@@ -260,6 +251,7 @@ public class FreezeTimersPlugin extends Plugin
return ArrayUtils.contains(client.getMapRegions(), VORKATH_REGION); return ArrayUtils.contains(client.getMapRegions(), VORKATH_REGION);
} }
@Subscribe
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (event.getGroup().equals("freezetimers")) if (event.getGroup().equals("freezetimers"))

View File

@@ -32,7 +32,7 @@ import net.runelite.api.VarPlayer;
import net.runelite.api.events.GameTick; import net.runelite.api.events.GameTick;
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.eventbus.EventBus; 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;
@@ -52,25 +52,20 @@ public class FriendListPlugin extends Plugin
@Inject @Inject
private Client client; private Client client;
@Inject
private EventBus eventBus;
@Override @Override
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
eventBus.subscribe(GameTick.class, this, this::onGameTick);
} }
@Override @Override
protected void shutDown() protected void shutDown()
{ {
eventBus.unregister(this);
final int world = client.getWorld(); final int world = client.getWorld();
setFriendsListTitle("Friends List - World " + world); setFriendsListTitle("Friends List - World " + world);
setIgnoreListTitle("Ignore List - World " + world); setIgnoreListTitle("Ignore List - World " + world);
} }
@Subscribe
private void onGameTick(GameTick tick) private void onGameTick(GameTick tick)
{ {
final int world = client.getWorld(); final int world = client.getWorld();

View File

@@ -45,7 +45,7 @@ import net.runelite.api.events.NameableNameChanged;
import net.runelite.api.util.Text; import net.runelite.api.util.Text;
import net.runelite.api.widgets.WidgetInfo; import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.game.chatbox.ChatboxPanelManager; import net.runelite.client.game.chatbox.ChatboxPanelManager;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
@@ -83,36 +83,22 @@ public class FriendNotesPlugin extends Plugin
@Inject @Inject
private ChatboxPanelManager chatboxPanelManager; private ChatboxPanelManager chatboxPanelManager;
@Inject
private EventBus eventBus;
@Getter @Getter
private HoveredFriend hoveredFriend = null; private HoveredFriend hoveredFriend = null;
@Override @Override
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
addSubscriptions();
overlayManager.add(overlay); overlayManager.add(overlay);
} }
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
overlayManager.remove(overlay); overlayManager.remove(overlay);
} }
private void addSubscriptions() /**
{
eventBus.subscribe(MenuEntryAdded.class, this, this::onMenuEntryAdded);
eventBus.subscribe(MenuOptionClicked.class, this, this::onMenuOptionClicked);
eventBus.subscribe(NameableNameChanged.class, this, this::onNameableNameChanged);
eventBus.subscribe(FriendRemoved.class, this, this::onFriendRemoved);
}
/**
* Set a friend note, or unset by passing a null/empty note. * Set a friend note, or unset by passing a null/empty note.
*/ */
private void setFriendNote(String displayName, String note) private void setFriendNote(String displayName, String note)
@@ -172,6 +158,7 @@ public class FriendNotesPlugin extends Plugin
} }
} }
@Subscribe
private void onMenuEntryAdded(MenuEntryAdded event) private void onMenuEntryAdded(MenuEntryAdded event)
{ {
final int groupId = WidgetInfo.TO_GROUP(event.getParam1()); final int groupId = WidgetInfo.TO_GROUP(event.getParam1());
@@ -200,6 +187,7 @@ public class FriendNotesPlugin extends Plugin
} }
} }
@Subscribe
private void onMenuOptionClicked(MenuOptionClicked event) private void onMenuOptionClicked(MenuOptionClicked event)
{ {
if (WidgetInfo.TO_GROUP(event.getParam1()) == WidgetInfo.FRIENDS_LIST.getGroupId()) if (WidgetInfo.TO_GROUP(event.getParam1()) == WidgetInfo.FRIENDS_LIST.getGroupId())
@@ -237,6 +225,7 @@ public class FriendNotesPlugin extends Plugin
} }
@Subscribe
private void onNameableNameChanged(NameableNameChanged event) private void onNameableNameChanged(NameableNameChanged event)
{ {
final Nameable nameable = event.getNameable(); final Nameable nameable = event.getNameable();
@@ -258,6 +247,7 @@ public class FriendNotesPlugin extends Plugin
} }
} }
@Subscribe
private void onFriendRemoved(FriendRemoved event) private void onFriendRemoved(FriendRemoved event)
{ {
// Delete a friend's note if they are removed // Delete a friend's note if they are removed

View File

@@ -33,7 +33,7 @@ import net.runelite.api.events.WidgetMenuOptionClicked;
import net.runelite.api.util.Text; import net.runelite.api.util.Text;
import net.runelite.api.widgets.WidgetInfo; import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.game.chatbox.ChatboxPanelManager; import net.runelite.client.game.chatbox.ChatboxPanelManager;
import net.runelite.client.game.chatbox.ChatboxTextInput; import net.runelite.client.game.chatbox.ChatboxTextInput;
import net.runelite.client.menus.MenuManager; import net.runelite.client.menus.MenuManager;
@@ -82,13 +82,9 @@ public class FriendTaggingPlugin extends Plugin
@Inject @Inject
private ChatboxPanelManager chatboxPanelManager; private ChatboxPanelManager chatboxPanelManager;
@Inject
private EventBus eventBus;
@Override @Override
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
addSubscriptions();
menuManager.addManagedCustomMenu(friendsTabMenuOption); menuManager.addManagedCustomMenu(friendsTabMenuOption);
menuManager.addManagedCustomMenu(ignoreTabMenuOption); menuManager.addManagedCustomMenu(ignoreTabMenuOption);
@@ -100,23 +96,13 @@ public class FriendTaggingPlugin extends Plugin
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
menuManager.removeManagedCustomMenu(friendsTabMenuOption); menuManager.removeManagedCustomMenu(friendsTabMenuOption);
menuManager.removeManagedCustomMenu(ignoreTabMenuOption); menuManager.removeManagedCustomMenu(ignoreTabMenuOption);
menuManager.removeManagedCustomMenu(friendTabResizableOption); menuManager.removeManagedCustomMenu(friendTabResizableOption);
menuManager.removeManagedCustomMenu(ignoreTabResizableOption); menuManager.removeManagedCustomMenu(ignoreTabResizableOption);
} }
private void addSubscriptions() @Subscribe
{
eventBus.subscribe(MenuEntryAdded.class, this, this::onMenuEntryAdded);
eventBus.subscribe(FriendRemoved.class, this, this::onFriendRemoved);
eventBus.subscribe(NameableNameChanged.class, this, this::onNameableNameChanged);
eventBus.subscribe(WidgetMenuOptionClicked.class, this, this::onWidgetMenuOptionClicked);
eventBus.subscribe(MenuOptionClicked.class, this, this::onMenuOptionClicked);
}
private void onMenuEntryAdded(MenuEntryAdded event) private void onMenuEntryAdded(MenuEntryAdded event)
{ {
final int groupId = WidgetInfo.TO_GROUP(event.getParam1()); final int groupId = WidgetInfo.TO_GROUP(event.getParam1());
@@ -141,12 +127,14 @@ public class FriendTaggingPlugin extends Plugin
} }
} }
@Subscribe
private void onFriendRemoved(FriendRemoved event) private void onFriendRemoved(FriendRemoved event)
{ {
final String displayName = event.getName().trim().toLowerCase(); final String displayName = event.getName().trim().toLowerCase();
deleteTag(displayName); deleteTag(displayName);
} }
@Subscribe
private void onNameableNameChanged(NameableNameChanged event) private void onNameableNameChanged(NameableNameChanged event)
{ {
final Nameable nameable = event.getNameable(); final Nameable nameable = event.getNameable();
@@ -162,6 +150,7 @@ public class FriendTaggingPlugin extends Plugin
} }
} }
@Subscribe
private void onWidgetMenuOptionClicked(WidgetMenuOptionClicked event) private void onWidgetMenuOptionClicked(WidgetMenuOptionClicked event)
{ {
if (event.getWidget().getId() == WidgetInfo.FIXED_VIEWPORT_FRIENDS_TAB.getId() && if (event.getWidget().getId() == WidgetInfo.FIXED_VIEWPORT_FRIENDS_TAB.getId() &&
@@ -171,6 +160,7 @@ public class FriendTaggingPlugin extends Plugin
} }
} }
@Subscribe
private void onMenuOptionClicked(MenuOptionClicked event) private void onMenuOptionClicked(MenuOptionClicked event)
{ {
if (WidgetInfo.TO_GROUP(event.getParam1()) == WidgetInfo.FRIENDS_LIST.getGroupId()) if (WidgetInfo.TO_GROUP(event.getParam1()) == WidgetInfo.FRIENDS_LIST.getGroupId())

View File

@@ -67,6 +67,7 @@ import net.runelite.api.events.VarbitChanged;
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.EventBus; import net.runelite.client.eventbus.EventBus;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.ConfigChanged;
import net.runelite.client.events.NpcLootReceived; import net.runelite.client.events.NpcLootReceived;
import net.runelite.client.game.ItemManager; import net.runelite.client.game.ItemManager;
@@ -201,7 +202,6 @@ public class GauntletPlugin extends Plugin
@Override @Override
protected void startUp() protected void startUp()
{ {
addSubscriptions();
updateConfig(); updateConfig();
initializeCounters(); initializeCounters();
overlayManager.add(overlay); overlayManager.add(overlay);
@@ -272,7 +272,6 @@ public class GauntletPlugin extends Plugin
@Override @Override
protected void shutDown() protected void shutDown()
{ {
eventBus.unregister(this);
timer.resetStates(); timer.resetStates();
if (timerVisible) if (timerVisible)
{ {
@@ -300,23 +299,7 @@ public class GauntletPlugin extends Plugin
countersVisible = false; countersVisible = false;
} }
private void addSubscriptions() @Subscribe
{
eventBus.subscribe(AnimationChanged.class, this, this::onAnimationChanged);
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(GameObjectDespawned.class, this, this::onGameObjectDespawned);
eventBus.subscribe(GameObjectSpawned.class, this, this::onGameObjectSpawned);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventBus.subscribe(GameTick.class, this, this::onGameTick);
eventBus.subscribe(NpcDespawned.class, this, this::onNpcDespawned);
eventBus.subscribe(NpcSpawned.class, this, this::onNpcSpawned);
eventBus.subscribe(ProjectileSpawned.class, this, this::onProjectileSpawned);
eventBus.subscribe(VarbitChanged.class, this, this::onVarbitChanged);
eventBus.subscribe(XpDropEvent.class, this, this::onXpDropEvent);
eventBus.subscribe(NpcLootReceived.class, this, this::onNpcLootReceived);
eventBus.subscribe(MenuOptionClicked.class, this, this::onMenuOptionClicked);
}
private void onMenuOptionClicked(MenuOptionClicked menuOptionClicked) private void onMenuOptionClicked(MenuOptionClicked menuOptionClicked)
{ {
if (menuOptionClicked.getTarget().toUpperCase().contains("LINUM")) if (menuOptionClicked.getTarget().toUpperCase().contains("LINUM"))
@@ -329,6 +312,7 @@ public class GauntletPlugin extends Plugin
} }
} }
@Subscribe
private void onNpcLootReceived(NpcLootReceived npcLootReceived) private void onNpcLootReceived(NpcLootReceived npcLootReceived)
{ {
fishGathered += (int) npcLootReceived.getItems().stream().filter(item -> item.getId() == ItemID.RAW_PADDLEFISH).count(); fishGathered += (int) npcLootReceived.getItems().stream().filter(item -> item.getId() == ItemID.RAW_PADDLEFISH).count();
@@ -336,6 +320,7 @@ public class GauntletPlugin extends Plugin
updateCounters(); updateCounters();
} }
@Subscribe
private void onXpDropEvent(XpDropEvent experienceChanged) private void onXpDropEvent(XpDropEvent experienceChanged)
{ {
if (experienceChanged.getSkill().compareTo(Skill.MINING) == 0) if (experienceChanged.getSkill().compareTo(Skill.MINING) == 0)
@@ -364,6 +349,7 @@ public class GauntletPlugin extends Plugin
updateCounters(); updateCounters();
} }
@Subscribe
private void onAnimationChanged(AnimationChanged event) private void onAnimationChanged(AnimationChanged event)
{ {
if (hunllef == null) if (hunllef == null)
@@ -434,6 +420,7 @@ public class GauntletPlugin extends Plugin
} }
} }
@Subscribe
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (!event.getGroup().equals("Gauntlet")) if (!event.getGroup().equals("Gauntlet"))
@@ -470,6 +457,7 @@ public class GauntletPlugin extends Plugin
} }
} }
@Subscribe
private void onGameObjectDespawned(GameObjectDespawned event) private void onGameObjectDespawned(GameObjectDespawned event)
{ {
final GameObject obj = event.getGameObject(); final GameObject obj = event.getGameObject();
@@ -479,6 +467,7 @@ public class GauntletPlugin extends Plugin
} }
} }
@Subscribe
private void onGameObjectSpawned(GameObjectSpawned event) private void onGameObjectSpawned(GameObjectSpawned event)
{ {
final GameObject obj = event.getGameObject(); final GameObject obj = event.getGameObject();
@@ -488,6 +477,7 @@ public class GauntletPlugin extends Plugin
} }
} }
@Subscribe
private void onGameStateChanged(GameStateChanged event) private void onGameStateChanged(GameStateChanged event)
{ {
if (event.getGameState() == GameState.LOADING) if (event.getGameState() == GameState.LOADING)
@@ -496,6 +486,7 @@ public class GauntletPlugin extends Plugin
} }
} }
@Subscribe
private void onGameTick(GameTick event) private void onGameTick(GameTick event)
{ {
// This handles the timer based on player health. // This handles the timer based on player health.
@@ -516,6 +507,7 @@ public class GauntletPlugin extends Plugin
} }
} }
@Subscribe
private void onNpcDespawned(NpcDespawned event) private void onNpcDespawned(NpcDespawned event)
{ {
final NPC npc = event.getNpc(); final NPC npc = event.getNpc();
@@ -530,6 +522,7 @@ public class GauntletPlugin extends Plugin
} }
} }
@Subscribe
private void onNpcSpawned(NpcSpawned event) private void onNpcSpawned(NpcSpawned event)
{ {
final NPC npc = event.getNpc(); final NPC npc = event.getNpc();
@@ -543,6 +536,7 @@ public class GauntletPlugin extends Plugin
} }
} }
@Subscribe
private void onProjectileSpawned(ProjectileSpawned event) private void onProjectileSpawned(ProjectileSpawned event)
{ {
if (hunllef == null) if (hunllef == null)
@@ -574,6 +568,7 @@ public class GauntletPlugin extends Plugin
} }
} }
@Subscribe
private void onVarbitChanged(VarbitChanged event) private void onVarbitChanged(VarbitChanged event)
{ {
if (this.completeStartup) if (this.completeStartup)

View File

@@ -70,7 +70,7 @@ import net.runelite.api.events.GameStateChanged;
import net.runelite.api.hooks.DrawCallbacks; import net.runelite.api.hooks.DrawCallbacks;
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.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
@@ -121,9 +121,6 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
@Inject @Inject
private PluginManager pluginManager; private PluginManager pluginManager;
@Inject
private EventBus eventbus;
private Canvas canvas; private Canvas canvas;
private JAWTWindow jawtWindow; private JAWTWindow jawtWindow;
private GL4 gl; private GL4 gl;
@@ -243,6 +240,7 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
private int fogCircularity; private int fogCircularity;
private int fogDensity; private int fogDensity;
@Subscribe
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (event.getGroup().equals("gpu")) if (event.getGroup().equals("gpu"))
@@ -266,7 +264,6 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
updateConfig(); updateConfig();
addSubscriptions();
clientThread.invoke(() -> clientThread.invoke(() ->
{ {
@@ -374,8 +371,6 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
@Override @Override
protected void shutDown() protected void shutDown()
{ {
eventbus.unregister(this);
clientThread.invoke(() -> clientThread.invoke(() ->
{ {
client.setGpu(false); client.setGpu(false);
@@ -445,13 +440,7 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
}); });
} }
private void addSubscriptions() @Provides
{
eventbus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventbus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
}
@Provides
GpuPluginConfig provideConfig(ConfigManager configManager) GpuPluginConfig provideConfig(ConfigManager configManager)
{ {
return configManager.getConfig(GpuPluginConfig.class); return configManager.getConfig(GpuPluginConfig.class);
@@ -611,7 +600,7 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
gl.glBindVertexArray(vaoUiHandle); gl.glBindVertexArray(vaoUiHandle);
FloatBuffer vboUiBuf = GpuFloatBuffer.allocateDirect(5 * 4); FloatBuffer vboUiBuf = GpuFloatBuffer.allocateDirect(5 * 4);
vboUiBuf.put(new float[]{ vboUiBuf.put(new float[] {
// positions // texture coords // positions // texture coords
1f, 1f, 0.0f, 1.0f, 0f, // top right 1f, 1f, 0.0f, 1.0f, 0f, // top right
1f, -1f, 0.0f, 1.0f, 1f, // bottom right 1f, -1f, 0.0f, 1.0f, 1f, // bottom right
@@ -738,7 +727,7 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
gl.glUseProgram(glProgram); gl.glUseProgram(glProgram);
float[] matrix = new float[]{ float[] matrix = new float[] {
2 / (right - left), 0, 0, 0, 2 / (right - left), 0, 0, 0,
0, 2 / (top - bottom), 0, 0, 0, 2 / (top - bottom), 0, 0,
0, 0, -2 / (far - near), 0, 0, 0, -2 / (far - near), 0,
@@ -1317,6 +1306,7 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
textureManager.animate(texture, diff); textureManager.animate(texture, diff);
} }
@Subscribe
private void onGameStateChanged(GameStateChanged gameStateChanged) private void onGameStateChanged(GameStateChanged gameStateChanged)
{ {
if (gameStateChanged.getGameState() != GameState.LOGGED_IN) if (gameStateChanged.getGameState() != GameState.LOGGED_IN)

View File

@@ -56,7 +56,6 @@ import static net.runelite.api.ItemID.COINS_995;
import net.runelite.api.MenuOpcode; import net.runelite.api.MenuOpcode;
import net.runelite.api.Varbits; import net.runelite.api.Varbits;
import net.runelite.api.events.ChatMessage; import net.runelite.api.events.ChatMessage;
import net.runelite.client.events.ConfigChanged;
import net.runelite.api.events.FocusChanged; import net.runelite.api.events.FocusChanged;
import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.GrandExchangeOfferChanged; import net.runelite.api.events.GrandExchangeOfferChanged;
@@ -72,7 +71,8 @@ import net.runelite.client.account.AccountSession;
import net.runelite.client.account.SessionManager; import net.runelite.client.account.SessionManager;
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.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.events.SessionClose; import net.runelite.client.events.SessionClose;
import net.runelite.client.events.SessionOpen; import net.runelite.client.events.SessionOpen;
import net.runelite.client.game.ItemManager; import net.runelite.client.game.ItemManager;
@@ -108,7 +108,9 @@ public class GrandExchangePlugin extends Plugin
private static final OSBGrandExchangeClient CLIENT = new OSBGrandExchangeClient(); private static final OSBGrandExchangeClient CLIENT = new OSBGrandExchangeClient();
private static final String OSB_GE_TEXT = "<br>OSBuddy Actively traded price: "; private static final String OSB_GE_TEXT = "<br>OSBuddy Actively traded price: ";
private static final String BUY_LIMIT_GE_TEXT = "<br>Buy limit: "; private static final String BUY_LIMIT_GE_TEXT = "<br>Buy limit: ";
private static final TypeToken<Map<Integer, Integer>> BUY_LIMIT_TOKEN = new TypeToken<Map<Integer, Integer>>() {}; private static final TypeToken<Map<Integer, Integer>> BUY_LIMIT_TOKEN = new TypeToken<Map<Integer, Integer>>()
{
};
@Getter(AccessLevel.PACKAGE) @Getter(AccessLevel.PACKAGE)
private NavigationButton button; private NavigationButton button;
@@ -155,9 +157,6 @@ public class GrandExchangePlugin extends Plugin
@Inject @Inject
private ConfigManager configManager; private ConfigManager configManager;
@Inject
private EventBus eventBus;
private Widget grandExchangeText; private Widget grandExchangeText;
private Widget grandExchangeItem; private Widget grandExchangeItem;
private Widget grandExchangeOfferQuantityHeading; private Widget grandExchangeOfferQuantityHeading;
@@ -213,7 +212,6 @@ public class GrandExchangePlugin extends Plugin
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
updateConfig(); updateConfig();
addSubscriptions();
itemGELimits = loadGELimits(); itemGELimits = loadGELimits();
panel = injector.getInstance(GrandExchangePanel.class); panel = injector.getInstance(GrandExchangePanel.class);
@@ -249,8 +247,6 @@ public class GrandExchangePlugin extends Plugin
@Override @Override
protected void shutDown() protected void shutDown()
{ {
eventBus.unregister(this);
clientToolbar.removeNavigation(button); clientToolbar.removeNavigation(button);
mouseManager.unregisterMouseListener(inputListener); mouseManager.unregisterMouseListener(inputListener);
keyManager.unregisterKeyListener(inputListener); keyManager.unregisterKeyListener(inputListener);
@@ -261,20 +257,7 @@ public class GrandExchangePlugin extends Plugin
grandExchangeClient = null; grandExchangeClient = null;
} }
private void addSubscriptions() @Subscribe
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(ChatMessage.class, this, this::onChatMessage);
eventBus.subscribe(SessionOpen.class, this, this::onSessionOpen);
eventBus.subscribe(SessionClose.class, this, this::onSessionClose);
eventBus.subscribe(GrandExchangeOfferChanged.class, this, this::onGrandExchangeOfferChanged);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventBus.subscribe(MenuEntryAdded.class, this, this::onMenuEntryAdded);
eventBus.subscribe(FocusChanged.class, this, this::onFocusChanged);
eventBus.subscribe(WidgetLoaded.class, this, this::onWidgetLoaded);
eventBus.subscribe(ScriptCallbackEvent.class, this, this::onScriptCallbackEvent);
}
private void onSessionOpen(SessionOpen sessionOpen) private void onSessionOpen(SessionOpen sessionOpen)
{ {
AccountSession accountSession = sessionManager.getAccountSession(); AccountSession accountSession = sessionManager.getAccountSession();
@@ -297,11 +280,13 @@ public class GrandExchangePlugin extends Plugin
this.enableAfford = config.enableAfford(); this.enableAfford = config.enableAfford();
} }
@Subscribe
private void onSessionClose(SessionClose sessionClose) private void onSessionClose(SessionClose sessionClose)
{ {
grandExchangeClient = null; grandExchangeClient = null;
} }
@Subscribe
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (event.getGroup().equals("grandexchange")) if (event.getGroup().equals("grandexchange"))
@@ -323,6 +308,7 @@ public class GrandExchangePlugin extends Plugin
} }
} }
@Subscribe
private void onGrandExchangeOfferChanged(GrandExchangeOfferChanged offerEvent) private void onGrandExchangeOfferChanged(GrandExchangeOfferChanged offerEvent)
{ {
final int slot = offerEvent.getSlot(); final int slot = offerEvent.getSlot();
@@ -400,6 +386,7 @@ public class GrandExchangePlugin extends Plugin
return savedOffer.getState() != grandExchangeOffer.getState(); return savedOffer.getState() != grandExchangeOffer.getState();
} }
@Subscribe
private void onChatMessage(ChatMessage event) private void onChatMessage(ChatMessage event)
{ {
if (!this.enableNotifications || event.getType() != ChatMessageType.GAMEMESSAGE) if (!this.enableNotifications || event.getType() != ChatMessageType.GAMEMESSAGE)
@@ -415,6 +402,7 @@ public class GrandExchangePlugin extends Plugin
} }
} }
@Subscribe
private void onGameStateChanged(GameStateChanged gameStateChanged) private void onGameStateChanged(GameStateChanged gameStateChanged)
{ {
if (gameStateChanged.getGameState() == GameState.LOGIN_SCREEN) if (gameStateChanged.getGameState() == GameState.LOGIN_SCREEN)
@@ -423,6 +411,7 @@ public class GrandExchangePlugin extends Plugin
} }
} }
@Subscribe
private void onMenuEntryAdded(MenuEntryAdded menuEntry) private void onMenuEntryAdded(MenuEntryAdded menuEntry)
{ {
// At the moment, if the user disables quick lookup, the input listener gets disabled. Thus, isHotKeyPressed() // At the moment, if the user disables quick lookup, the input listener gets disabled. Thus, isHotKeyPressed()
@@ -454,6 +443,7 @@ public class GrandExchangePlugin extends Plugin
} }
} }
@Subscribe
private void onFocusChanged(FocusChanged focusChanged) private void onFocusChanged(FocusChanged focusChanged)
{ {
if (!focusChanged.isFocused()) if (!focusChanged.isFocused())
@@ -462,6 +452,7 @@ public class GrandExchangePlugin extends Plugin
} }
} }
@Subscribe
private void onWidgetLoaded(WidgetLoaded event) private void onWidgetLoaded(WidgetLoaded event)
{ {
switch (event.getGroupId()) switch (event.getGroupId())
@@ -480,6 +471,7 @@ public class GrandExchangePlugin extends Plugin
} }
} }
@Subscribe
private void onScriptCallbackEvent(ScriptCallbackEvent event) private void onScriptCallbackEvent(ScriptCallbackEvent event)
{ {
if (event.getEventName().equals("geBuilt")) if (event.getEventName().equals("geBuilt"))
@@ -544,7 +536,6 @@ public class GrandExchangePlugin extends Plugin
} }
if (this.enableAfford && offerType == OFFER_TYPE_BUY) if (this.enableAfford && offerType == OFFER_TYPE_BUY)
{ {
final ItemContainer inventory = client.getItemContainer(InventoryID.INVENTORY); final ItemContainer inventory = client.getItemContainer(InventoryID.INVENTORY);

View File

@@ -32,7 +32,7 @@ import net.runelite.api.Client;
import net.runelite.api.NPC; import net.runelite.api.NPC;
import static net.runelite.api.NpcID.DUSK_7888; import static net.runelite.api.NpcID.DUSK_7888;
import net.runelite.api.events.GameTick; import net.runelite.api.events.GameTick;
import net.runelite.client.eventbus.EventBus; 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.plugins.PluginType; import net.runelite.client.plugins.PluginType;
@@ -42,7 +42,7 @@ import net.runelite.client.ui.overlay.OverlayManager;
@PluginDescriptor( @PluginDescriptor(
name = "Grotesque Guardians", name = "Grotesque Guardians",
description = "Show various helpful utitiles during the Grotesque Gaurdians (Gargoyles) fight", description = "Show various helpful utitiles during the Grotesque Gaurdians (Gargoyles) fight",
tags = { "bosses", "combat", "gargs", "overlay", "grotesque", "pve", "pvm" }, tags = {"bosses", "combat", "gargs", "overlay", "grotesque", "pve", "pvm"},
type = PluginType.PVM, type = PluginType.PVM,
enabledByDefault = false enabledByDefault = false
) )
@@ -56,8 +56,6 @@ public class GrotesqueGuardiansPlugin extends Plugin
private OverlayManager overlayManager; private OverlayManager overlayManager;
@Inject @Inject
private GrotesqueGuardiansPrayerOverlay prayerOverlay; private GrotesqueGuardiansPrayerOverlay prayerOverlay;
@Inject
private EventBus eventBus;
@Nullable @Nullable
private DuskAttack prayAgainst; private DuskAttack prayAgainst;
@Nullable @Nullable
@@ -77,7 +75,6 @@ public class GrotesqueGuardiansPlugin extends Plugin
@Override @Override
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
eventBus.subscribe(GameTick.class, this, this::onGameTick);
overlayManager.add(overlay); overlayManager.add(overlay);
overlayManager.add(prayerOverlay); overlayManager.add(prayerOverlay);
@@ -88,14 +85,13 @@ public class GrotesqueGuardiansPlugin extends Plugin
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
overlayManager.remove(overlay); overlayManager.remove(overlay);
overlayManager.remove(prayerOverlay); overlayManager.remove(prayerOverlay);
dusk = null; dusk = null;
prayAgainst = null; prayAgainst = null;
} }
@Subscribe
private void onGameTick(final GameTick event) private void onGameTick(final GameTick event)
{ {
final ArrayList<Integer> regions = new ArrayList<>(); final ArrayList<Integer> regions = new ArrayList<>();

View File

@@ -68,7 +68,6 @@ import net.runelite.api.TileItem;
import net.runelite.api.TileItemPile; import net.runelite.api.TileItemPile;
import net.runelite.api.coords.WorldPoint; import net.runelite.api.coords.WorldPoint;
import net.runelite.api.events.ClientTick; import net.runelite.api.events.ClientTick;
import net.runelite.client.events.ConfigChanged;
import net.runelite.api.events.FocusChanged; import net.runelite.api.events.FocusChanged;
import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.GameTick; import net.runelite.api.events.GameTick;
@@ -80,7 +79,8 @@ import net.runelite.api.events.MenuOptionClicked;
import net.runelite.api.util.Text; import net.runelite.api.util.Text;
import net.runelite.client.Notifier; import net.runelite.client.Notifier;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.events.NpcLootReceived; import net.runelite.client.events.NpcLootReceived;
import net.runelite.client.events.PlayerLootReceived; import net.runelite.client.events.PlayerLootReceived;
import net.runelite.client.game.ItemManager; import net.runelite.client.game.ItemManager;
@@ -421,8 +421,6 @@ public class GroundItemsPlugin extends Plugin
private GroundItemsOverlay overlay; private GroundItemsOverlay overlay;
@Inject @Inject
private Notifier notifier; private Notifier notifier;
@Inject
private EventBus eventBus;
private LoadingCache<String, Boolean> highlightedItems; private LoadingCache<String, Boolean> highlightedItems;
private Color defaultColor; private Color defaultColor;
private Color highlightedColor; private Color highlightedColor;
@@ -487,7 +485,6 @@ public class GroundItemsPlugin extends Plugin
protected void startUp() protected void startUp()
{ {
updateConfig(); updateConfig();
addSubscriptions();
overlayManager.add(overlay); overlayManager.add(overlay);
reset(); reset();
@@ -498,8 +495,6 @@ public class GroundItemsPlugin extends Plugin
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
overlayManager.remove(overlay); overlayManager.remove(overlay);
mouseManager.unregisterMouseListener(inputListener); mouseManager.unregisterMouseListener(inputListener);
keyManager.unregisterKeyListener(inputListener); keyManager.unregisterKeyListener(inputListener);
@@ -512,22 +507,7 @@ public class GroundItemsPlugin extends Plugin
collectedGroundItems.clear(); collectedGroundItems.clear();
} }
private void addSubscriptions() @Subscribe
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(GameTick.class, this, this::onGameTick);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventBus.subscribe(ItemSpawned.class, this, this::onItemSpawned);
eventBus.subscribe(ItemDespawned.class, this, this::onItemDespawned);
eventBus.subscribe(ItemQuantityChanged.class, this, this::onItemQuantityChanged);
eventBus.subscribe(NpcLootReceived.class, this, this::onNpcLootReceived);
eventBus.subscribe(PlayerLootReceived.class, this, this::onPlayerLootReceived);
eventBus.subscribe(ClientTick.class, this, this::onClientTick);
eventBus.subscribe(MenuEntryAdded.class, this, this::onMenuEntryAdded);
eventBus.subscribe(FocusChanged.class, this, this::onFocusChanged);
eventBus.subscribe(MenuOptionClicked.class, this, this::onMenuOptionClicked);
}
private void onGameTick(GameTick event) private void onGameTick(GameTick event)
{ {
for (GroundItem item : collectedGroundItems.values()) for (GroundItem item : collectedGroundItems.values())
@@ -540,6 +520,7 @@ public class GroundItemsPlugin extends Plugin
} }
} }
@Subscribe
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (event.getGroup().equals("grounditems")) if (event.getGroup().equals("grounditems"))
@@ -549,6 +530,7 @@ public class GroundItemsPlugin extends Plugin
} }
} }
@Subscribe
private void onGameStateChanged(final GameStateChanged event) private void onGameStateChanged(final GameStateChanged event)
{ {
if (event.getGameState() == GameState.LOADING) if (event.getGameState() == GameState.LOADING)
@@ -557,6 +539,7 @@ public class GroundItemsPlugin extends Plugin
} }
} }
@Subscribe
private void onItemSpawned(ItemSpawned itemSpawned) private void onItemSpawned(ItemSpawned itemSpawned)
{ {
TileItem item = itemSpawned.getItem(); TileItem item = itemSpawned.getItem();
@@ -583,6 +566,7 @@ public class GroundItemsPlugin extends Plugin
} }
} }
@Subscribe
private void onItemDespawned(ItemDespawned itemDespawned) private void onItemDespawned(ItemDespawned itemDespawned)
{ {
TileItem item = itemDespawned.getItem(); TileItem item = itemDespawned.getItem();
@@ -609,6 +593,7 @@ public class GroundItemsPlugin extends Plugin
} }
} }
@Subscribe
private void onItemQuantityChanged(ItemQuantityChanged itemQuantityChanged) private void onItemQuantityChanged(ItemQuantityChanged itemQuantityChanged)
{ {
TileItem item = itemQuantityChanged.getItem(); TileItem item = itemQuantityChanged.getItem();
@@ -625,6 +610,7 @@ public class GroundItemsPlugin extends Plugin
} }
} }
@Subscribe
private void onNpcLootReceived(NpcLootReceived npcLootReceived) private void onNpcLootReceived(NpcLootReceived npcLootReceived)
{ {
npcLootReceived.getItems().forEach(item -> npcLootReceived.getItems().forEach(item ->
@@ -642,6 +628,7 @@ public class GroundItemsPlugin extends Plugin
lootNotifier(items); lootNotifier(items);
} }
@Subscribe
private void onPlayerLootReceived(PlayerLootReceived playerLootReceived) private void onPlayerLootReceived(PlayerLootReceived playerLootReceived)
{ {
Collection<ItemStack> items = playerLootReceived.getItems(); Collection<ItemStack> items = playerLootReceived.getItems();
@@ -689,6 +676,7 @@ public class GroundItemsPlugin extends Plugin
notifier.notify(notification); notifier.notify(notification);
} }
@Subscribe
private void onClientTick(ClientTick event) private void onClientTick(ClientTick event)
{ {
final MenuEntry[] menuEntries = client.getMenuEntries(); final MenuEntry[] menuEntries = client.getMenuEntries();
@@ -931,6 +919,7 @@ public class GroundItemsPlugin extends Plugin
} }
} }
@Subscribe
private void onMenuEntryAdded(MenuEntryAdded lastEntry) private void onMenuEntryAdded(MenuEntryAdded lastEntry)
{ {
if (this.itemHighlightMode != OVERLAY) if (this.itemHighlightMode != OVERLAY)
@@ -1174,6 +1163,7 @@ public class GroundItemsPlugin extends Plugin
return this.defaultColor; return this.defaultColor;
} }
@Subscribe
private void onFocusChanged(FocusChanged focusChanged) private void onFocusChanged(FocusChanged focusChanged)
{ {
if (!focusChanged.isFocused()) if (!focusChanged.isFocused())
@@ -1182,6 +1172,7 @@ public class GroundItemsPlugin extends Plugin
} }
} }
@Subscribe
private void onMenuOptionClicked(MenuOptionClicked menuOptionClicked) private void onMenuOptionClicked(MenuOptionClicked menuOptionClicked)
{ {
if (menuOptionClicked.getMenuOpcode() == MenuOpcode.ITEM_DROP) if (menuOptionClicked.getMenuOpcode() == MenuOpcode.ITEM_DROP)

View File

@@ -58,7 +58,7 @@ import net.runelite.api.events.MenuEntryAdded;
import net.runelite.api.events.MenuOptionClicked; import net.runelite.api.events.MenuOptionClicked;
import net.runelite.api.util.Text; import net.runelite.api.util.Text;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.ConfigChanged;
import net.runelite.client.input.KeyManager; import net.runelite.client.input.KeyManager;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
@@ -112,9 +112,6 @@ public class GroundMarkerPlugin extends Plugin
@Inject @Inject
private GroundMarkerMinimapOverlay minimapOverlay; private GroundMarkerMinimapOverlay minimapOverlay;
@Inject
private EventBus eventBus;
@Inject @Inject
private KeyManager keyManager; private KeyManager keyManager;
@@ -140,7 +137,9 @@ public class GroundMarkerPlugin extends Plugin
return GSON.fromJson(json, new GroundMarkerListTypeToken().getType()); return GSON.fromJson(json, new GroundMarkerListTypeToken().getType());
} }
private static class GroundMarkerListTypeToken extends TypeToken<List<GroundMarkerPoint>> {} private static class GroundMarkerListTypeToken extends TypeToken<List<GroundMarkerPoint>>
{
}
private GroundMarkerConfig.amount amount; private GroundMarkerConfig.amount amount;
@Getter(AccessLevel.PACKAGE) @Getter(AccessLevel.PACKAGE)
@@ -293,6 +292,7 @@ public class GroundMarkerPlugin extends Plugin
return point; return point;
} }
@Subscribe
private void onGameStateChanged(GameStateChanged gameStateChanged) private void onGameStateChanged(GameStateChanged gameStateChanged)
{ {
if (gameStateChanged.getGameState() != GameState.LOGGED_IN) if (gameStateChanged.getGameState() != GameState.LOGGED_IN)
@@ -304,6 +304,7 @@ public class GroundMarkerPlugin extends Plugin
loadPoints(); loadPoints();
} }
@Subscribe
private void onFocusChanged(FocusChanged focusChanged) private void onFocusChanged(FocusChanged focusChanged)
{ {
if (!focusChanged.isFocused()) if (!focusChanged.isFocused())
@@ -312,6 +313,7 @@ public class GroundMarkerPlugin extends Plugin
} }
} }
@Subscribe
private void onMenuEntryAdded(MenuEntryAdded event) private void onMenuEntryAdded(MenuEntryAdded event)
{ {
if (hotKeyPressed && event.getOption().equals(WALK_HERE)) if (hotKeyPressed && event.getOption().equals(WALK_HERE))
@@ -358,6 +360,7 @@ public class GroundMarkerPlugin extends Plugin
} }
} }
@Subscribe
private void onMenuOptionClicked(MenuOptionClicked event) private void onMenuOptionClicked(MenuOptionClicked event)
{ {
if (!event.getOption().contains(MARK) && !event.getOption().contains(UNMARK)) if (!event.getOption().contains(MARK) && !event.getOption().contains(UNMARK))
@@ -385,7 +388,6 @@ public class GroundMarkerPlugin extends Plugin
protected void startUp() protected void startUp()
{ {
updateConfig(); updateConfig();
addSubscriptions();
overlayManager.add(overlay); overlayManager.add(overlay);
overlayManager.add(minimapOverlay); overlayManager.add(minimapOverlay);
@@ -396,23 +398,13 @@ public class GroundMarkerPlugin extends Plugin
@Override @Override
protected void shutDown() protected void shutDown()
{ {
eventBus.unregister(this);
overlayManager.remove(overlay); overlayManager.remove(overlay);
overlayManager.remove(minimapOverlay); overlayManager.remove(minimapOverlay);
keyManager.unregisterKeyListener(inputListener); keyManager.unregisterKeyListener(inputListener);
points.clear(); points.clear();
} }
private void addSubscriptions() private void markTile(LocalPoint localPoint, int group)
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventBus.subscribe(FocusChanged.class, this, this::onFocusChanged);
eventBus.subscribe(MenuEntryAdded.class, this, this::onMenuEntryAdded);
eventBus.subscribe(MenuOptionClicked.class, this, this::onMenuOptionClicked);
}
private void markTile(LocalPoint localPoint, int group)
{ {
if (localPoint == null) if (localPoint == null)
{ {
@@ -493,6 +485,7 @@ public class GroundMarkerPlugin extends Plugin
return color; return color;
} }
@Subscribe
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (event.getGroup().equals("groundMarker")) if (event.getGroup().equals("groundMarker"))

View File

@@ -59,7 +59,7 @@ import net.runelite.api.events.GroundObjectDespawned;
import net.runelite.api.events.GroundObjectSpawned; import net.runelite.api.events.GroundObjectSpawned;
import net.runelite.api.events.VarbitChanged; import net.runelite.api.events.VarbitChanged;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
@@ -115,9 +115,6 @@ public class HerbiboarPlugin extends Plugin
@Inject @Inject
private HerbiboarConfig config; private HerbiboarConfig config;
@Inject
private EventBus eventBus;
@Getter(AccessLevel.PACKAGE) @Getter(AccessLevel.PACKAGE)
private boolean inHerbiboarArea; private boolean inHerbiboarArea;
@@ -194,7 +191,6 @@ public class HerbiboarPlugin extends Plugin
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
updateConfig(); updateConfig();
addSubscriptions();
overlayManager.add(overlay); overlayManager.add(overlay);
overlayManager.add(minimapOverlay); overlayManager.add(minimapOverlay);
@@ -204,27 +200,11 @@ public class HerbiboarPlugin extends Plugin
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
overlayManager.remove(overlay); overlayManager.remove(overlay);
overlayManager.remove(minimapOverlay); overlayManager.remove(minimapOverlay);
} }
private void addSubscriptions() private void updateTrailData()
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventBus.subscribe(VarbitChanged.class, this, this::onVarbitChanged);
eventBus.subscribe(AnimationChanged.class, this, this::onAnimationChanged);
eventBus.subscribe(GameObjectSpawned.class, this, this::onGameObjectSpawned);
eventBus.subscribe(GameObjectChanged.class, this, this::onGameObjectChanged);
eventBus.subscribe(GameObjectDespawned.class, this, this::onGameObjectDespawned);
eventBus.subscribe(GroundObjectSpawned.class, this, this::onGroundObjectSpawned);
eventBus.subscribe(GroundObjectChanged.class, this, this::onGroundObjectChanged);
eventBus.subscribe(GroundObjectDespawned.class, this, this::onGroundObjectDespawned);
}
private void updateTrailData()
{ {
currentTrail = null; currentTrail = null;
currentPath = -1; currentPath = -1;
@@ -318,6 +298,7 @@ public class HerbiboarPlugin extends Plugin
tunnels.clear(); tunnels.clear();
} }
@Subscribe
private void onGameStateChanged(GameStateChanged event) private void onGameStateChanged(GameStateChanged event)
{ {
switch (event.getGameState()) switch (event.getGameState())
@@ -335,6 +316,7 @@ public class HerbiboarPlugin extends Plugin
} }
} }
@Subscribe
private void onVarbitChanged(VarbitChanged event) private void onVarbitChanged(VarbitChanged event)
{ {
if (isInHerbiboarArea()) if (isInHerbiboarArea())
@@ -343,11 +325,13 @@ public class HerbiboarPlugin extends Plugin
} }
} }
@Subscribe
private void onGameObjectSpawned(GameObjectSpawned event) private void onGameObjectSpawned(GameObjectSpawned event)
{ {
onGameObject(event.getTile(), null, event.getGameObject()); onGameObject(event.getTile(), null, event.getGameObject());
} }
@Subscribe
public void onAnimationChanged(AnimationChanged event) public void onAnimationChanged(AnimationChanged event)
{ {
if (!(event.getActor() instanceof NPC)) if (!(event.getActor() instanceof NPC))
@@ -373,26 +357,31 @@ public class HerbiboarPlugin extends Plugin
} }
} }
@Subscribe
private void onGameObjectChanged(GameObjectChanged event) private void onGameObjectChanged(GameObjectChanged event)
{ {
onGameObject(event.getTile(), event.getPrevious(), event.getGameObject()); onGameObject(event.getTile(), event.getPrevious(), event.getGameObject());
} }
@Subscribe
private void onGameObjectDespawned(GameObjectDespawned event) private void onGameObjectDespawned(GameObjectDespawned event)
{ {
onGameObject(event.getTile(), event.getGameObject(), null); onGameObject(event.getTile(), event.getGameObject(), null);
} }
@Subscribe
private void onGroundObjectSpawned(GroundObjectSpawned event) private void onGroundObjectSpawned(GroundObjectSpawned event)
{ {
onGroundObject( null, event.getGroundObject()); onGroundObject(null, event.getGroundObject());
} }
@Subscribe
private void onGroundObjectChanged(GroundObjectChanged event) private void onGroundObjectChanged(GroundObjectChanged event)
{ {
onGroundObject(event.getPrevious(), event.getGroundObject()); onGroundObject(event.getPrevious(), event.getGroundObject());
} }
@Subscribe
private void onGroundObjectDespawned(GroundObjectDespawned event) private void onGroundObjectDespawned(GroundObjectDespawned event)
{ {
onGroundObject(event.getGroundObject(), null); onGroundObject(event.getGroundObject(), null);
@@ -476,6 +465,7 @@ public class HerbiboarPlugin extends Plugin
return END_LOCATIONS; return END_LOCATIONS;
} }
@Subscribe
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (event.getGroup().equals("herbiboar")) if (event.getGroup().equals("herbiboar"))

View File

@@ -46,7 +46,7 @@ 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.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
@@ -109,9 +109,6 @@ public class HidePrayersPlugin extends Plugin
@Inject @Inject
private HidePrayersConfig config; private HidePrayersConfig config;
@Inject
private EventBus eventBus;
private boolean showindividualprayers; private boolean showindividualprayers;
private boolean ShowTHICK_SKIN; private boolean ShowTHICK_SKIN;
private boolean ShowBURST_OF_STRENGTH; private boolean ShowBURST_OF_STRENGTH;
@@ -172,7 +169,6 @@ public class HidePrayersPlugin extends Plugin
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
updateConfig(); updateConfig();
addSubscriptions();
hidePrayers(); hidePrayers();
} }
@@ -180,18 +176,10 @@ public class HidePrayersPlugin extends Plugin
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
restorePrayers(); restorePrayers();
} }
private void addSubscriptions() @Subscribe
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventBus.subscribe(WidgetLoaded.class, this, this::onWidgetLoaded);
}
private void onGameStateChanged(GameStateChanged event) private void onGameStateChanged(GameStateChanged event)
{ {
if (event.getGameState() == GameState.LOGGED_IN) if (event.getGameState() == GameState.LOGGED_IN)
@@ -201,6 +189,7 @@ public class HidePrayersPlugin extends Plugin
} }
} }
@Subscribe
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (event.getGroup().equals("hideprayers")) if (event.getGroup().equals("hideprayers"))
@@ -210,6 +199,7 @@ public class HidePrayersPlugin extends Plugin
} }
} }
@Subscribe
private void onWidgetLoaded(WidgetLoaded event) private void onWidgetLoaded(WidgetLoaded event)
{ {
if (event.getGroupId() == WidgetID.PRAYER_GROUP_ID || event.getGroupId() == WidgetID.QUICK_PRAYERS_GROUP_ID) if (event.getGroupId() == WidgetID.PRAYER_GROUP_ID || event.getGroupId() == WidgetID.QUICK_PRAYERS_GROUP_ID)
@@ -306,7 +296,7 @@ public class HidePrayersPlugin extends Plugin
return; return;
} }
if ( !this.showindividualprayers if (!this.showindividualprayers
&& !this.getarmadylprayers && !this.getarmadylprayers
&& !this.getbarrowsprayers && !this.getbarrowsprayers
&& !this.getbandosprayers && !this.getbandosprayers

View File

@@ -45,7 +45,7 @@ import static net.runelite.api.widgets.WidgetID.GUIDE_PRICES_INVENTORY_GROUP_ID;
import static net.runelite.api.widgets.WidgetID.INVENTORY_GROUP_ID; import static net.runelite.api.widgets.WidgetID.INVENTORY_GROUP_ID;
import static net.runelite.api.widgets.WidgetID.SHOP_INVENTORY_GROUP_ID; import static net.runelite.api.widgets.WidgetID.SHOP_INVENTORY_GROUP_ID;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
@@ -76,9 +76,6 @@ public class HighAlchemyPlugin extends Plugin
@Inject @Inject
private HighAlchemyOverlay overlay; private HighAlchemyOverlay overlay;
@Inject
private EventBus eventBus;
@Provides @Provides
HighAlchemyConfig getConfig(ConfigManager configManager) HighAlchemyConfig getConfig(ConfigManager configManager)
{ {
@@ -98,8 +95,6 @@ public class HighAlchemyPlugin extends Plugin
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
updateConfig(); updateConfig();
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
buildGroupList(); buildGroupList();
overlayManager.add(overlay); overlayManager.add(overlay);
} }
@@ -110,6 +105,7 @@ public class HighAlchemyPlugin extends Plugin
overlayManager.remove(overlay); overlayManager.remove(overlay);
} }
@Subscribe
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (event.getGroup().equals(CONFIG_GROUP)) if (event.getGroup().equals(CONFIG_GROUP))
@@ -131,7 +127,7 @@ public class HighAlchemyPlugin extends Plugin
if (this.showInventory) if (this.showInventory)
{ {
Arrays.stream( Arrays.stream(
new int[]{ new int[] {
DEPOSIT_BOX_GROUP_ID, DEPOSIT_BOX_GROUP_ID,
BANK_INVENTORY_GROUP_ID, BANK_INVENTORY_GROUP_ID,
SHOP_INVENTORY_GROUP_ID, SHOP_INVENTORY_GROUP_ID,

View File

@@ -44,13 +44,13 @@ import net.runelite.api.Client;
import net.runelite.api.MenuEntry; import net.runelite.api.MenuEntry;
import net.runelite.api.MenuOpcode; import net.runelite.api.MenuOpcode;
import net.runelite.api.events.ChatMessage; import net.runelite.api.events.ChatMessage;
import net.runelite.client.events.ConfigChanged;
import net.runelite.api.events.MenuEntryAdded; import net.runelite.api.events.MenuEntryAdded;
import net.runelite.api.events.PlayerMenuOptionClicked; import net.runelite.api.events.PlayerMenuOptionClicked;
import net.runelite.api.util.Text; import net.runelite.api.util.Text;
import net.runelite.api.widgets.WidgetInfo; import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.menus.MenuManager; import net.runelite.client.menus.MenuManager;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
@@ -97,9 +97,6 @@ public class HiscorePlugin extends Plugin
@Inject @Inject
private HiscoreConfig config; private HiscoreConfig config;
@Inject
private EventBus eventBus;
private NavigationButton navButton; private NavigationButton navButton;
private HiscorePanel hiscorePanel; private HiscorePanel hiscorePanel;
@@ -115,7 +112,6 @@ public class HiscorePlugin extends Plugin
@Override @Override
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
addSubscriptions();
updateConfig(); updateConfig();
hiscorePanel = injector.getInstance(HiscorePanel.class); hiscorePanel = injector.getInstance(HiscorePanel.class);
@@ -144,8 +140,6 @@ public class HiscorePlugin extends Plugin
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
hiscorePanel.removeInputKeyListener(autocompleter); hiscorePanel.removeInputKeyListener(autocompleter);
clientToolbar.removeNavigation(navButton); clientToolbar.removeNavigation(navButton);
@@ -155,14 +149,7 @@ public class HiscorePlugin extends Plugin
} }
} }
private void addSubscriptions() @Subscribe
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(MenuEntryAdded.class, this, this::onMenuEntryAdded);
eventBus.subscribe(PlayerMenuOptionClicked.class, this, this::onPlayerMenuOptionClicked);
eventBus.subscribe(ChatMessage.class, this, this::onChatMessage);
}
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
@@ -195,6 +182,7 @@ public class HiscorePlugin extends Plugin
} }
@Subscribe
private void onMenuEntryAdded(MenuEntryAdded event) private void onMenuEntryAdded(MenuEntryAdded event)
{ {
if (!this.menuOption) if (!this.menuOption)
@@ -229,6 +217,7 @@ public class HiscorePlugin extends Plugin
} }
} }
@Subscribe
private void onPlayerMenuOptionClicked(PlayerMenuOptionClicked event) private void onPlayerMenuOptionClicked(PlayerMenuOptionClicked event)
{ {
if (event.getMenuOption().equals(LOOKUP)) if (event.getMenuOption().equals(LOOKUP))
@@ -237,6 +226,7 @@ public class HiscorePlugin extends Plugin
} }
} }
@Subscribe
private void onChatMessage(ChatMessage event) private void onChatMessage(ChatMessage event)
{ {
if (!this.bountyLookup || !event.getType().equals(ChatMessageType.GAMEMESSAGE)) if (!this.bountyLookup || !event.getType().equals(ChatMessageType.GAMEMESSAGE))

View File

@@ -43,12 +43,12 @@ import net.runelite.api.Tile;
import net.runelite.api.coords.Direction; import net.runelite.api.coords.Direction;
import net.runelite.api.coords.LocalPoint; import net.runelite.api.coords.LocalPoint;
import net.runelite.api.coords.WorldPoint; import net.runelite.api.coords.WorldPoint;
import net.runelite.client.events.ConfigChanged;
import net.runelite.api.events.GameObjectSpawned; import net.runelite.api.events.GameObjectSpawned;
import net.runelite.api.events.GameTick; import net.runelite.api.events.GameTick;
import net.runelite.client.Notifier; import net.runelite.client.Notifier;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
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;
@@ -77,9 +77,6 @@ public class HunterPlugin extends Plugin
@Inject @Inject
private HunterConfig config; private HunterConfig config;
@Inject
private EventBus eventBus;
@Getter(AccessLevel.PACKAGE) @Getter(AccessLevel.PACKAGE)
private final Map<WorldPoint, HunterTrap> traps = new HashMap<>(); private final Map<WorldPoint, HunterTrap> traps = new HashMap<>();
@@ -108,7 +105,6 @@ public class HunterPlugin extends Plugin
protected void startUp() protected void startUp()
{ {
updateConfig(); updateConfig();
addSubscriptions();
overlayManager.add(overlay); overlayManager.add(overlay);
overlay.updateConfig(); overlay.updateConfig();
@@ -117,20 +113,12 @@ public class HunterPlugin extends Plugin
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
overlayManager.remove(overlay); overlayManager.remove(overlay);
lastActionTime = Instant.ofEpochMilli(0); lastActionTime = Instant.ofEpochMilli(0);
traps.clear(); traps.clear();
} }
private void addSubscriptions() @Subscribe
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(GameTick.class, this, this::onGameTick);
eventBus.subscribe(GameObjectSpawned.class, this, this::onGameObjectSpawned);
}
private void onGameObjectSpawned(GameObjectSpawned event) private void onGameObjectSpawned(GameObjectSpawned event)
{ {
final GameObject gameObject = event.getGameObject(); final GameObject gameObject = event.getGameObject();
@@ -327,6 +315,7 @@ public class HunterPlugin extends Plugin
* checks if the trap is still there. If the trap is gone, it removes * checks if the trap is still there. If the trap is gone, it removes
* the trap from the local players trap collection. * the trap from the local players trap collection.
*/ */
@Subscribe
private void onGameTick(GameTick event) private void onGameTick(GameTick event)
{ {
// Check if all traps are still there, and remove the ones that are not. // Check if all traps are still there, and remove the ones that are not.
@@ -404,6 +393,7 @@ public class HunterPlugin extends Plugin
lastTickLocalPlayerLocation = client.getLocalPlayer().getWorldLocation(); lastTickLocalPlayerLocation = client.getLocalPlayer().getWorldLocation();
} }
@Subscribe
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (event.getGroup().equals("hunterplugin")) if (event.getGroup().equals("hunterplugin"))

View File

@@ -38,7 +38,7 @@ import net.runelite.api.events.AnimationChanged;
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.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
@@ -73,9 +73,6 @@ public class BabyHydraPlugin extends Plugin
@Inject @Inject
private Client client; private Client client;
@Inject
private EventBus eventBus;
@Provides @Provides
BabyHydraConfig provideConfig(ConfigManager configManager) BabyHydraConfig provideConfig(ConfigManager configManager)
{ {
@@ -100,7 +97,6 @@ public class BabyHydraPlugin extends Plugin
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
updateConfig(); updateConfig();
addSubscriptions();
if (this.TextIndicator) if (this.TextIndicator)
{ {
@@ -116,8 +112,6 @@ public class BabyHydraPlugin extends Plugin
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
overlayManager.remove(hydraOverlay); overlayManager.remove(hydraOverlay);
overlayManager.remove(hydraPrayOverlay); overlayManager.remove(hydraPrayOverlay);
overlayManager.remove(hydraIndicatorOverlay); overlayManager.remove(hydraIndicatorOverlay);
@@ -125,14 +119,7 @@ public class BabyHydraPlugin extends Plugin
hydraattacks.clear(); hydraattacks.clear();
} }
private void addSubscriptions() @Subscribe
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(NpcSpawned.class, this, this::onNpcSpawned);
eventBus.subscribe(NpcDespawned.class, this, this::onNpcDespawned);
eventBus.subscribe(AnimationChanged.class, this, this::onAnimationChanged);
}
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (!event.getGroup().equals("hydra")) if (!event.getGroup().equals("hydra"))
@@ -168,6 +155,7 @@ public class BabyHydraPlugin extends Plugin
} }
} }
@Subscribe
private void onNpcSpawned(NpcSpawned event) private void onNpcSpawned(NpcSpawned event)
{ {
NPC hydra = event.getNpc(); NPC hydra = event.getNpc();
@@ -177,6 +165,7 @@ public class BabyHydraPlugin extends Plugin
} }
} }
@Subscribe
private void onNpcDespawned(NpcDespawned event) private void onNpcDespawned(NpcDespawned event)
{ {
NPC hydra = event.getNpc(); NPC hydra = event.getNpc();
@@ -187,6 +176,7 @@ public class BabyHydraPlugin extends Plugin
} }
} }
@Subscribe
private void onAnimationChanged(AnimationChanged event) private void onAnimationChanged(AnimationChanged event)
{ {
Actor monster = event.getActor(); Actor monster = event.getActor();

View File

@@ -71,7 +71,7 @@ import net.runelite.api.events.SpotAnimationChanged;
import net.runelite.api.events.WallObjectSpawned; import net.runelite.api.events.WallObjectSpawned;
import net.runelite.client.Notifier; import net.runelite.client.Notifier;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.ConfigChanged;
import net.runelite.client.game.Sound; import net.runelite.client.game.Sound;
import net.runelite.client.game.SoundManager; import net.runelite.client.game.SoundManager;
@@ -240,9 +240,6 @@ public class IdleNotifierPlugin extends Plugin
@Inject @Inject
private IdleNotifierConfig config; private IdleNotifierConfig config;
@Inject
private EventBus eventBus;
private Instant lastAnimating; private Instant lastAnimating;
private int lastAnimation = AnimationID.IDLE; private int lastAnimation = AnimationID.IDLE;
private Instant lastInteracting; private Instant lastInteracting;
@@ -305,6 +302,7 @@ public class IdleNotifierPlugin extends Plugin
return configManager.getConfig(IdleNotifierConfig.class); return configManager.getConfig(IdleNotifierConfig.class);
} }
@Subscribe
void onAnimationChanged(AnimationChanged event) void onAnimationChanged(AnimationChanged event)
{ {
if (client.getGameState() != GameState.LOGGED_IN) if (client.getGameState() != GameState.LOGGED_IN)
@@ -343,6 +341,7 @@ public class IdleNotifierPlugin extends Plugin
} }
} }
@Subscribe
private void onPlayerSpawned(PlayerSpawned event) private void onPlayerSpawned(PlayerSpawned event)
{ {
final Player p = event.getPlayer(); final Player p = event.getPlayer();
@@ -357,6 +356,7 @@ public class IdleNotifierPlugin extends Plugin
} }
} }
@Subscribe
private void onWallObjectSpawned(WallObjectSpawned event) private void onWallObjectSpawned(WallObjectSpawned event)
{ {
WallObject wall = event.getWallObject(); WallObject wall = event.getWallObject();
@@ -370,6 +370,7 @@ public class IdleNotifierPlugin extends Plugin
} }
} }
@Subscribe
private void onItemContainerChanged(ItemContainerChanged event) private void onItemContainerChanged(ItemContainerChanged event)
{ {
ItemContainer itemContainer = event.getItemContainer(); ItemContainer itemContainer = event.getItemContainer();
@@ -447,6 +448,7 @@ public class IdleNotifierPlugin extends Plugin
itemQuantitiesPrevious = itemQuantities; itemQuantitiesPrevious = itemQuantities;
} }
@Subscribe
void onInteractingChanged(InteractingChanged event) void onInteractingChanged(InteractingChanged event)
{ {
final Actor source = event.getSource(); final Actor source = event.getSource();
@@ -497,6 +499,7 @@ public class IdleNotifierPlugin extends Plugin
} }
} }
@Subscribe
void onGameStateChanged(GameStateChanged gameStateChanged) void onGameStateChanged(GameStateChanged gameStateChanged)
{ {
lastInteracting = null; lastInteracting = null;
@@ -530,6 +533,7 @@ public class IdleNotifierPlugin extends Plugin
} }
} }
@Subscribe
void onHitsplatApplied(HitsplatApplied event) void onHitsplatApplied(HitsplatApplied event)
{ {
if (event.getActor() != client.getLocalPlayer()) if (event.getActor() != client.getLocalPlayer())
@@ -546,6 +550,7 @@ public class IdleNotifierPlugin extends Plugin
} }
} }
@Subscribe
private void onSpotAnimationChanged(SpotAnimationChanged event) private void onSpotAnimationChanged(SpotAnimationChanged event)
{ {
Actor actor = event.getActor(); Actor actor = event.getActor();
@@ -561,6 +566,7 @@ public class IdleNotifierPlugin extends Plugin
} }
} }
@Subscribe
void onGameTick(GameTick event) void onGameTick(GameTick event)
{ {
skullNotifier(); skullNotifier();
@@ -986,29 +992,14 @@ public class IdleNotifierPlugin extends Plugin
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
updateConfig(); updateConfig();
addSubscriptions();
} }
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
}
private void addSubscriptions()
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(AnimationChanged.class, this, this::onAnimationChanged);
eventBus.subscribe(PlayerSpawned.class, this, this::onPlayerSpawned);
eventBus.subscribe(WallObjectSpawned.class, this, this::onWallObjectSpawned);
eventBus.subscribe(ItemContainerChanged.class, this, this::onItemContainerChanged);
eventBus.subscribe(InteractingChanged.class, this, this::onInteractingChanged);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventBus.subscribe(HitsplatApplied.class, this, this::onHitsplatApplied);
eventBus.subscribe(SpotAnimationChanged.class, this, this::onSpotAnimationChanged);
eventBus.subscribe(GameTick.class, this, this::onGameTick);
} }
@Subscribe
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (!event.getGroup().equals("idlenotifier")) if (!event.getGroup().equals("idlenotifier"))

View File

@@ -43,7 +43,7 @@ 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.Notifier;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
@@ -85,9 +85,6 @@ public class ImplingsPlugin extends Plugin
@Inject @Inject
private ImplingsConfig config; private ImplingsConfig config;
@Inject
private EventBus eventBus;
@Inject @Inject
private Notifier notifier; private Notifier notifier;
@@ -134,7 +131,6 @@ public class ImplingsPlugin extends Plugin
protected void startUp() protected void startUp()
{ {
updateConfig(); updateConfig();
addSubscriptions();
dynamicSpawns.put(DYNAMIC_SPAWN_NATURE_DRAGON, "T3 Nature-Lucky Dynamic"); dynamicSpawns.put(DYNAMIC_SPAWN_NATURE_DRAGON, "T3 Nature-Lucky Dynamic");
dynamicSpawns.put(DYNAMIC_SPAWN_ECLECTIC, "T2 Eclectic Dynamic"); dynamicSpawns.put(DYNAMIC_SPAWN_ECLECTIC, "T2 Eclectic Dynamic");
@@ -148,24 +144,13 @@ public class ImplingsPlugin extends Plugin
@Override @Override
protected void shutDown() protected void shutDown()
{ {
eventBus.unregister(this);
implings.clear(); implings.clear();
overlayManager.remove(overlay); overlayManager.remove(overlay);
overlayManager.remove(minimapOverlay); overlayManager.remove(minimapOverlay);
overlayManager.remove(implingCounterOverlay); overlayManager.remove(implingCounterOverlay);
} }
private void addSubscriptions() @Subscribe
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(GameTick.class, this, this::onGameTick);
eventBus.subscribe(NpcSpawned.class, this, this::onNpcSpawned);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventBus.subscribe(NpcDespawned.class, this, this::onNpcDespawned);
eventBus.subscribe(NpcDefinitionChanged.class, this, this::onNpcDefinitionChanged);
}
private void onGameTick(GameTick event) private void onGameTick(GameTick event)
{ {
implingCounterMap.clear(); implingCounterMap.clear();
@@ -190,6 +175,7 @@ public class ImplingsPlugin extends Plugin
} }
} }
@Subscribe
private void onNpcSpawned(NpcSpawned npcSpawned) private void onNpcSpawned(NpcSpawned npcSpawned)
{ {
NPC npc = npcSpawned.getNpc(); NPC npc = npcSpawned.getNpc();
@@ -206,6 +192,7 @@ public class ImplingsPlugin extends Plugin
} }
} }
@Subscribe
private void onNpcDefinitionChanged(NpcDefinitionChanged npcCompositionChanged) private void onNpcDefinitionChanged(NpcDefinitionChanged npcCompositionChanged)
{ {
NPC npc = npcCompositionChanged.getNpc(); NPC npc = npcCompositionChanged.getNpc();
@@ -222,6 +209,7 @@ public class ImplingsPlugin extends Plugin
} }
} }
@Subscribe
private void onGameStateChanged(GameStateChanged event) private void onGameStateChanged(GameStateChanged event)
{ {
if (event.getGameState() == GameState.LOGIN_SCREEN || event.getGameState() == GameState.HOPPING) if (event.getGameState() == GameState.LOGIN_SCREEN || event.getGameState() == GameState.HOPPING)
@@ -231,6 +219,7 @@ public class ImplingsPlugin extends Plugin
} }
} }
@Subscribe
private void onNpcDespawned(NpcDespawned npcDespawned) private void onNpcDespawned(NpcDespawned npcDespawned)
{ {
if (implings.isEmpty()) if (implings.isEmpty())
@@ -334,6 +323,7 @@ public class ImplingsPlugin extends Plugin
} }
} }
@Subscribe
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (!event.getGroup().equals("implings")) if (!event.getGroup().equals("implings"))

View File

@@ -48,7 +48,7 @@ import net.runelite.api.events.GameTick;
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.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
@@ -94,9 +94,6 @@ public class InfernoPlugin extends Plugin
@Inject @Inject
private InfernoConfig config; private InfernoConfig config;
@Inject
private EventBus eventBus;
@Getter(AccessLevel.PACKAGE) @Getter(AccessLevel.PACKAGE)
private InfernoConfig.FontStyle fontStyle = InfernoConfig.FontStyle.BOLD; private InfernoConfig.FontStyle fontStyle = InfernoConfig.FontStyle.BOLD;
@Getter(AccessLevel.PACKAGE) @Getter(AccessLevel.PACKAGE)
@@ -243,7 +240,6 @@ public class InfernoPlugin extends Plugin
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
updateConfig(); updateConfig();
addSubscriptions();
waveOverlay.setDisplayMode(this.waveDisplay); waveOverlay.setDisplayMode(this.waveDisplay);
waveOverlay.setWaveHeaderColor(this.getWaveOverlayHeaderColor); waveOverlay.setWaveHeaderColor(this.getWaveOverlayHeaderColor);
@@ -267,8 +263,6 @@ public class InfernoPlugin extends Plugin
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
overlayManager.remove(infernoOverlay); overlayManager.remove(infernoOverlay);
overlayManager.remove(waveOverlay); overlayManager.remove(waveOverlay);
overlayManager.remove(jadOverlay); overlayManager.remove(jadOverlay);
@@ -279,17 +273,7 @@ public class InfernoPlugin extends Plugin
showNpcDeaths(); showNpcDeaths();
} }
private void addSubscriptions() @Subscribe
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(NpcSpawned.class, this, this::onNpcSpawned);
eventBus.subscribe(NpcDespawned.class, this, this::onNpcDespawned);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventBus.subscribe(ChatMessage.class, this, this::onChatMessage);
eventBus.subscribe(GameTick.class, this, this::onGameTick);
eventBus.subscribe(AnimationChanged.class, this, this::onAnimationChanged);
}
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (!"inferno".equals(event.getGroup())) if (!"inferno".equals(event.getGroup()))
@@ -319,6 +303,7 @@ public class InfernoPlugin extends Plugin
} }
} }
@Subscribe
private void onGameTick(GameTick GameTickEvent) private void onGameTick(GameTick GameTickEvent)
{ {
if (!isInInferno()) if (!isInInferno())
@@ -347,6 +332,7 @@ public class InfernoPlugin extends Plugin
calculateCentralNibbler(); calculateCentralNibbler();
} }
@Subscribe
private void onNpcSpawned(NpcSpawned event) private void onNpcSpawned(NpcSpawned event)
{ {
if (!isInInferno()) if (!isInInferno())
@@ -392,6 +378,7 @@ public class InfernoPlugin extends Plugin
} }
} }
@Subscribe
private void onNpcDespawned(NpcDespawned event) private void onNpcDespawned(NpcDespawned event)
{ {
if (!isInInferno()) if (!isInInferno())
@@ -407,6 +394,7 @@ public class InfernoPlugin extends Plugin
infernoNpcs.removeIf(infernoNPC -> infernoNPC.getNpc() == event.getNpc()); infernoNpcs.removeIf(infernoNPC -> infernoNPC.getNpc() == event.getNpc());
} }
@Subscribe
private void onAnimationChanged(AnimationChanged event) private void onAnimationChanged(AnimationChanged event)
{ {
if (!isInInferno()) if (!isInInferno())
@@ -426,6 +414,7 @@ public class InfernoPlugin extends Plugin
} }
} }
@Subscribe
private void onGameStateChanged(GameStateChanged event) private void onGameStateChanged(GameStateChanged event)
{ {
if (event.getGameState() != GameState.LOGGED_IN) if (event.getGameState() != GameState.LOGGED_IN)
@@ -461,6 +450,7 @@ public class InfernoPlugin extends Plugin
} }
} }
@Subscribe
private void onChatMessage(ChatMessage event) private void onChatMessage(ChatMessage event)
{ {
if (!isInInferno() || event.getType() != ChatMessageType.GAMEMESSAGE) if (!isInInferno() || event.getType() != ChatMessageType.GAMEMESSAGE)

View File

@@ -27,7 +27,6 @@ package net.runelite.client.plugins.info;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
import net.runelite.client.eventbus.EventBus;
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.ClientToolbar; import net.runelite.client.ui.ClientToolbar;
@@ -45,9 +44,6 @@ public class InfoPlugin extends Plugin
@Inject @Inject
private ClientToolbar clientToolbar; private ClientToolbar clientToolbar;
@Inject
private EventBus eventbus;
private NavigationButton navButton; private NavigationButton navButton;
@@ -72,8 +68,6 @@ public class InfoPlugin extends Plugin
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventbus.unregister(this);
clientToolbar.removeNavigation(navButton); clientToolbar.removeNavigation(navButton);
} }
} }

View File

@@ -31,7 +31,7 @@ import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.WidgetMenuOptionClicked; import net.runelite.api.events.WidgetMenuOptionClicked;
import net.runelite.api.widgets.WidgetInfo; import net.runelite.api.widgets.WidgetInfo;
import static net.runelite.api.widgets.WidgetInfo.WORLD_MAP_OPTION; import static net.runelite.api.widgets.WidgetInfo.WORLD_MAP_OPTION;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.input.KeyManager; import net.runelite.client.input.KeyManager;
import net.runelite.client.input.MouseManager; import net.runelite.client.input.MouseManager;
import net.runelite.client.menus.MenuManager; import net.runelite.client.menus.MenuManager;
@@ -67,9 +67,6 @@ public class InstanceMapPlugin extends Plugin
@Inject @Inject
private MouseManager mouseManager; private MouseManager mouseManager;
@Inject
private EventBus eventBus;
@Override @Override
public void configure(Binder binder) public void configure(Binder binder)
{ {
@@ -89,7 +86,6 @@ public class InstanceMapPlugin extends Plugin
@Override @Override
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
addSubscriptions();
overlayManager.add(overlay); overlayManager.add(overlay);
addCustomOptions(); addCustomOptions();
@@ -101,8 +97,6 @@ public class InstanceMapPlugin extends Plugin
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
overlay.setShowMap(false); overlay.setShowMap(false);
overlayManager.remove(overlay); overlayManager.remove(overlay);
removeCustomOptions(); removeCustomOptions();
@@ -111,12 +105,7 @@ public class InstanceMapPlugin extends Plugin
mouseManager.unregisterMouseWheelListener(inputListener); mouseManager.unregisterMouseWheelListener(inputListener);
} }
private void addSubscriptions() @Subscribe
{
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventBus.subscribe(WidgetMenuOptionClicked.class, this, this::onWidgetMenuOptionClicked);
}
private void onGameStateChanged(GameStateChanged event) private void onGameStateChanged(GameStateChanged event)
{ {
overlay.onGameStateChange(event); overlay.onGameStateChange(event);
@@ -127,6 +116,7 @@ public class InstanceMapPlugin extends Plugin
return event.getMenuOption().equals(widgetMenuOption.getMenuOption()) && event.getMenuTarget().equals(widgetMenuOption.getMenuTarget()); return event.getMenuOption().equals(widgetMenuOption.getMenuOption()) && event.getMenuTarget().equals(widgetMenuOption.getMenuTarget());
} }
@Subscribe
private void onWidgetMenuOptionClicked(WidgetMenuOptionClicked event) private void onWidgetMenuOptionClicked(WidgetMenuOptionClicked event)
{ {
if (event.getWidget() != WORLD_MAP_OPTION) if (event.getWidget() != WORLD_MAP_OPTION)

View File

@@ -44,7 +44,7 @@ import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetInfo; import net.runelite.api.widgets.WidgetInfo;
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.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.ConfigChanged;
import net.runelite.client.game.SpriteManager; import net.runelite.client.game.SpriteManager;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
@@ -73,9 +73,6 @@ public class InterfaceStylesPlugin extends Plugin
@Inject @Inject
private SpriteManager spriteManager; private SpriteManager spriteManager;
@Inject
private EventBus eventBus;
private Sprite[] defaultCrossSprites; private Sprite[] defaultCrossSprites;
private Skin skin; private Skin skin;
@@ -93,15 +90,12 @@ public class InterfaceStylesPlugin extends Plugin
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
updateConfig(); updateConfig();
addSubscriptions();
clientThread.invoke(this::updateAllOverrides); clientThread.invoke(this::updateAllOverrides);
} }
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
clientThread.invoke(() -> clientThread.invoke(() ->
{ {
restoreWidgetDimensions(); restoreWidgetDimensions();
@@ -111,15 +105,7 @@ public class InterfaceStylesPlugin extends Plugin
}); });
} }
private void addSubscriptions() @Subscribe
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(WidgetPositioned.class, this, this::onWidgetPositioned);
eventBus.subscribe(PostHealthBar.class, this, this::onPostHealthBar);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventBus.subscribe(BeforeMenuRender.class, this, this::onBeforeMenuRender);
}
private void onConfigChanged(ConfigChanged config) private void onConfigChanged(ConfigChanged config)
{ {
if (config.getGroup().equals("interfaceStyles")) if (config.getGroup().equals("interfaceStyles"))
@@ -129,11 +115,13 @@ public class InterfaceStylesPlugin extends Plugin
} }
} }
@Subscribe
private void onWidgetPositioned(WidgetPositioned widgetPositioned) private void onWidgetPositioned(WidgetPositioned widgetPositioned)
{ {
adjustWidgetDimensions(); adjustWidgetDimensions();
} }
@Subscribe
private void onPostHealthBar(PostHealthBar postHealthBar) private void onPostHealthBar(PostHealthBar postHealthBar)
{ {
if (!this.hdHealthBars) if (!this.hdHealthBars)
@@ -152,6 +140,7 @@ public class InterfaceStylesPlugin extends Plugin
} }
} }
@Subscribe
private void onGameStateChanged(GameStateChanged gameStateChanged) private void onGameStateChanged(GameStateChanged gameStateChanged)
{ {
if (gameStateChanged.getGameState() != GameState.LOGIN_SCREEN) if (gameStateChanged.getGameState() != GameState.LOGIN_SCREEN)
@@ -178,6 +167,7 @@ public class InterfaceStylesPlugin extends Plugin
overrideCrossSprites(); overrideCrossSprites();
} }
@Subscribe
private void onBeforeMenuRender(BeforeMenuRender event) private void onBeforeMenuRender(BeforeMenuRender event)
{ {
if (this.hdMenu) if (this.hdMenu)

View File

@@ -32,7 +32,7 @@ import java.awt.Color;
import lombok.AccessLevel; import lombok.AccessLevel;
import lombok.Getter; import lombok.Getter;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
@@ -56,9 +56,6 @@ public class InventoryGridPlugin extends Plugin
@Inject @Inject
private InventoryGridConfig config; private InventoryGridConfig config;
@Inject
private EventBus eventBus;
@Getter(AccessLevel.PACKAGE) @Getter(AccessLevel.PACKAGE)
private boolean showItem; private boolean showItem;
@Getter(AccessLevel.PACKAGE) @Getter(AccessLevel.PACKAGE)
@@ -76,16 +73,12 @@ public class InventoryGridPlugin extends Plugin
public void startUp() public void startUp()
{ {
updateConfig(); updateConfig();
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
overlayManager.add(overlay); overlayManager.add(overlay);
} }
@Override @Override
public void shutDown() public void shutDown()
{ {
eventBus.unregister(this);
overlayManager.remove(overlay); overlayManager.remove(overlay);
} }
@@ -95,6 +88,7 @@ public class InventoryGridPlugin extends Plugin
return configManager.getConfig(InventoryGridConfig.class); return configManager.getConfig(InventoryGridConfig.class);
} }
@Subscribe
private void onConfigChanged(ConfigChanged config) private void onConfigChanged(ConfigChanged config)
{ {
if (config.getGroup().equals("inventorygrid")) if (config.getGroup().equals("inventorygrid"))

View File

@@ -53,7 +53,7 @@ import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.ItemContainerChanged; import net.runelite.api.events.ItemContainerChanged;
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.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.ConfigChanged;
import net.runelite.client.game.ItemManager; import net.runelite.client.game.ItemManager;
import net.runelite.client.game.ItemVariationMapping; import net.runelite.client.game.ItemVariationMapping;
@@ -104,9 +104,6 @@ public class InventorySetupPlugin extends Plugin
@Inject @Inject
private ClientThread clientThread; private ClientThread clientThread;
@Inject
private EventBus eventBus;
@Inject @Inject
private ConfigManager configManager; private ConfigManager configManager;
@@ -134,7 +131,6 @@ public class InventorySetupPlugin extends Plugin
public void startUp() public void startUp()
{ {
updateConfigOptions(); updateConfigOptions();
addSubscriptions();
overlayManager.add(overlay); overlayManager.add(overlay);
@@ -261,6 +257,7 @@ public class InventorySetupPlugin extends Plugin
return configManager.getConfig(InventorySetupConfig.class); return configManager.getConfig(InventorySetupConfig.class);
} }
@Subscribe
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (event.getGroup().equals(CONFIG_GROUP)) if (event.getGroup().equals(CONFIG_GROUP))
@@ -301,7 +298,9 @@ public class InventorySetupPlugin extends Plugin
{ {
// TODO add last resort?, serialize exception just make empty map // TODO add last resort?, serialize exception just make empty map
final Gson gson = new Gson(); final Gson gson = new Gson();
Type type = new TypeToken<HashMap<String, InventorySetup>>() {}.getType(); Type type = new TypeToken<HashMap<String, InventorySetup>>()
{
}.getType();
inventorySetups.clear(); inventorySetups.clear();
inventorySetups.putAll(gson.fromJson(json, type)); inventorySetups.putAll(gson.fromJson(json, type));
} }
@@ -313,6 +312,7 @@ public class InventorySetupPlugin extends Plugin
} }
@Subscribe
private void onItemContainerChanged(ItemContainerChanged event) private void onItemContainerChanged(ItemContainerChanged event)
{ {
@@ -346,6 +346,7 @@ public class InventorySetupPlugin extends Plugin
} }
@Subscribe
private void onGameStateChanged(GameStateChanged event) private void onGameStateChanged(GameStateChanged event)
{ {
switch (event.getGameState()) switch (event.getGameState())
@@ -413,11 +414,6 @@ public class InventorySetupPlugin extends Plugin
return newContainer; return newContainer;
} }
public final InventorySetupConfig getConfig()
{
return config;
}
public boolean getHighlightDifference() public boolean getHighlightDifference()
{ {
return highlightDifference; return highlightDifference;
@@ -426,19 +422,11 @@ public class InventorySetupPlugin extends Plugin
@Override @Override
public void shutDown() public void shutDown()
{ {
eventBus.unregister(this);
overlayManager.remove(overlay); overlayManager.remove(overlay);
clientToolbar.removeNavigation(navButton); clientToolbar.removeNavigation(navButton);
} }
private void addSubscriptions() final int[] getCurrentInventorySetupIds()
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(ItemContainerChanged.class, this, this::onItemContainerChanged);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
}
final int[] getCurrentInventorySetupIds()
{ {
InventorySetup setup = inventorySetups.get(panel.getSelectedInventorySetup()); InventorySetup setup = inventorySetups.get(panel.getSelectedInventorySetup());
if (setup == null) if (setup == null)

View File

@@ -39,7 +39,7 @@ import net.runelite.api.events.WidgetMenuOptionClicked;
import net.runelite.api.util.Text; import net.runelite.api.util.Text;
import net.runelite.api.widgets.WidgetInfo; import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.ConfigChanged;
import net.runelite.client.menus.MenuManager; import net.runelite.client.menus.MenuManager;
import net.runelite.client.menus.WidgetMenuOption; import net.runelite.client.menus.WidgetMenuOption;
@@ -106,9 +106,6 @@ public class InventoryTagsPlugin extends Plugin
@Inject @Inject
private OverlayManager overlayManager; private OverlayManager overlayManager;
@Inject
private EventBus eventBus;
private boolean editorMode; private boolean editorMode;
private InventoryTagsConfig.amount amount; private InventoryTagsConfig.amount amount;
@@ -152,7 +149,6 @@ public class InventoryTagsPlugin extends Plugin
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
updateConfig(); updateConfig();
addSubscriptions();
refreshInventoryMenuOptions(); refreshInventoryMenuOptions();
overlayManager.add(overlay); overlayManager.add(overlay);
@@ -161,21 +157,12 @@ public class InventoryTagsPlugin extends Plugin
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
removeInventoryMenuOptions(); removeInventoryMenuOptions();
overlayManager.remove(overlay); overlayManager.remove(overlay);
editorMode = false; editorMode = false;
} }
private void addSubscriptions() @Subscribe
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(WidgetMenuOptionClicked.class, this, this::onWidgetMenuOptionClicked);
eventBus.subscribe(MenuOptionClicked.class, this, this::onMenuOptionClicked);
eventBus.subscribe(MenuOpened.class, this, this::onMenuOpened);
}
private void onWidgetMenuOptionClicked(final WidgetMenuOptionClicked event) private void onWidgetMenuOptionClicked(final WidgetMenuOptionClicked event)
{ {
if (event.getWidget() == WidgetInfo.FIXED_VIEWPORT_INVENTORY_TAB if (event.getWidget() == WidgetInfo.FIXED_VIEWPORT_INVENTORY_TAB
@@ -187,6 +174,7 @@ public class InventoryTagsPlugin extends Plugin
} }
} }
@Subscribe
private void onMenuOptionClicked(final MenuOptionClicked event) private void onMenuOptionClicked(final MenuOptionClicked event)
{ {
if (event.getMenuOpcode() != MenuOpcode.RUNELITE) if (event.getMenuOpcode() != MenuOpcode.RUNELITE)
@@ -206,6 +194,7 @@ public class InventoryTagsPlugin extends Plugin
} }
} }
@Subscribe
private void onMenuOpened(final MenuOpened event) private void onMenuOpened(final MenuOpened event)
{ {
final MenuEntry firstEntry = event.getFirstEntry(); final MenuEntry firstEntry = event.getFirstEntry();
@@ -305,6 +294,7 @@ public class InventoryTagsPlugin extends Plugin
} }
} }
@Subscribe
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (event.getGroup().equals("inventorytags")) if (event.getGroup().equals("inventorytags"))

View File

@@ -30,7 +30,7 @@ import javax.inject.Singleton;
import lombok.AccessLevel; import lombok.AccessLevel;
import lombok.Getter; import lombok.Getter;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
@@ -56,9 +56,6 @@ public class InventoryViewerPlugin extends Plugin
@Inject @Inject
private InventoryViewerConfig config; private InventoryViewerConfig config;
@Inject
private EventBus eventBus;
@Getter(AccessLevel.PACKAGE) @Getter(AccessLevel.PACKAGE)
private InventoryViewerMode viewerMode; private InventoryViewerMode viewerMode;
@Getter(AccessLevel.PACKAGE) @Getter(AccessLevel.PACKAGE)
@@ -76,11 +73,10 @@ public class InventoryViewerPlugin extends Plugin
public void startUp() public void startUp()
{ {
updateConfig(); updateConfig();
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
overlayManager.add(overlay); overlayManager.add(overlay);
} }
@Subscribe
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (event.getGroup().equals(CONFIG_GROUP_KEY)) if (event.getGroup().equals(CONFIG_GROUP_KEY))
@@ -92,8 +88,6 @@ public class InventoryViewerPlugin extends Plugin
@Override @Override
public void shutDown() public void shutDown()
{ {
eventBus.unregister(this);
overlayManager.remove(overlay); overlayManager.remove(overlay);
} }

View File

@@ -57,7 +57,7 @@ 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;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.ConfigChanged;
import net.runelite.client.game.ItemManager; import net.runelite.client.game.ItemManager;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
@@ -168,9 +168,6 @@ public class ItemChargePlugin extends Plugin
@Inject @Inject
private ItemChargeConfig config; private ItemChargeConfig config;
@Inject
private EventBus eventBus;
// Limits destroy callback to once per tick // Limits destroy callback to once per tick
private int lastCheckTick; private int lastCheckTick;
@@ -247,7 +244,6 @@ public class ItemChargePlugin extends Plugin
protected void startUp() protected void startUp()
{ {
updateConfig(); updateConfig();
addSubscriptions();
overlayManager.add(overlay); overlayManager.add(overlay);
overlayManager.add(recoilOverlay); overlayManager.add(recoilOverlay);
@@ -257,25 +253,13 @@ public class ItemChargePlugin extends Plugin
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
overlayManager.remove(overlay); overlayManager.remove(overlay);
overlayManager.remove(recoilOverlay); overlayManager.remove(recoilOverlay);
infoBoxManager.removeIf(ItemChargeInfobox.class::isInstance); infoBoxManager.removeIf(ItemChargeInfobox.class::isInstance);
lastCheckTick = -1; lastCheckTick = -1;
} }
private void addSubscriptions() @Subscribe
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(ChatMessage.class, this, this::onChatMessage);
eventBus.subscribe(ItemContainerChanged.class, this, this::onItemContainerChanged);
eventBus.subscribe(GameTick.class, this, this::onGameTick);
eventBus.subscribe(SpotAnimationChanged.class, this, this::onSpotAnimationChanged);
eventBus.subscribe(ScriptCallbackEvent.class, this, this::onScriptCallbackEvent);
eventBus.subscribe(VarbitChanged.class, this, this::onVarbitChanged);
}
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (!event.getGroup().equals("itemCharge")) if (!event.getGroup().equals("itemCharge"))
@@ -328,6 +312,7 @@ public class ItemChargePlugin extends Plugin
} }
} }
@Subscribe
void onChatMessage(ChatMessage event) void onChatMessage(ChatMessage event)
{ {
String message = event.getMessage(); String message = event.getMessage();
@@ -490,6 +475,7 @@ public class ItemChargePlugin extends Plugin
} }
} }
@Subscribe
private void onItemContainerChanged(ItemContainerChanged event) private void onItemContainerChanged(ItemContainerChanged event)
{ {
if (event.getItemContainer() != client.getItemContainer(InventoryID.EQUIPMENT) || !this.showInfoboxes) if (event.getItemContainer() != client.getItemContainer(InventoryID.EQUIPMENT) || !this.showInfoboxes)
@@ -536,6 +522,7 @@ public class ItemChargePlugin extends Plugin
} }
} }
@Subscribe
private void onGameTick(GameTick event) private void onGameTick(GameTick event)
{ {
Widget braceletBreakWidget = client.getWidget(WidgetInfo.DIALOG_SPRITE_TEXT); Widget braceletBreakWidget = client.getWidget(WidgetInfo.DIALOG_SPRITE_TEXT);
@@ -635,6 +622,7 @@ public class ItemChargePlugin extends Plugin
} }
} }
@Subscribe
private void onSpotAnimationChanged(SpotAnimationChanged event) private void onSpotAnimationChanged(SpotAnimationChanged event)
{ {
if (event.getActor() == client.getLocalPlayer() && client.getLocalPlayer().getSpotAnimation() == GraphicID.XERIC_TELEPORT) if (event.getActor() == client.getLocalPlayer() && client.getLocalPlayer().getSpotAnimation() == GraphicID.XERIC_TELEPORT)
@@ -644,6 +632,7 @@ public class ItemChargePlugin extends Plugin
} }
} }
@Subscribe
private void onScriptCallbackEvent(ScriptCallbackEvent event) private void onScriptCallbackEvent(ScriptCallbackEvent event)
{ {
if (!"destroyOnOpKey".equals(event.getEventName())) if (!"destroyOnOpKey".equals(event.getEventName()))
@@ -658,6 +647,7 @@ public class ItemChargePlugin extends Plugin
} }
} }
@Subscribe
private void onVarbitChanged(VarbitChanged event) private void onVarbitChanged(VarbitChanged event)
{ {
int explorerRingCharge = client.getVar(Varbits.EXPLORER_RING_ALCHS); int explorerRingCharge = client.getVar(Varbits.EXPLORER_RING_ALCHS);

View File

@@ -31,7 +31,7 @@ import javax.inject.Singleton;
import lombok.AccessLevel; import lombok.AccessLevel;
import lombok.Getter; import lombok.Getter;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
@@ -54,9 +54,6 @@ public class ItemIdentificationPlugin extends Plugin
@Inject @Inject
private ItemIdentificationConfig config; private ItemIdentificationConfig config;
@Inject
private EventBus eventBus;
@Getter(AccessLevel.PACKAGE) @Getter(AccessLevel.PACKAGE)
private ItemIdentificationMode identificationType; private ItemIdentificationMode identificationType;
@Getter(AccessLevel.PACKAGE) @Getter(AccessLevel.PACKAGE)
@@ -82,19 +79,16 @@ public class ItemIdentificationPlugin extends Plugin
protected void startUp() protected void startUp()
{ {
updateConfig(); updateConfig();
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
overlayManager.add(overlay); overlayManager.add(overlay);
} }
@Override @Override
protected void shutDown() protected void shutDown()
{ {
eventBus.unregister(this);
overlayManager.remove(overlay); overlayManager.remove(overlay);
} }
@Subscribe
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (!event.getGroup().equals("itemidentification")) if (!event.getGroup().equals("itemidentification"))

View File

@@ -30,7 +30,7 @@ import javax.inject.Singleton;
import lombok.AccessLevel; import lombok.AccessLevel;
import lombok.Getter; import lombok.Getter;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
@@ -54,9 +54,6 @@ public class ItemPricesPlugin extends Plugin
@Inject @Inject
private ItemPricesConfig config; private ItemPricesConfig config;
@Inject
private EventBus eventBus;
@Getter(AccessLevel.PACKAGE) @Getter(AccessLevel.PACKAGE)
private boolean showGEPrice; private boolean showGEPrice;
@Getter(AccessLevel.PACKAGE) @Getter(AccessLevel.PACKAGE)
@@ -80,18 +77,16 @@ public class ItemPricesPlugin extends Plugin
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
updateConfig(); updateConfig();
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
overlayManager.add(overlay); overlayManager.add(overlay);
} }
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
overlayManager.remove(overlay); overlayManager.remove(overlay);
} }
@Subscribe
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (!event.getGroup().equals("itemprices")) if (!event.getGroup().equals("itemprices"))

View File

@@ -59,7 +59,7 @@ import net.runelite.api.vars.AccountType;
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.api.widgets.WidgetType; import net.runelite.api.widgets.WidgetType;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.game.ItemManager; import net.runelite.client.game.ItemManager;
import net.runelite.client.game.ItemMapping; import net.runelite.client.game.ItemMapping;
import net.runelite.client.game.ItemReclaimCost; import net.runelite.client.game.ItemReclaimCost;
@@ -116,9 +116,6 @@ public class ItemsKeptOnDeathPlugin extends Plugin
@Inject @Inject
private ItemManager itemManager; private ItemManager itemManager;
@Inject
private EventBus eventBus;
private WidgetButton deepWildyButton; private WidgetButton deepWildyButton;
private WidgetButton lowWildyButton; private WidgetButton lowWildyButton;
@@ -132,15 +129,14 @@ public class ItemsKeptOnDeathPlugin extends Plugin
@Override @Override
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
eventBus.subscribe(ScriptCallbackEvent.class, this, this::onScriptCallbackEvent);
} }
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
} }
@Subscribe
private void onScriptCallbackEvent(ScriptCallbackEvent event) private void onScriptCallbackEvent(ScriptCallbackEvent event)
{ {
if (event.getEventName().equals("itemsKeptOnDeath")) if (event.getEventName().equals("itemsKeptOnDeath"))

View File

@@ -47,7 +47,6 @@ import net.runelite.api.ItemID;
import net.runelite.api.SpriteID; import net.runelite.api.SpriteID;
import net.runelite.api.VarPlayer; import net.runelite.api.VarPlayer;
import net.runelite.api.Varbits; import net.runelite.api.Varbits;
import net.runelite.client.events.ConfigChanged;
import net.runelite.api.events.GameTick; import net.runelite.api.events.GameTick;
import net.runelite.api.events.ScriptCallbackEvent; import net.runelite.api.events.ScriptCallbackEvent;
import net.runelite.api.events.VarbitChanged; import net.runelite.api.events.VarbitChanged;
@@ -58,7 +57,8 @@ import net.runelite.api.widgets.WidgetTextAlignment;
import net.runelite.api.widgets.WidgetType; import net.runelite.api.widgets.WidgetType;
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.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.game.ItemManager; import net.runelite.client.game.ItemManager;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
@@ -98,9 +98,6 @@ public class ItemStatPlugin extends Plugin
@Inject @Inject
private ClientThread clientThread; private ClientThread clientThread;
@Inject
private EventBus eventBus;
private Widget itemInformationTitle; private Widget itemInformationTitle;
@Getter(AccessLevel.PACKAGE) @Getter(AccessLevel.PACKAGE)
@@ -143,27 +140,17 @@ public class ItemStatPlugin extends Plugin
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
updateConfig(); updateConfig();
addSubscriptions();
overlayManager.add(overlay); overlayManager.add(overlay);
} }
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
overlayManager.remove(overlay); overlayManager.remove(overlay);
clientThread.invokeLater(this::resetGEInventory); clientThread.invokeLater(this::resetGEInventory);
} }
private void addSubscriptions() @Subscribe
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(GameTick.class, this, this::onGameTick);
eventBus.subscribe(VarbitChanged.class, this, this::onVarbitChanged);
eventBus.subscribe(ScriptCallbackEvent.class, this, this::onScriptCallbackEvent);
}
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (event.getKey().equals("geStats")) if (event.getKey().equals("geStats"))
@@ -173,6 +160,7 @@ public class ItemStatPlugin extends Plugin
} }
} }
@Subscribe
private void onGameTick(GameTick event) private void onGameTick(GameTick event)
{ {
if (itemInformationTitle != null && this.geStats if (itemInformationTitle != null && this.geStats
@@ -184,6 +172,7 @@ public class ItemStatPlugin extends Plugin
} }
@Subscribe
private void onVarbitChanged(VarbitChanged event) private void onVarbitChanged(VarbitChanged event)
{ {
if (client.getVar(VarPlayer.CURRENT_GE_ITEM) == -1 && this.geStats) if (client.getVar(VarPlayer.CURRENT_GE_ITEM) == -1 && this.geStats)
@@ -192,6 +181,7 @@ public class ItemStatPlugin extends Plugin
} }
} }
@Subscribe
private void onScriptCallbackEvent(ScriptCallbackEvent event) private void onScriptCallbackEvent(ScriptCallbackEvent event)
{ {
if (event.getEventName().equals("geBuilt") && this.geStats) if (event.getEventName().equals("geBuilt") && this.geStats)

View File

@@ -44,7 +44,7 @@ import net.runelite.api.widgets.WidgetInfo;
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.config.ModifierlessKeybind; import net.runelite.client.config.ModifierlessKeybind;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.ConfigChanged;
import net.runelite.client.input.KeyManager; import net.runelite.client.input.KeyManager;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
@@ -80,9 +80,6 @@ public class KeyRemappingPlugin extends Plugin
@Inject @Inject
private KeyRemappingListener inputListener; private KeyRemappingListener inputListener;
@Inject
private EventBus eventBus;
@Getter(AccessLevel.PACKAGE) @Getter(AccessLevel.PACKAGE)
@Setter(AccessLevel.PACKAGE) @Setter(AccessLevel.PACKAGE)
private boolean typing; private boolean typing;
@@ -131,7 +128,6 @@ public class KeyRemappingPlugin extends Plugin
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
updateConfig(); updateConfig();
addSubscriptions();
typing = false; typing = false;
keyManager.registerKeyListener(inputListener); keyManager.registerKeyListener(inputListener);
@@ -150,8 +146,6 @@ public class KeyRemappingPlugin extends Plugin
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
clientThread.invoke(() -> clientThread.invoke(() ->
{ {
if (client.getGameState() == GameState.LOGGED_IN) if (client.getGameState() == GameState.LOGGED_IN)
@@ -163,13 +157,7 @@ public class KeyRemappingPlugin extends Plugin
keyManager.unregisterKeyListener(inputListener); keyManager.unregisterKeyListener(inputListener);
} }
private void addSubscriptions() @Provides
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(ScriptCallbackEvent.class, this, this::onScriptCallbackEvent);
}
@Provides
KeyRemappingConfig getConfig(ConfigManager configManager) KeyRemappingConfig getConfig(ConfigManager configManager)
{ {
return configManager.getConfig(KeyRemappingConfig.class); return configManager.getConfig(KeyRemappingConfig.class);
@@ -209,6 +197,7 @@ public class KeyRemappingPlugin extends Plugin
return w == null || w.isSelfHidden(); return w == null || w.isSelfHidden();
} }
@Subscribe
private void onConfigChanged(ConfigChanged configChanged) private void onConfigChanged(ConfigChanged configChanged)
{ {
if (!configChanged.getGroup().equals("keyremapping")) if (!configChanged.getGroup().equals("keyremapping"))
@@ -229,6 +218,7 @@ public class KeyRemappingPlugin extends Plugin
); );
} }
@Subscribe
private void onScriptCallbackEvent(ScriptCallbackEvent scriptCallbackEvent) private void onScriptCallbackEvent(ScriptCallbackEvent scriptCallbackEvent)
{ {
switch (scriptCallbackEvent.getEventName()) switch (scriptCallbackEvent.getEventName())

View File

@@ -47,7 +47,7 @@ import net.runelite.client.chat.ChatMessageBuilder;
import net.runelite.client.chat.ChatMessageManager; import net.runelite.client.chat.ChatMessageManager;
import net.runelite.client.chat.QueuedMessage; import net.runelite.client.chat.QueuedMessage;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.ConfigChanged;
import net.runelite.client.game.ItemManager; import net.runelite.client.game.ItemManager;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
@@ -84,9 +84,6 @@ public class KingdomPlugin extends Plugin
@Inject @Inject
private ItemManager itemManager; private ItemManager itemManager;
@Inject
private EventBus eventBus;
@Getter(AccessLevel.PACKAGE) @Getter(AccessLevel.PACKAGE)
private int favor = 0, coffer = 0; private int favor = 0, coffer = 0;
@@ -105,30 +102,22 @@ public class KingdomPlugin extends Plugin
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
updateConfig(); updateConfig();
addSubscriptions();
} }
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
removeKingdomInfobox(); removeKingdomInfobox();
} }
private void addSubscriptions() @Subscribe
{
eventBus.subscribe(VarbitChanged.class, this, this::onVarbitChanged);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
}
private void onVarbitChanged(VarbitChanged event) private void onVarbitChanged(VarbitChanged event)
{ {
updateKingdomVarbits(); updateKingdomVarbits();
processInfobox(); processInfobox();
} }
@Subscribe
public void onGameStateChanged(GameStateChanged event) public void onGameStateChanged(GameStateChanged event)
{ {
@@ -144,6 +133,7 @@ public class KingdomPlugin extends Plugin
} }
} }
@Subscribe
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (!event.getGroup().equals("kingdomofmiscellania")) if (!event.getGroup().equals("kingdomofmiscellania"))

View File

@@ -46,14 +46,14 @@ import net.runelite.api.Player;
import net.runelite.api.coords.WorldPoint; import net.runelite.api.coords.WorldPoint;
import net.runelite.api.events.AnimationChanged; import net.runelite.api.events.AnimationChanged;
import net.runelite.api.events.ChatMessage; import net.runelite.api.events.ChatMessage;
import net.runelite.client.events.ConfigChanged;
import net.runelite.api.events.GameTick; import net.runelite.api.events.GameTick;
import net.runelite.api.events.ItemContainerChanged; import net.runelite.api.events.ItemContainerChanged;
import net.runelite.api.events.MenuOptionClicked; import net.runelite.api.events.MenuOptionClicked;
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.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.game.ItemManager; import net.runelite.client.game.ItemManager;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
@@ -98,9 +98,6 @@ public class KourendLibraryPlugin extends Plugin
@Inject @Inject
private ItemManager itemManager; private ItemManager itemManager;
@Inject
private EventBus eventBus;
private KourendLibraryPanel panel; private KourendLibraryPanel panel;
private NavigationButton navButton; private NavigationButton navButton;
private boolean buttonAttached = false; private boolean buttonAttached = false;
@@ -121,7 +118,6 @@ public class KourendLibraryPlugin extends Plugin
@Override @Override
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
addSubscriptions();
hideButton = config.hideButton(); hideButton = config.hideButton();
hideDuplicateBook = config.hideDuplicateBook(); hideDuplicateBook = config.hideDuplicateBook();
@@ -153,8 +149,6 @@ public class KourendLibraryPlugin extends Plugin
@Override @Override
protected void shutDown() protected void shutDown()
{ {
eventBus.unregister(this);
overlay.setHidden(true); overlay.setHidden(true);
overlayManager.remove(overlay); overlayManager.remove(overlay);
clientToolbar.removeNavigation(navButton); clientToolbar.removeNavigation(navButton);
@@ -164,16 +158,7 @@ public class KourendLibraryPlugin extends Plugin
playerBooks = null; playerBooks = null;
} }
private void addSubscriptions() @Subscribe
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(MenuOptionClicked.class, this, this::onMenuOptionClicked);
eventBus.subscribe(AnimationChanged.class, this, this::onAnimationChanged);
eventBus.subscribe(ChatMessage.class, this, this::onChatMessage);
eventBus.subscribe(GameTick.class, this, this::onGameTick);
eventBus.subscribe(ItemContainerChanged.class, this, this::onItemContainerChanged);
}
private void onConfigChanged(ConfigChanged ev) private void onConfigChanged(ConfigChanged ev)
{ {
if (!KourendLibraryConfig.GROUP_KEY.equals(ev.getGroup())) if (!KourendLibraryConfig.GROUP_KEY.equals(ev.getGroup()))
@@ -206,6 +191,7 @@ public class KourendLibraryPlugin extends Plugin
}); });
} }
@Subscribe
private void onMenuOptionClicked(MenuOptionClicked menuOpt) private void onMenuOptionClicked(MenuOptionClicked menuOpt)
{ {
if (MenuOpcode.GAME_OBJECT_FIRST_OPTION == menuOpt.getMenuOpcode() && menuOpt.getTarget().contains("Bookshelf")) if (MenuOpcode.GAME_OBJECT_FIRST_OPTION == menuOpt.getMenuOpcode() && menuOpt.getTarget().contains("Bookshelf"))
@@ -215,6 +201,7 @@ public class KourendLibraryPlugin extends Plugin
} }
} }
@Subscribe
private void onAnimationChanged(AnimationChanged anim) private void onAnimationChanged(AnimationChanged anim)
{ {
if (anim.getActor() == client.getLocalPlayer() && anim.getActor().getAnimation() == AnimationID.LOOKING_INTO) if (anim.getActor() == client.getLocalPlayer() && anim.getActor().getAnimation() == AnimationID.LOOKING_INTO)
@@ -223,6 +210,7 @@ public class KourendLibraryPlugin extends Plugin
} }
} }
@Subscribe
private void onChatMessage(ChatMessage event) private void onChatMessage(ChatMessage event)
{ {
if (lastBookcaseAnimatedOn != null && event.getType() == ChatMessageType.GAMEMESSAGE) if (lastBookcaseAnimatedOn != null && event.getType() == ChatMessageType.GAMEMESSAGE)
@@ -236,6 +224,7 @@ public class KourendLibraryPlugin extends Plugin
} }
} }
@Subscribe
private void onGameTick(GameTick tick) private void onGameTick(GameTick tick)
{ {
boolean inRegion = client.getLocalPlayer().getWorldLocation().getRegionID() == REGION; boolean inRegion = client.getLocalPlayer().getWorldLocation().getRegionID() == REGION;
@@ -307,6 +296,7 @@ public class KourendLibraryPlugin extends Plugin
} }
} }
@Subscribe
private void onItemContainerChanged(ItemContainerChanged itemContainerChangedEvent) private void onItemContainerChanged(ItemContainerChanged itemContainerChangedEvent)
{ {
updatePlayerBooks(); updatePlayerBooks();

View File

@@ -23,7 +23,7 @@ import net.runelite.api.events.WidgetLoaded;
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.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
@@ -50,9 +50,6 @@ public class LearnToClickPlugin extends Plugin
@Inject @Inject
private Client client; private Client client;
@Inject
private EventBus eventBus;
private boolean shouldBlockCompass; private boolean shouldBlockCompass;
private boolean shouldRightClickMap; private boolean shouldRightClickMap;
private boolean shouldRightClickXp; private boolean shouldRightClickXp;
@@ -69,26 +66,16 @@ public class LearnToClickPlugin extends Plugin
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
updateConfig(); updateConfig();
addSubscriptions();
} }
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
forceRightClickFlag = false; forceRightClickFlag = false;
hideOrbWidgets(false); hideOrbWidgets(false);
} }
private void addSubscriptions() @Subscribe
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(WidgetLoaded.class, this, this::onWidgetLoaded);
eventBus.subscribe(MenuShouldLeftClick.class, this, this::onMenuShouldLeftClick);
eventBus.subscribe(MenuEntryAdded.class, this, this::onMenuEntryAdded);
}
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (!event.getGroup().equals("learntoclick")) if (!event.getGroup().equals("learntoclick"))
@@ -109,6 +96,7 @@ public class LearnToClickPlugin extends Plugin
} }
@Subscribe
private void onWidgetLoaded(WidgetLoaded event) private void onWidgetLoaded(WidgetLoaded event)
{ {
if (!this.hideOrbs) if (!this.hideOrbs)
@@ -121,6 +109,7 @@ public class LearnToClickPlugin extends Plugin
} }
} }
@Subscribe
private void onMenuShouldLeftClick(MenuShouldLeftClick event) private void onMenuShouldLeftClick(MenuShouldLeftClick event)
{ {
if (!forceRightClickFlag) if (!forceRightClickFlag)
@@ -142,6 +131,7 @@ public class LearnToClickPlugin extends Plugin
} }
} }
@Subscribe
private void onMenuEntryAdded(MenuEntryAdded event) private void onMenuEntryAdded(MenuEntryAdded event)
{ {
if ((event.getOption().equals("Floating") && this.shouldRightClickMap) || (event.getOption().equals("Hide") if ((event.getOption().equals("Floating") && this.shouldRightClickMap) || (event.getOption().equals("Hide")
@@ -167,6 +157,7 @@ public class LearnToClickPlugin extends Plugin
/** /**
* Toggles hiding the World map and special attack orb widgets * Toggles hiding the World map and special attack orb widgets
*
* @param hidden - hides the Widgets if true, un-hides them if false * @param hidden - hides the Widgets if true, un-hides them if false
*/ */
private void hideOrbWidgets(boolean hidden) private void hideOrbWidgets(boolean hidden)

View File

@@ -39,7 +39,7 @@ import net.runelite.api.events.AnimationChanged;
import net.runelite.api.events.ChatMessage; import net.runelite.api.events.ChatMessage;
import net.runelite.client.Notifier; import net.runelite.client.Notifier;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
@@ -75,9 +75,6 @@ public class LizardmenShamanPlugin extends Plugin
@Inject @Inject
private Notifier notifier; private Notifier notifier;
@Inject
private EventBus eventBus;
private boolean showTimer; private boolean showTimer;
private boolean notifyOnSpawn; private boolean notifyOnSpawn;
@@ -90,7 +87,6 @@ public class LizardmenShamanPlugin extends Plugin
@Override @Override
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
addSubscriptions();
this.showTimer = config.showTimer(); this.showTimer = config.showTimer();
this.notifyOnSpawn = config.notifyOnSpawn(); this.notifyOnSpawn = config.notifyOnSpawn();
@@ -101,19 +97,11 @@ public class LizardmenShamanPlugin extends Plugin
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
overlayManager.remove(overlay); overlayManager.remove(overlay);
spawns.clear(); spawns.clear();
} }
private void addSubscriptions() @Subscribe
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(ChatMessage.class, this, this::onChatMessage);
eventBus.subscribe(AnimationChanged.class, this, this::onAnimationChanged);
}
private void onChatMessage(ChatMessage event) private void onChatMessage(ChatMessage event)
{ {
if (this.notifyOnSpawn && /* event.getType() == ChatMessageType.GAMEMESSAGE && */event.getMessage().contains(MESSAGE)) if (this.notifyOnSpawn && /* event.getType() == ChatMessageType.GAMEMESSAGE && */event.getMessage().contains(MESSAGE))
@@ -123,6 +111,7 @@ public class LizardmenShamanPlugin extends Plugin
} }
} }
@Subscribe
private void onAnimationChanged(AnimationChanged event) private void onAnimationChanged(AnimationChanged event)
{ {
Actor actor = event.getActor(); Actor actor = event.getActor();
@@ -137,6 +126,7 @@ public class LizardmenShamanPlugin extends Plugin
} }
} }
@Subscribe
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (!event.getGroup().equals("shaman")) if (!event.getGroup().equals("shaman"))

View File

@@ -38,7 +38,7 @@ import net.runelite.api.Client;
import net.runelite.api.GameState; import net.runelite.api.GameState;
import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.GameStateChanged;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.ConfigChanged;
import net.runelite.client.events.SessionOpen; import net.runelite.client.events.SessionOpen;
import net.runelite.client.input.KeyListener; import net.runelite.client.input.KeyListener;
@@ -67,9 +67,6 @@ public class LoginScreenPlugin extends Plugin implements KeyListener
@Inject @Inject
private KeyManager keyManager; private KeyManager keyManager;
@Inject
private EventBus eventBus;
private String usernameCache; private String usernameCache;
private boolean syncUsername; private boolean syncUsername;
@@ -80,7 +77,6 @@ public class LoginScreenPlugin extends Plugin implements KeyListener
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
updateConfig(); updateConfig();
addSubscriptions();
client.setHideDisconnect(config.hideDisconnected()); client.setHideDisconnect(config.hideDisconnected());
@@ -91,8 +87,6 @@ public class LoginScreenPlugin extends Plugin implements KeyListener
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
if (this.syncUsername) if (this.syncUsername)
{ {
client.getPreferences().setRememberedUsername(usernameCache); client.getPreferences().setRememberedUsername(usernameCache);
@@ -103,19 +97,13 @@ public class LoginScreenPlugin extends Plugin implements KeyListener
keyManager.unregisterKeyListener(this); keyManager.unregisterKeyListener(this);
} }
private void addSubscriptions() @Provides
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventBus.subscribe(SessionOpen.class, this, this::onSessionOpen);
}
@Provides
LoginScreenConfig getConfig(ConfigManager configManager) LoginScreenConfig getConfig(ConfigManager configManager)
{ {
return configManager.getConfig(LoginScreenConfig.class); return configManager.getConfig(LoginScreenConfig.class);
} }
@Subscribe
private void onGameStateChanged(GameStateChanged event) private void onGameStateChanged(GameStateChanged event)
{ {
if (!this.syncUsername) if (!this.syncUsername)
@@ -147,6 +135,7 @@ public class LoginScreenPlugin extends Plugin implements KeyListener
} }
} }
@Subscribe
private void onSessionOpen(SessionOpen event) private void onSessionOpen(SessionOpen event)
{ {
// configuation for the account is available now, so update the username // configuation for the account is available now, so update the username
@@ -240,6 +229,7 @@ public class LoginScreenPlugin extends Plugin implements KeyListener
} }
@Subscribe
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (!event.getGroup().equals("loginscreen")) if (!event.getGroup().equals("loginscreen"))

View File

@@ -9,7 +9,7 @@ import net.runelite.api.Player;
import net.runelite.api.coords.WorldPoint; import net.runelite.api.coords.WorldPoint;
import net.runelite.api.events.AnimationChanged; import net.runelite.api.events.AnimationChanged;
import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.GameStateChanged;
import net.runelite.client.eventbus.EventBus; 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.plugins.PluginType; import net.runelite.client.plugins.PluginType;
@@ -31,15 +31,11 @@ public class LootAssistPlugin extends Plugin
@Inject @Inject
private LootAssistOverlay lootAssistOverlay; private LootAssistOverlay lootAssistOverlay;
@Inject
private EventBus eventBus;
static final ConcurrentHashMap<WorldPoint, LootPile> lootPiles = new ConcurrentHashMap<>(); static final ConcurrentHashMap<WorldPoint, LootPile> lootPiles = new ConcurrentHashMap<>();
@Override @Override
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
addSubscriptions();
overlayManager.add(lootAssistOverlay); overlayManager.add(lootAssistOverlay);
} }
@@ -47,23 +43,17 @@ public class LootAssistPlugin extends Plugin
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this);
lootPiles.clear(); lootPiles.clear();
overlayManager.remove(lootAssistOverlay); overlayManager.remove(lootAssistOverlay);
} }
private void addSubscriptions() @Subscribe
{
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventBus.subscribe(AnimationChanged.class, this, this::onAnimationChanged);
}
private void onGameStateChanged(GameStateChanged event) private void onGameStateChanged(GameStateChanged event)
{ {
lootPiles.clear(); lootPiles.clear();
} }
@Subscribe
private void onAnimationChanged(AnimationChanged event) private void onAnimationChanged(AnimationChanged event)
{ {
final Actor actor = event.getActor(); final Actor actor = event.getActor();

View File

@@ -39,7 +39,7 @@ import net.runelite.api.events.WidgetHiddenChanged;
import net.runelite.api.widgets.Widget; import net.runelite.api.widgets.Widget;
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.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
@@ -80,9 +80,6 @@ public class LootingBagViewerPlugin extends Plugin
@Inject @Inject
private LootingBagViewerConfig config; private LootingBagViewerConfig config;
@Inject
private EventBus eventBus;
@Getter(AccessLevel.PACKAGE) @Getter(AccessLevel.PACKAGE)
@Setter(AccessLevel.PACKAGE) @Setter(AccessLevel.PACKAGE)
private int valueToShow = -1; private int valueToShow = -1;
@@ -96,7 +93,6 @@ public class LootingBagViewerPlugin extends Plugin
@Override @Override
public void startUp() public void startUp()
{ {
addSubscriptions();
if (config.renderViewer()) if (config.renderViewer())
{ {
@@ -112,18 +108,11 @@ public class LootingBagViewerPlugin extends Plugin
@Override @Override
public void shutDown() public void shutDown()
{ {
eventBus.unregister(this);
overlayManager.remove(overlay); overlayManager.remove(overlay);
overlayManager.remove(widgetOverlay); overlayManager.remove(widgetOverlay);
} }
private void addSubscriptions() @Subscribe
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(WidgetHiddenChanged.class, this, this::onWidgetHiddenChanged);
}
private void onConfigChanged(ConfigChanged configChanged) private void onConfigChanged(ConfigChanged configChanged)
{ {
if (configChanged.getKey().equals("renderViewer")) if (configChanged.getKey().equals("renderViewer"))
@@ -154,6 +143,7 @@ public class LootingBagViewerPlugin extends Plugin
/** /**
* @param widgetHiddenChanged * @param widgetHiddenChanged
*/ */
@Subscribe
private void onWidgetHiddenChanged(WidgetHiddenChanged widgetHiddenChanged) private void onWidgetHiddenChanged(WidgetHiddenChanged widgetHiddenChanged)
{ {
Widget widget = widgetHiddenChanged.getWidget(); Widget widget = widgetHiddenChanged.getWidget();

View File

@@ -79,7 +79,6 @@ import net.runelite.api.Varbits;
import net.runelite.api.WorldType; import net.runelite.api.WorldType;
import net.runelite.api.coords.WorldPoint; import net.runelite.api.coords.WorldPoint;
import net.runelite.api.events.ChatMessage; import net.runelite.api.events.ChatMessage;
import net.runelite.client.events.ConfigChanged;
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.LocalPlayerDeath; import net.runelite.api.events.LocalPlayerDeath;
@@ -103,7 +102,8 @@ import static net.runelite.client.database.data.Tables.LOOTTRACKEREVENTS;
import static net.runelite.client.database.data.Tables.LOOTTRACKERLINK; import static net.runelite.client.database.data.Tables.LOOTTRACKERLINK;
import static net.runelite.client.database.data.Tables.LOOTTRACKERLOOT; import static net.runelite.client.database.data.Tables.LOOTTRACKERLOOT;
import static net.runelite.client.database.data.Tables.USER; import static net.runelite.client.database.data.Tables.USER;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.events.NpcLootReceived; import net.runelite.client.events.NpcLootReceived;
import net.runelite.client.events.PlayerLootReceived; import net.runelite.client.events.PlayerLootReceived;
import net.runelite.client.events.SessionClose; import net.runelite.client.events.SessionClose;
@@ -224,8 +224,6 @@ public class LootTrackerPlugin extends Plugin
@Inject @Inject
private ScheduledExecutorService executor; private ScheduledExecutorService executor;
@Inject @Inject
private EventBus eventBus;
@Inject
private LootRecordWriter writer; private LootRecordWriter writer;
@Inject @Inject
private DatabaseManager databaseManager; private DatabaseManager databaseManager;
@@ -299,6 +297,7 @@ public class LootTrackerPlugin extends Plugin
return configManager.getConfig(LootTrackerConfig.class); return configManager.getConfig(LootTrackerConfig.class);
} }
@Subscribe
private void onSessionOpen(SessionOpen sessionOpen) private void onSessionOpen(SessionOpen sessionOpen)
{ {
AccountSession accountSession = sessionManager.getAccountSession(); AccountSession accountSession = sessionManager.getAccountSession();
@@ -312,12 +311,14 @@ public class LootTrackerPlugin extends Plugin
} }
} }
@Subscribe
private void onSessionClose(SessionClose sessionClose) private void onSessionClose(SessionClose sessionClose)
{ {
submitLoot(); submitLoot();
lootTrackerClient = null; lootTrackerClient = null;
} }
@Subscribe
private void onLocalPlayerDeath(LocalPlayerDeath event) private void onLocalPlayerDeath(LocalPlayerDeath event)
{ {
if (client.getVar(Varbits.IN_WILDERNESS) == 1 || WorldType.isPvpWorld(client.getWorldType())) if (client.getVar(Varbits.IN_WILDERNESS) == 1 || WorldType.isPvpWorld(client.getWorldType()))
@@ -327,6 +328,7 @@ public class LootTrackerPlugin extends Plugin
} }
} }
@Subscribe
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (event.getGroup().equals("loottracker")) if (event.getGroup().equals("loottracker"))
@@ -355,7 +357,6 @@ public class LootTrackerPlugin extends Plugin
@Override @Override
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
addSubscriptions();
ignoredItems = Text.fromCSV(config.getIgnoredItems()); ignoredItems = Text.fromCSV(config.getIgnoredItems());
ignoredNPCs = Text.fromCSV(config.getIgnoredNPCs()); ignoredNPCs = Text.fromCSV(config.getIgnoredNPCs());
@@ -483,7 +484,6 @@ public class LootTrackerPlugin extends Plugin
@Override @Override
protected void shutDown() protected void shutDown()
{ {
eventBus.unregister(this);
submitLoot(); submitLoot();
clientToolbar.removeNavigation(navButton); clientToolbar.removeNavigation(navButton);
@@ -492,22 +492,7 @@ public class LootTrackerPlugin extends Plugin
chestLooted = false; chestLooted = false;
} }
private void addSubscriptions() @Subscribe
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(SessionOpen.class, this, this::onSessionOpen);
eventBus.subscribe(SessionClose.class, this, this::onSessionClose);
eventBus.subscribe(LocalPlayerDeath.class, this, this::onLocalPlayerDeath);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventBus.subscribe(NpcLootReceived.class, this, this::onNpcLootReceived);
eventBus.subscribe(PlayerSpawned.class, this, this::onPlayerSpawned);
eventBus.subscribe(PlayerLootReceived.class, this, this::onPlayerLootReceived);
eventBus.subscribe(WidgetLoaded.class, this, this::onWidgetLoaded);
eventBus.subscribe(ChatMessage.class, this, this::onChatMessage);
eventBus.subscribe(ItemContainerChanged.class, this, this::onItemContainerChanged);
eventBus.subscribe(MenuOptionClicked.class, this, this::onMenuOptionClicked);
}
private void onGameStateChanged(final GameStateChanged event) private void onGameStateChanged(final GameStateChanged event)
{ {
if (client.getLocalPlayer() == null) if (client.getLocalPlayer() == null)
@@ -552,6 +537,7 @@ public class LootTrackerPlugin extends Plugin
} }
} }
@Subscribe
private void onNpcLootReceived(final NpcLootReceived npcLootReceived) private void onNpcLootReceived(final NpcLootReceived npcLootReceived)
{ {
if (client.getLocalPlayer() == null) if (client.getLocalPlayer() == null)
@@ -620,6 +606,7 @@ public class LootTrackerPlugin extends Plugin
writer.addLootTrackerRecord(record); writer.addLootTrackerRecord(record);
} }
@Subscribe
private void onPlayerSpawned(PlayerSpawned event) private void onPlayerSpawned(PlayerSpawned event)
{ {
if (event.getPlayer().equals(client.getLocalPlayer())) if (event.getPlayer().equals(client.getLocalPlayer()))
@@ -628,6 +615,7 @@ public class LootTrackerPlugin extends Plugin
} }
} }
@Subscribe
private void onPlayerLootReceived(final PlayerLootReceived playerLootReceived) private void onPlayerLootReceived(final PlayerLootReceived playerLootReceived)
{ {
if (client.getLocalPlayer() == null) if (client.getLocalPlayer() == null)
@@ -680,6 +668,7 @@ public class LootTrackerPlugin extends Plugin
writer.addLootTrackerRecord(record); writer.addLootTrackerRecord(record);
} }
@Subscribe
private void onWidgetLoaded(WidgetLoaded event) private void onWidgetLoaded(WidgetLoaded event)
{ {
if (client.getLocalPlayer() == null) if (client.getLocalPlayer() == null)
@@ -804,6 +793,7 @@ public class LootTrackerPlugin extends Plugin
writer.addLootTrackerRecord(record); writer.addLootTrackerRecord(record);
} }
@Subscribe
private void onChatMessage(ChatMessage event) private void onChatMessage(ChatMessage event)
{ {
if (client.getLocalPlayer() == null) if (client.getLocalPlayer() == null)
@@ -950,6 +940,7 @@ public class LootTrackerPlugin extends Plugin
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Subscribe
public void onItemContainerChanged(ItemContainerChanged event) public void onItemContainerChanged(ItemContainerChanged event)
{ {
if (client.getLocalPlayer() == null) if (client.getLocalPlayer() == null)
@@ -1022,6 +1013,7 @@ public class LootTrackerPlugin extends Plugin
} }
} }
@Subscribe
private void onMenuOptionClicked(MenuOptionClicked event) private void onMenuOptionClicked(MenuOptionClicked event)
{ {
if (event.getParam1() != WidgetInfo.INVENTORY.getId()) if (event.getParam1() != WidgetInfo.INVENTORY.getId())
@@ -1451,7 +1443,9 @@ public class LootTrackerPlugin extends Plugin
try try
{ {
Collection<LootRecord> lootRecords = new ArrayList<>(RuneLiteAPI.GSON.fromJson(new FileReader(LOOT_RECORDS_FILE), Collection<LootRecord> lootRecords = new ArrayList<>(RuneLiteAPI.GSON.fromJson(new FileReader(LOOT_RECORDS_FILE),
new TypeToken<ArrayList<LootRecord>>() {}.getType())); new TypeToken<ArrayList<LootRecord>>()
{
}.getType()));
DSLContext dslContext = databaseManager.getDsl(); DSLContext dslContext = databaseManager.getDsl();

View File

@@ -30,6 +30,7 @@ import net.runelite.api.GameState;
import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.GameStateChanged;
import net.runelite.client.callback.ClientThread; import net.runelite.client.callback.ClientThread;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.EventBus;
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;
@@ -67,6 +68,7 @@ public class LowMemoryPlugin extends Plugin
clientThread.invoke(() -> client.changeMemoryMode(false)); clientThread.invoke(() -> client.changeMemoryMode(false));
} }
@Subscribe
private void onGameStateChanged(GameStateChanged event) private void onGameStateChanged(GameStateChanged event)
{ {
// When the client starts it initializes the texture size based on the memory mode setting. // When the client starts it initializes the texture size based on the memory mode setting.

Some files were not shown because too many files have changed in this diff Show More