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

@@ -24,17 +24,15 @@
*/
package net.runelite.client.plugins.account;
import java.util.concurrent.ScheduledExecutorService;
import javax.inject.Inject;
import javax.inject.Singleton;
import lombok.extern.slf4j.Slf4j;
import net.runelite.client.account.AccountSession;
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.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.ui.ClientToolbar;
@PluginDescriptor(
name = "Account",
@@ -49,33 +47,7 @@ public class AccountPlugin extends Plugin
@Inject
private SessionManager sessionManager;
@Inject
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);
}
@Subscribe
private void onSessionOpen(SessionOpen sessionOpen)
{
AccountSession session = sessionManager.getAccountSession();

View File

@@ -40,11 +40,12 @@ import net.runelite.api.QuestState;
import net.runelite.api.ScriptID;
import net.runelite.api.VarPlayer;
import net.runelite.api.events.WidgetLoaded;
import net.runelite.api.util.Text;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetID;
import net.runelite.api.widgets.WidgetInfo;
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.PluginDescriptor;
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.WesternDiaryRequirement;
import net.runelite.client.plugins.achievementdiary.diaries.WildernessDiaryRequirement;
import net.runelite.api.util.Text;
@Slf4j
@PluginDescriptor(
@@ -79,21 +79,17 @@ public class DiaryRequirementsPlugin extends Plugin
@Inject
private ClientThread clientThread;
@Inject
private EventBus eventBus;
@Override
protected void startUp() throws Exception
{
eventBus.subscribe(WidgetLoaded.class, this, this::onWidgetLoaded);
}
@Override
protected void shutDown() throws Exception
{
eventBus.unregister(this);
}
}
@Subscribe
private void onWidgetLoaded(final WidgetLoaded event)
{
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.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.AgilityShortcut;
import net.runelite.client.game.ItemManager;
@@ -170,7 +171,6 @@ public class AgilityPlugin extends Plugin
protected void startUp() throws Exception
{
updateConfig();
addSubscriptions();
if (config.showShortcutLevel())
{
@@ -185,7 +185,6 @@ public class AgilityPlugin extends Plugin
@Override
protected void shutDown() throws Exception
{
eventBus.unregister(this);
eventBus.unregister(MENU_SUBS);
overlayManager.remove(agilityOverlay);
@@ -196,34 +195,13 @@ public class AgilityPlugin extends Plugin
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()
{
eventBus.subscribe(BeforeRender.class, MENU_SUBS, this::onBeforeRender);
eventBus.subscribe(MenuOpened.class, MENU_SUBS, this::onMenuOpened);
}
@Subscribe
private void onGameStateChanged(GameStateChanged event)
{
switch (event.getGameState())
@@ -248,6 +226,7 @@ public class AgilityPlugin extends Plugin
}
}
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
if (!event.getGroup().equals("agility"))
@@ -293,6 +272,7 @@ public class AgilityPlugin extends Plugin
this.showAgilityArenaTimer = config.showAgilityArenaTimer();
}
@Subscribe
public void onStatChanged(StatChanged statChanged)
{
if (statChanged.getSkill() != AGILITY)
@@ -335,6 +315,7 @@ public class AgilityPlugin extends Plugin
}
}
@Subscribe
private void onItemSpawned(ItemSpawned itemSpawned)
{
if (obstacles.isEmpty())
@@ -351,12 +332,14 @@ public class AgilityPlugin extends Plugin
}
}
@Subscribe
private void onItemDespawned(ItemDespawned itemDespawned)
{
final Tile tile = itemDespawned.getTile();
marksOfGrace.remove(tile);
}
@Subscribe
private void onGameTick(GameTick tick)
{
if (isInAgilityArena())
@@ -408,61 +391,73 @@ public class AgilityPlugin extends Plugin
infoBoxManager.addInfoBox(new AgilityArenaTimer(this, itemManager.getImage(AGILITY_ARENA_TICKET)));
}
@Subscribe
private void onGameObjectSpawned(GameObjectSpawned event)
{
onTileObject(event.getTile(), null, event.getGameObject());
}
@Subscribe
private void onGameObjectChanged(GameObjectChanged event)
{
onTileObject(event.getTile(), event.getPrevious(), event.getGameObject());
}
@Subscribe
private void onGameObjectDespawned(GameObjectDespawned event)
{
onTileObject(event.getTile(), event.getGameObject(), null);
}
@Subscribe
private void onGroundObjectSpawned(GroundObjectSpawned event)
{
onTileObject(event.getTile(), null, event.getGroundObject());
}
@Subscribe
private void onGroundObjectChanged(GroundObjectChanged event)
{
onTileObject(event.getTile(), event.getPrevious(), event.getGroundObject());
}
@Subscribe
private void onGroundObjectDespawned(GroundObjectDespawned event)
{
onTileObject(event.getTile(), event.getGroundObject(), null);
}
@Subscribe
private void onWallObjectSpawned(WallObjectSpawned event)
{
onTileObject(event.getTile(), null, event.getWallObject());
}
@Subscribe
private void onWallObjectChanged(WallObjectChanged event)
{
onTileObject(event.getTile(), event.getPrevious(), event.getWallObject());
}
@Subscribe
private void onWallObjectDespawned(WallObjectDespawned event)
{
onTileObject(event.getTile(), event.getWallObject(), null);
}
@Subscribe
private void onDecorativeObjectSpawned(DecorativeObjectSpawned event)
{
onTileObject(event.getTile(), null, event.getDecorativeObject());
}
@Subscribe
private void onDecorativeObjectChanged(DecorativeObjectChanged event)
{
onTileObject(event.getTile(), event.getPrevious(), event.getDecorativeObject());
}
@Subscribe
private void onDecorativeObjectDespawned(DecorativeObjectDespawned event)
{
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.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.PluginDescriptor;
@@ -122,9 +123,6 @@ public class HydraPlugin extends Plugin
{
initConfig();
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
inHydraInstance = checkArea();
lastAttackTick = -1;
poisonProjectiles.clear();
@@ -133,7 +131,6 @@ public class HydraPlugin extends Plugin
@Override
protected void shutDown()
{
eventBus.unregister(this);
eventBus.unregister("fight");
eventBus.unregister("npcSpawned");
@@ -165,6 +162,7 @@ public class HydraPlugin extends Plugin
eventBus.subscribe(ChatMessage.class, "fight", this::onChatMessage);
}
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
if (!event.getGroup().equals("betterHydra"))
@@ -207,6 +205,7 @@ public class HydraPlugin extends Plugin
}
}
@Subscribe
private void onGameStateChanged(GameStateChanged state)
{
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.InventoryID;
import net.runelite.api.Item;
import net.runelite.api.ItemDefinition;
import net.runelite.api.ItemContainer;
import net.runelite.api.ItemDefinition;
import net.runelite.api.events.ItemContainerChanged;
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.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
@@ -61,15 +61,11 @@ public class AmmoPlugin extends Plugin
@Inject
private ItemManager itemManager;
@Inject
private EventBus eventBus;
private AmmoCounter counterBox;
@Override
protected void startUp() throws Exception
{
eventBus.subscribe(ItemContainerChanged.class, this, this::onItemContainerChanged);
clientThread.invokeLater(() ->
{
@@ -85,12 +81,11 @@ public class AmmoPlugin extends Plugin
@Override
protected void shutDown() throws Exception
{
eventBus.unregister(this);
infoBoxManager.removeInfoBox(counterBox);
counterBox = null;
}
@Subscribe
private void onItemContainerChanged(ItemContainerChanged event)
{
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.Singleton;
import net.runelite.api.Client;
import net.runelite.client.events.ConfigChanged;
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.PluginDescriptor;
@@ -51,9 +51,6 @@ public class AnimationSmoothingPlugin extends Plugin
@Inject
private AnimationSmoothingConfig config;
@Inject
private EventBus eventBus;
@Provides
AnimationSmoothingConfig getConfig(ConfigManager configManager)
{
@@ -63,22 +60,19 @@ public class AnimationSmoothingPlugin extends Plugin
@Override
protected void startUp() throws Exception
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
update();
}
@Override
protected void shutDown() throws Exception
{
eventBus.unregister(this);
client.setInterpolatePlayerAnimations(false);
client.setInterpolateNpcAnimations(false);
client.setInterpolateObjectAnimations(false);
client.setInterpolateWidgetAnimations(false);
}
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
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.client.config.ConfigManager;
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.input.KeyManager;
import net.runelite.client.plugins.Plugin;
@@ -71,15 +71,9 @@ public class AntiDragPlugin extends Plugin
@Inject
private OverlayManager overlayManager;
@Inject
private ConfigManager configManager;
@Inject
private KeyManager keyManager;
@Inject
private EventBus eventBus;
@Provides
AntiDragConfig getConfig(ConfigManager configManager)
{
@@ -96,8 +90,6 @@ public class AntiDragPlugin extends Plugin
protected void startUp() throws Exception
{
overlay.setColor(config.color());
addSubscriptions();
updateConfig();
updateKeyListeners();
@@ -110,8 +102,6 @@ public class AntiDragPlugin extends Plugin
@Override
protected void shutDown() throws Exception
{
eventBus.unregister(this);
client.setInventoryDragDelay(DEFAULT_DELAY);
keyManager.unregisterKeyListener(holdListener);
keyManager.unregisterKeyListener(toggleListener);
@@ -120,13 +110,7 @@ public class AntiDragPlugin extends Plugin
clientUI.resetCursor();
}
private void addSubscriptions()
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(FocusChanged.class, this, this::onFocusChanged);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
}
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
if (event.getGroup().equals("antiDrag"))
@@ -158,6 +142,7 @@ public class AntiDragPlugin extends Plugin
}
}
@Subscribe
private void onGameStateChanged(GameStateChanged event)
{
if (event.getGameState() == GameState.LOGIN_SCREEN)
@@ -179,6 +164,7 @@ public class AntiDragPlugin extends Plugin
this.selectedCursor = config.selectedCursor();
}
@Subscribe
private void onFocusChanged(FocusChanged focusChanged)
{
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.client.Notifier;
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.PluginDescriptor;
@@ -84,8 +84,6 @@ public class AoeWarningPlugin extends Plugin
private BombOverlay bombOverlay;
@Inject
private Client client;
@Inject
private EventBus eventbus;
@Getter(AccessLevel.PACKAGE)
private List<WorldPoint> lightningTrail = new ArrayList<>();
@Getter(AccessLevel.PACKAGE)
@@ -167,7 +165,6 @@ public class AoeWarningPlugin extends Plugin
protected void startUp()
{
updateConfig();
addSubscriptions();
overlayManager.add(coreOverlay);
overlayManager.add(bombOverlay);
reset();
@@ -179,20 +176,9 @@ public class AoeWarningPlugin extends Plugin
overlayManager.remove(coreOverlay);
overlayManager.remove(bombOverlay);
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)
{
if (!event.getGroup().equals("aoe"))
@@ -203,6 +189,7 @@ public class AoeWarningPlugin extends Plugin
updateConfig();
}
@Subscribe
private void onProjectileSpawned(ProjectileSpawned event)
{
final Projectile projectile = event.getProjectile();
@@ -231,6 +218,7 @@ public class AoeWarningPlugin extends Plugin
}
}
@Subscribe
private void onProjectileMoved(ProjectileMoved event)
{
if (projectiles.isEmpty())
@@ -249,6 +237,7 @@ public class AoeWarningPlugin extends Plugin
});
}
@Subscribe
private void onGameObjectSpawned(GameObjectSpawned event)
{
final GameObject gameObject = event.getGameObject();
@@ -283,6 +272,7 @@ public class AoeWarningPlugin extends Plugin
}
}
@Subscribe
private void onGameObjectDespawned(GameObjectDespawned event)
{
final GameObject gameObject = event.getGameObject();
@@ -304,6 +294,7 @@ public class AoeWarningPlugin extends Plugin
}
}
@Subscribe
private void onGameStateChanged(GameStateChanged event)
{
if (event.getGameState() == GameState.LOGGED_IN)
@@ -313,6 +304,7 @@ public class AoeWarningPlugin extends Plugin
reset();
}
@Subscribe
private void onGameTick(GameTick event)
{
lightningTrail.clear();

View File

@@ -30,17 +30,16 @@ import com.google.common.collect.Table;
import com.google.inject.Provides;
import java.util.HashSet;
import java.util.Set;
import javax.annotation.Nullable;
import javax.inject.Inject;
import javax.inject.Singleton;
import lombok.AccessLevel;
import lombok.Getter;
import javax.annotation.Nullable;
import net.runelite.api.Client;
import net.runelite.api.GameState;
import net.runelite.api.Skill;
import net.runelite.api.VarPlayer;
import net.runelite.api.Varbits;
import net.runelite.client.events.ConfigChanged;
import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.VarbitChanged;
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 net.runelite.client.callback.ClientThread;
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.PluginDescriptor;
import static net.runelite.client.plugins.attackstyles.AttackStyle.CASTING;
@@ -90,9 +90,6 @@ public class AttackStylesPlugin extends Plugin
@Inject
private AttackStylesOverlay overlay;
@Inject
private EventBus eventBus;
@Provides
AttackStylesConfig provideConfig(ConfigManager configManager)
{
@@ -114,7 +111,6 @@ public class AttackStylesPlugin extends Plugin
protected void startUp() throws Exception
{
updateConfig();
addSubscriptions();
overlayManager.add(overlay);
@@ -142,24 +138,13 @@ public class AttackStylesPlugin extends Plugin
@Override
protected void shutDown()
{
eventBus.unregister(this);
overlayManager.remove(overlay);
hideWarnedStyles(false);
processWidgets();
hideWidget(client.getWidget(WidgetInfo.COMBAT_AUTO_RETALIATE), false);
}
private void addSubscriptions()
{
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
@Nullable
public AttackStyle getAttackStyle()
{
return attackStyle;
@@ -170,6 +155,7 @@ public class AttackStylesPlugin extends Plugin
return warnedSkillSelected;
}
@Subscribe
private void onWidgetHiddenChanged(WidgetHiddenChanged event)
{
if (event.getWidget().isSelfHidden() || TO_GROUP(event.getWidget().getId()) != COMBAT_GROUP_ID)
@@ -180,6 +166,7 @@ public class AttackStylesPlugin extends Plugin
processWidgets();
}
@Subscribe
private void onWidgetLoaded(WidgetLoaded event)
{
if (event.getGroupId() != COMBAT_GROUP_ID)
@@ -207,6 +194,7 @@ public class AttackStylesPlugin extends Plugin
hideWidget(client.getWidget(WidgetInfo.COMBAT_AUTO_RETALIATE), this.hideAutoRetaliate);
}
@Subscribe
private void onGameStateChanged(GameStateChanged event)
{
if (event.getGameState() == GameState.LOGGED_IN)
@@ -215,6 +203,7 @@ public class AttackStylesPlugin extends Plugin
}
}
@Subscribe
void onVarbitChanged(VarbitChanged event)
{
int currentAttackStyleVarbit = client.getVar(VarPlayer.ATTACK_STYLE);
@@ -240,6 +229,7 @@ public class AttackStylesPlugin extends Plugin
}
}
@Subscribe
void onConfigChanged(ConfigChanged event)
{
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.client.callback.ClientThread;
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.plugins.Plugin;
@@ -95,16 +95,16 @@ public class BankPlugin extends Plugin
);
private static final List<WidgetInfo> BANK_PINS = ImmutableList.of(
WidgetInfo.BANK_PIN_1,
WidgetInfo.BANK_PIN_2,
WidgetInfo.BANK_PIN_3,
WidgetInfo.BANK_PIN_4,
WidgetInfo.BANK_PIN_5,
WidgetInfo.BANK_PIN_6,
WidgetInfo.BANK_PIN_7,
WidgetInfo.BANK_PIN_8,
WidgetInfo.BANK_PIN_9,
WidgetInfo.BANK_PIN_10
WidgetInfo.BANK_PIN_1,
WidgetInfo.BANK_PIN_2,
WidgetInfo.BANK_PIN_3,
WidgetInfo.BANK_PIN_4,
WidgetInfo.BANK_PIN_5,
WidgetInfo.BANK_PIN_6,
WidgetInfo.BANK_PIN_7,
WidgetInfo.BANK_PIN_8,
WidgetInfo.BANK_PIN_9,
WidgetInfo.BANK_PIN_10
);
private static final String DEPOSIT_WORN = "Deposit worn items";
@@ -133,9 +133,6 @@ public class BankPlugin extends Plugin
@Inject
private BankSearch bankSearch;
@Inject
private EventBus eventBus;
@Inject
private ContainerCalculation bankCalculation;
@@ -166,30 +163,18 @@ public class BankPlugin extends Plugin
protected void startUp() throws Exception
{
updateConfig();
addSubscriptions();
searchString = "";
}
@Override
protected void shutDown()
{
eventBus.unregister(this);
clientThread.invokeLater(() -> bankSearch.reset(false));
forceRightClickFlag = false;
itemQuantities = null;
}
private void addSubscriptions()
{
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 = "";
}
@Subscribe
private void onMenuShouldLeftClick(MenuShouldLeftClick event)
{
if (!forceRightClickFlag)
@@ -211,6 +196,7 @@ public class BankPlugin extends Plugin
}
}
@Subscribe
private void onMenuEntryAdded(MenuEntryAdded event)
{
if ((event.getOption().equals(DEPOSIT_WORN) && this.rightClickBankEquip)
@@ -221,6 +207,7 @@ public class BankPlugin extends Plugin
}
}
@Subscribe
private void onScriptCallbackEvent(ScriptCallbackEvent event)
{
if (event.getEventName().equals("bankPinButtons") && this.largePinNumbers)
@@ -265,6 +252,7 @@ public class BankPlugin extends Plugin
}
}
@Subscribe
private void onWidgetLoaded(WidgetLoaded event)
{
if (event.getGroupId() != WidgetID.SEED_VAULT_GROUP_ID || !config.seedVaultValue())
@@ -275,6 +263,7 @@ public class BankPlugin extends Plugin
updateSeedVaultTotal();
}
@Subscribe
public void onVarClientStrChanged(VarClientStrChanged event)
{
String searchVar = client.getVar(VarClientStr.INPUT_TEXT);
@@ -302,6 +291,7 @@ public class BankPlugin extends Plugin
}
}
@Subscribe
public void onItemContainerChanged(ItemContainerChanged event)
{
int containerId = event.getContainerId();
@@ -427,6 +417,7 @@ public class BankPlugin extends Plugin
return itemContainer.getItems();
}
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
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.VarClientInt;
import net.runelite.api.VarClientStr;
import net.runelite.client.events.ConfigChanged;
import net.runelite.api.events.DraggingWidgetChanged;
import net.runelite.api.events.FocusChanged;
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.client.callback.ClientThread;
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.SpriteManager;
import net.runelite.client.game.chatbox.ChatboxPanelManager;
@@ -146,9 +146,6 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis
@Inject
private SpriteManager spriteManager;
@Inject
private EventBus eventBus;
@Inject
private ConfigManager configManager;
@@ -166,7 +163,6 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis
@Override
public void startUp()
{
addSubscriptions();
cleanConfig();
keyManager.registerKeyListener(this);
@@ -231,8 +227,6 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis
@Override
public void shutDown()
{
eventBus.unregister(this);
keyManager.unregisterKeyListener(this);
mouseManager.unregisterMouseWheelListener(this);
clientThread.invokeLater(tabInterface::destroy);
@@ -242,26 +236,14 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis
itemQuantities.clear();
}
private void addSubscriptions()
{
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()
private boolean isSearching()
{
return client.getVar(VarClientInt.INPUT_TYPE) == InputType.SEARCH.getType()
|| (client.getVar(VarClientInt.INPUT_TYPE) <= 0
&& client.getVar(VarClientStr.INPUT_TEXT) != null && client.getVar(VarClientStr.INPUT_TEXT).length() > 0);
}
@Subscribe
private void onScriptCallbackEvent(ScriptCallbackEvent event)
{
String eventName = event.getEventName();
@@ -371,6 +353,7 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis
}
}
@Subscribe
private void onMenuEntryAdded(MenuEntryAdded event)
{
if (event.getParam1() == WidgetInfo.BANK_ITEM_CONTAINER.getId()
@@ -401,6 +384,7 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis
tabInterface.handleAdd(event);
}
@Subscribe
private void onMenuOptionClicked(MenuOptionClicked event)
{
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)
{
if (event.getContainerId() == InventoryID.BANK.getId())
@@ -491,6 +476,7 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis
}
}
@Subscribe
private void onConfigChanged(ConfigChanged configChanged)
{
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)
{
tabInterface.update();
}
@Subscribe
private void onDraggingWidgetChanged(DraggingWidgetChanged event)
{
tabInterface.handleDrag(event.isDraggingWidget(), shiftPressed);
}
@Subscribe
private void onWidgetLoaded(WidgetLoaded event)
{
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)
{
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.QueuedMessage;
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.PluginDescriptor;
@@ -92,9 +92,6 @@ public class BanListPlugin extends Plugin
@Inject
private ChatMessageManager chatMessageManager;
@Inject
private EventBus eventBus;
private String tobNames = "";
private boolean enableWDRScam;
private boolean enableWDRToxic;
@@ -112,7 +109,6 @@ public class BanListPlugin extends Plugin
protected void startUp() throws Exception
{
updateConfig();
addSubscriptions();
manualBans.addAll(Text.fromCSV(Text.standardize(config.getBannedPlayers())));
@@ -123,22 +119,13 @@ public class BanListPlugin extends Plugin
protected void shutDown() throws Exception
{
eventBus.unregister(this);
wdrScamSet.clear();
wdrToxicSet.clear();
runeWatchSet.clear();
manualBans.clear();
}
private void addSubscriptions()
{
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);
}
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
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
*/
@Subscribe
private void onWidgetHiddenChanged(WidgetHiddenChanged widgetHiddenChanged)
{
if (client.getGameState() != GameState.LOGGED_IN
@@ -183,6 +171,7 @@ public class BanListPlugin extends Plugin
});
}
@Subscribe
private void onClanMemberJoined(ClanMemberJoined event)
{
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"
*/
@Subscribe
private void onWidgetLoaded(WidgetLoaded widgetLoaded)
{
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)
{
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.QueuedMessage;
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.input.KeyListener;
@@ -155,9 +155,6 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
@Inject
private KeyManager keyManager;
@Inject
private EventBus eventBus;
@Getter
private boolean inGame = false;
@@ -309,7 +306,6 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
protected void startUp() throws Exception
{
updateConfig();
addSubscriptions();
font = FontManager.getRunescapeFont().deriveFont(Font.BOLD, 24);
torsoImage = itemManager.getImage(ItemID.FIGHTER_TORSO);
@@ -327,8 +323,6 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
@Override
protected void shutDown() throws Exception
{
eventBus.unregister(this);
overlayManager.remove(widgetsOverlay);
overlayManager.remove(sceneOverlay);
keyManager.unregisterKeyListener(this);
@@ -349,25 +343,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
menu.clearHiddenMenus();
}
private void addSubscriptions()
{
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
@Override
public void keyTyped(KeyEvent e)
{
}
@@ -400,6 +376,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
}
}
@Subscribe
private void onConfigChanged(ConfigChanged configChanged)
{
//not client thread be careful
@@ -510,6 +487,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
this.showEggCountOverlay = config.showEggCountOverlay();
}
@Subscribe
private void onWidgetLoaded(WidgetLoaded event)
{
switch (event.getGroupId())
@@ -580,6 +558,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
}
}
@Subscribe
private void onChatMessage(ChatMessage chatMessage)
{
if (!chatMessage.getType().equals(ChatMessageType.GAMEMESSAGE))
@@ -629,7 +608,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
{
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])
{
@@ -663,6 +642,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
}
}
@Subscribe
private void onItemSpawned(ItemSpawned itemSpawned)
{
if (!isInGame())
@@ -682,6 +662,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
}
}
@Subscribe
private void onItemDespawned(ItemDespawned itemDespawned)
{
if (!isInGame())
@@ -732,6 +713,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
}
}
@Subscribe
private void onGameTick(GameTick event)
{
// 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)
{
if (!isInGame())
@@ -785,6 +768,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
}
}
@Subscribe
private void onNpcDespawned(NpcDespawned event)
{
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
// 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.
@Subscribe
private void onBeforeRender(BeforeRender event)
{
if (!isInGame())
@@ -973,6 +958,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
// onMenuEntryAdded is being used for conditional entry changes that are not
// easily achievable using MenuManager, all other changes use MenuManager in
// the BarbarianAssaultMenu/Menus classes
@Subscribe
private void onMenuEntryAdded(MenuEntryAdded event)
{
if (!isInGame())
@@ -1163,6 +1149,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
client.setMenuEntries(menu.toArray(new MenuEntry[0]));
}
@Subscribe
private void onMenuOptionClicked(MenuOptionClicked event)
{
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
@Subscribe
private void onInteractingChanged(InteractingChanged event)
{
if (!isInGame() || getRole() != Role.HEALER)
@@ -1225,11 +1213,12 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
}
else if (StringUtils.equals(opponent.getName(), "Penance Healer"))
{
lastInteracted = ((NPC)opponent).getIndex();
lastInteracted = ((NPC) opponent).getIndex();
}
}
@Subscribe
private void onProjectileSpawned(ProjectileSpawned event)
{
if (!isInGame())
@@ -1246,10 +1235,11 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
String name = target.getName();
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)
{
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.WidgetInfo;
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.SpriteManager;
import net.runelite.client.plugins.Plugin;
@@ -125,9 +125,6 @@ public class BarrowsPlugin extends Plugin
@Inject
private BarrowsConfig config;
@Inject
private EventBus eventBus;
@Provides
BarrowsConfig provideConfig(ConfigManager configManager)
{
@@ -150,7 +147,6 @@ public class BarrowsPlugin extends Plugin
protected void startUp() throws Exception
{
updateConfig();
addSubscriptions();
overlayManager.add(barrowsOverlay);
overlayManager.add(brotherOverlay);
@@ -159,8 +155,6 @@ public class BarrowsPlugin extends Plugin
@Override
protected void shutDown()
{
eventBus.unregister(this);
overlayManager.remove(barrowsOverlay);
overlayManager.remove(brotherOverlay);
walls.clear();
@@ -183,19 +177,7 @@ public class BarrowsPlugin extends Plugin
}
}
private void addSubscriptions()
{
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);
}
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
if (event.getGroup().equals("barrows"))
@@ -219,6 +201,7 @@ public class BarrowsPlugin extends Plugin
this.showPrayerDrainTimer = config.showPrayerDrainTimer();
}
@Subscribe
private void onWallObjectSpawned(WallObjectSpawned event)
{
WallObject wallObject = event.getWallObject();
@@ -228,6 +211,7 @@ public class BarrowsPlugin extends Plugin
}
}
@Subscribe
private void onWallObjectChanged(WallObjectChanged event)
{
WallObject previous = event.getPrevious();
@@ -240,12 +224,14 @@ public class BarrowsPlugin extends Plugin
}
}
@Subscribe
private void onWallObjectDespawned(WallObjectDespawned event)
{
WallObject wallObject = event.getWallObject();
walls.remove(wallObject);
}
@Subscribe
private void onGameObjectSpawned(GameObjectSpawned event)
{
GameObject gameObject = event.getGameObject();
@@ -255,6 +241,7 @@ public class BarrowsPlugin extends Plugin
}
}
@Subscribe
private void onGameObjectChanged(GameObjectChanged event)
{
GameObject previous = event.getPrevious();
@@ -267,12 +254,14 @@ public class BarrowsPlugin extends Plugin
}
}
@Subscribe
private void onGameObjectDespawned(GameObjectDespawned event)
{
GameObject gameObject = event.getGameObject();
ladders.remove(gameObject);
}
@Subscribe
private void onGameStateChanged(GameStateChanged event)
{
if (event.getGameState() == GameState.LOADING)
@@ -297,6 +286,7 @@ public class BarrowsPlugin extends Plugin
}
}
@Subscribe
private void onWidgetLoaded(WidgetLoaded event)
{
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.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.AbstractComparableEntry;
import net.runelite.client.menus.MenuManager;
@@ -99,8 +100,6 @@ public class BlackjackPlugin extends Plugin
@Override
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_MENAPHITE);
this.pickpocketOnAggro = config.pickpocketOnAggro();
@@ -113,10 +112,10 @@ public class BlackjackPlugin extends Plugin
menuManager.removePriorityEntry(PICKPOCKET_MENAPHITE);
menuManager.removePriorityEntry(KNOCKOUT_BANDIT);
menuManager.removePriorityEntry(KNOCKOUT_MENAPHITE);
eventBus.unregister(this);
eventBus.unregister("poll");
}
@Subscribe
private void onGameStateChanged(GameStateChanged event)
{
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);
}
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
if (event.getGroup().equals("blackjack"))
@@ -183,7 +183,7 @@ public class BlackjackPlugin extends Plugin
{
return
Text.removeTags(entry.getTarget(), true).equalsIgnoreCase(this.getTarget()) &&
entry.getOption().equalsIgnoreCase(this.getOption());
entry.getOption().equalsIgnoreCase(this.getOption());
}
}
}

View File

@@ -46,7 +46,7 @@ import net.runelite.api.util.Text;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetInfo;
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.plugins.Plugin;
@@ -97,9 +97,6 @@ public class BlastFurnacePlugin extends Plugin
@Inject
private BlastFurnaceConfig config;
@Inject
private EventBus eventBus;
@Getter(AccessLevel.PACKAGE)
private boolean showConveyorBelt;
@Getter(AccessLevel.PACKAGE)
@@ -109,7 +106,6 @@ public class BlastFurnacePlugin extends Plugin
protected void startUp() throws Exception
{
updateConfig();
addSubscriptions();
overlayManager.add(overlay);
overlayManager.add(cofferOverlay);
@@ -119,8 +115,6 @@ public class BlastFurnacePlugin extends Plugin
@Override
protected void shutDown()
{
eventBus.unregister(this);
infoBoxManager.removeIf(ForemanTimer.class::isInstance);
overlayManager.remove(overlay);
overlayManager.remove(cofferOverlay);
@@ -130,21 +124,13 @@ public class BlastFurnacePlugin extends Plugin
foremanTimer = null;
}
private void addSubscriptions()
{
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
@Provides
BlastFurnaceConfig provideConfig(ConfigManager configManager)
{
return configManager.getConfig(BlastFurnaceConfig.class);
}
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
if (event.getGroup().equals("blastfurnace"))
@@ -153,6 +139,7 @@ public class BlastFurnacePlugin extends Plugin
}
}
@Subscribe
private void onGameObjectSpawned(GameObjectSpawned event)
{
GameObject gameObject = event.getGameObject();
@@ -169,6 +156,7 @@ public class BlastFurnacePlugin extends Plugin
}
}
@Subscribe
private void onGameObjectDespawned(GameObjectDespawned event)
{
GameObject gameObject = event.getGameObject();
@@ -185,6 +173,7 @@ public class BlastFurnacePlugin extends Plugin
}
}
@Subscribe
private void onGameStateChanged(GameStateChanged event)
{
if (event.getGameState() == GameState.LOADING)
@@ -194,6 +183,7 @@ public class BlastFurnacePlugin extends Plugin
}
}
@Subscribe
private void onGameTick(GameTick event)
{
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.WidgetInfo;
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.PluginDescriptor;
import net.runelite.client.ui.overlay.OverlayManager;
@@ -73,9 +73,6 @@ public class BlastMinePlugin extends Plugin
@Inject
private BlastMinePluginConfig config;
@Inject
private EventBus eventBus;
@Provides
BlastMinePluginConfig getConfig(ConfigManager configManager)
{
@@ -99,7 +96,6 @@ public class BlastMinePlugin extends Plugin
protected void startUp() throws Exception
{
updateConfig();
addSubscriptions();
overlayManager.add(blastMineRockOverlay);
overlayManager.add(blastMineOreCountOverlay);
@@ -108,8 +104,6 @@ public class BlastMinePlugin extends Plugin
@Override
protected void shutDown() throws Exception
{
eventBus.unregister(this);
overlayManager.remove(blastMineRockOverlay);
overlayManager.remove(blastMineOreCountOverlay);
final Widget blastMineWidget = client.getWidget(WidgetInfo.BLAST_MINE);
@@ -120,13 +114,7 @@ public class BlastMinePlugin extends Plugin
}
}
private void addSubscriptions()
{
eventBus.subscribe(GameObjectSpawned.class, this, this::onGameObjectSpawned);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventBus.subscribe(GameTick.class, this, this::onGameTick);
}
@Subscribe
private void onGameObjectSpawned(GameObjectSpawned event)
{
final GameObject gameObject = event.getGameObject();
@@ -145,6 +133,7 @@ public class BlastMinePlugin extends Plugin
}
}
@Subscribe
private void onGameStateChanged(GameStateChanged event)
{
if (event.getGameState() == GameState.LOADING)
@@ -153,6 +142,7 @@ public class BlastMinePlugin extends Plugin
}
}
@Subscribe
private void onGameTick(GameTick gameTick)
{
if (rocks.isEmpty())

View File

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

View File

@@ -30,7 +30,7 @@ import javax.inject.Singleton;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.NPC;
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.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
@@ -51,22 +51,18 @@ public class BossTimersPlugin extends Plugin
@Inject
private ItemManager itemManager;
@Inject
private EventBus eventBus;
@Override
protected void startUp() throws Exception
{
eventBus.subscribe(NpcDespawned.class, this, this::onNpcDespawned);
}
@Override
protected void shutDown() throws Exception
{
eventBus.unregister(this);
infoBoxManager.removeIf(t -> t instanceof RespawnTimer);
}
@Subscribe
private void onNpcDespawned(NpcDespawned npcDespawned)
{
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.util.Text;
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.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
@@ -76,9 +76,6 @@ public class BossTimeTrackerPlugin extends Plugin
@Inject
private ConfigManager configManager;
@Inject
private EventBus eventBus;
@Getter
private BossTimeTracker timer;
@@ -90,9 +87,9 @@ public class BossTimeTrackerPlugin extends Plugin
@Override
public void startUp()
{
addSubscriptions();
}
@Subscribe
public void onGameStateChanged(GameStateChanged event)
{
switch (event.getGameState())
@@ -125,6 +122,7 @@ public class BossTimeTrackerPlugin extends Plugin
}
}
@Subscribe
public void onChatMessage(ChatMessage event)
{
if (event.getType() != ChatMessageType.GAMEMESSAGE && event.getType() != ChatMessageType.SPAM)
@@ -242,19 +240,12 @@ public class BossTimeTrackerPlugin extends Plugin
@Override
protected void shutDown() throws Exception
{
eventBus.unregister(this);
removeTimer();
resetConfig();
resetVars();
}
private void addSubscriptions()
{
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventBus.subscribe(ChatMessage.class, this, this::onChatMessage);
}
private void loadConfig()
private void loadConfig()
{
startTime = configManager.getConfiguration(CONFIG_GROUP, CONFIG_TIME, Instant.class);
started = configManager.getConfiguration(CONFIG_GROUP, CONFIG_STARTED, Boolean.class);

View File

@@ -1,10 +1,18 @@
package net.runelite.client.plugins.bronzeman;
import java.awt.image.BufferedImage;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.InputStream;
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.extern.slf4j.Slf4j;
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.WidgetInfo;
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.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
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
@@ -52,9 +52,6 @@ public class BronzemanPlugin extends Plugin
@Inject
private Client client;
@Inject
private EventBus eventBus;
@Inject
private OverlayManager overlayManager;
@@ -74,7 +71,6 @@ public class BronzemanPlugin extends Plugin
@Override
protected void startUp() throws Exception
{
addSubscriptions();
loadUnlockImage();
unlockedItems = new ArrayList<>();
overlayManager.add(bronzemanOverlay);
@@ -83,23 +79,14 @@ public class BronzemanPlugin extends Plugin
@Override
protected void shutDown() throws Exception
{
eventBus.unregister(this);
unlockedItems = null;
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
**/
@Subscribe
public void onGameStateChanged(GameStateChanged e)
{
if (e.getGameState() == GameState.LOGGED_IN)
@@ -111,6 +98,7 @@ public class BronzemanPlugin extends Plugin
/**
* Unlocks all new items that are currently not unlocked
**/
@Subscribe
public void onItemContainerChanged(ItemContainerChanged e)
{
for (Item i : e.getItemContainer().getItems())
@@ -134,6 +122,7 @@ public class BronzemanPlugin extends Plugin
}
}
@Subscribe
public void onWidgetLoaded(WidgetLoaded e)
{
switch (e.getGroupId())
@@ -151,6 +140,7 @@ public class BronzemanPlugin extends Plugin
/**
* Handles greying out items in the GrandExchange
**/
@Subscribe
public void onGameTick(GameTick e)
{
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 net.runelite.api.coords.WorldPoint;
import net.runelite.api.events.ChatMessage;
import net.runelite.client.events.ConfigChanged;
import net.runelite.api.events.GameObjectSpawned;
import net.runelite.api.events.GameTick;
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.callback.ClientThread;
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.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
@@ -107,8 +107,6 @@ public class CannonPlugin extends Plugin
private Client client;
@Inject
private ClientThread clientThread;
@Inject
private EventBus eventbus;
private boolean lock;
private boolean showEmptyCannonNotification;
private boolean showInfobox;
@@ -131,7 +129,6 @@ public class CannonPlugin extends Plugin
protected void startUp() throws Exception
{
updateConfig();
addSubscriptions();
overlayManager.add(cannonOverlay);
overlayManager.add(cannonSpotOverlay);
@@ -141,8 +138,6 @@ public class CannonPlugin extends Plugin
@Override
protected void shutDown() throws Exception
{
eventbus.unregister(this);
cannonSpotOverlay.setHidden(true);
overlayManager.remove(cannonOverlay);
overlayManager.remove(cannonSpotOverlay);
@@ -155,16 +150,7 @@ public class CannonPlugin extends Plugin
spotPoints.clear();
}
private void addSubscriptions()
{
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);
}
@Subscribe
private void onItemContainerChanged(ItemContainerChanged event)
{
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));
}
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
if (event.getGroup().equals("cannon"))
@@ -196,8 +183,8 @@ public class CannonPlugin extends Plugin
}
@Schedule(
period = 1,
unit = ChronoUnit.SECONDS
period = 1,
unit = ChronoUnit.SECONDS
)
public void checkSpots()
{
@@ -218,6 +205,7 @@ public class CannonPlugin extends Plugin
}
}
@Subscribe
private void onGameObjectSpawned(GameObjectSpawned event)
{
final GameObject gameObject = event.getGameObject();
@@ -232,6 +220,7 @@ public class CannonPlugin extends Plugin
}
}
@Subscribe
private void onProjectileSpawned(ProjectileSpawned event)
{
final Projectile projectile = event.getProjectile();
@@ -247,6 +236,7 @@ public class CannonPlugin extends Plugin
}
}
@Subscribe
private void onChatMessage(ChatMessage event)
{
if (event.getType() != ChatMessageType.SPAM && event.getType() != ChatMessageType.GAMEMESSAGE)
@@ -330,6 +320,7 @@ public class CannonPlugin extends Plugin
}
}
@Subscribe
private void onGameTick(GameTick event)
{
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.NpcDespawned;
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.PluginDescriptor;
import net.runelite.client.ui.overlay.OverlayManager;
@@ -59,33 +59,20 @@ public class CerberusPlugin extends Plugin
@Inject
private CerberusOverlay overlay;
@Inject
private EventBus eventBus;
@Override
protected void startUp() throws Exception
{
overlayManager.add(overlay);
addSubscriptions();
}
@Override
protected void shutDown() throws Exception
{
eventBus.unregister(this);
overlayManager.remove(overlay);
ghosts.clear();
}
private void addSubscriptions()
{
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);
}
@Subscribe
private void onGameStateChanged(GameStateChanged event)
{
GameState gameState = event.getGameState();
@@ -95,17 +82,20 @@ public class CerberusPlugin extends Plugin
}
}
@Subscribe
private void onNpcSpawned(final NpcSpawned event)
{
final NPC npc = event.getNpc();
CerberusGhost.fromNPC(npc).ifPresent(ghost -> ghosts.add(npc));
}
@Subscribe
private void onNpcDespawned(final NpcDespawned event)
{
ghosts.remove(event.getNpc());
}
@Subscribe
void onGameTick(GameTick gameTick)
{
if (ghosts.isEmpty())

View File

@@ -38,7 +38,7 @@ import net.runelite.api.widgets.WidgetSizeMode;
import net.runelite.api.widgets.WidgetType;
import net.runelite.client.callback.ClientThread;
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.PluginDescriptor;
@@ -55,14 +55,10 @@ public class ChatboxPerformancePlugin extends Plugin
@Inject
private ClientThread clientThread;
@Inject
private EventBus eventBus;
@Inject
private ChatboxPerformanceConfig config;
private boolean transparentChatBox;
@Subscribe
public void onConfigChanged(ConfigChanged event)
{
if (event.getGroup().equals("chatboxperformance"))
@@ -80,7 +76,6 @@ public class ChatboxPerformancePlugin extends Plugin
@Override
public void startUp()
{
addSubscriptions();
if (client.getGameState() == GameState.LOGGED_IN)
{
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));
}
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)
{
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.VarbitChanged;
import net.runelite.api.events.WidgetLoaded;
import static net.runelite.api.util.Text.sanitize;
import net.runelite.api.vars.AccountType;
import net.runelite.api.widgets.Widget;
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.ChatMessageManager;
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.game.ItemManager;
import net.runelite.client.input.KeyManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
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.Duels;
import net.runelite.http.api.hiscore.HiscoreClient;
@@ -145,13 +145,9 @@ public class ChatCommandsPlugin extends Plugin
@Inject
private ChatKeyboardListener chatKeyboardListener;
@Inject
private EventBus eventBus;
@Override
public void startUp()
{
addSubscriptions();
keyManager.registerKeyListener(chatKeyboardListener);
@@ -170,8 +166,6 @@ public class ChatCommandsPlugin extends Plugin
@Override
public void shutDown()
{
eventBus.unregister(this);
lastBossKill = null;
keyManager.unregisterKeyListener(chatKeyboardListener);
@@ -188,15 +182,7 @@ public class ChatCommandsPlugin extends Plugin
chatCommandManager.unregisterCommand(DUEL_ARENA_COMMAND);
}
private void addSubscriptions()
{
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
@Provides
ChatCommandsConfig provideConfig(ConfigManager configManager)
{
return configManager.getConfig(ChatCommandsConfig.class);
@@ -228,6 +214,7 @@ public class ChatCommandsPlugin extends Plugin
return personalBest == null ? 0 : personalBest;
}
@Subscribe
void onChatMessage(ChatMessage chatMessage)
{
if (chatMessage.getType() != ChatMessageType.TRADE
@@ -361,6 +348,7 @@ public class ChatCommandsPlugin extends Plugin
}
}
@Subscribe
private void onGameTick(GameTick event)
{
if (!logKills)
@@ -397,6 +385,7 @@ public class ChatCommandsPlugin extends Plugin
}
}
@Subscribe
private void onWidgetLoaded(WidgetLoaded widget)
{
// 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;
}
@Subscribe
private void onVarbitChanged(VarbitChanged varbitChanged)
{
hiscoreEndpoint = getLocalHiscoreEndpointType();
@@ -446,6 +436,7 @@ public class ChatCommandsPlugin extends Plugin
return true;
}
@Subscribe
private void killCountLookup(ChatMessage chatMessage, String message)
{
if (!config.killcount())
@@ -533,6 +524,7 @@ public class ChatCommandsPlugin extends Plugin
return true;
}
@Subscribe
private void duelArenaLookup(ChatMessage chatMessage, String message)
{
if (!config.duels())
@@ -590,6 +582,7 @@ public class ChatCommandsPlugin extends Plugin
client.refreshChat();
}
@Subscribe
private void questPointsLookup(ChatMessage chatMessage, String message)
{
if (!config.qp())
@@ -658,6 +651,7 @@ public class ChatCommandsPlugin extends Plugin
return true;
}
@Subscribe
private void gambleCountLookup(ChatMessage chatMessage, String message)
{
if (!config.gc())
@@ -729,6 +723,7 @@ public class ChatCommandsPlugin extends Plugin
}
@Subscribe
private void personalBestLookup(ChatMessage chatMessage, String message)
{
if (!config.pb())
@@ -825,6 +820,7 @@ public class ChatCommandsPlugin extends Plugin
* @param chatMessage The chat message containing the command.
* @param message The chat message
*/
@Subscribe
private void itemPriceLookup(ChatMessage chatMessage, String message)
{
if (!config.price())
@@ -896,6 +892,7 @@ public class ChatCommandsPlugin extends Plugin
* @param chatMessage The chat message containing the command.
* @param message The chat message
*/
@Subscribe
private void playerSkillLookup(ChatMessage chatMessage, String message)
{
if (!config.lvl())
@@ -970,6 +967,7 @@ public class ChatCommandsPlugin extends Plugin
}
}
@Subscribe
private void combatLevelLookup(ChatMessage chatMessage, String message)
{
if (!config.lvl())
@@ -1055,6 +1053,7 @@ public class ChatCommandsPlugin extends Plugin
}
}
@Subscribe
private void clueLookup(ChatMessage chatMessage, String message)
{
if (!config.clue())

View File

@@ -42,12 +42,12 @@ import net.runelite.api.ChatMessageType;
import net.runelite.api.Client;
import net.runelite.api.MessageNode;
import net.runelite.api.Player;
import net.runelite.client.events.ConfigChanged;
import net.runelite.api.events.OverheadTextChanged;
import net.runelite.api.events.ScriptCallbackEvent;
import net.runelite.api.util.Text;
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.PluginDescriptor;
import org.apache.commons.lang3.StringUtils;
@@ -76,9 +76,6 @@ public class ChatFilterPlugin extends Plugin
@Inject
private ChatFilterConfig config;
@Inject
private EventBus eventBus;
@Setter(AccessLevel.PACKAGE)
private ChatFilterType filterType;
@Setter(AccessLevel.PACKAGE)
@@ -100,7 +97,6 @@ public class ChatFilterPlugin extends Plugin
protected void startUp() throws Exception
{
updateConfig();
addSubscriptions();
updateFilteredPatterns();
client.refreshChat();
@@ -109,19 +105,11 @@ public class ChatFilterPlugin extends Plugin
@Override
protected void shutDown() throws Exception
{
eventBus.unregister(this);
filteredPatterns.clear();
client.refreshChat();
}
private void addSubscriptions()
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(ScriptCallbackEvent.class, this, this::onScriptCallbackEvent);
eventBus.subscribe(OverheadTextChanged.class, this, this::onOverheadTextChanged);
}
@Subscribe
private void onScriptCallbackEvent(ScriptCallbackEvent event)
{
if (!"chatFilterCheck".equals(event.getEventName()))
@@ -185,6 +173,7 @@ public class ChatFilterPlugin extends Plugin
}
}
@Subscribe
private void onOverheadTextChanged(OverheadTextChanged event)
{
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);
}
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
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.QueuedMessage;
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.input.KeyListener;
import net.runelite.client.input.KeyManager;
@@ -85,9 +85,6 @@ public class ChatHistoryPlugin extends Plugin implements KeyListener
@Inject
private ChatMessageManager chatMessageManager;
@Inject
private EventBus eventBus;
private boolean retainChatHistory;
private boolean pmTargetCycling;
@@ -101,7 +98,6 @@ public class ChatHistoryPlugin extends Plugin implements KeyListener
protected void startUp()
{
updateConfig();
addSubscriptions();
messageQueue = EvictingQueue.create(100);
friends = new ArrayDeque<>(FRIENDS_MAX_SIZE + 1);
@@ -111,8 +107,6 @@ public class ChatHistoryPlugin extends Plugin implements KeyListener
@Override
protected void shutDown()
{
eventBus.unregister(this);
messageQueue.clear();
messageQueue = null;
friends.clear();
@@ -120,13 +114,7 @@ public class ChatHistoryPlugin extends Plugin implements KeyListener
keyManager.unregisterKeyListener(this);
}
private void addSubscriptions()
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(ChatMessage.class, this, this::onChatMessage);
eventBus.subscribe(MenuOptionClicked.class, this, this::onMenuOptionClicked);
}
@Subscribe
private void onChatMessage(ChatMessage chatMessage)
{
// 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)
{
String menuOption = event.getOption();
@@ -280,6 +269,7 @@ public class ChatHistoryPlugin extends Plugin implements KeyListener
return friends.getLast();
}
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
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.ChatMessageManager;
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.PluginDescriptor;
@@ -73,9 +73,6 @@ public class ChatNotificationsPlugin extends Plugin
@Inject
private Notifier notifier;
@Inject
private EventBus eventBus;
//Custom Highlights
private Pattern usernameMatcher = null;
private String usernameReplacer = "";
@@ -102,7 +99,6 @@ public class ChatNotificationsPlugin extends Plugin
public void startUp()
{
updateConfig();
addSubscriptions();
updateHighlights();
}
@@ -110,18 +106,10 @@ public class ChatNotificationsPlugin extends Plugin
@Override
public void shutDown()
{
eventBus.unregister(this);
this.privateMessageHashes.clear();
}
private void addSubscriptions()
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventBus.subscribe(ChatMessage.class, this, this::onChatMessage);
}
@Subscribe
private void onGameStateChanged(GameStateChanged event)
{
switch (event.getGameState())
@@ -133,6 +121,7 @@ public class ChatNotificationsPlugin extends Plugin
}
}
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
if (event.getGroup().equals("chatnotification"))
@@ -159,6 +148,7 @@ public class ChatNotificationsPlugin extends Plugin
}
}
@Subscribe
void onChatMessage(ChatMessage chatMessage)
{
MessageNode messageNode = chatMessage.getMessageNode();
@@ -280,6 +270,7 @@ public class ChatNotificationsPlugin extends Plugin
return (message.getName() + message.getMessage()).hashCode();
}
@Subscribe
private void sendNotification(ChatMessage message)
{
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.config.ConfigManager;
import net.runelite.client.eventbus.EventBus;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.input.KeyListener;
import net.runelite.client.input.KeyManager;
@@ -84,8 +85,6 @@ public class ChatTranslationPlugin extends Plugin implements KeyListener
@Override
protected void startUp() throws Exception
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
translator.setInLang(config.publicTargetLanguage());
translator.setOutLang(config.playerTargetLanguage());
@@ -115,7 +114,6 @@ public class ChatTranslationPlugin extends Plugin implements KeyListener
@Override
protected void shutDown() throws Exception
{
eventBus.unregister(this);
eventBus.unregister(OPTION);
eventBus.unregister(PUBLIC);
menuManager.removePlayerMenuItem(TRANSLATE);
@@ -123,6 +121,7 @@ public class ChatTranslationPlugin extends Plugin implements KeyListener
playerNames.clear();
}
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
if (!event.getGroup().equals("chattranslation"))
@@ -227,6 +226,7 @@ public class ChatTranslationPlugin extends Plugin implements KeyListener
config.playerNames(Text.toCSV(playerNames));
}
@Subscribe
private void onChatMessage(ChatMessage chatMessage)
{
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.ClanMemberJoined;
import net.runelite.api.events.ClanMemberLeft;
import net.runelite.client.events.ConfigChanged;
import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.GameTick;
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.chat.ChatMessageBuilder;
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.SpriteManager;
import net.runelite.client.plugins.Plugin;
@@ -114,9 +114,6 @@ public class ClanChatPlugin extends Plugin
@Inject
private ClientThread clientThread;
@Inject
private EventBus eventBus;
private List<String> chats = new ArrayList<>();
@SuppressWarnings("unchecked")
@@ -155,7 +152,6 @@ public class ClanChatPlugin extends Plugin
public void startUp()
{
updateConfig();
addSubscriptions();
chats = new ArrayList<>(Text.fromCSV(this.chatsData));
}
@@ -163,28 +159,12 @@ public class ClanChatPlugin extends Plugin
@Override
public void shutDown()
{
eventBus.unregister(this);
clanMembers.clear();
removeClanCounter();
resetClanChats();
}
private void addSubscriptions()
{
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);
}
@Subscribe
private void onConfigChanged(ConfigChanged configChanged)
{
if (configChanged.getGroup().equals("clanchat"))
@@ -207,6 +187,7 @@ public class ClanChatPlugin extends Plugin
}
}
@Subscribe
private void onClanMemberJoined(ClanMemberJoined event)
{
final ClanMember member = event.getMember();
@@ -252,6 +233,7 @@ public class ClanChatPlugin extends Plugin
}
}
@Subscribe
private void onClanMemberLeft(ClanMemberLeft event)
{
final ClanMember member = event.getMember();
@@ -295,6 +277,7 @@ public class ClanChatPlugin extends Plugin
}
}
@Subscribe
private void onGameTick(GameTick gameTick)
{
if (client.getGameState() != GameState.LOGGED_IN)
@@ -434,6 +417,7 @@ public class ClanChatPlugin extends Plugin
clanJoinMessages.addLast(clanJoinMessage);
}
@Subscribe
private void onVarClientStrChanged(VarClientStrChanged strChanged)
{
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)
{
if (client.getGameState() != GameState.LOADING && client.getGameState() != GameState.LOGGED_IN)
@@ -483,6 +468,7 @@ public class ClanChatPlugin extends Plugin
insertClanRankIcon(chatMessage);
}
@Subscribe
private void onGameStateChanged(GameStateChanged state)
{
GameState gameState = state.getGameState();
@@ -496,6 +482,7 @@ public class ClanChatPlugin extends Plugin
}
}
@Subscribe
private void onPlayerSpawned(PlayerSpawned event)
{
final Player local = client.getLocalPlayer();
@@ -508,6 +495,7 @@ public class ClanChatPlugin extends Plugin
}
}
@Subscribe
private void onPlayerDespawned(PlayerDespawned event)
{
if (clanMembers.remove(event.getPlayer()) && clanMembers.isEmpty())
@@ -516,6 +504,7 @@ public class ClanChatPlugin extends Plugin
}
}
@Subscribe
private void onClanChanged(ClanChanged event)
{
if (event.isJoined())
@@ -531,6 +520,7 @@ public class ClanChatPlugin extends Plugin
activityBuffer.clear();
}
@Subscribe
private void onScriptCallbackEvent(ScriptCallbackEvent scriptCallbackEvent)
{
if (!scriptCallbackEvent.getEventName().equalsIgnoreCase("clanchatInput"))
@@ -548,6 +538,7 @@ public class ClanChatPlugin extends Plugin
return clanMembers.size();
}
@Subscribe
private void insertClanRankIcon(final ChatMessage message)
{
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.GameTick;
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.PluginDescriptor;
@@ -52,9 +52,6 @@ public class ClanManModePlugin extends Plugin
@Inject
private Client client;
@Inject
private EventBus eventBus;
@Getter(AccessLevel.PACKAGE)
private boolean highlightAttackable;
@Getter(AccessLevel.PACKAGE)
@@ -103,8 +100,7 @@ public class ClanManModePlugin extends Plugin
protected void startUp() throws Exception
{
updateConfig();
addSubscriptions();
overlayManager.add(ClanManModeOverlay);
overlayManager.add(ClanManModeTileOverlay);
overlayManager.add(ClanManModeMinimapOverlay);
@@ -113,8 +109,6 @@ public class ClanManModePlugin extends Plugin
@Override
protected void shutDown() throws Exception
{
eventBus.unregister(this);
overlayManager.remove(ClanManModeOverlay);
overlayManager.remove(ClanManModeTileOverlay);
overlayManager.remove(ClanManModeMinimapOverlay);
@@ -126,23 +120,18 @@ public class ClanManModePlugin extends Plugin
inwildy = 0;
}
private void addSubscriptions()
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventBus.subscribe(GameTick.class, this, this::onGameTick);
}
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
if (!"clanmanmode".equals(event.getGroup()))
{
return;
}
updateConfig();
}
@Subscribe
private void onGameStateChanged(GameStateChanged gameStateChanged)
{
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)
{
ticks++;
@@ -170,7 +160,7 @@ public class ClanManModePlugin extends Plugin
clanmax = Collections.max(clan.values());
}
}
private void updateConfig()
{
this.highlightAttackable = config.highlightAttackable();

View File

@@ -60,7 +60,6 @@ import net.runelite.api.TileObject;
import net.runelite.api.coords.LocalPoint;
import net.runelite.api.coords.WorldPoint;
import net.runelite.api.events.ChatMessage;
import net.runelite.client.events.ConfigChanged;
import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.GameTick;
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.NpcSpawned;
import net.runelite.api.events.WidgetLoaded;
import net.runelite.api.util.Text;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetID;
import net.runelite.api.widgets.WidgetInfo;
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.plugins.Plugin;
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.util.ImageUtil;
import net.runelite.client.util.ItemUtil;
import net.runelite.api.util.Text;
@PluginDescriptor(
name = "Clue Scroll",
@@ -166,9 +166,6 @@ public class ClueScrollPlugin extends Plugin
@Inject
private WorldMapPointManager worldMapPointManager;
@Inject
private EventBus eventBus;
private BufferedImage emoteImage;
private BufferedImage mapArrow;
private Integer clueItemId;
@@ -193,7 +190,6 @@ public class ClueScrollPlugin extends Plugin
@Override
protected void startUp() throws Exception
{
addSubscriptions();
this.displayHintArrows = config.displayHintArrows();
overlayManager.add(clueScrollOverlay);
@@ -205,8 +201,6 @@ public class ClueScrollPlugin extends Plugin
@Override
protected void shutDown() throws Exception
{
eventBus.unregister(this);
overlayManager.remove(clueScrollOverlay);
overlayManager.remove(clueScrollEmoteOverlay);
overlayManager.remove(clueScrollWorldOverlay);
@@ -217,19 +211,7 @@ public class ClueScrollPlugin extends Plugin
resetClue(true);
}
private void addSubscriptions()
{
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);
}
@Subscribe
private void onChatMessage(ChatMessage event)
{
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)
{
if ("read".equalsIgnoreCase(event.getOption()))
@@ -269,6 +252,7 @@ public class ClueScrollPlugin extends Plugin
}
}
@Subscribe
private void onItemContainerChanged(final ItemContainerChanged event)
{
if (event.getItemContainer() == client.getItemContainer(InventoryID.EQUIPMENT))
@@ -309,12 +293,14 @@ public class ClueScrollPlugin extends Plugin
}
}
@Subscribe
private void onNpcSpawned(final NpcSpawned event)
{
final NPC npc = event.getNpc();
checkClueNPCs(clue, npc);
}
@Subscribe
private void onNpcDespawned(final NpcDespawned event)
{
final boolean removed = npcsToMark.remove(event.getNpc());
@@ -333,6 +319,7 @@ public class ClueScrollPlugin extends Plugin
}
}
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
if (event.getGroup().equals("cluescroll"))
@@ -345,6 +332,7 @@ public class ClueScrollPlugin extends Plugin
}
}
@Subscribe
private void onGameStateChanged(final GameStateChanged event)
{
if (event.getGameState() == GameState.LOGIN_SCREEN)
@@ -353,6 +341,7 @@ public class ClueScrollPlugin extends Plugin
}
}
@Subscribe
private void onGameTick(final GameTick event)
{
objectsToMark.clear();
@@ -431,6 +420,7 @@ public class ClueScrollPlugin extends Plugin
updateClue(findClueScroll());
}
@Subscribe
private void onWidgetLoaded(WidgetLoaded event)
{
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.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.PluginDescriptor;
@@ -63,15 +64,15 @@ import net.runelite.client.plugins.PluginType;
import net.runelite.client.ui.overlay.OverlayManager;
@PluginDescriptor(
name = "Tick Counter",
description = "Count the amount of perfect combat ticks performed by each player.",
tags = {"combat", "counter", "tick"},
type = PluginType.UTILITY,
enabledByDefault = false
name = "Tick Counter",
description = "Count the amount of perfect combat ticks performed by each player.",
tags = {"combat", "counter", "tick"},
type = PluginType.UTILITY,
enabledByDefault = false
)
@Singleton
@Slf4j
public class CombatCounter extends Plugin
public class CombatCounter extends Plugin
{
@Inject
@@ -266,7 +267,6 @@ public class CombatCounter extends Plugin
private void addSubscriptions()
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(AnimationChanged.class, this, this::onAnimationChanged);
eventBus.subscribe(GameTick.class, this, this::onGameTick);
eventBus.subscribe(HitsplatApplied.class, this, this::onHitsplatApplied);
@@ -422,7 +422,7 @@ public class CombatCounter extends Plugin
{
boolean prevInstance = instanced;
instanced = client.isInInstancedRegion();
if (!prevInstance && instanced)
if (!prevInstance && instanced)
{
this.counter.clear();
this.blowpipe.clear();
@@ -654,6 +654,7 @@ public class CombatCounter extends Plugin
return 2 + (int) Math.floor((3d + distance) / 6d);
}
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
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.Skill;
import net.runelite.api.WorldType;
import net.runelite.client.events.ConfigChanged;
import net.runelite.api.events.GameTick;
import net.runelite.api.events.ScriptCallbackEvent;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.callback.ClientThread;
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.PluginDescriptor;
import net.runelite.client.ui.overlay.OverlayManager;
@@ -84,9 +84,6 @@ public class CombatLevelPlugin extends Plugin
@Inject
private OverlayManager overlayManager;
@Inject
private EventBus eventBus;
@Getter(AccessLevel.PACKAGE)
private boolean showLevelsUntil;
private boolean wildernessAttackLevelRange;
@@ -101,7 +98,6 @@ public class CombatLevelPlugin extends Plugin
protected void startUp() throws Exception
{
updateConfig();
addSubscriptions();
overlayManager.add(overlay);
@@ -114,8 +110,6 @@ public class CombatLevelPlugin extends Plugin
@Override
protected void shutDown() throws Exception
{
eventBus.unregister(this);
overlayManager.remove(overlay);
Widget combatLevelWidget = client.getWidget(WidgetInfo.COMBAT_LEVEL);
@@ -132,13 +126,7 @@ public class CombatLevelPlugin extends Plugin
shutDownAttackLevelRange();
}
private void addSubscriptions()
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(GameTick.class, this, this::onGameTick);
eventBus.subscribe(ScriptCallbackEvent.class, this, this::onScriptCallbackEvent);
}
@Subscribe
private void onGameTick(GameTick event)
{
if (client.getGameState() != GameState.LOGGED_IN)
@@ -165,6 +153,7 @@ public class CombatLevelPlugin extends Plugin
combatLevelWidget.setText("Combat Lvl: " + DECIMAL_FORMAT.format(combatLevelPrecise));
}
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
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)
{
if (this.wildernessAttackLevelRange

View File

@@ -35,9 +35,9 @@ import net.runelite.client.RuneLite;
import net.runelite.client.callback.ClientThread;
import net.runelite.client.config.ChatColorConfig;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.config.RuneLiteConfig;
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.PluginChanged;
import net.runelite.client.plugins.Plugin;
@@ -84,16 +84,12 @@ public class ConfigPlugin extends Plugin
@Inject
private ColorPickerManager colorPickerManager;
@Inject
private EventBus eventBus;
private ConfigPanel configPanel;
private NavigationButton navButton;
@Override
protected void startUp() throws Exception
{
addSubscriptions();
configPanel = new ConfigPanel(pluginManager, configManager, executorService, runeLiteConfig, OpenOSRSConfig, chatColorConfig, colorPickerManager);
@@ -112,8 +108,6 @@ public class ConfigPlugin extends Plugin
@Override
public void shutDown() throws Exception
{
eventBus.unregister(this);
clientToolbar.removeNavigation(navButton);
RuneLite.getInjector().getInstance(ClientThread.class).invokeLater(() ->
{
@@ -133,17 +127,13 @@ public class ConfigPlugin extends Plugin
});
}
private void addSubscriptions()
{
eventBus.subscribe(PluginChanged.class, this, this::onPluginChanged);
eventBus.subscribe(OverlayMenuClicked.class, this, this::onOverlayMenuClicked);
}
@Subscribe
private void onPluginChanged(PluginChanged event)
{
SwingUtilities.invokeLater(configPanel::refreshPluginList);
}
@Subscribe
private void onOverlayMenuClicked(OverlayMenuClicked overlayMenuClicked)
{
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.SpotAnimationChanged;
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.OverlayMenuClicked;
import net.runelite.client.game.ItemManager;
@@ -83,9 +83,6 @@ public class CookingPlugin extends Plugin
@Inject
private ItemManager itemManager;
@Inject
private EventBus eventBus;
@Getter(AccessLevel.PACKAGE)
private CookingSession session;
@@ -103,7 +100,6 @@ public class CookingPlugin extends Plugin
protected void startUp() throws Exception
{
updateConfig();
addSubscriptions();
session = null;
overlayManager.add(overlay);
@@ -112,22 +108,12 @@ public class CookingPlugin extends Plugin
@Override
protected void shutDown() throws Exception
{
eventBus.unregister(this);
infoBoxManager.removeIf(FermentTimer.class::isInstance);
overlayManager.remove(overlay);
session = null;
}
private void addSubscriptions()
{
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);
}
@Subscribe
private void onOverlayMenuClicked(OverlayMenuClicked overlayMenuClicked)
{
OverlayMenuEntry overlayMenuEntry = overlayMenuClicked.getEntry();
@@ -139,6 +125,7 @@ public class CookingPlugin extends Plugin
}
}
@Subscribe
private void onGameTick(GameTick gameTick)
{
if (session == null || this.statTimeout == 0)
@@ -155,6 +142,7 @@ public class CookingPlugin extends Plugin
}
}
@Subscribe
void onSpotAnimationChanged(SpotAnimationChanged graphicChanged)
{
Player player = client.getLocalPlayer();
@@ -184,6 +172,7 @@ public class CookingPlugin extends Plugin
}
}
@Subscribe
void onChatMessage(ChatMessage event)
{
if (event.getType() != ChatMessageType.SPAM)
@@ -221,6 +210,7 @@ public class CookingPlugin extends Plugin
}
}
@Subscribe
private void onConfigChanged(ConfigChanged configChanged)
{
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.QueuedMessage;
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.PluginDescriptor;
@@ -100,9 +100,6 @@ public class CorpPlugin extends Plugin
@Inject
private CorpConfig config;
@Inject
private EventBus eventBus;
private boolean leftClickCore;
@Getter(AccessLevel.PACKAGE)
private boolean showDamage;
@@ -117,7 +114,6 @@ public class CorpPlugin extends Plugin
protected void startUp() throws Exception
{
updateConfig();
addSubscriptions();
overlayManager.add(corpOverlay);
overlayManager.add(coreOverlay);
@@ -126,8 +122,6 @@ public class CorpPlugin extends Plugin
@Override
protected void shutDown() throws Exception
{
eventBus.unregister(this);
overlayManager.remove(corpOverlay);
overlayManager.remove(coreOverlay);
@@ -137,17 +131,7 @@ public class CorpPlugin extends Plugin
players.clear();
}
private void addSubscriptions()
{
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);
}
@Subscribe
private void onGameStateChanged(GameStateChanged gameStateChanged)
{
if (gameStateChanged.getGameState() == GameState.LOADING)
@@ -156,6 +140,7 @@ public class CorpPlugin extends Plugin
}
}
@Subscribe
private void onNpcSpawned(NpcSpawned npcSpawned)
{
NPC npc = npcSpawned.getNpc();
@@ -175,6 +160,7 @@ public class CorpPlugin extends Plugin
}
}
@Subscribe
private void onNpcDespawned(NpcDespawned npcDespawned)
{
NPC npc = npcDespawned.getNpc();
@@ -211,6 +197,7 @@ public class CorpPlugin extends Plugin
}
}
@Subscribe
private void onHitsplatApplied(HitsplatApplied hitsplatApplied)
{
Actor actor = hitsplatApplied.getActor();
@@ -229,6 +216,7 @@ public class CorpPlugin extends Plugin
totalDamage += hitsplatApplied.getHitsplat().getAmount();
}
@Subscribe
private void onInteractingChanged(InteractingChanged interactingChanged)
{
Actor source = interactingChanged.getSource();
@@ -242,6 +230,7 @@ public class CorpPlugin extends Plugin
players.add(source);
}
@Subscribe
private void onMenuEntryAdded(MenuEntryAdded event)
{
if (event.getOpcode() != NPC_SECOND_OPTION.getId()
@@ -261,6 +250,7 @@ public class CorpPlugin extends Plugin
event.setModified();
}
@Subscribe
private void onConfigChanged(ConfigChanged configChanged)
{
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.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.PluginDescriptor;
@@ -162,7 +163,6 @@ public class CoxPlugin extends Plugin
protected void startUp()
{
updateConfig();
addSubscriptions();
overlayManager.add(coxOverlay);
overlayManager.add(coxInfoBox);
handCripple = false;
@@ -178,22 +178,11 @@ public class CoxPlugin extends Plugin
@Override
protected void shutDown()
{
eventBus.unregister(this);
overlayManager.remove(coxOverlay);
overlayManager.remove(coxInfoBox);
}
private void addSubscriptions()
{
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);
}
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
if (event.getGroup().equals("Cox"))
@@ -202,6 +191,7 @@ public class CoxPlugin extends Plugin
}
}
@Subscribe
private void onChatMessage(ChatMessage event)
{
if (!inRaid())
@@ -274,6 +264,7 @@ public class CoxPlugin extends Plugin
}
}
@Subscribe
private void onProjectileSpawned(ProjectileSpawned event)
{
if (!inRaid())
@@ -299,6 +290,7 @@ public class CoxPlugin extends Plugin
}
}
@Subscribe
private void onSpotAnimationChanged(SpotAnimationChanged event)
{
if (!inRaid())
@@ -332,6 +324,7 @@ public class CoxPlugin extends Plugin
}
}
@Subscribe
private void onNpcSpawned(NpcSpawned event)
{
if (!inRaid())
@@ -376,6 +369,7 @@ public class CoxPlugin extends Plugin
}
}
@Subscribe
private void onNpcDespawned(NpcDespawned event)
{
if (!inRaid())
@@ -423,6 +417,7 @@ public class CoxPlugin extends Plugin
}
}
@Subscribe
private void onGameTick(GameTick event)
{
if (!inRaid())

View File

@@ -36,7 +36,7 @@ import javax.sound.sampled.LineUnavailableException;
import javax.sound.sampled.UnsupportedAudioFileException;
import lombok.extern.slf4j.Slf4j;
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.PluginDescriptor;
@@ -57,9 +57,6 @@ public class CustomCursorPlugin extends Plugin
@Inject
private CustomCursorConfig config;
@Inject
private EventBus eventBus;
private Clip skillSpecsRage;
private int volume = 35;
@@ -72,7 +69,6 @@ public class CustomCursorPlugin extends Plugin
@Override
protected void startUp()
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
updateCursor();
try (AudioInputStream ais = AudioSystem.getAudioInputStream(this.getClass().getResourceAsStream("specs-rage.wav")))
@@ -93,11 +89,10 @@ public class CustomCursorPlugin extends Plugin
@Override
protected void shutDown()
{
eventBus.unregister(this);
clientUI.resetCursor();
}
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
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.QueuedMessage;
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.PluginDescriptor;
@@ -80,9 +80,6 @@ public class DailyTasksPlugin extends Plugin
@Inject
private ChatMessageManager chatMessageManager;
@Inject
private EventBus eventBus;
private long lastReset;
private boolean loggingIn;
@@ -106,7 +103,6 @@ public class DailyTasksPlugin extends Plugin
public void startUp()
{
updateConfig();
addSubscriptions();
loggingIn = true;
}
@@ -114,19 +110,10 @@ public class DailyTasksPlugin extends Plugin
@Override
public void shutDown()
{
eventBus.unregister(this);
eventBus.unregister(this);
lastReset = 0L;
}
private void addSubscriptions()
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventBus.subscribe(GameTick.class, this, this::onGameTick);
}
@Subscribe
private void onGameStateChanged(GameStateChanged event)
{
if (event.getGameState() == GameState.LOGGING_IN)
@@ -135,6 +122,7 @@ public class DailyTasksPlugin extends Plugin
}
}
@Subscribe
private void onGameTick(GameTick event)
{
long currentTime = System.currentTimeMillis();
@@ -186,7 +174,7 @@ public class DailyTasksPlugin extends Plugin
{
checkArrows(dailyReset);
}
if (this.showDynamite)
{
checkDynamite(dailyReset);
@@ -310,6 +298,7 @@ public class DailyTasksPlugin extends Plugin
.build());
}
@Subscribe
private void onConfigChanged(ConfigChanged configChanged)
{
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.Player;
import net.runelite.api.coords.WorldPoint;
import net.runelite.client.events.ConfigChanged;
import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.GameTick;
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.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.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
@@ -122,6 +123,7 @@ public class DeathIndicatorPlugin extends Plugin
private Instant lastDeathTime;
private int lastDeathWorld;
private int despawnIdx = 0;
@Provides
DeathIndicatorConfig deathIndicatorConfig(ConfigManager configManager)
{
@@ -131,7 +133,10 @@ public class DeathIndicatorPlugin extends Plugin
@Override
protected void startUp()
{
addSubscriptions();
if (config.permaBones())
{
addBoneSubs();
}
if (!hasDied())
{
@@ -165,7 +170,6 @@ public class DeathIndicatorPlugin extends Plugin
@Override
protected void shutDown()
{
eventBus.unregister(this);
eventBus.unregister(BONES);
if (client.hasHintArrow())
@@ -194,18 +198,6 @@ public class DeathIndicatorPlugin extends Plugin
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()
{
eventBus.subscribe(ItemDespawned.class, BONES, this::onItemDespawn);
@@ -301,6 +293,7 @@ public class DeathIndicatorPlugin extends Plugin
}
}
@Subscribe
private void onLocalPlayerDeath(LocalPlayerDeath death)
{
if (client.isInInstancedRegion())
@@ -319,6 +312,7 @@ public class DeathIndicatorPlugin extends Plugin
lastDeathTime = Instant.now();
}
@Subscribe
private void onGameTick(GameTick event)
{
// Check if player respawned in a death respawn location
@@ -383,6 +377,7 @@ public class DeathIndicatorPlugin extends Plugin
}
}
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
if (event.getGroup().equals("deathIndicator"))
@@ -436,6 +431,7 @@ public class DeathIndicatorPlugin extends Plugin
}
}
@Subscribe
private void onGameStateChanged(GameStateChanged event)
{
switch (event.getGameState())

View File

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

View File

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

View File

@@ -50,6 +50,7 @@ import net.runelite.api.events.VarbitChanged;
import net.runelite.api.kit.KitType;
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.PluginDescriptor;
import net.runelite.client.ui.ClientToolbar;
@@ -142,7 +143,6 @@ public class DevToolsPlugin extends Plugin
@Override
protected void startUp() throws Exception
{
addSubscriptions();
players = new DevToolsButton("Players");
npcs = new DevToolsButton("NPCs");
@@ -206,8 +206,6 @@ public class DevToolsPlugin extends Plugin
@Override
protected void shutDown() throws Exception
{
eventBus.unregister(this);
overlayManager.remove(overlay);
overlayManager.remove(locationOverlay);
overlayManager.remove(sceneOverlay);
@@ -218,14 +216,7 @@ public class DevToolsPlugin extends Plugin
clientToolbar.removeNavigation(navButton);
}
private void addSubscriptions()
{
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);
}
@Subscribe
private void onCommandExecuted(CommandExecuted commandExecuted)
{
String[] args = commandExecuted.getArguments();
@@ -379,6 +370,7 @@ public class DevToolsPlugin extends Plugin
}
}
@Subscribe
private void onMenuEntryAdded(MenuEntryAdded entry)
{
if (!examine.isActive())
@@ -414,6 +406,7 @@ public class DevToolsPlugin extends Plugin
}
}
@Subscribe
private void onSoundEffectPlayed(SoundEffectPlayed event)
{
if (!getSoundEffects().isActive() || soundEffectOverlay == null)
@@ -424,6 +417,7 @@ public class DevToolsPlugin extends Plugin
soundEffectOverlay.onSoundEffectPlayed(event);
}
@Subscribe
private void onAreaSoundEffectPlayed(AreaSoundEffectPlayed event)
{
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.WorldType;
import net.runelite.api.coords.WorldPoint;
import net.runelite.client.events.ConfigChanged;
import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.StatChanged;
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.DiscordJoinRequest;
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.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
@@ -107,9 +107,6 @@ public class DiscordPlugin extends Plugin
@Inject
private WSClient wsClient;
@Inject
private EventBus eventBus;
private final Map<Skill, Integer> skillExp = new HashMap<>();
private NavigationButton discordButton;
private boolean loginFlag;
@@ -137,7 +134,6 @@ public class DiscordPlugin extends Plugin
protected void startUp() throws Exception
{
updateConfig();
addSubscriptions();
final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "discord.png");
@@ -163,30 +159,13 @@ public class DiscordPlugin extends Plugin
@Override
protected void shutDown() throws Exception
{
eventBus.unregister(this);
clientToolbar.removeNavigation(discordButton);
discordState.reset();
partyService.changeParty(null);
wsClient.unregisterMessage(DiscordUserInfo.class);
}
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(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);
}
@Subscribe
private void onGameStateChanged(GameStateChanged event)
{
switch (event.getGameState())
@@ -210,6 +189,7 @@ public class DiscordPlugin extends Plugin
checkForAreaUpdate();
}
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
if (event.getGroup().equalsIgnoreCase("discord"))
@@ -222,6 +202,7 @@ public class DiscordPlugin extends Plugin
}
}
@Subscribe
private void onStatChanged(StatChanged statChanged)
{
final Skill skill = statChanged.getSkill();
@@ -241,6 +222,7 @@ public class DiscordPlugin extends Plugin
}
}
@Subscribe
private void onVarbitChanged(VarbitChanged event)
{
if (!this.showRaidingActivity)
@@ -256,11 +238,13 @@ public class DiscordPlugin extends Plugin
}
}
@Subscribe
private void onDiscordReady(DiscordReady event)
{
partyService.setUsername(event.getUsername() + "#" + event.getDiscriminator());
}
@Subscribe
private void onDiscordJoinRequest(DiscordJoinRequest request)
{
log.debug("Got discord join request {}", request);
@@ -272,6 +256,7 @@ public class DiscordPlugin extends Plugin
}
}
@Subscribe
private void onDiscordJoinGame(DiscordJoinGame joinGame)
{
log.debug("Got discord join game {}", joinGame);
@@ -280,6 +265,7 @@ public class DiscordPlugin extends Plugin
updatePresence();
}
@Subscribe
private void onDiscordUserInfo(final DiscordUserInfo event)
{
final PartyMember memberById = partyService.getMemberById(event.getMemberId());
@@ -339,11 +325,13 @@ public class DiscordPlugin extends Plugin
});
}
@Subscribe
private void onUserJoin(final UserJoin event)
{
updatePresence();
}
@Subscribe
private void onUserSync(final UserSync event)
{
final PartyMember localMember = partyService.getLocalMember();
@@ -359,11 +347,13 @@ public class DiscordPlugin extends Plugin
}
}
@Subscribe
private void onUserPart(final UserPart event)
{
updatePresence();
}
@Subscribe
private void onPartyChanged(final PartyChanged event)
{
updatePresence();

View File

@@ -1,210 +1,198 @@
/*
* Copyright (c) 2017, Adam <Adam@sigterm.info>
* All rights reserved.
*
*
* Modified by farhan1666
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.plugins.dropparty;
import com.google.inject.Provides;
import java.awt.Color;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
import javax.inject.Singleton;
import lombok.AccessLevel;
import lombok.Getter;
import net.runelite.api.Client;
import net.runelite.api.Player;
import net.runelite.api.coords.WorldPoint;
import net.runelite.api.events.GameTick;
import net.runelite.api.util.Text;
import net.runelite.client.Notifier;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.ui.overlay.OverlayManager;
@PluginDescriptor(
name = "Drop Party",
description = "Marks where a user ran, for drop partys",
tags = {"Drop", "Party", "marker", "player"},
type = PluginType.UTILITY,
enabledByDefault = false
)
@Singleton
public class DropPartyPlugin extends Plugin
{
@Inject
private DropPartyConfig config;
@Getter(AccessLevel.PACKAGE)
private List<WorldPoint> playerPath = new ArrayList<>();
@Getter(AccessLevel.PACKAGE)
private String playerName = "";
@Getter(AccessLevel.PACKAGE)
private int showAmmount = 0;
@Getter(AccessLevel.PACKAGE)
private int MAXPATHSIZE = 100;
private Player runningPlayer;
@Getter(AccessLevel.PACKAGE)
private Color overlayColor;
@Inject
private Notifier notifier;
@Inject
private OverlayManager overlayManager;
@Inject
private DropPartyOverlay coreOverlay;
@Inject
private EventBus eventbus;
@Inject
private Client client;
@Getter(AccessLevel.PACKAGE)
private int fontStyle;
@Getter(AccessLevel.PACKAGE)
private int textSize;
@Provides
DropPartyConfig getConfig(ConfigManager configManager)
{
return configManager.getConfig(DropPartyConfig.class);
}
@Override
protected void startUp()
{
updateConfig();
addSubscriptions();
overlayManager.add(coreOverlay);
reset();
}
@Override
protected void shutDown()
{
overlayManager.remove(coreOverlay);
reset();
eventbus.unregister(this);
}
private void addSubscriptions()
{
eventbus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventbus.subscribe(GameTick.class, this, this::onGameTick);
}
private void onGameTick(GameTick event)
{
shuffleList();
if (playerName.equalsIgnoreCase(""))
{
return;
}
runningPlayer = null;
for (Player player : client.getPlayers())
{
if (player.getName() == null)
{
continue;
}
if (Text.standardize(player.getName()).equalsIgnoreCase(playerName))
{
runningPlayer = player;
break;
}
}
if (runningPlayer == null)
{
cordsError();
return;
}
addCords();
}
private void cordsError()
{
playerPath.add(null);
}
private void shuffleList()
{
if (playerPath.size() > MAXPATHSIZE - 1)
{
playerPath.remove(0);
}
}
private void addCords()
{
while (true)
{
if (playerPath.size() >= MAXPATHSIZE)
{
playerPath.add(runningPlayer.getWorldLocation());
break;
}
playerPath.add(null);
}
}
private void onConfigChanged(ConfigChanged event)
{
if (!event.getGroup().equals("drop"))
{
return;
}
updateConfig();
}
private void reset()
{
playerPath.clear();
}
private void updateConfig()
{
this.playerName = config.playerName();
this.showAmmount = config.showAmmount();
this.overlayColor = config.overlayColor();
this.fontStyle = config.fontStyle().getFont();
this.textSize = config.textSize();
}
}
/*
* Copyright (c) 2017, Adam <Adam@sigterm.info>
* All rights reserved.
*
*
* Modified by farhan1666
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.plugins.dropparty;
import com.google.inject.Provides;
import java.awt.Color;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
import javax.inject.Singleton;
import lombok.AccessLevel;
import lombok.Getter;
import net.runelite.api.Client;
import net.runelite.api.Player;
import net.runelite.api.coords.WorldPoint;
import net.runelite.api.events.GameTick;
import net.runelite.api.util.Text;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.ui.overlay.OverlayManager;
@PluginDescriptor(
name = "Drop Party",
description = "Marks where a user ran, for drop partys",
tags = {"Drop", "Party", "marker", "player"},
type = PluginType.UTILITY,
enabledByDefault = false
)
@Singleton
public class DropPartyPlugin extends Plugin
{
@Inject
private DropPartyConfig config;
@Getter(AccessLevel.PACKAGE)
private List<WorldPoint> playerPath = new ArrayList<>();
@Getter(AccessLevel.PACKAGE)
private String playerName = "";
@Getter(AccessLevel.PACKAGE)
private int showAmmount = 0;
@Getter(AccessLevel.PACKAGE)
private int MAXPATHSIZE = 100;
private Player runningPlayer;
@Getter(AccessLevel.PACKAGE)
private Color overlayColor;
@Inject
private OverlayManager overlayManager;
@Inject
private DropPartyOverlay coreOverlay;
@Inject
private Client client;
@Getter(AccessLevel.PACKAGE)
private int fontStyle;
@Getter(AccessLevel.PACKAGE)
private int textSize;
@Provides
DropPartyConfig getConfig(ConfigManager configManager)
{
return configManager.getConfig(DropPartyConfig.class);
}
@Override
protected void startUp()
{
updateConfig();
overlayManager.add(coreOverlay);
reset();
}
@Override
protected void shutDown()
{
overlayManager.remove(coreOverlay);
reset();
}
@Subscribe
private void onGameTick(GameTick event)
{
shuffleList();
if (playerName.equalsIgnoreCase(""))
{
return;
}
runningPlayer = null;
for (Player player : client.getPlayers())
{
if (player.getName() == null)
{
continue;
}
if (Text.standardize(player.getName()).equalsIgnoreCase(playerName))
{
runningPlayer = player;
break;
}
}
if (runningPlayer == null)
{
cordsError();
return;
}
addCords();
}
private void cordsError()
{
playerPath.add(null);
}
private void shuffleList()
{
if (playerPath.size() > MAXPATHSIZE - 1)
{
playerPath.remove(0);
}
}
private void addCords()
{
while (true)
{
if (playerPath.size() >= MAXPATHSIZE)
{
playerPath.add(runningPlayer.getWorldLocation());
break;
}
playerPath.add(null);
}
}
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
if (!event.getGroup().equals("drop"))
{
return;
}
updateConfig();
}
private void reset()
{
playerPath.clear();
}
private void updateConfig()
{
this.playerName = config.playerName();
this.showAmmount = config.showAmmount();
this.overlayColor = config.overlayColor();
this.fontStyle = config.fontStyle().getFont();
this.textSize = config.textSize();
}
}

View File

@@ -55,6 +55,7 @@ import net.runelite.api.kit.KitType;
import net.runelite.api.util.Text;
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.menus.MenuManager;
@@ -163,9 +164,9 @@ public class DynamicMaxHit extends Plugin
eventBus.subscribe(SpotAnimationChanged.class, this, this::onSpotAnimationChanged);
eventBus.subscribe(ChatMessage.class, this, this::onChatMessage);
eventBus.subscribe(PlayerMenuOptionClicked.class, this, this::onPlayerMenuOptionClicked);
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
}
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
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.OverheadTextChanged;
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.PluginDescriptor;
import net.runelite.client.util.ImageUtil;
@@ -65,31 +65,20 @@ public class EmojiPlugin extends Plugin
@Inject
private ChatMessageManager chatMessageManager;
@Inject
private EventBus eventBus;
private int modIconsStart = -1;
@Override
protected void startUp()
{
loadEmojiIcons();
addSubscriptions();
}
@Override
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)
{
if (gameStateChanged.getGameState() == GameState.LOGGED_IN)
@@ -130,6 +119,7 @@ public class EmojiPlugin extends Plugin
client.setModIcons(newModIcons);
}
@Subscribe
void onChatMessage(ChatMessage chatMessage)
{
if (client.getGameState() != GameState.LOGGED_IN || modIconsStart == -1)
@@ -164,6 +154,7 @@ public class EmojiPlugin extends Plugin
client.refreshChat();
}
@Subscribe
private void onOverheadTextChanged(final OverheadTextChanged event)
{
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.Player;
import net.runelite.api.coords.WorldPoint;
import net.runelite.client.events.ConfigChanged;
import net.runelite.api.events.GameStateChanged;
import net.runelite.api.util.Text;
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.PluginDescriptor;
@@ -59,9 +59,6 @@ public class EntityHiderPlugin extends Plugin
@Inject
private EntityHiderConfig config;
@Inject
private EventBus eventBus;
@Provides
EntityHiderConfig provideConfig(ConfigManager configManager)
{
@@ -72,18 +69,12 @@ public class EntityHiderPlugin extends Plugin
protected void startUp()
{
updateConfig();
addSubscriptions();
Text.fromCSV(config.hideNPCsNames()).forEach(client::addHiddenNpcName);
Text.fromCSV(config.hideNPCsOnDeath()).forEach(client::addHiddenNpcDeath);
}
private void addSubscriptions()
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
}
@Subscribe
public void onConfigChanged(ConfigChanged event)
{
if (event.getGroup().equals("entityhider"))
@@ -121,6 +112,7 @@ public class EntityHiderPlugin extends Plugin
}
}
@Subscribe
public void onGameStateChanged(GameStateChanged event)
{
if (event.getGameState() == GameState.LOGGED_IN)
@@ -158,8 +150,6 @@ public class EntityHiderPlugin extends Plugin
@Override
protected void shutDown() throws Exception
{
eventBus.unregister(this);
client.setIsHidingEntities(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.QueuedMessage;
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.menus.MenuManager;
@@ -94,9 +94,6 @@ public class EquipmentInspectorPlugin extends Plugin
@Inject
private ClientToolbar pluginToolbar;
@Inject
private EventBus eventBus;
private NavigationButton navButton;
private EquipmentInspectorPanel equipmentInspectorPanel;
private int TotalPrice = 0;
@@ -119,7 +116,6 @@ public class EquipmentInspectorPlugin extends Plugin
protected void startUp() throws Exception
{
updateConfig();
addSubscriptions();
equipmentInspectorPanel = injector.getInstance(EquipmentInspectorPanel.class);
if (client != null)
@@ -143,18 +139,11 @@ public class EquipmentInspectorPlugin extends Plugin
@Override
protected void shutDown() throws Exception
{
eventBus.unregister(this);
menuManager.removePlayerMenuItem(INSPECT_EQUIPMENT);
pluginToolbar.removeNavigation(navButton);
}
private void addSubscriptions()
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(PlayerMenuOptionClicked.class, this, this::onPlayerMenuOptionClicked);
}
@Subscribe
private void onPlayerMenuOptionClicked(PlayerMenuOptionClicked event)
{
if (event.getMenuOption().equals(INSPECT_EQUIPMENT))
@@ -305,6 +294,7 @@ public class EquipmentInspectorPlugin extends Plugin
}
}
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
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.ChatMessageManager;
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.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
@@ -102,33 +102,23 @@ public class ExaminePlugin extends Plugin
@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(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)
{
pending.clear();
}
@Subscribe
void onMenuOptionClicked(MenuOptionClicked event)
{
if (!event.getOption().equals("Examine"))
@@ -190,6 +180,7 @@ public class ExaminePlugin extends Plugin
pending.push(pendingExamine);
}
@Subscribe
void onChatMessage(ChatMessage event)
{
ExamineType type;
@@ -292,7 +283,7 @@ public class ExaminePlugin extends Plugin
Widget widgetItem = widget.getChild(1);
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)
@@ -300,7 +291,7 @@ public class ExaminePlugin extends Plugin
Widget widgetItem = widget.getChild(2);
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
@@ -309,7 +300,7 @@ public class ExaminePlugin extends Plugin
Widget widgetItem = widget.getChild(actionParam);
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
@@ -324,7 +315,7 @@ public class ExaminePlugin extends Plugin
if (actionParam < children.length)
{
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)
@@ -333,7 +324,7 @@ public class ExaminePlugin extends Plugin
if (actionParam < children.length)
{
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)
@@ -342,7 +333,7 @@ public class ExaminePlugin extends Plugin
if (actionParam < children.length)
{
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)
@@ -351,7 +342,7 @@ public class ExaminePlugin extends Plugin
if (actionParam < children.length)
{
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)
@@ -360,7 +351,7 @@ public class ExaminePlugin extends Plugin
if (actionParam < children.length)
{
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)
@@ -369,7 +360,7 @@ public class ExaminePlugin extends Plugin
if (actionParam < children.length)
{
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.WidgetInfo;
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.NPCManager;
import net.runelite.client.game.XpDropEvent;
@@ -80,8 +80,6 @@ public class XpDropPlugin extends Plugin
private OverlayManager overlayManager;
@Inject
private XpDropOverlay overlay;
@Inject
private EventBus eventBus;
@Getter(AccessLevel.PACKAGE)
private int damage = 0;
@@ -119,7 +117,6 @@ public class XpDropPlugin extends Plugin
protected void startUp() throws Exception
{
updateConfig();
addSubscriptions();
damageMode = config.showdamagedrops();
@@ -132,21 +129,10 @@ public class XpDropPlugin extends Plugin
@Override
protected void shutDown() throws Exception
{
eventBus.unregister(this);
overlayManager.remove(overlay);
}
private void addSubscriptions()
{
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);
}
@Subscribe
private void onXpDropEvent(XpDropEvent event)
{
previousExpGained = event.getExp();
@@ -154,6 +140,7 @@ public class XpDropPlugin extends Plugin
hasDropped = true;
}
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
if (!event.getGroup().equals("xpdrop"))
@@ -183,12 +170,14 @@ public class XpDropPlugin extends Plugin
}
}
@Subscribe
private void onGameStateChanged(GameStateChanged event)
{
tickShow = 0;
damage = 0;
}
@Subscribe
private void onWidgetHiddenChanged(WidgetHiddenChanged event)
{
Widget widget = event.getWidget();
@@ -316,6 +305,7 @@ public class XpDropPlugin extends Plugin
return null;
}
@Subscribe
private void onGameTick(GameTick tick)
{
lastOpponent = client.getLocalPlayer().getInteracting();
@@ -351,6 +341,7 @@ public class XpDropPlugin extends Plugin
client.runScript(XPDROP_DISABLED, lastSkill.ordinal(), previousExpGained);
}
@Subscribe
private void onScriptCallbackEvent(ScriptCallbackEvent e)
{
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.client.callback.ClientThread;
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.chatbox.ChatboxPanelManager;
import net.runelite.client.game.chatbox.ChatboxTextInput;
@@ -71,9 +71,9 @@ import net.runelite.client.plugins.PluginDescriptor;
@Singleton
public class FairyRingPlugin extends Plugin
{
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[] rightDial = new String[]{"P", "S", "R", "Q"};
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[] rightDial = new String[] {"P", "S", "R", "Q"};
private static final int ENTRY_PADDING = 3;
@@ -92,9 +92,6 @@ public class FairyRingPlugin extends Plugin
@Inject
private ClientThread clientThread;
@Inject
private EventBus eventBus;
private ChatboxTextInput searchInput = null;
private Widget searchBtn;
private Collection<CodeWidgets> codes = null;
@@ -118,23 +115,14 @@ public class FairyRingPlugin extends Plugin
protected void startUp() throws Exception
{
this.autoOpen = config.autoOpen();
addSubscriptions();
}
@Override
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)
{
if (!event.getGroup().equals("fairyrings"))
@@ -151,11 +139,13 @@ public class FairyRingPlugin extends Plugin
return configManager.getConfig(FairyRingConfig.class);
}
@Subscribe
private void onVarbitChanged(VarbitChanged event)
{
setWidgetTextToDestination();
}
@Subscribe
private void onWidgetLoaded(WidgetLoaded widgetLoaded)
{
if (widgetLoaded.getGroupId() == WidgetID.FAIRY_RING_PANEL_GROUP_ID)
@@ -242,6 +232,7 @@ public class FairyRingPlugin extends Plugin
.build();
}
@Subscribe
private void onGameTick(GameTick t)
{
// 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.Singleton;
import lombok.extern.slf4j.Slf4j;
import net.runelite.client.events.ConfigChanged;
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.PluginDescriptor;
import net.runelite.client.task.Schedule;
@@ -69,9 +69,6 @@ public class FeedPlugin extends Plugin
@Inject
private FeedClient feedClient;
@Inject
private EventBus eventBus;
private FeedPanel feedPanel;
private NavigationButton navButton;
@@ -91,8 +88,6 @@ public class FeedPlugin extends Plugin
@Override
protected void startUp() throws Exception
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
feedPanel = new FeedPanel(config, feedSupplier);
final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "icon.png");
@@ -111,7 +106,6 @@ public class FeedPlugin extends Plugin
@Override
protected void shutDown() throws Exception
{
eventBus.unregister(this);
clientToolbar.removeNavigation(navButton);
}
@@ -120,6 +114,7 @@ public class FeedPlugin extends Plugin
feedPanel.rebuildFeed();
}
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
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.NpcSpawned;
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.NPCManager;
import net.runelite.client.plugins.Plugin;
@@ -130,8 +130,6 @@ public class FightCavePlugin extends Plugin
private FightCaveOverlay fightCaveOverlay;
@Inject
private FightCaveConfig config;
@Inject
private EventBus eventBus;
@Getter(AccessLevel.PACKAGE)
private Set<FightCaveContainer> fightCaveContainer = new HashSet<>();
@Getter(AccessLevel.PACKAGE)
@@ -172,7 +170,6 @@ public class FightCavePlugin extends Plugin
public void startUp()
{
updateConfig();
addSubscriptions();
if (client.getGameState() == GameState.LOGGED_IN && regionCheck())
{
@@ -185,23 +182,12 @@ public class FightCavePlugin extends Plugin
@Override
public void shutDown()
{
eventBus.unregister(this);
overlayManager.remove(waveOverlay);
overlayManager.remove(fightCaveOverlay);
currentWave = -1;
}
private void addSubscriptions()
{
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);
}
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
if (!event.getGroup().equals("fightcave"))
@@ -212,6 +198,7 @@ public class FightCavePlugin extends Plugin
updateConfig();
}
@Subscribe
private void onChatMessage(ChatMessage event)
{
if (!validRegion)
@@ -229,6 +216,7 @@ public class FightCavePlugin extends Plugin
currentWave = Integer.parseInt(waveMatcher.group(1));
}
@Subscribe
private void onGameStateChanged(GameStateChanged event)
{
if (event.getGameState() != GameState.LOGGED_IN)
@@ -252,6 +240,7 @@ public class FightCavePlugin extends Plugin
fightCaveContainer.clear();
}
@Subscribe
private void onNpcSpawned(NpcSpawned event)
{
if (!validRegion)
@@ -276,6 +265,7 @@ public class FightCavePlugin extends Plugin
}
}
@Subscribe
private void onNpcDespawned(NpcDespawned event)
{
if (!validRegion)
@@ -300,6 +290,7 @@ public class FightCavePlugin extends Plugin
}
}
@Subscribe
private void onGameTick(GameTick Event)
{
if (!validRegion)

View File

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

View File

@@ -31,7 +31,7 @@ import lombok.AccessLevel;
import lombok.Getter;
import net.runelite.api.events.FocusChanged;
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.PluginDescriptor;
@@ -74,9 +74,6 @@ public class FpsPlugin extends Plugin
@Inject
private FpsConfig fpsConfig;
@Inject
private EventBus eventBus;
@Getter(AccessLevel.PACKAGE)
private FpsLimitMode limitMode;
@@ -89,6 +86,7 @@ public class FpsPlugin extends Plugin
return configManager.getConfig(FpsConfig.class);
}
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
if (event.getGroup().equals(CONFIG_GROUP_KEY))
@@ -100,6 +98,7 @@ public class FpsPlugin extends Plugin
}
}
@Subscribe
private void onFocusChanged(FocusChanged event)
{
drawListener.onFocusChanged(event);
@@ -109,7 +108,6 @@ public class FpsPlugin extends Plugin
@Override
protected void startUp() throws Exception
{
addSubscriptions();
limitMode = fpsConfig.limitMode();
drawFps = fpsConfig.drawFps();
@@ -121,15 +119,8 @@ public class FpsPlugin extends Plugin
@Override
protected void shutDown() throws Exception
{
eventBus.unregister(this);
overlayManager.remove(overlay);
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.SpotAnimationChanged;
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.PluginDescriptor;
@@ -78,8 +78,6 @@ public class FreezeTimersPlugin extends Plugin
private FreezeTimersOverlay overlay;
@Inject
private FreezeTimersConfig config;
@Inject
private EventBus eventBus;
@Getter(AccessLevel.PACKAGE)
private boolean showPlayers;
@@ -103,14 +101,12 @@ public class FreezeTimersPlugin extends Plugin
public void startUp()
{
updateConfig();
addSubscriptions();
overlayManager.add(overlay);
}
public void shutDown()
{
eventBus.unregister(this);
overlayManager.remove(overlay);
}
@@ -120,16 +116,7 @@ public class FreezeTimersPlugin extends Plugin
return configManager.getConfig(FreezeTimersConfig.class);
}
private void addSubscriptions()
{
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);
}
@Subscribe
public void onSpotAnimationChanged(SpotAnimationChanged graphicChanged)
{
final int oldGraphic = prayerTracker.getSpotanimLastTick(graphicChanged.getActor());
@@ -162,9 +149,10 @@ public class FreezeTimersPlugin extends Plugin
}
timers.setTimerEnd(graphicChanged.getActor(), effect.getType(),
currentTime + length);
currentTime + length);
}
@Subscribe
public void onGameTick(GameTick tickEvent)
{
prayerTracker.gameTick();
@@ -194,12 +182,12 @@ public class FreezeTimersPlugin extends Plugin
timers.setTimerReApply(actor, TimerType.TELEBLOCK, System.currentTimeMillis());
}
else if (WorldType.isPvpWorld(worldTypes) &&
MapLocations.getPvpSafeZones(actorLoc.getPlane()).contains(actorLoc.getX(), actorLoc.getY()))
MapLocations.getPvpSafeZones(actorLoc.getPlane()).contains(actorLoc.getX(), actorLoc.getY()))
{
timers.setTimerReApply(actor, TimerType.TELEBLOCK, System.currentTimeMillis());
}
else if (WorldType.isDeadmanWorld(worldTypes) &&
MapLocations.getDeadmanSafeZones(actorLoc.getPlane()).contains(actorLoc.getX(), actorLoc.getY()))
MapLocations.getDeadmanSafeZones(actorLoc.getPlane()).contains(actorLoc.getX(), actorLoc.getY()))
{
timers.setTimerReApply(actor, TimerType.TELEBLOCK, System.currentTimeMillis());
}
@@ -207,6 +195,7 @@ public class FreezeTimersPlugin extends Plugin
}
}
@Subscribe
private void onLocalPlayerDeath(LocalPlayerDeath event)
{
final Player localPlayer = client.getLocalPlayer();
@@ -223,6 +212,7 @@ public class FreezeTimersPlugin extends Plugin
}
}
@Subscribe
public void onNpcDespawned(NpcDespawned event)
{
if (!isAtVorkath())
@@ -240,14 +230,15 @@ public class FreezeTimersPlugin extends Plugin
if (npc.getName().equals("Zombified Spawn"))
{
timers.setTimerReApply(client.getLocalPlayer(), TimerType.FREEZE,
System.currentTimeMillis());
System.currentTimeMillis());
}
}
@Subscribe
public void onChatMessage(ChatMessage event)
{
if (event.getType() != ChatMessageType.GAMEMESSAGE
|| !event.getMessage().contains("Your Tele Block has been removed"))
|| !event.getMessage().contains("Your Tele Block has been removed"))
{
return;
}
@@ -260,6 +251,7 @@ public class FreezeTimersPlugin extends Plugin
return ArrayUtils.contains(client.getMapRegions(), VORKATH_REGION);
}
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
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.widgets.Widget;
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.PluginDescriptor;
@@ -52,25 +52,20 @@ public class FriendListPlugin extends Plugin
@Inject
private Client client;
@Inject
private EventBus eventBus;
@Override
protected void startUp() throws Exception
{
eventBus.subscribe(GameTick.class, this, this::onGameTick);
}
@Override
protected void shutDown()
{
eventBus.unregister(this);
final int world = client.getWorld();
setFriendsListTitle("Friends List - World " + world);
setIgnoreListTitle("Ignore List - World " + world);
}
@Subscribe
private void onGameTick(GameTick tick)
{
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.widgets.WidgetInfo;
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.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
@@ -83,36 +83,22 @@ public class FriendNotesPlugin extends Plugin
@Inject
private ChatboxPanelManager chatboxPanelManager;
@Inject
private EventBus eventBus;
@Getter
private HoveredFriend hoveredFriend = null;
@Override
protected void startUp() throws Exception
{
addSubscriptions();
overlayManager.add(overlay);
}
@Override
protected void shutDown() throws Exception
{
eventBus.unregister(this);
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.
*/
private void setFriendNote(String displayName, String note)
@@ -172,6 +158,7 @@ public class FriendNotesPlugin extends Plugin
}
}
@Subscribe
private void onMenuEntryAdded(MenuEntryAdded event)
{
final int groupId = WidgetInfo.TO_GROUP(event.getParam1());
@@ -200,6 +187,7 @@ public class FriendNotesPlugin extends Plugin
}
}
@Subscribe
private void onMenuOptionClicked(MenuOptionClicked event)
{
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)
{
final Nameable nameable = event.getNameable();
@@ -258,6 +247,7 @@ public class FriendNotesPlugin extends Plugin
}
}
@Subscribe
private void onFriendRemoved(FriendRemoved event)
{
// 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.widgets.WidgetInfo;
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.ChatboxTextInput;
import net.runelite.client.menus.MenuManager;
@@ -82,13 +82,9 @@ public class FriendTaggingPlugin extends Plugin
@Inject
private ChatboxPanelManager chatboxPanelManager;
@Inject
private EventBus eventBus;
@Override
protected void startUp() throws Exception
{
addSubscriptions();
menuManager.addManagedCustomMenu(friendsTabMenuOption);
menuManager.addManagedCustomMenu(ignoreTabMenuOption);
@@ -100,23 +96,13 @@ public class FriendTaggingPlugin extends Plugin
@Override
protected void shutDown() throws Exception
{
eventBus.unregister(this);
menuManager.removeManagedCustomMenu(friendsTabMenuOption);
menuManager.removeManagedCustomMenu(ignoreTabMenuOption);
menuManager.removeManagedCustomMenu(friendTabResizableOption);
menuManager.removeManagedCustomMenu(ignoreTabResizableOption);
}
private void addSubscriptions()
{
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);
}
@Subscribe
private void onMenuEntryAdded(MenuEntryAdded event)
{
final int groupId = WidgetInfo.TO_GROUP(event.getParam1());
@@ -141,12 +127,14 @@ public class FriendTaggingPlugin extends Plugin
}
}
@Subscribe
private void onFriendRemoved(FriendRemoved event)
{
final String displayName = event.getName().trim().toLowerCase();
deleteTag(displayName);
}
@Subscribe
private void onNameableNameChanged(NameableNameChanged event)
{
final Nameable nameable = event.getNameable();
@@ -162,6 +150,7 @@ public class FriendTaggingPlugin extends Plugin
}
}
@Subscribe
private void onWidgetMenuOptionClicked(WidgetMenuOptionClicked event)
{
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)
{
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.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.game.ItemManager;
@@ -201,7 +202,6 @@ public class GauntletPlugin extends Plugin
@Override
protected void startUp()
{
addSubscriptions();
updateConfig();
initializeCounters();
overlayManager.add(overlay);
@@ -272,7 +272,6 @@ public class GauntletPlugin extends Plugin
@Override
protected void shutDown()
{
eventBus.unregister(this);
timer.resetStates();
if (timerVisible)
{
@@ -300,23 +299,7 @@ public class GauntletPlugin extends Plugin
countersVisible = false;
}
private void addSubscriptions()
{
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);
}
@Subscribe
private void onMenuOptionClicked(MenuOptionClicked menuOptionClicked)
{
if (menuOptionClicked.getTarget().toUpperCase().contains("LINUM"))
@@ -329,6 +312,7 @@ public class GauntletPlugin extends Plugin
}
}
@Subscribe
private void onNpcLootReceived(NpcLootReceived npcLootReceived)
{
fishGathered += (int) npcLootReceived.getItems().stream().filter(item -> item.getId() == ItemID.RAW_PADDLEFISH).count();
@@ -336,6 +320,7 @@ public class GauntletPlugin extends Plugin
updateCounters();
}
@Subscribe
private void onXpDropEvent(XpDropEvent experienceChanged)
{
if (experienceChanged.getSkill().compareTo(Skill.MINING) == 0)
@@ -364,6 +349,7 @@ public class GauntletPlugin extends Plugin
updateCounters();
}
@Subscribe
private void onAnimationChanged(AnimationChanged event)
{
if (hunllef == null)
@@ -434,6 +420,7 @@ public class GauntletPlugin extends Plugin
}
}
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
if (!event.getGroup().equals("Gauntlet"))
@@ -470,6 +457,7 @@ public class GauntletPlugin extends Plugin
}
}
@Subscribe
private void onGameObjectDespawned(GameObjectDespawned event)
{
final GameObject obj = event.getGameObject();
@@ -479,6 +467,7 @@ public class GauntletPlugin extends Plugin
}
}
@Subscribe
private void onGameObjectSpawned(GameObjectSpawned event)
{
final GameObject obj = event.getGameObject();
@@ -488,6 +477,7 @@ public class GauntletPlugin extends Plugin
}
}
@Subscribe
private void onGameStateChanged(GameStateChanged event)
{
if (event.getGameState() == GameState.LOADING)
@@ -496,6 +486,7 @@ public class GauntletPlugin extends Plugin
}
}
@Subscribe
private void onGameTick(GameTick event)
{
// This handles the timer based on player health.
@@ -516,6 +507,7 @@ public class GauntletPlugin extends Plugin
}
}
@Subscribe
private void onNpcDespawned(NpcDespawned event)
{
final NPC npc = event.getNpc();
@@ -530,6 +522,7 @@ public class GauntletPlugin extends Plugin
}
}
@Subscribe
private void onNpcSpawned(NpcSpawned event)
{
final NPC npc = event.getNpc();
@@ -543,6 +536,7 @@ public class GauntletPlugin extends Plugin
}
}
@Subscribe
private void onProjectileSpawned(ProjectileSpawned event)
{
if (hunllef == null)
@@ -574,6 +568,7 @@ public class GauntletPlugin extends Plugin
}
}
@Subscribe
private void onVarbitChanged(VarbitChanged event)
{
if (this.completeStartup)

View File

@@ -70,7 +70,7 @@ import net.runelite.api.events.GameStateChanged;
import net.runelite.api.hooks.DrawCallbacks;
import net.runelite.client.callback.ClientThread;
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.PluginDescriptor;
@@ -121,9 +121,6 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
@Inject
private PluginManager pluginManager;
@Inject
private EventBus eventbus;
private Canvas canvas;
private JAWTWindow jawtWindow;
private GL4 gl;
@@ -243,6 +240,7 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
private int fogCircularity;
private int fogDensity;
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
if (event.getGroup().equals("gpu"))
@@ -266,7 +264,6 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
protected void startUp() throws Exception
{
updateConfig();
addSubscriptions();
clientThread.invoke(() ->
{
@@ -374,8 +371,6 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
@Override
protected void shutDown()
{
eventbus.unregister(this);
clientThread.invoke(() ->
{
client.setGpu(false);
@@ -445,13 +440,7 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
});
}
private void addSubscriptions()
{
eventbus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventbus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
}
@Provides
@Provides
GpuPluginConfig provideConfig(ConfigManager configManager)
{
return configManager.getConfig(GpuPluginConfig.class);
@@ -611,7 +600,7 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
gl.glBindVertexArray(vaoUiHandle);
FloatBuffer vboUiBuf = GpuFloatBuffer.allocateDirect(5 * 4);
vboUiBuf.put(new float[]{
vboUiBuf.put(new float[] {
// positions // texture coords
1f, 1f, 0.0f, 1.0f, 0f, // top right
1f, -1f, 0.0f, 1.0f, 1f, // bottom right
@@ -738,7 +727,7 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
gl.glUseProgram(glProgram);
float[] matrix = new float[]{
float[] matrix = new float[] {
2 / (right - left), 0, 0, 0,
0, 2 / (top - bottom), 0, 0,
0, 0, -2 / (far - near), 0,
@@ -763,8 +752,8 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
}
public void drawScenePaint(int orientation, int pitchSin, int pitchCos, int yawSin, int yawCos, int x, int y, int z,
TilePaint paint, int tileZ, int tileX, int tileY,
int zoom, int centerX, int centerY)
TilePaint paint, int tileZ, int tileX, int tileY,
int zoom, int centerX, int centerY)
{
if (paint.getBufferLen() > 0)
{
@@ -789,8 +778,8 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
}
public void drawSceneModel(int orientation, int pitchSin, int pitchCos, int yawSin, int yawCos, int x, int y, int z,
TileModel model, int tileZ, int tileX, int tileY,
int zoom, int centerX, int centerY)
TileModel model, int tileZ, int tileX, int tileY,
int zoom, int centerX, int centerY)
{
if (model.getBufferLen() > 0)
{
@@ -1317,6 +1306,7 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
textureManager.animate(texture, diff);
}
@Subscribe
private void onGameStateChanged(GameStateChanged gameStateChanged)
{
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.Varbits;
import net.runelite.api.events.ChatMessage;
import net.runelite.client.events.ConfigChanged;
import net.runelite.api.events.FocusChanged;
import net.runelite.api.events.GameStateChanged;
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.callback.ClientThread;
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.SessionOpen;
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 String OSB_GE_TEXT = "<br>OSBuddy Actively traded price: ";
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)
private NavigationButton button;
@@ -155,9 +157,6 @@ public class GrandExchangePlugin extends Plugin
@Inject
private ConfigManager configManager;
@Inject
private EventBus eventBus;
private Widget grandExchangeText;
private Widget grandExchangeItem;
private Widget grandExchangeOfferQuantityHeading;
@@ -213,7 +212,6 @@ public class GrandExchangePlugin extends Plugin
protected void startUp() throws Exception
{
updateConfig();
addSubscriptions();
itemGELimits = loadGELimits();
panel = injector.getInstance(GrandExchangePanel.class);
@@ -249,8 +247,6 @@ public class GrandExchangePlugin extends Plugin
@Override
protected void shutDown()
{
eventBus.unregister(this);
clientToolbar.removeNavigation(button);
mouseManager.unregisterMouseListener(inputListener);
keyManager.unregisterKeyListener(inputListener);
@@ -261,20 +257,7 @@ public class GrandExchangePlugin extends Plugin
grandExchangeClient = null;
}
private void addSubscriptions()
{
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);
}
@Subscribe
private void onSessionOpen(SessionOpen sessionOpen)
{
AccountSession accountSession = sessionManager.getAccountSession();
@@ -297,11 +280,13 @@ public class GrandExchangePlugin extends Plugin
this.enableAfford = config.enableAfford();
}
@Subscribe
private void onSessionClose(SessionClose sessionClose)
{
grandExchangeClient = null;
}
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
if (event.getGroup().equals("grandexchange"))
@@ -323,6 +308,7 @@ public class GrandExchangePlugin extends Plugin
}
}
@Subscribe
private void onGrandExchangeOfferChanged(GrandExchangeOfferChanged offerEvent)
{
final int slot = offerEvent.getSlot();
@@ -400,6 +386,7 @@ public class GrandExchangePlugin extends Plugin
return savedOffer.getState() != grandExchangeOffer.getState();
}
@Subscribe
private void onChatMessage(ChatMessage event)
{
if (!this.enableNotifications || event.getType() != ChatMessageType.GAMEMESSAGE)
@@ -415,6 +402,7 @@ public class GrandExchangePlugin extends Plugin
}
}
@Subscribe
private void onGameStateChanged(GameStateChanged gameStateChanged)
{
if (gameStateChanged.getGameState() == GameState.LOGIN_SCREEN)
@@ -423,6 +411,7 @@ public class GrandExchangePlugin extends Plugin
}
}
@Subscribe
private void onMenuEntryAdded(MenuEntryAdded menuEntry)
{
// 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)
{
if (!focusChanged.isFocused())
@@ -462,6 +452,7 @@ public class GrandExchangePlugin extends Plugin
}
}
@Subscribe
private void onWidgetLoaded(WidgetLoaded event)
{
switch (event.getGroupId())
@@ -480,6 +471,7 @@ public class GrandExchangePlugin extends Plugin
}
}
@Subscribe
private void onScriptCallbackEvent(ScriptCallbackEvent event)
{
if (event.getEventName().equals("geBuilt"))
@@ -544,7 +536,6 @@ public class GrandExchangePlugin extends Plugin
}
if (this.enableAfford && offerType == OFFER_TYPE_BUY)
{
final ItemContainer inventory = client.getItemContainer(InventoryID.INVENTORY);

View File

@@ -32,7 +32,7 @@ import net.runelite.api.Client;
import net.runelite.api.NPC;
import static net.runelite.api.NpcID.DUSK_7888;
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.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
@@ -42,7 +42,7 @@ import net.runelite.client.ui.overlay.OverlayManager;
@PluginDescriptor(
name = "Grotesque Guardians",
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,
enabledByDefault = false
)
@@ -56,8 +56,6 @@ public class GrotesqueGuardiansPlugin extends Plugin
private OverlayManager overlayManager;
@Inject
private GrotesqueGuardiansPrayerOverlay prayerOverlay;
@Inject
private EventBus eventBus;
@Nullable
private DuskAttack prayAgainst;
@Nullable
@@ -77,7 +75,6 @@ public class GrotesqueGuardiansPlugin extends Plugin
@Override
protected void startUp() throws Exception
{
eventBus.subscribe(GameTick.class, this, this::onGameTick);
overlayManager.add(overlay);
overlayManager.add(prayerOverlay);
@@ -88,14 +85,13 @@ public class GrotesqueGuardiansPlugin extends Plugin
@Override
protected void shutDown() throws Exception
{
eventBus.unregister(this);
overlayManager.remove(overlay);
overlayManager.remove(prayerOverlay);
dusk = null;
prayAgainst = null;
}
@Subscribe
private void onGameTick(final GameTick event)
{
final ArrayList<Integer> regions = new ArrayList<>();
@@ -128,14 +124,14 @@ public class GrotesqueGuardiansPlugin extends Plugin
}
}
else
{
{
prayAgainst = null;
}
needingToRun = dusk.getAnimation() == 7802;
}
}
else
{
{
inGargs = false;
prayAgainst = null;
dusk = null;

View File

@@ -68,7 +68,6 @@ import net.runelite.api.TileItem;
import net.runelite.api.TileItemPile;
import net.runelite.api.coords.WorldPoint;
import net.runelite.api.events.ClientTick;
import net.runelite.client.events.ConfigChanged;
import net.runelite.api.events.FocusChanged;
import net.runelite.api.events.GameStateChanged;
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.client.Notifier;
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.PlayerLootReceived;
import net.runelite.client.game.ItemManager;
@@ -421,8 +421,6 @@ public class GroundItemsPlugin extends Plugin
private GroundItemsOverlay overlay;
@Inject
private Notifier notifier;
@Inject
private EventBus eventBus;
private LoadingCache<String, Boolean> highlightedItems;
private Color defaultColor;
private Color highlightedColor;
@@ -487,7 +485,6 @@ public class GroundItemsPlugin extends Plugin
protected void startUp()
{
updateConfig();
addSubscriptions();
overlayManager.add(overlay);
reset();
@@ -498,8 +495,6 @@ public class GroundItemsPlugin extends Plugin
@Override
protected void shutDown() throws Exception
{
eventBus.unregister(this);
overlayManager.remove(overlay);
mouseManager.unregisterMouseListener(inputListener);
keyManager.unregisterKeyListener(inputListener);
@@ -512,22 +507,7 @@ public class GroundItemsPlugin extends Plugin
collectedGroundItems.clear();
}
private void addSubscriptions()
{
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);
}
@Subscribe
private void onGameTick(GameTick event)
{
for (GroundItem item : collectedGroundItems.values())
@@ -540,6 +520,7 @@ public class GroundItemsPlugin extends Plugin
}
}
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
if (event.getGroup().equals("grounditems"))
@@ -549,6 +530,7 @@ public class GroundItemsPlugin extends Plugin
}
}
@Subscribe
private void onGameStateChanged(final GameStateChanged event)
{
if (event.getGameState() == GameState.LOADING)
@@ -557,6 +539,7 @@ public class GroundItemsPlugin extends Plugin
}
}
@Subscribe
private void onItemSpawned(ItemSpawned itemSpawned)
{
TileItem item = itemSpawned.getItem();
@@ -583,6 +566,7 @@ public class GroundItemsPlugin extends Plugin
}
}
@Subscribe
private void onItemDespawned(ItemDespawned itemDespawned)
{
TileItem item = itemDespawned.getItem();
@@ -609,6 +593,7 @@ public class GroundItemsPlugin extends Plugin
}
}
@Subscribe
private void onItemQuantityChanged(ItemQuantityChanged itemQuantityChanged)
{
TileItem item = itemQuantityChanged.getItem();
@@ -625,6 +610,7 @@ public class GroundItemsPlugin extends Plugin
}
}
@Subscribe
private void onNpcLootReceived(NpcLootReceived npcLootReceived)
{
npcLootReceived.getItems().forEach(item ->
@@ -642,6 +628,7 @@ public class GroundItemsPlugin extends Plugin
lootNotifier(items);
}
@Subscribe
private void onPlayerLootReceived(PlayerLootReceived playerLootReceived)
{
Collection<ItemStack> items = playerLootReceived.getItems();
@@ -689,6 +676,7 @@ public class GroundItemsPlugin extends Plugin
notifier.notify(notification);
}
@Subscribe
private void onClientTick(ClientTick event)
{
final MenuEntry[] menuEntries = client.getMenuEntries();
@@ -931,6 +919,7 @@ public class GroundItemsPlugin extends Plugin
}
}
@Subscribe
private void onMenuEntryAdded(MenuEntryAdded lastEntry)
{
if (this.itemHighlightMode != OVERLAY)
@@ -1174,6 +1163,7 @@ public class GroundItemsPlugin extends Plugin
return this.defaultColor;
}
@Subscribe
private void onFocusChanged(FocusChanged focusChanged)
{
if (!focusChanged.isFocused())
@@ -1182,6 +1172,7 @@ public class GroundItemsPlugin extends Plugin
}
}
@Subscribe
private void onMenuOptionClicked(MenuOptionClicked menuOptionClicked)
{
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.util.Text;
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.input.KeyManager;
import net.runelite.client.plugins.Plugin;
@@ -112,9 +112,6 @@ public class GroundMarkerPlugin extends Plugin
@Inject
private GroundMarkerMinimapOverlay minimapOverlay;
@Inject
private EventBus eventBus;
@Inject
private KeyManager keyManager;
@@ -140,7 +137,9 @@ public class GroundMarkerPlugin extends Plugin
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;
@Getter(AccessLevel.PACKAGE)
@@ -293,6 +292,7 @@ public class GroundMarkerPlugin extends Plugin
return point;
}
@Subscribe
private void onGameStateChanged(GameStateChanged gameStateChanged)
{
if (gameStateChanged.getGameState() != GameState.LOGGED_IN)
@@ -304,6 +304,7 @@ public class GroundMarkerPlugin extends Plugin
loadPoints();
}
@Subscribe
private void onFocusChanged(FocusChanged focusChanged)
{
if (!focusChanged.isFocused())
@@ -312,6 +313,7 @@ public class GroundMarkerPlugin extends Plugin
}
}
@Subscribe
private void onMenuEntryAdded(MenuEntryAdded event)
{
if (hotKeyPressed && event.getOption().equals(WALK_HERE))
@@ -358,6 +360,7 @@ public class GroundMarkerPlugin extends Plugin
}
}
@Subscribe
private void onMenuOptionClicked(MenuOptionClicked event)
{
if (!event.getOption().contains(MARK) && !event.getOption().contains(UNMARK))
@@ -385,7 +388,6 @@ public class GroundMarkerPlugin extends Plugin
protected void startUp()
{
updateConfig();
addSubscriptions();
overlayManager.add(overlay);
overlayManager.add(minimapOverlay);
@@ -396,23 +398,13 @@ public class GroundMarkerPlugin extends Plugin
@Override
protected void shutDown()
{
eventBus.unregister(this);
overlayManager.remove(overlay);
overlayManager.remove(minimapOverlay);
keyManager.unregisterKeyListener(inputListener);
points.clear();
}
private void addSubscriptions()
{
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)
private void markTile(LocalPoint localPoint, int group)
{
if (localPoint == null)
{
@@ -493,6 +485,7 @@ public class GroundMarkerPlugin extends Plugin
return color;
}
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
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.VarbitChanged;
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.PluginDescriptor;
@@ -115,9 +115,6 @@ public class HerbiboarPlugin extends Plugin
@Inject
private HerbiboarConfig config;
@Inject
private EventBus eventBus;
@Getter(AccessLevel.PACKAGE)
private boolean inHerbiboarArea;
@@ -194,7 +191,6 @@ public class HerbiboarPlugin extends Plugin
protected void startUp() throws Exception
{
updateConfig();
addSubscriptions();
overlayManager.add(overlay);
overlayManager.add(minimapOverlay);
@@ -204,27 +200,11 @@ public class HerbiboarPlugin extends Plugin
@Override
protected void shutDown() throws Exception
{
eventBus.unregister(this);
overlayManager.remove(overlay);
overlayManager.remove(minimapOverlay);
}
private void addSubscriptions()
{
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()
private void updateTrailData()
{
currentTrail = null;
currentPath = -1;
@@ -318,6 +298,7 @@ public class HerbiboarPlugin extends Plugin
tunnels.clear();
}
@Subscribe
private void onGameStateChanged(GameStateChanged event)
{
switch (event.getGameState())
@@ -335,6 +316,7 @@ public class HerbiboarPlugin extends Plugin
}
}
@Subscribe
private void onVarbitChanged(VarbitChanged event)
{
if (isInHerbiboarArea())
@@ -343,11 +325,13 @@ public class HerbiboarPlugin extends Plugin
}
}
@Subscribe
private void onGameObjectSpawned(GameObjectSpawned event)
{
onGameObject(event.getTile(), null, event.getGameObject());
}
@Subscribe
public void onAnimationChanged(AnimationChanged event)
{
if (!(event.getActor() instanceof NPC))
@@ -373,26 +357,31 @@ public class HerbiboarPlugin extends Plugin
}
}
@Subscribe
private void onGameObjectChanged(GameObjectChanged event)
{
onGameObject(event.getTile(), event.getPrevious(), event.getGameObject());
}
@Subscribe
private void onGameObjectDespawned(GameObjectDespawned event)
{
onGameObject(event.getTile(), event.getGameObject(), null);
}
@Subscribe
private void onGroundObjectSpawned(GroundObjectSpawned event)
{
onGroundObject( null, event.getGroundObject());
onGroundObject(null, event.getGroundObject());
}
@Subscribe
private void onGroundObjectChanged(GroundObjectChanged event)
{
onGroundObject(event.getPrevious(), event.getGroundObject());
}
@Subscribe
private void onGroundObjectDespawned(GroundObjectDespawned event)
{
onGroundObject(event.getGroundObject(), null);
@@ -476,6 +465,7 @@ public class HerbiboarPlugin extends Plugin
return END_LOCATIONS;
}
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
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.WidgetInfo;
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.PluginDescriptor;
@@ -72,36 +72,36 @@ import net.runelite.client.plugins.hideprayers.util.Zulrah;
public class HidePrayersPlugin extends Plugin
{
private static final List<WidgetInfo> PRAYER_WIDGET_INFO_LIST = ImmutableList.of(
WidgetInfo.PRAYER_THICK_SKIN, //0
WidgetInfo.PRAYER_BURST_OF_STRENGTH, //1
WidgetInfo.PRAYER_CLARITY_OF_THOUGHT, //2
WidgetInfo.PRAYER_SHARP_EYE, //3
WidgetInfo.PRAYER_MYSTIC_WILL, //4
WidgetInfo.PRAYER_ROCK_SKIN, //5
WidgetInfo.PRAYER_SUPERHUMAN_STRENGTH, //6
WidgetInfo.PRAYER_IMPROVED_REFLEXES, //7
WidgetInfo.PRAYER_RAPID_RESTORE, //8
WidgetInfo.PRAYER_RAPID_HEAL, //9
WidgetInfo.PRAYER_PROTECT_ITEM, //10
WidgetInfo.PRAYER_HAWK_EYE, //11
WidgetInfo.PRAYER_MYSTIC_LORE, //12
WidgetInfo.PRAYER_STEEL_SKIN, //13
WidgetInfo.PRAYER_ULTIMATE_STRENGTH, //14
WidgetInfo.PRAYER_INCREDIBLE_REFLEXES, //15
WidgetInfo.PRAYER_PROTECT_FROM_MAGIC, //16
WidgetInfo.PRAYER_PROTECT_FROM_MISSILES, //17
WidgetInfo.PRAYER_PROTECT_FROM_MELEE, //18
WidgetInfo.PRAYER_EAGLE_EYE, //19
WidgetInfo.PRAYER_MYSTIC_MIGHT, //20
WidgetInfo.PRAYER_RETRIBUTION, //21
WidgetInfo.PRAYER_REDEMPTION, //22
WidgetInfo.PRAYER_SMITE, //23
WidgetInfo.PRAYER_PRESERVE, //24
WidgetInfo.PRAYER_CHIVALRY, //25
WidgetInfo.PRAYER_PIETY, //26
WidgetInfo.PRAYER_RIGOUR, //27
WidgetInfo.PRAYER_AUGURY //28
);
WidgetInfo.PRAYER_THICK_SKIN, //0
WidgetInfo.PRAYER_BURST_OF_STRENGTH, //1
WidgetInfo.PRAYER_CLARITY_OF_THOUGHT, //2
WidgetInfo.PRAYER_SHARP_EYE, //3
WidgetInfo.PRAYER_MYSTIC_WILL, //4
WidgetInfo.PRAYER_ROCK_SKIN, //5
WidgetInfo.PRAYER_SUPERHUMAN_STRENGTH, //6
WidgetInfo.PRAYER_IMPROVED_REFLEXES, //7
WidgetInfo.PRAYER_RAPID_RESTORE, //8
WidgetInfo.PRAYER_RAPID_HEAL, //9
WidgetInfo.PRAYER_PROTECT_ITEM, //10
WidgetInfo.PRAYER_HAWK_EYE, //11
WidgetInfo.PRAYER_MYSTIC_LORE, //12
WidgetInfo.PRAYER_STEEL_SKIN, //13
WidgetInfo.PRAYER_ULTIMATE_STRENGTH, //14
WidgetInfo.PRAYER_INCREDIBLE_REFLEXES, //15
WidgetInfo.PRAYER_PROTECT_FROM_MAGIC, //16
WidgetInfo.PRAYER_PROTECT_FROM_MISSILES, //17
WidgetInfo.PRAYER_PROTECT_FROM_MELEE, //18
WidgetInfo.PRAYER_EAGLE_EYE, //19
WidgetInfo.PRAYER_MYSTIC_MIGHT, //20
WidgetInfo.PRAYER_RETRIBUTION, //21
WidgetInfo.PRAYER_REDEMPTION, //22
WidgetInfo.PRAYER_SMITE, //23
WidgetInfo.PRAYER_PRESERVE, //24
WidgetInfo.PRAYER_CHIVALRY, //25
WidgetInfo.PRAYER_PIETY, //26
WidgetInfo.PRAYER_RIGOUR, //27
WidgetInfo.PRAYER_AUGURY //28
);
@Inject
private Client client;
@@ -109,9 +109,6 @@ public class HidePrayersPlugin extends Plugin
@Inject
private HidePrayersConfig config;
@Inject
private EventBus eventBus;
private boolean showindividualprayers;
private boolean ShowTHICK_SKIN;
private boolean ShowBURST_OF_STRENGTH;
@@ -172,7 +169,6 @@ public class HidePrayersPlugin extends Plugin
protected void startUp() throws Exception
{
updateConfig();
addSubscriptions();
hidePrayers();
}
@@ -180,18 +176,10 @@ public class HidePrayersPlugin extends Plugin
@Override
protected void shutDown() throws Exception
{
eventBus.unregister(this);
restorePrayers();
}
private void addSubscriptions()
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventBus.subscribe(WidgetLoaded.class, this, this::onWidgetLoaded);
}
@Subscribe
private void onGameStateChanged(GameStateChanged event)
{
if (event.getGameState() == GameState.LOGGED_IN)
@@ -201,6 +189,7 @@ public class HidePrayersPlugin extends Plugin
}
}
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
if (event.getGroup().equals("hideprayers"))
@@ -210,6 +199,7 @@ public class HidePrayersPlugin extends Plugin
}
}
@Subscribe
private void onWidgetLoaded(WidgetLoaded event)
{
if (event.getGroupId() == WidgetID.PRAYER_GROUP_ID || event.getGroupId() == WidgetID.QUICK_PRAYERS_GROUP_ID)
@@ -306,7 +296,7 @@ public class HidePrayersPlugin extends Plugin
return;
}
if ( !this.showindividualprayers
if (!this.showindividualprayers
&& !this.getarmadylprayers
&& !this.getbarrowsprayers
&& !this.getbandosprayers
@@ -325,35 +315,35 @@ public class HidePrayersPlugin extends Plugin
if (this.showindividualprayers)
{
prayerWidgets.get(0).setHidden(!this.ShowTHICK_SKIN); // Thick Skin
prayerWidgets.get(1).setHidden(!this.ShowBURST_OF_STRENGTH); // Burst of Strength
prayerWidgets.get(2).setHidden(!this.ShowCLARITY_OF_THOUGHT); // Clarity of Thought
prayerWidgets.get(3).setHidden(!this.ShowSHARP_EYE); // Sharp Eye
prayerWidgets.get(4).setHidden(!this.ShowMYSTIC_WILL); // Mystic Will
prayerWidgets.get(5).setHidden(!this.ShowROCK_SKIN); // Rock Skin
prayerWidgets.get(6).setHidden(!this.ShowSUPERHUMAN_STRENGTH); // Super Human Strength
prayerWidgets.get(7).setHidden(!this.ShowIMPROVED_REFLEXES); // Improved_Reflexes
prayerWidgets.get(8).setHidden(!this.ShowRapidRestore); // Rapid Restore
prayerWidgets.get(9).setHidden(!this.ShowRapidHeal); // Rapid Heal
prayerWidgets.get(10).setHidden(!this.ShowProtectItem); // Protect Item
prayerWidgets.get(11).setHidden(!this.ShowHAWK_EYE); // Hawk Eye
prayerWidgets.get(12).setHidden(!this.ShowMYSTIC_LORE); // Mystic Lore
prayerWidgets.get(13).setHidden(!this.ShowSteelSkin); // Steel Skin
prayerWidgets.get(14).setHidden(!this.ShowUltimateStrength); // Ultimate Strength
prayerWidgets.get(15).setHidden(!this.ShowIncredibleReflex); // Incredible Reflexes
prayerWidgets.get(16).setHidden(!this.ShowPTFMagic); // Protect from Magic
prayerWidgets.get(17).setHidden(!this.ShowPTFRange); // Protect from Range
prayerWidgets.get(18).setHidden(!this.ShowPTFMelee); // Protect from Melee
prayerWidgets.get(19).setHidden(!this.ShowEagle); // eagle eye
prayerWidgets.get(20).setHidden(!this.ShowMystic); // Mystic Might
prayerWidgets.get(21).setHidden(!this.ShowRETRIBUTION); // Retribution
prayerWidgets.get(22).setHidden(!this.ShowRedemption); // Redemption
prayerWidgets.get(23).setHidden(!this.ShowSmite); // Smite
prayerWidgets.get(24).setHidden(!this.ShowPreserve); // Preserve
prayerWidgets.get(25).setHidden(!this.ShowChivalry); // Chivalry
prayerWidgets.get(26).setHidden(!this.ShowPiety); // Piety
prayerWidgets.get(27).setHidden(!this.ShowRigour); // Rigour
prayerWidgets.get(28).setHidden(!this.ShowAugury); // Augury
prayerWidgets.get(0).setHidden(!this.ShowTHICK_SKIN); // Thick Skin
prayerWidgets.get(1).setHidden(!this.ShowBURST_OF_STRENGTH); // Burst of Strength
prayerWidgets.get(2).setHidden(!this.ShowCLARITY_OF_THOUGHT); // Clarity of Thought
prayerWidgets.get(3).setHidden(!this.ShowSHARP_EYE); // Sharp Eye
prayerWidgets.get(4).setHidden(!this.ShowMYSTIC_WILL); // Mystic Will
prayerWidgets.get(5).setHidden(!this.ShowROCK_SKIN); // Rock Skin
prayerWidgets.get(6).setHidden(!this.ShowSUPERHUMAN_STRENGTH); // Super Human Strength
prayerWidgets.get(7).setHidden(!this.ShowIMPROVED_REFLEXES); // Improved_Reflexes
prayerWidgets.get(8).setHidden(!this.ShowRapidRestore); // Rapid Restore
prayerWidgets.get(9).setHidden(!this.ShowRapidHeal); // Rapid Heal
prayerWidgets.get(10).setHidden(!this.ShowProtectItem); // Protect Item
prayerWidgets.get(11).setHidden(!this.ShowHAWK_EYE); // Hawk Eye
prayerWidgets.get(12).setHidden(!this.ShowMYSTIC_LORE); // Mystic Lore
prayerWidgets.get(13).setHidden(!this.ShowSteelSkin); // Steel Skin
prayerWidgets.get(14).setHidden(!this.ShowUltimateStrength); // Ultimate Strength
prayerWidgets.get(15).setHidden(!this.ShowIncredibleReflex); // Incredible Reflexes
prayerWidgets.get(16).setHidden(!this.ShowPTFMagic); // Protect from Magic
prayerWidgets.get(17).setHidden(!this.ShowPTFRange); // Protect from Range
prayerWidgets.get(18).setHidden(!this.ShowPTFMelee); // Protect from Melee
prayerWidgets.get(19).setHidden(!this.ShowEagle); // eagle eye
prayerWidgets.get(20).setHidden(!this.ShowMystic); // Mystic Might
prayerWidgets.get(21).setHidden(!this.ShowRETRIBUTION); // Retribution
prayerWidgets.get(22).setHidden(!this.ShowRedemption); // Redemption
prayerWidgets.get(23).setHidden(!this.ShowSmite); // Smite
prayerWidgets.get(24).setHidden(!this.ShowPreserve); // Preserve
prayerWidgets.get(25).setHidden(!this.ShowChivalry); // Chivalry
prayerWidgets.get(26).setHidden(!this.ShowPiety); // Piety
prayerWidgets.get(27).setHidden(!this.ShowRigour); // Rigour
prayerWidgets.get(28).setHidden(!this.ShowAugury); // Augury
}
else if (this.getarmadylprayers)
@@ -518,7 +508,7 @@ public class HidePrayersPlugin extends Plugin
break;
}
}
else if (this.getzamorakprayers)
{
switch (this.zamorak)

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.SHOP_INVENTORY_GROUP_ID;
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.PluginDescriptor;
@@ -76,9 +76,6 @@ public class HighAlchemyPlugin extends Plugin
@Inject
private HighAlchemyOverlay overlay;
@Inject
private EventBus eventBus;
@Provides
HighAlchemyConfig getConfig(ConfigManager configManager)
{
@@ -98,8 +95,6 @@ public class HighAlchemyPlugin extends Plugin
protected void startUp() throws Exception
{
updateConfig();
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
buildGroupList();
overlayManager.add(overlay);
}
@@ -110,6 +105,7 @@ public class HighAlchemyPlugin extends Plugin
overlayManager.remove(overlay);
}
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
if (event.getGroup().equals(CONFIG_GROUP))
@@ -131,7 +127,7 @@ public class HighAlchemyPlugin extends Plugin
if (this.showInventory)
{
Arrays.stream(
new int[]{
new int[] {
DEPOSIT_BOX_GROUP_ID,
BANK_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.MenuOpcode;
import net.runelite.api.events.ChatMessage;
import net.runelite.client.events.ConfigChanged;
import net.runelite.api.events.MenuEntryAdded;
import net.runelite.api.events.PlayerMenuOptionClicked;
import net.runelite.api.util.Text;
import net.runelite.api.widgets.WidgetInfo;
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.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
@@ -97,9 +97,6 @@ public class HiscorePlugin extends Plugin
@Inject
private HiscoreConfig config;
@Inject
private EventBus eventBus;
private NavigationButton navButton;
private HiscorePanel hiscorePanel;
@@ -115,7 +112,6 @@ public class HiscorePlugin extends Plugin
@Override
protected void startUp() throws Exception
{
addSubscriptions();
updateConfig();
hiscorePanel = injector.getInstance(HiscorePanel.class);
@@ -144,8 +140,6 @@ public class HiscorePlugin extends Plugin
@Override
protected void shutDown() throws Exception
{
eventBus.unregister(this);
hiscorePanel.removeInputKeyListener(autocompleter);
clientToolbar.removeNavigation(navButton);
@@ -155,14 +149,7 @@ public class HiscorePlugin extends Plugin
}
}
private void addSubscriptions()
{
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);
}
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
@@ -171,30 +158,31 @@ public class HiscorePlugin extends Plugin
return;
}
updateConfig();
if (client != null)
{
menuManager.get().removePlayerMenuItem(LOOKUP);
if (client != null)
{
menuManager.get().removePlayerMenuItem(LOOKUP);
if (this.playerOption)
{
menuManager.get().addPlayerMenuItem(LOOKUP);
}
}
if (event.getKey().equals("autocomplete"))
if (this.playerOption)
{
if (this.autocomplete)
{
hiscorePanel.addInputKeyListener(autocompleter);
}
else
{
hiscorePanel.removeInputKeyListener(autocompleter);
}
menuManager.get().addPlayerMenuItem(LOOKUP);
}
}
if (event.getKey().equals("autocomplete"))
{
if (this.autocomplete)
{
hiscorePanel.addInputKeyListener(autocompleter);
}
else
{
hiscorePanel.removeInputKeyListener(autocompleter);
}
}
}
@Subscribe
private void onMenuEntryAdded(MenuEntryAdded event)
{
if (!this.menuOption)
@@ -229,6 +217,7 @@ public class HiscorePlugin extends Plugin
}
}
@Subscribe
private void onPlayerMenuOptionClicked(PlayerMenuOptionClicked event)
{
if (event.getMenuOption().equals(LOOKUP))
@@ -237,6 +226,7 @@ public class HiscorePlugin extends Plugin
}
}
@Subscribe
private void onChatMessage(ChatMessage event)
{
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.LocalPoint;
import net.runelite.api.coords.WorldPoint;
import net.runelite.client.events.ConfigChanged;
import net.runelite.api.events.GameObjectSpawned;
import net.runelite.api.events.GameTick;
import net.runelite.client.Notifier;
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.PluginDescriptor;
import net.runelite.client.ui.overlay.OverlayManager;
@@ -77,9 +77,6 @@ public class HunterPlugin extends Plugin
@Inject
private HunterConfig config;
@Inject
private EventBus eventBus;
@Getter(AccessLevel.PACKAGE)
private final Map<WorldPoint, HunterTrap> traps = new HashMap<>();
@@ -108,7 +105,6 @@ public class HunterPlugin extends Plugin
protected void startUp()
{
updateConfig();
addSubscriptions();
overlayManager.add(overlay);
overlay.updateConfig();
@@ -117,20 +113,12 @@ public class HunterPlugin extends Plugin
@Override
protected void shutDown() throws Exception
{
eventBus.unregister(this);
overlayManager.remove(overlay);
lastActionTime = Instant.ofEpochMilli(0);
traps.clear();
}
private void addSubscriptions()
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(GameTick.class, this, this::onGameTick);
eventBus.subscribe(GameObjectSpawned.class, this, this::onGameObjectSpawned);
}
@Subscribe
private void onGameObjectSpawned(GameObjectSpawned event)
{
final GameObject gameObject = event.getGameObject();
@@ -262,30 +250,30 @@ public class HunterPlugin extends Plugin
// Imp entering box
case ObjectID.MAGIC_BOX_19225:
// Black chin shaking box
// Black chin shaking box
case ObjectID.BOX_TRAP:
case ObjectID.BOX_TRAP_2026:
case ObjectID.BOX_TRAP_2028:
case ObjectID.BOX_TRAP_2029:
// Red chin shaking box
// Red chin shaking box
case ObjectID.BOX_TRAP_9381:
case ObjectID.BOX_TRAP_9390:
case ObjectID.BOX_TRAP_9391:
case ObjectID.BOX_TRAP_9392:
case ObjectID.BOX_TRAP_9393:
// Grey chin shaking box
// Grey chin shaking box
case ObjectID.BOX_TRAP_9386:
case ObjectID.BOX_TRAP_9387:
case ObjectID.BOX_TRAP_9388:
// Ferret shaking box
// Ferret shaking box
case ObjectID.BOX_TRAP_9394:
case ObjectID.BOX_TRAP_9396:
case ObjectID.BOX_TRAP_9397:
// Bird traps
// Bird traps
case ObjectID.BIRD_SNARE_9346:
case ObjectID.BIRD_SNARE_9347:
case ObjectID.BIRD_SNARE_9349:
@@ -293,7 +281,7 @@ public class HunterPlugin extends Plugin
case ObjectID.BIRD_SNARE_9376:
case ObjectID.BIRD_SNARE_9378:
// Deadfall trap
// Deadfall trap
case ObjectID.DEADFALL_19218:
case ObjectID.DEADFALL_19851:
case ObjectID.DEADFALL_20128:
@@ -301,7 +289,7 @@ public class HunterPlugin extends Plugin
case ObjectID.DEADFALL_20130:
case ObjectID.DEADFALL_20131:
// Net trap
// Net trap
case ObjectID.NET_TRAP_9003:
case ObjectID.NET_TRAP_9005:
case ObjectID.NET_TRAP_8972:
@@ -311,7 +299,7 @@ public class HunterPlugin extends Plugin
case ObjectID.NET_TRAP_8993:
case ObjectID.NET_TRAP_8997:
// Maniacal monkey boulder trap
// Maniacal monkey boulder trap
case ObjectID.MONKEY_TRAP_28828:
case ObjectID.MONKEY_TRAP_28829:
if (myTrap != null)
@@ -327,6 +315,7 @@ public class HunterPlugin extends Plugin
* checks if the trap is still there. If the trap is gone, it removes
* the trap from the local players trap collection.
*/
@Subscribe
private void onGameTick(GameTick event)
{
// 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();
}
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
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.NpcSpawned;
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.PluginDescriptor;
@@ -73,9 +73,6 @@ public class BabyHydraPlugin extends Plugin
@Inject
private Client client;
@Inject
private EventBus eventBus;
@Provides
BabyHydraConfig provideConfig(ConfigManager configManager)
{
@@ -100,7 +97,6 @@ public class BabyHydraPlugin extends Plugin
protected void startUp() throws Exception
{
updateConfig();
addSubscriptions();
if (this.TextIndicator)
{
@@ -116,8 +112,6 @@ public class BabyHydraPlugin extends Plugin
@Override
protected void shutDown() throws Exception
{
eventBus.unregister(this);
overlayManager.remove(hydraOverlay);
overlayManager.remove(hydraPrayOverlay);
overlayManager.remove(hydraIndicatorOverlay);
@@ -125,14 +119,7 @@ public class BabyHydraPlugin extends Plugin
hydraattacks.clear();
}
private void addSubscriptions()
{
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);
}
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
if (!event.getGroup().equals("hydra"))
@@ -168,6 +155,7 @@ public class BabyHydraPlugin extends Plugin
}
}
@Subscribe
private void onNpcSpawned(NpcSpawned event)
{
NPC hydra = event.getNpc();
@@ -177,6 +165,7 @@ public class BabyHydraPlugin extends Plugin
}
}
@Subscribe
private void onNpcDespawned(NpcDespawned event)
{
NPC hydra = event.getNpc();
@@ -187,6 +176,7 @@ public class BabyHydraPlugin extends Plugin
}
}
@Subscribe
private void onAnimationChanged(AnimationChanged event)
{
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.client.Notifier;
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.Sound;
import net.runelite.client.game.SoundManager;
@@ -240,9 +240,6 @@ public class IdleNotifierPlugin extends Plugin
@Inject
private IdleNotifierConfig config;
@Inject
private EventBus eventBus;
private Instant lastAnimating;
private int lastAnimation = AnimationID.IDLE;
private Instant lastInteracting;
@@ -305,6 +302,7 @@ public class IdleNotifierPlugin extends Plugin
return configManager.getConfig(IdleNotifierConfig.class);
}
@Subscribe
void onAnimationChanged(AnimationChanged event)
{
if (client.getGameState() != GameState.LOGGED_IN)
@@ -343,6 +341,7 @@ public class IdleNotifierPlugin extends Plugin
}
}
@Subscribe
private void onPlayerSpawned(PlayerSpawned event)
{
final Player p = event.getPlayer();
@@ -357,6 +356,7 @@ public class IdleNotifierPlugin extends Plugin
}
}
@Subscribe
private void onWallObjectSpawned(WallObjectSpawned event)
{
WallObject wall = event.getWallObject();
@@ -370,6 +370,7 @@ public class IdleNotifierPlugin extends Plugin
}
}
@Subscribe
private void onItemContainerChanged(ItemContainerChanged event)
{
ItemContainer itemContainer = event.getItemContainer();
@@ -447,6 +448,7 @@ public class IdleNotifierPlugin extends Plugin
itemQuantitiesPrevious = itemQuantities;
}
@Subscribe
void onInteractingChanged(InteractingChanged event)
{
final Actor source = event.getSource();
@@ -497,6 +499,7 @@ public class IdleNotifierPlugin extends Plugin
}
}
@Subscribe
void onGameStateChanged(GameStateChanged gameStateChanged)
{
lastInteracting = null;
@@ -530,6 +533,7 @@ public class IdleNotifierPlugin extends Plugin
}
}
@Subscribe
void onHitsplatApplied(HitsplatApplied event)
{
if (event.getActor() != client.getLocalPlayer())
@@ -546,6 +550,7 @@ public class IdleNotifierPlugin extends Plugin
}
}
@Subscribe
private void onSpotAnimationChanged(SpotAnimationChanged event)
{
Actor actor = event.getActor();
@@ -561,6 +566,7 @@ public class IdleNotifierPlugin extends Plugin
}
}
@Subscribe
void onGameTick(GameTick event)
{
skullNotifier();
@@ -977,7 +983,7 @@ public class IdleNotifierPlugin extends Plugin
return ArrayUtils.contains(client.getMapRegions(), RESOURCE_AREA_REGION);
}
private void notifyWith(Player local, String message)
private void notifyWith(Player local, String message)
{
notifier.notify("[" + local.getName() + "] " + message);
}
@@ -986,29 +992,14 @@ public class IdleNotifierPlugin extends Plugin
protected void startUp() throws Exception
{
updateConfig();
addSubscriptions();
}
@Override
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)
{
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.client.Notifier;
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.PluginDescriptor;
@@ -85,9 +85,6 @@ public class ImplingsPlugin extends Plugin
@Inject
private ImplingsConfig config;
@Inject
private EventBus eventBus;
@Inject
private Notifier notifier;
@@ -134,7 +131,6 @@ public class ImplingsPlugin extends Plugin
protected void startUp()
{
updateConfig();
addSubscriptions();
dynamicSpawns.put(DYNAMIC_SPAWN_NATURE_DRAGON, "T3 Nature-Lucky Dynamic");
dynamicSpawns.put(DYNAMIC_SPAWN_ECLECTIC, "T2 Eclectic Dynamic");
@@ -148,24 +144,13 @@ public class ImplingsPlugin extends Plugin
@Override
protected void shutDown()
{
eventBus.unregister(this);
implings.clear();
overlayManager.remove(overlay);
overlayManager.remove(minimapOverlay);
overlayManager.remove(implingCounterOverlay);
}
private void addSubscriptions()
{
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);
}
@Subscribe
private void onGameTick(GameTick event)
{
implingCounterMap.clear();
@@ -190,6 +175,7 @@ public class ImplingsPlugin extends Plugin
}
}
@Subscribe
private void onNpcSpawned(NpcSpawned npcSpawned)
{
NPC npc = npcSpawned.getNpc();
@@ -206,6 +192,7 @@ public class ImplingsPlugin extends Plugin
}
}
@Subscribe
private void onNpcDefinitionChanged(NpcDefinitionChanged npcCompositionChanged)
{
NPC npc = npcCompositionChanged.getNpc();
@@ -222,6 +209,7 @@ public class ImplingsPlugin extends Plugin
}
}
@Subscribe
private void onGameStateChanged(GameStateChanged event)
{
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)
{
if (implings.isEmpty())
@@ -334,6 +323,7 @@ public class ImplingsPlugin extends Plugin
}
}
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
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.NpcSpawned;
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.PluginDescriptor;
@@ -94,9 +94,6 @@ public class InfernoPlugin extends Plugin
@Inject
private InfernoConfig config;
@Inject
private EventBus eventBus;
@Getter(AccessLevel.PACKAGE)
private InfernoConfig.FontStyle fontStyle = InfernoConfig.FontStyle.BOLD;
@Getter(AccessLevel.PACKAGE)
@@ -243,7 +240,6 @@ public class InfernoPlugin extends Plugin
protected void startUp() throws Exception
{
updateConfig();
addSubscriptions();
waveOverlay.setDisplayMode(this.waveDisplay);
waveOverlay.setWaveHeaderColor(this.getWaveOverlayHeaderColor);
@@ -267,8 +263,6 @@ public class InfernoPlugin extends Plugin
@Override
protected void shutDown() throws Exception
{
eventBus.unregister(this);
overlayManager.remove(infernoOverlay);
overlayManager.remove(waveOverlay);
overlayManager.remove(jadOverlay);
@@ -279,17 +273,7 @@ public class InfernoPlugin extends Plugin
showNpcDeaths();
}
private void addSubscriptions()
{
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);
}
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
if (!"inferno".equals(event.getGroup()))
@@ -319,6 +303,7 @@ public class InfernoPlugin extends Plugin
}
}
@Subscribe
private void onGameTick(GameTick GameTickEvent)
{
if (!isInInferno())
@@ -347,6 +332,7 @@ public class InfernoPlugin extends Plugin
calculateCentralNibbler();
}
@Subscribe
private void onNpcSpawned(NpcSpawned event)
{
if (!isInInferno())
@@ -392,6 +378,7 @@ public class InfernoPlugin extends Plugin
}
}
@Subscribe
private void onNpcDespawned(NpcDespawned event)
{
if (!isInInferno())
@@ -407,6 +394,7 @@ public class InfernoPlugin extends Plugin
infernoNpcs.removeIf(infernoNPC -> infernoNPC.getNpc() == event.getNpc());
}
@Subscribe
private void onAnimationChanged(AnimationChanged event)
{
if (!isInInferno())
@@ -426,6 +414,7 @@ public class InfernoPlugin extends Plugin
}
}
@Subscribe
private void onGameStateChanged(GameStateChanged event)
{
if (event.getGameState() != GameState.LOGGED_IN)
@@ -461,6 +450,7 @@ public class InfernoPlugin extends Plugin
}
}
@Subscribe
private void onChatMessage(ChatMessage event)
{
if (!isInInferno() || event.getType() != ChatMessageType.GAMEMESSAGE)

View File

@@ -27,7 +27,6 @@ package net.runelite.client.plugins.info;
import java.awt.image.BufferedImage;
import javax.inject.Inject;
import javax.inject.Singleton;
import net.runelite.client.eventbus.EventBus;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.ui.ClientToolbar;
@@ -45,9 +44,6 @@ public class InfoPlugin extends Plugin
@Inject
private ClientToolbar clientToolbar;
@Inject
private EventBus eventbus;
private NavigationButton navButton;
@@ -72,8 +68,6 @@ public class InfoPlugin extends Plugin
@Override
protected void shutDown() throws Exception
{
eventbus.unregister(this);
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.widgets.WidgetInfo;
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.MouseManager;
import net.runelite.client.menus.MenuManager;
@@ -67,9 +67,6 @@ public class InstanceMapPlugin extends Plugin
@Inject
private MouseManager mouseManager;
@Inject
private EventBus eventBus;
@Override
public void configure(Binder binder)
{
@@ -89,7 +86,6 @@ public class InstanceMapPlugin extends Plugin
@Override
protected void startUp() throws Exception
{
addSubscriptions();
overlayManager.add(overlay);
addCustomOptions();
@@ -101,8 +97,6 @@ public class InstanceMapPlugin extends Plugin
@Override
protected void shutDown() throws Exception
{
eventBus.unregister(this);
overlay.setShowMap(false);
overlayManager.remove(overlay);
removeCustomOptions();
@@ -111,12 +105,7 @@ public class InstanceMapPlugin extends Plugin
mouseManager.unregisterMouseWheelListener(inputListener);
}
private void addSubscriptions()
{
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventBus.subscribe(WidgetMenuOptionClicked.class, this, this::onWidgetMenuOptionClicked);
}
@Subscribe
private void onGameStateChanged(GameStateChanged event)
{
overlay.onGameStateChange(event);
@@ -127,6 +116,7 @@ public class InstanceMapPlugin extends Plugin
return event.getMenuOption().equals(widgetMenuOption.getMenuOption()) && event.getMenuTarget().equals(widgetMenuOption.getMenuTarget());
}
@Subscribe
private void onWidgetMenuOptionClicked(WidgetMenuOptionClicked event)
{
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.client.callback.ClientThread;
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.SpriteManager;
import net.runelite.client.plugins.Plugin;
@@ -73,9 +73,6 @@ public class InterfaceStylesPlugin extends Plugin
@Inject
private SpriteManager spriteManager;
@Inject
private EventBus eventBus;
private Sprite[] defaultCrossSprites;
private Skin skin;
@@ -93,15 +90,12 @@ public class InterfaceStylesPlugin extends Plugin
protected void startUp() throws Exception
{
updateConfig();
addSubscriptions();
clientThread.invoke(this::updateAllOverrides);
}
@Override
protected void shutDown() throws Exception
{
eventBus.unregister(this);
clientThread.invoke(() ->
{
restoreWidgetDimensions();
@@ -111,15 +105,7 @@ public class InterfaceStylesPlugin extends Plugin
});
}
private void addSubscriptions()
{
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);
}
@Subscribe
private void onConfigChanged(ConfigChanged config)
{
if (config.getGroup().equals("interfaceStyles"))
@@ -129,11 +115,13 @@ public class InterfaceStylesPlugin extends Plugin
}
}
@Subscribe
private void onWidgetPositioned(WidgetPositioned widgetPositioned)
{
adjustWidgetDimensions();
}
@Subscribe
private void onPostHealthBar(PostHealthBar postHealthBar)
{
if (!this.hdHealthBars)
@@ -152,6 +140,7 @@ public class InterfaceStylesPlugin extends Plugin
}
}
@Subscribe
private void onGameStateChanged(GameStateChanged gameStateChanged)
{
if (gameStateChanged.getGameState() != GameState.LOGIN_SCREEN)
@@ -178,6 +167,7 @@ public class InterfaceStylesPlugin extends Plugin
overrideCrossSprites();
}
@Subscribe
private void onBeforeMenuRender(BeforeMenuRender event)
{
if (this.hdMenu)

View File

@@ -32,7 +32,7 @@ import java.awt.Color;
import lombok.AccessLevel;
import lombok.Getter;
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.PluginDescriptor;
@@ -56,9 +56,6 @@ public class InventoryGridPlugin extends Plugin
@Inject
private InventoryGridConfig config;
@Inject
private EventBus eventBus;
@Getter(AccessLevel.PACKAGE)
private boolean showItem;
@Getter(AccessLevel.PACKAGE)
@@ -76,16 +73,12 @@ public class InventoryGridPlugin extends Plugin
public void startUp()
{
updateConfig();
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
overlayManager.add(overlay);
}
@Override
public void shutDown()
{
eventBus.unregister(this);
overlayManager.remove(overlay);
}
@@ -95,6 +88,7 @@ public class InventoryGridPlugin extends Plugin
return configManager.getConfig(InventoryGridConfig.class);
}
@Subscribe
private void onConfigChanged(ConfigChanged config)
{
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.client.callback.ClientThread;
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.ItemVariationMapping;
@@ -104,9 +104,6 @@ public class InventorySetupPlugin extends Plugin
@Inject
private ClientThread clientThread;
@Inject
private EventBus eventBus;
@Inject
private ConfigManager configManager;
@@ -134,7 +131,6 @@ public class InventorySetupPlugin extends Plugin
public void startUp()
{
updateConfigOptions();
addSubscriptions();
overlayManager.add(overlay);
@@ -261,6 +257,7 @@ public class InventorySetupPlugin extends Plugin
return configManager.getConfig(InventorySetupConfig.class);
}
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
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
final Gson gson = new Gson();
Type type = new TypeToken<HashMap<String, InventorySetup>>() {}.getType();
Type type = new TypeToken<HashMap<String, InventorySetup>>()
{
}.getType();
inventorySetups.clear();
inventorySetups.putAll(gson.fromJson(json, type));
}
@@ -313,6 +312,7 @@ public class InventorySetupPlugin extends Plugin
}
@Subscribe
private void onItemContainerChanged(ItemContainerChanged event)
{
@@ -346,6 +346,7 @@ public class InventorySetupPlugin extends Plugin
}
@Subscribe
private void onGameStateChanged(GameStateChanged event)
{
switch (event.getGameState())
@@ -413,11 +414,6 @@ public class InventorySetupPlugin extends Plugin
return newContainer;
}
public final InventorySetupConfig getConfig()
{
return config;
}
public boolean getHighlightDifference()
{
return highlightDifference;
@@ -426,19 +422,11 @@ public class InventorySetupPlugin extends Plugin
@Override
public void shutDown()
{
eventBus.unregister(this);
overlayManager.remove(overlay);
clientToolbar.removeNavigation(navButton);
}
private void addSubscriptions()
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(ItemContainerChanged.class, this, this::onItemContainerChanged);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
}
final int[] getCurrentInventorySetupIds()
final int[] getCurrentInventorySetupIds()
{
InventorySetup setup = inventorySetups.get(panel.getSelectedInventorySetup());
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.widgets.WidgetInfo;
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.WidgetMenuOption;
@@ -106,9 +106,6 @@ public class InventoryTagsPlugin extends Plugin
@Inject
private OverlayManager overlayManager;
@Inject
private EventBus eventBus;
private boolean editorMode;
private InventoryTagsConfig.amount amount;
@@ -152,7 +149,6 @@ public class InventoryTagsPlugin extends Plugin
protected void startUp() throws Exception
{
updateConfig();
addSubscriptions();
refreshInventoryMenuOptions();
overlayManager.add(overlay);
@@ -161,21 +157,12 @@ public class InventoryTagsPlugin extends Plugin
@Override
protected void shutDown() throws Exception
{
eventBus.unregister(this);
removeInventoryMenuOptions();
overlayManager.remove(overlay);
editorMode = false;
}
private void addSubscriptions()
{
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);
}
@Subscribe
private void onWidgetMenuOptionClicked(final WidgetMenuOptionClicked event)
{
if (event.getWidget() == WidgetInfo.FIXED_VIEWPORT_INVENTORY_TAB
@@ -187,6 +174,7 @@ public class InventoryTagsPlugin extends Plugin
}
}
@Subscribe
private void onMenuOptionClicked(final MenuOptionClicked event)
{
if (event.getMenuOpcode() != MenuOpcode.RUNELITE)
@@ -206,6 +194,7 @@ public class InventoryTagsPlugin extends Plugin
}
}
@Subscribe
private void onMenuOpened(final MenuOpened event)
{
final MenuEntry firstEntry = event.getFirstEntry();
@@ -305,6 +294,7 @@ public class InventoryTagsPlugin extends Plugin
}
}
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
if (event.getGroup().equals("inventorytags"))

