Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Stopwatch and Timer plugin #7223

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

pr0f3ss
Copy link

@pr0f3ss pr0f3ss commented Jan 10, 2025

This plugin adds a simple stopwatch and countdown timer to the plugin panel, ideal for speedrunning, skilling, and PvM encounters. The countdown timer finds use in specific PvM mechanics, such as ghost skipping at Cerberus or set spawning in the Inferno. It comes with multiple presets and optional sound notifications.

@runelite-github-app
Copy link

runelite-github-app bot commented Jan 10, 2025

@DominickCobb-rs
Copy link
Contributor

This violates Jagex's rules about plugins assisting with PvM.

@pr0f3ss
Copy link
Author

pr0f3ss commented Jan 10, 2025

This violates Jagex's rules about plugins assisting with PvM.

This plugin certainly does not violate any Jagex rules. It works as a standalone feature in the plugin panel and does not pull data from the core client. The set-timer plugin #3188 offers similar functionality, albeit limited to the inferno.

Below you can see how the panel plugin is implemented.
image
image

@raiyni
Copy link
Member

raiyni commented Jan 10, 2025

The default timers plugin already has these features?

@pr0f3ss
Copy link
Author

pr0f3ss commented Jan 10, 2025

The default timers plugin already has these features?

This plugin is designed with speedrunners and PvMers in mind, offering larger UI elements for clearer visibility during high-paced gameplay. Moreover, the larger UI and integration into the plugin panel is very helpful for streamers and content creators. It also includes predefined presets for specific PvM encounters without requiring manual adjustments. While the default timers plugin may serve general needs, this plugin is tailored for those who require quick and efficient time control.

A similar argument for the need of separate plugins can be made for set-timers (#3188).

@DominickCobb-rs
Copy link
Contributor

This violates Jagex's rules about plugins assisting with PvM.

I didn't see it was manually activated timers. Disregard my comment

@LlemonDuck
Copy link
Contributor

Don't construct your panel on the client thread, construct it on the Swing thread (just move the new StopWatchPanel outside of the invokeLater): https://github.com/pr0f3ss/StopWatch/blob/cc38d5c8ee2f5139c138fb6c6c620a39779ad701/src/main/java/com/stopwatch/StopWatchPlugin.java#L41

Same goes for ClientToolbar#removeNavigation, that should be on Swing thread as well https://github.com/pr0f3ss/StopWatch/blob/cc38d5c8ee2f5139c138fb6c6c620a39779ad701/src/main/java/com/stopwatch/StopWatchPlugin.java#L60

You need to make sure this clip is closed to avoid leaking resources (check something like c-engineer plugin for an example? I'm not sure exactly where to look): https://github.com/pr0f3ss/StopWatch/blob/cc38d5c8ee2f5139c138fb6c6c620a39779ad701/src/main/java/com/stopwatch/StopWatchPanel.java#L356-L358

@LlemonDuck LlemonDuck added the waiting for author waiting for the pr author to make changes or respond to questions label Jan 25, 2025
@runelite-github-app runelite-github-app bot removed the waiting for author waiting for the pr author to make changes or respond to questions label Jan 31, 2025
@pr0f3ss
Copy link
Author

pr0f3ss commented Jan 31, 2025

Don't construct your panel on the client thread, construct it on the Swing thread (just move the new StopWatchPanel outside of the invokeLater): https://github.com/pr0f3ss/StopWatch/blob/cc38d5c8ee2f5139c138fb6c6c620a39779ad701/src/main/java/com/stopwatch/StopWatchPlugin.java#L41

Same goes for ClientToolbar#removeNavigation, that should be on Swing thread as well https://github.com/pr0f3ss/StopWatch/blob/cc38d5c8ee2f5139c138fb6c6c620a39779ad701/src/main/java/com/stopwatch/StopWatchPlugin.java#L60

You need to make sure this clip is closed to avoid leaking resources (check something like c-engineer plugin for an example? I'm not sure exactly where to look): https://github.com/pr0f3ss/StopWatch/blob/cc38d5c8ee2f5139c138fb6c6c620a39779ad701/src/main/java/com/stopwatch/StopWatchPanel.java#L356-L358

Thanks for the review.

I've adjusted all of your raised concerns.

For the clip player, I looked into the c-engineer plugin to see how they do it. Essentially, I created a sound player class that holds a single clip instance, which is created/destroyed appropriately.

@LlemonDuck
Copy link
Contributor

Can you describe where you got the alert.wav sound file and whether it is appropriately licensable?

@LlemonDuck LlemonDuck added the waiting for author waiting for the pr author to make changes or respond to questions label Feb 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin added waiting for author waiting for the pr author to make changes or respond to questions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants