Repository navigation
Conversation
|
Sorry I'm not familiar with the event bus. Is there any documentation about it? What are the reasons to expose this? What are the reasons not to expose this? |
|
Sorry, I should have elaborated in the original post, my bad - basically it's a publish/subscribe dispatcher that allows plugins to post or subscribe to events, essentially allowing for inter-plugin communication. Other plugins will be able to subscribe to the player's attack cooldown to extend their function without directly needing modify or re-implement this plugin logic. I guess an unlikely (imo) but potential downside is that posting an event calls every matching subscriber synchronously, and the poster (attacktimer) will be blocked until every subscriber returns. You'd need some seriously sloppy event handling in a subscriber for this to be a problem, really should just be setting a few vars and returning immediately. Example: inside If no plugins are subscribed then the event post is essentially a no-op so no need to check if there's any listeners prior to posting the event. I am happy to document this a bit further in the src or readme if you'd like. RL docs: https://static.runelite.net/runelite-client/apidocs/net/runelite/client/eventbus/EventBus.html |
|
Thanks for the link, I guess the update could be sent in another thread if subscribers start holding up the plugin thread. Hmm this is a bit of a slippery slope argument - but this essentially becomes a public API of the plugin right? It makes currently inconsequential things important, such as the clamp to Would you also like things like My gut says this should therefore be versioned and treated like a public API, so that we can do internal changes if needed. I understand there's not really a concept of combat in the client as is, and I'm just weary about this plugin becoming a source of truth for that, because there's plenty of bugs in this plugin a user can just ignore (visuals) but I'm less confident other plugin developers will see those bugs as much bigger issues and not help fix them. |
|
I've just pushed a new event publishing handler that runs on a separate thread so the main thread will never get held up, also added a queuing logic as well as keys: I added
also
Example output from running the added test subscriber (which I just realised I forgot to disable by default). I still need to do some testing with an actual second plugin, so I will mark this as a draft for now until that testing is complete. Appreciate all your work to maintain this plugin by the way, it's definitely one of my fave plugins of all time. I hope to contribute in a meaningful way, but if this is something you'd rather not add as a feature to the plugin then I totally understand 😊 |
|
I think for now lets keep the API as small as possible, so if your use case works with just getTicksUntilNextAttack then that's all we should publish on the bus. Just because there's no expectation of robust versioning doesn't mean that we should do it. Hyrum's law and all that. You've persuaded me that this would be beneficial, i just want to be careful about overpromising and under delivering. Let me know when your testing is completed and I'll do a full code review and look at merging |
Summary
This PR adds the ticksRemaining to the RuneLite event bus for other plugins to consume - I have been using a fork of this plugin for a while to test tracking performance and tick loss while PvMing so figured it'd just be easier to subscribe to the events with a separate plugin.
Testing
Confirmed working with the following snippet.