Skip to content

fix: Make the LineReporter work again with the new dialogue system to allow us to get information on what lines need Voice acting#81

Merged
kmaxii merged 2 commits intomainfrom
fix/line-collector
Apr 9, 2026
Merged

fix: Make the LineReporter work again with the new dialogue system to allow us to get information on what lines need Voice acting#81
kmaxii merged 2 commits intomainfrom
fix/line-collector

Conversation

@kmaxii
Copy link
Copy Markdown
Collaborator

@kmaxii kmaxii commented Apr 7, 2026

Summary by CodeRabbit

  • Improvements
    • Refined dialogue and audio logging behavior to be more selective based on configuration settings. Early-play audio logging now respects user preferences for logging filtered or already-played lines.

… allow us to get information on what lines need Voice acting
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 7, 2026

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d19dce96-6a56-4858-a3c1-4fabbc8659fe

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

These changes refactor dialogue logging behavior by removing NPC-line detection logic from LineData and consolidating logging configuration checks across SoundPlayer, LineReporter, and OverlayHandler to uniformly respect dialogue logging settings.

Changes

Cohort / File(s) Summary
NPC Detection Removal
src/main/java/com/wynnvp/wynncraftvp/sound/line/LineData.java
Deleted NPC_DIALOGUE_PATTERN regex constant and isNPCSentLine() method, retaining only getNPCName() and basic getter/setter functionality.
Logging Consolidation
src/main/java/com/wynnvp/wynncraftvp/sound/SoundPlayer.java, src/main/java/com/wynnvp/wynncraftvp/sound/line/LineReporter.java, src/main/java/com/wynnvp/wynncraftvp/text/OverlayHandler.java
Unified logging behavior to respect config-driven dialogue line logging settings; removed NPC-sent-line gating from condition checks and consolidated early-return guards in LineReporter.MissingLine(); updated copyright header (2024–2026); refactored OverlayHandler.firePending() to conditionally log based on early-play state and config flags instead of unconditional logging.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • PR #64: Both PRs touch the dialogue/overlay subsystem; this PR changes OverlayHandler's logging behavior and removes NPC-detection logic across the call chain.
  • PR #69: Both PRs modify OverlayHandler.firePending() and SoundPlayer sound playback paths with overlapping file changes.

Poem

🐰 No more NPC patterns to detect,
Just config-driven logs, lines correct!
Consolidated checks make the flow so clean,
Dialogue logging's the cleanest we've seen! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main objective of the changes: restoring LineReporter functionality to collect information about dialogue lines needing voice acting.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/line-collector

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/main/java/com/wynnvp/wynncraftvp/sound/line/LineReporter.java (1)

29-40: ⚠️ Potential issue | 🔴 Critical

Fix concurrency race and logging violations in the async reporting path.

Line 30 now lets more misses reach CompletableFuture.runAsync(...), but reportedLines is a non-thread-safe LinkedList. The contains / add / remove sequence races under concurrent access, allowing duplicate reports and inconsistent queue eviction.

Additionally, lines 43–48 and 79 violate the logging guideline—replace all System.out.println and e.printStackTrace() calls with ModCore.LOGGER.