View File

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

View File

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

View File

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

View File

@@ -30,7 +30,7 @@ import javax.inject.Singleton;
import lombok.AccessLevel;
import lombok.Getter;
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.PluginDescriptor;
@@ -54,9 +54,6 @@ public class ItemPricesPlugin extends Plugin
@Inject
private ItemPricesConfig config;
@Inject
private EventBus eventBus;
@Getter(AccessLevel.PACKAGE)
private boolean showGEPrice;
@Getter(AccessLevel.PACKAGE)
@@ -80,18 +77,16 @@ public class ItemPricesPlugin extends Plugin
protected void startUp() throws Exception
{
updateConfig();
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
overlayManager.add(overlay);
}
@Override
protected void shutDown() throws Exception
{
eventBus.unregister(this);
overlayManager.remove(overlay);
}
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
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.WidgetInfo;
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.ItemMapping;
import net.runelite.client.game.ItemReclaimCost;
@@ -116,9 +116,6 @@ public class ItemsKeptOnDeathPlugin extends Plugin
@Inject
private ItemManager itemManager;
@Inject
private EventBus eventBus;
private WidgetButton deepWildyButton;
private WidgetButton lowWildyButton;
@@ -132,15 +129,14 @@ public class ItemsKeptOnDeathPlugin extends Plugin
@Override
protected void startUp() throws Exception
{
eventBus.subscribe(ScriptCallbackEvent.class, this, this::onScriptCallbackEvent);
}
@Override
protected void shutDown() throws Exception
{
eventBus.unregister(this);
}
}
@Subscribe
private void onScriptCallbackEvent(ScriptCallbackEvent event)
{
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.VarPlayer;
import net.runelite.api.Varbits;
import net.runelite.client.events.ConfigChanged;
import net.runelite.api.events.GameTick;
import net.runelite.api.events.ScriptCallbackEvent;
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.client.callback.ClientThread;
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.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
@@ -98,9 +98,6 @@ public class ItemStatPlugin extends Plugin
@Inject
private ClientThread clientThread;
@Inject
private EventBus eventBus;
private Widget itemInformationTitle;
@Getter(AccessLevel.PACKAGE)
@@ -143,27 +140,17 @@ public class ItemStatPlugin extends Plugin
protected void startUp() throws Exception
{
updateConfig();
addSubscriptions();
overlayManager.add(overlay);
}
@Override
protected void shutDown() throws Exception
{
eventBus.unregister(this);
overlayManager.remove(overlay);
clientThread.invokeLater(this::resetGEInventory);
}
private void addSubscriptions()
{
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);
}
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
if (event.getKey().equals("geStats"))
@@ -173,6 +160,7 @@ public class ItemStatPlugin extends Plugin
}
}
@Subscribe
private void onGameTick(GameTick event)
{
if (itemInformationTitle != null && this.geStats
@@ -184,6 +172,7 @@ public class ItemStatPlugin extends Plugin
}
@Subscribe
private void onVarbitChanged(VarbitChanged event)
{
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)
{
if (event.getEventName().equals("geBuilt") && this.geStats)
@@ -386,7 +376,7 @@ public class ItemStatPlugin extends Plugin
}
private static Widget createText(Widget parent, String text, int fontId, int textColor,
int x, int y, int width, int height)
int x, int y, int width, int height)
{
final Widget widget = parent.createChild(-1, WidgetType.TEXT);
widget.setText(text);

View File

@@ -44,7 +44,7 @@ import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.callback.ClientThread;
import net.runelite.client.config.ConfigManager;
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.input.KeyManager;
import net.runelite.client.plugins.Plugin;
@@ -80,9 +80,6 @@ public class KeyRemappingPlugin extends Plugin
@Inject
private KeyRemappingListener inputListener;
@Inject
private EventBus eventBus;
@Getter(AccessLevel.PACKAGE)
@Setter(AccessLevel.PACKAGE)
private boolean typing;
@@ -131,7 +128,6 @@ public class KeyRemappingPlugin extends Plugin
protected void startUp() throws Exception
{
updateConfig();
addSubscriptions();
typing = false;
keyManager.registerKeyListener(inputListener);
@@ -150,8 +146,6 @@ public class KeyRemappingPlugin extends Plugin
@Override
protected void shutDown() throws Exception
{
eventBus.unregister(this);
clientThread.invoke(() ->
{
if (client.getGameState() == GameState.LOGGED_IN)
@@ -163,13 +157,7 @@ public class KeyRemappingPlugin extends Plugin
keyManager.unregisterKeyListener(inputListener);
}
private void addSubscriptions()
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(ScriptCallbackEvent.class, this, this::onScriptCallbackEvent);
}
@Provides
@Provides
KeyRemappingConfig getConfig(ConfigManager configManager)
{
return configManager.getConfig(KeyRemappingConfig.class);
@@ -209,6 +197,7 @@ public class KeyRemappingPlugin extends Plugin
return w == null || w.isSelfHidden();
}
@Subscribe
private void onConfigChanged(ConfigChanged configChanged)
{
if (!configChanged.getGroup().equals("keyremapping"))
@@ -229,6 +218,7 @@ public class KeyRemappingPlugin extends Plugin
);
}
@Subscribe
private void onScriptCallbackEvent(ScriptCallbackEvent scriptCallbackEvent)
{
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.QueuedMessage;
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.plugins.Plugin;
@@ -84,9 +84,6 @@ public class KingdomPlugin extends Plugin
@Inject
private ItemManager itemManager;
@Inject
private EventBus eventBus;
@Getter(AccessLevel.PACKAGE)
private int favor = 0, coffer = 0;
@@ -105,30 +102,22 @@ public class KingdomPlugin extends Plugin
protected void startUp() throws Exception
{
updateConfig();
addSubscriptions();
}
@Override
protected void shutDown() throws Exception
{
eventBus.unregister(this);
removeKingdomInfobox();
}
private void addSubscriptions()
{
eventBus.subscribe(VarbitChanged.class, this, this::onVarbitChanged);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
}
@Subscribe
private void onVarbitChanged(VarbitChanged event)
{
updateKingdomVarbits();
processInfobox();
}
@Subscribe
public void onGameStateChanged(GameStateChanged event)
{
@@ -144,6 +133,7 @@ public class KingdomPlugin extends Plugin
}
}
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
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.events.AnimationChanged;
import net.runelite.api.events.ChatMessage;
import net.runelite.client.events.ConfigChanged;
import net.runelite.api.events.GameTick;
import net.runelite.api.events.ItemContainerChanged;
import net.runelite.api.events.MenuOptionClicked;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetInfo;
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.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
@@ -98,9 +98,6 @@ public class KourendLibraryPlugin extends Plugin
@Inject
private ItemManager itemManager;
@Inject
private EventBus eventBus;
private KourendLibraryPanel panel;
private NavigationButton navButton;
private boolean buttonAttached = false;
@@ -121,7 +118,6 @@ public class KourendLibraryPlugin extends Plugin
@Override
protected void startUp() throws Exception
{
addSubscriptions();
hideButton = config.hideButton();
hideDuplicateBook = config.hideDuplicateBook();
@@ -153,8 +149,6 @@ public class KourendLibraryPlugin extends Plugin
@Override
protected void shutDown()
{
eventBus.unregister(this);
overlay.setHidden(true);
overlayManager.remove(overlay);
clientToolbar.removeNavigation(navButton);
@@ -164,16 +158,7 @@ public class KourendLibraryPlugin extends Plugin
playerBooks = null;
}
private void addSubscriptions()
{
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);
}
@Subscribe
private void onConfigChanged(ConfigChanged ev)
{
if (!KourendLibraryConfig.GROUP_KEY.equals(ev.getGroup()))
@@ -206,6 +191,7 @@ public class KourendLibraryPlugin extends Plugin
});
}
@Subscribe
private void onMenuOptionClicked(MenuOptionClicked menuOpt)
{
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)
{
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)
{
if (lastBookcaseAnimatedOn != null && event.getType() == ChatMessageType.GAMEMESSAGE)
@@ -236,6 +224,7 @@ public class KourendLibraryPlugin extends Plugin
}
}
@Subscribe
private void onGameTick(GameTick tick)
{
boolean inRegion = client.getLocalPlayer().getWorldLocation().getRegionID() == REGION;
@@ -307,6 +296,7 @@ public class KourendLibraryPlugin extends Plugin
}
}
@Subscribe
private void onItemContainerChanged(ItemContainerChanged itemContainerChangedEvent)
{
updatePlayerBooks();

View File

@@ -23,7 +23,7 @@ import net.runelite.api.events.WidgetLoaded;
import net.runelite.api.widgets.WidgetID;
import net.runelite.api.widgets.WidgetInfo;
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.PluginDescriptor;
@@ -50,9 +50,6 @@ public class LearnToClickPlugin extends Plugin
@Inject
private Client client;
@Inject
private EventBus eventBus;
private boolean shouldBlockCompass;
private boolean shouldRightClickMap;
private boolean shouldRightClickXp;
@@ -69,26 +66,16 @@ public class LearnToClickPlugin extends Plugin
protected void startUp() throws Exception
{
updateConfig();
addSubscriptions();
}
@Override
protected void shutDown() throws Exception
{
eventBus.unregister(this);
forceRightClickFlag = false;
hideOrbWidgets(false);
}
private void addSubscriptions()
{
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);
}
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
if (!event.getGroup().equals("learntoclick"))
@@ -109,6 +96,7 @@ public class LearnToClickPlugin extends Plugin
}
@Subscribe
private void onWidgetLoaded(WidgetLoaded event)
{
if (!this.hideOrbs)
@@ -121,6 +109,7 @@ public class LearnToClickPlugin extends Plugin
}
}
@Subscribe
private void onMenuShouldLeftClick(MenuShouldLeftClick event)
{
if (!forceRightClickFlag)
@@ -142,6 +131,7 @@ public class LearnToClickPlugin extends Plugin
}
}
@Subscribe
private void onMenuEntryAdded(MenuEntryAdded event)
{
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
*
* @param hidden - hides the Widgets if true, un-hides them if false
*/
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.client.Notifier;
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.PluginDescriptor;
@@ -75,9 +75,6 @@ public class LizardmenShamanPlugin extends Plugin
@Inject
private Notifier notifier;
@Inject
private EventBus eventBus;
private boolean showTimer;
private boolean notifyOnSpawn;
@@ -90,7 +87,6 @@ public class LizardmenShamanPlugin extends Plugin
@Override
protected void startUp() throws Exception
{
addSubscriptions();
this.showTimer = config.showTimer();
this.notifyOnSpawn = config.notifyOnSpawn();
@@ -101,19 +97,11 @@ public class LizardmenShamanPlugin extends Plugin
@Override
protected void shutDown() throws Exception
{
eventBus.unregister(this);
overlayManager.remove(overlay);
spawns.clear();
}
private void addSubscriptions()
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(ChatMessage.class, this, this::onChatMessage);
eventBus.subscribe(AnimationChanged.class, this, this::onAnimationChanged);
}
@Subscribe
private void onChatMessage(ChatMessage event)
{
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)
{
Actor actor = event.getActor();
@@ -137,6 +126,7 @@ public class LizardmenShamanPlugin extends Plugin
}
}
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
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.events.GameStateChanged;
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.SessionOpen;
import net.runelite.client.input.KeyListener;
@@ -67,9 +67,6 @@ public class LoginScreenPlugin extends Plugin implements KeyListener
@Inject
private KeyManager keyManager;
@Inject
private EventBus eventBus;
private String usernameCache;
private boolean syncUsername;
@@ -80,7 +77,6 @@ public class LoginScreenPlugin extends Plugin implements KeyListener
protected void startUp() throws Exception
{
updateConfig();
addSubscriptions();
client.setHideDisconnect(config.hideDisconnected());
@@ -91,8 +87,6 @@ public class LoginScreenPlugin extends Plugin implements KeyListener
@Override
protected void shutDown() throws Exception
{
eventBus.unregister(this);
if (this.syncUsername)
{
client.getPreferences().setRememberedUsername(usernameCache);
@@ -103,19 +97,13 @@ public class LoginScreenPlugin extends Plugin implements KeyListener
keyManager.unregisterKeyListener(this);
}
private void addSubscriptions()
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventBus.subscribe(SessionOpen.class, this, this::onSessionOpen);
}
@Provides
@Provides
LoginScreenConfig getConfig(ConfigManager configManager)
{
return configManager.getConfig(LoginScreenConfig.class);
}
@Subscribe
private void onGameStateChanged(GameStateChanged event)
{
if (!this.syncUsername)
@@ -147,6 +135,7 @@ public class LoginScreenPlugin extends Plugin implements KeyListener
}
}
@Subscribe
private void onSessionOpen(SessionOpen event)
{
// 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)
{
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.events.AnimationChanged;
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.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
@@ -31,15 +31,11 @@ public class LootAssistPlugin extends Plugin
@Inject
private LootAssistOverlay lootAssistOverlay;
@Inject
private EventBus eventBus;
static final ConcurrentHashMap<WorldPoint, LootPile> lootPiles = new ConcurrentHashMap<>();
@Override
protected void startUp() throws Exception
{
addSubscriptions();
overlayManager.add(lootAssistOverlay);
}
@@ -47,23 +43,17 @@ public class LootAssistPlugin extends Plugin
@Override
protected void shutDown() throws Exception
{
eventBus.unregister(this);
lootPiles.clear();
overlayManager.remove(lootAssistOverlay);
}
private void addSubscriptions()
{
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventBus.subscribe(AnimationChanged.class, this, this::onAnimationChanged);
}
@Subscribe
private void onGameStateChanged(GameStateChanged event)
{
lootPiles.clear();
}
@Subscribe
private void onAnimationChanged(AnimationChanged event)
{
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.client.callback.ClientThread;
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.PluginDescriptor;
@@ -47,11 +47,11 @@ import net.runelite.client.plugins.PluginType;
import net.runelite.client.ui.overlay.OverlayManager;
@PluginDescriptor(
name = "PvP Looting Bag Viewer",
description = "Add an overlay showing the contents of your looting bag",
tags = {"alternate", "items", "overlay", "second"},
type = PluginType.PVP,
enabledByDefault = false
name = "PvP Looting Bag Viewer",
description = "Add an overlay showing the contents of your looting bag",
tags = {"alternate", "items", "overlay", "second"},
type = PluginType.PVP,
enabledByDefault = false
)
/**
* TODO: Remember current looting bag value when client restarts
@@ -80,9 +80,6 @@ public class LootingBagViewerPlugin extends Plugin
@Inject
private LootingBagViewerConfig config;
@Inject
private EventBus eventBus;
@Getter(AccessLevel.PACKAGE)
@Setter(AccessLevel.PACKAGE)
private int valueToShow = -1;
@@ -96,7 +93,6 @@ public class LootingBagViewerPlugin extends Plugin
@Override
public void startUp()
{
addSubscriptions();
if (config.renderViewer())
{
@@ -112,18 +108,11 @@ public class LootingBagViewerPlugin extends Plugin
@Override
public void shutDown()
{
eventBus.unregister(this);
overlayManager.remove(overlay);
overlayManager.remove(widgetOverlay);
}
private void addSubscriptions()
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(WidgetHiddenChanged.class, this, this::onWidgetHiddenChanged);
}
@Subscribe
private void onConfigChanged(ConfigChanged configChanged)
{
if (configChanged.getKey().equals("renderViewer"))
@@ -154,6 +143,7 @@ public class LootingBagViewerPlugin extends Plugin
/**
* @param widgetHiddenChanged
*/
@Subscribe
private void onWidgetHiddenChanged(WidgetHiddenChanged widgetHiddenChanged)
{
Widget widget = widgetHiddenChanged.getWidget();
@@ -166,17 +156,17 @@ public class LootingBagViewerPlugin extends Plugin
if (!Strings.isNullOrEmpty(value.getText()))
{
if (value.getText().equals("Value: -"))
if (value.getText().equals("Value: -"))
{
setValueToShow(-1);
}
else
}
else
{
String str = value.getText();
str = str.replace("Bag value: ", "")
.replace("Value: ", "")
.replace(" coins", "")
.replace(",", "");
.replace("Value: ", "")
.replace(" coins", "")
.replace(",", "");
int val = Integer.parseInt(str);
setValueToShow(Math.round(val) / 1000);
@@ -186,4 +176,4 @@ public class LootingBagViewerPlugin extends Plugin
}
}
}
}

View File

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

View File

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

View File

@@ -34,8 +34,7 @@ import net.runelite.api.events.ItemContainerChanged;
import net.runelite.api.events.VarbitChanged;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.eventbus.EventBus;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
@@ -56,38 +55,23 @@ public class MaxHitPlugin extends Plugin
@Inject
private Client client;
@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(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(ItemContainerChanged.class, this, this::onItemContainerChanged);
eventBus.subscribe(VarbitChanged.class, this, this::onVarbitChanged);
}
}
@Subscribe
private void onItemContainerChanged(final ItemContainerChanged event)
{
this.updateMaxHitWidget();
}
private void onConfigChanged(final ConfigChanged event)
{
this.updateMaxHitWidget();
}
@Subscribe
private void onVarbitChanged(VarbitChanged event)
{
this.updateMaxHitWidget();

View File

@@ -62,7 +62,6 @@ import static net.runelite.api.Varbits.WITHDRAW_X_AMOUNT;
import net.runelite.api.WorldType;
import net.runelite.api.coords.WorldPoint;
import net.runelite.api.events.ClientTick;
import net.runelite.client.events.ConfigChanged;
import net.runelite.api.events.FocusChanged;
import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.Menu;
@@ -79,6 +78,8 @@ import net.runelite.client.callback.ClientThread;
import net.runelite.client.config.ConfigManager;
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.input.KeyManager;
import net.runelite.client.menus.AbstractComparableEntry;
import static net.runelite.client.menus.ComparableEntries.newBankComparableEntry;
@@ -317,7 +318,10 @@ public class MenuEntrySwapperPlugin extends Plugin
migrateConfig();
updateConfig();
addSubscriptions();
if (config.lastJewel())
{
eventBus.subscribe(MenuOptionClicked.class, JEWEL_CLICKED, this::onMenuOptionClicked);
}
addSwaps();
loadConstructionItems();
loadCustomSwaps(config.customSwaps(), customSwaps);
@@ -341,8 +345,6 @@ public class MenuEntrySwapperPlugin extends Plugin
@Override
public void shutDown()
{
eventBus.unregister(this);
loadCustomSwaps("", customSwaps); // Removes all custom swaps
removeSwaps();
removeBuySellEntries();
@@ -358,21 +360,7 @@ public class MenuEntrySwapperPlugin extends Plugin
}
}
private void addSubscriptions()
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventBus.subscribe(VarbitChanged.class, this, this::onVarbitChanged);
eventBus.subscribe(MenuOpened.class, this, this::onMenuOpened);
eventBus.subscribe(MenuEntryAdded.class, this, this::onMenuEntryAdded);
eventBus.subscribe(FocusChanged.class, this, this::onFocusChanged);
if (config.lastJewel())
{
eventBus.subscribe(MenuOptionClicked.class, JEWEL_CLICKED, this::onMenuOptionClicked);
}
}
@Subscribe
private void onFocusChanged(FocusChanged event)
{
if (!event.isFocused())
@@ -382,6 +370,7 @@ public class MenuEntrySwapperPlugin extends Plugin
}
}
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
if (!"menuentryswapper".equals(event.getGroup()))
@@ -452,6 +441,7 @@ public class MenuEntrySwapperPlugin extends Plugin
}
}
@Subscribe
private void onGameStateChanged(GameStateChanged event)
{
if (event.getGameState() != GameState.LOGGED_IN)
@@ -466,6 +456,7 @@ public class MenuEntrySwapperPlugin extends Plugin
keyManager.registerKeyListener(hotkey);
}
@Subscribe
private void onVarbitChanged(VarbitChanged event)
{
buildingMode = client.getVar(BUILDING_MODE) == 1;
@@ -474,6 +465,7 @@ public class MenuEntrySwapperPlugin extends Plugin
setCastOptions(false);
}
@Subscribe
private void onMenuOpened(MenuOpened event)
{
Player localPlayer = client.getLocalPlayer();
@@ -581,6 +573,7 @@ public class MenuEntrySwapperPlugin extends Plugin
event.setModified();
}
@Subscribe
public void onMenuEntryAdded(MenuEntryAdded event)
{
if (client.getGameState() != GameState.LOGGED_IN)

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