Concurrency fix
         CompletableFuture.runAsync(() -> {
-            if (reportedLines.contains(lineData.getRealLine())) {
-                return;
-            }
-            reportedLines.add(lineData.getRealLine());
-
-            if (reportedLines.size() > 20) {
-                reportedLines.remove();
+            synchronized (reportedLines) {
+                if (reportedLines.contains(lineData.getRealLine())) {
+                    return;
+                }
+                reportedLines.add(lineData.getRealLine());
+
+                if (reportedLines.size() > 20) {
+                    reportedLines.remove();
+                }
             }
             try {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/main/java/com/wynnvp/wynncraftvp/sound/line/LineReporter.java` around
lines 29 - 40, The MissingLine method is racing on the non-thread-safe
reportedLines LinkedList (contains/add/remove sequence) and also uses
System.out.println / e.printStackTrace for logging; replace the LinkedList usage
with a thread-safe construct (e.g., a ConcurrentLinkedQueue or
LinkedBlockingDeque) or wrap the contains/add/remove sequence in a synchronized
block around reportedLines so duplicates cannot slip through and the eviction
(size > 20 -> remove) is atomic, and replace all System.out.println and
e.printStackTrace calls in this class with ModCore.LOGGER calls to comply with
logging guidelines (refer to MissingLine, reportedLines, and any exception
handling sites).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/main/java/com/wynnvp/wynncraftvp/sound/line/LineReporter.java`:
- Around line 29-30: The reporter methods (starting with MissingLine(LineData))
currently print success/failure via System.out and call printStackTrace; replace
all uses of System.out.println/System.err.println and Throwable.printStackTrace
in this class (including the branches around lines 30, 43-48, and 79) to use
ModCore.LOGGER instead—use ModCore.LOGGER.info/debug for normal status messages
and ModCore.LOGGER.error(...) with the exception parameter for failures so the
exception stacktrace is logged through the mod logger and respects
configuration.
- Around line 29-30: The report is sending sensitive data over plain HTTP;
update the endpoint URL used in reportUnvoicedLine() inside LineReporter (the
method that POSTs player name, coordinates, and config.getWord()) to use HTTPS
(https://voicesofwynn.com/api/unvoiced-line-report/new) so the API key and
telemetry are transmitted securely; locate the HTTP string in
reportUnvoicedLine() and replace the protocol to https and ensure any HTTP
client code honors TLS (no other logic changes).

In `@src/main/java/com/wynnvp/wynncraftvp/text/OverlayHandler.java`:
- Around line 145-160: Remove the early VowLogger.logLine call for the
wrongKeyPlayed branch so logging is not emitted before the final lookup/retry;
inside the wrongKeyPlayed block only stop the audio via
ModCore.instance.soundPlayer.stopCurrentAudio() (keep any existing config checks
if needed) and let
ModCore.instance.soundPlayer.playSound(LineFormatter.formatToLineData(formattedPlaybackLine))
be solely responsible for logging/reporting the retry outcome (avoid writing
formattedPlaybackLine in wrongKeyPlayed to prevent duplicate/misleading logs).

---

Outside diff comments:
In `@src/main/java/com/wynnvp/wynncraftvp/sound/line/LineReporter.java`:
- Around line 29-40: The MissingLine method is racing on the non-thread-safe
reportedLines LinkedList (contains/add/remove sequence) and also uses
System.out.println / e.printStackTrace for logging; replace the LinkedList usage
with a thread-safe construct (e.g., a ConcurrentLinkedQueue or
LinkedBlockingDeque) or wrap the contains/add/remove sequence in a synchronized
block around reportedLines so duplicates cannot slip through and the eviction
(size > 20 -> remove) is atomic, and replace all System.out.println and
e.printStackTrace calls in this class with ModCore.LOGGER calls to comply with
logging guidelines (refer to MissingLine, reportedLines, and any exception
handling sites).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 885b68c8-6728-41e9-beb8-95e22a33061c

📥 Commits

Reviewing files that changed from the base of the PR and between 79e65a1 and 060fc7a.

📒 Files selected for processing (4)
  • src/main/java/com/wynnvp/wynncraftvp/sound/SoundPlayer.java
  • src/main/java/com/wynnvp/wynncraftvp/sound/line/LineData.java
  • src/main/java/com/wynnvp/wynncraftvp/sound/line/LineReporter.java
  • src/main/java/com/wynnvp/wynncraftvp/text/OverlayHandler.java
💤 Files with no reviewable changes (1)
  • src/main/java/com/wynnvp/wynncraftvp/sound/line/LineData.java

Comment thread src/main/java/com/wynnvp/wynncraftvp/sound/line/LineReporter.java
Comment thread src/main/java/com/wynnvp/wynncraftvp/text/OverlayHandler.java
@kmaxii kmaxii force-pushed the fix/line-collector branch from 42d6e28 to 7c3bafd Compare April 9, 2026 17:42
@kmaxii kmaxii merged commit 1e1c9c4 into main Apr 9, 2026
2 checks passed
@kmaxii kmaxii deleted the fix/line-collector branch April 9, 2026 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant