Skip to content

Use shared vote counting policy in Bukkit listener - #1614

Merged
BenCodez merged 1 commit into
masterfrom
codex/use-shared-vote-policy
Sep 20, 2026
Merged

BenCodez merged 1 commit into
masterfrom
codex/use-shared-vote-policy

Conversation

@BenCodez

@BenCodez BenCodez commented Sep 20, 2026 •

Copy link
Copy Markdown
Owner

Summary

Follow-up to #1608: the accepted Bukkit vote path now uses the platform-neutral SharedVotePolicy for its existing totals and points gate. The listener still calls the same VotingPluginUser methods in the same order. No reward API, reward configuration, event ingress, proxy routing, persistence, or reward delivery changes are included.

This is a focused step toward sharing vote decisions with future platforms. It does not claim full SharedVoteProcessor production integration or Fabric/Forge/NeoForge runtime support. Reward YAML continues to be read through the existing runtime path.

Behavior preserved

  • Real and fake vote counting, event.addTotals, Config.AddTotals, and AddTotalsOffline retain their current effects.
  • Configured vote points remain awarded for an accepted countable vote even when Config.AddTotals is false.
  • Totals use the user's current online state. Proxy origin, forced proxy reward routing, and historical wasOnline remain in their existing paths.
  • Reward execution, offline vote queues, vote party, timestamps, streaks, hooks, and post-vote events remain in their existing order and ownership.

Validation

  • Focused PlayerVoteListenerCountingPolicyTest, SharedVoteProcessorEndToEndTest, and SharedVoteProcessorRecoveryTest: 23 tests, no failures/errors.
  • mvn -B -f VotingPlugin/pom.xml clean package: 1,222 unit tests plus one packaged-artifact test, no failures/errors.
  • git diff --check and unzip -tqq VotingPlugin/target/VotingPlugin.jar: passed.
  • Packaged JAR: 21,711,129 bytes; SHA-256 7c48a5075bf7377750923e8e245d543ad958c59e157b43c079ed5d264d3ba0e0.

Summary by CodeRabbit

  • Bug Fixes

    • Improved consistency when recording vote totals and awarding configured points.
    • Vote counting now correctly respects real/fake vote status, event settings, configured totals, and online/offline rules.
    • Offline total handling avoids unnecessary online-status checks when offline counting is enabled.
  • Tests

    • Added coverage for online and offline voting scenarios, total-count settings, fake votes, and points awards.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 20, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-20T21:37:14.365522Z 265a1d7 PR opened
🔒 Security Review ✅ Completed 2026-09-20T21:39:11.782983Z 265a1d7 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 719d7b54-9658-46d6-ade8-7ad2bc02e4ad

📥 Commits

Reviewing files that changed from the base of the PR and between 28e45e9 and 265a1d7.

📒 Files selected for processing (3)
  • VotingPlugin/src/main/java/com/bencodez/votingplugin/core/vote/SharedVotePolicy.java
  • VotingPlugin/src/main/java/com/bencodez/votingplugin/listeners/PlayerVoteListener.java
  • VotingPlugin/src/test/java/com/bencodez/votingplugin/listeners/PlayerVoteListenerCountingPolicyTest.java

Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review.

📜 Recent review details
⏰ Context from checks skipped due to timeout. (2)
  • GitHub Check: Analyze (java-kotlin)
  • GitHub Check: build
🧰 Additional context used
📓 Path-based instructions (1)
The Maven project lives in the `VotingPlugin/` subdirectory.

📄 CodeRabbit inference engine (AGENTS.md)

Files:

  • VotingPlugin/src/main/java/com/bencodez/votingplugin/listeners/PlayerVoteListener.java
  • VotingPlugin/src/test/java/com/bencodez/votingplugin/listeners/PlayerVoteListenerCountingPolicyTest.java
  • VotingPlugin/src/main/java/com/bencodez/votingplugin/core/vote/SharedVotePolicy.java

📝 Walkthrough

Walkthrough

SharedVotePolicy now centralizes configured vote mutation and totals decisions. PlayerVoteListener uses the policy before updating totals and points. New tests cover real and fake votes, online and offline states, configuration settings, and lazy online checks.

Changes

Vote counting policy

Layer / File(s) Summary
Shared vote eligibility policy
VotingPlugin/src/main/java/com/bencodez/votingplugin/core/vote/SharedVotePolicy.java
Adds primitive-argument overloads for mutation and totals checks. Totals checks validate the online supplier and evaluate it only when required.
Accepted vote count application
VotingPlugin/src/main/java/com/bencodez/votingplugin/listeners/PlayerVoteListener.java, VotingPlugin/src/test/java/com/bencodez/votingplugin/listeners/PlayerVoteListenerCountingPolicyTest.java
Routes accepted vote totals and points through SharedVotePolicy. Tests verify real and fake votes, configuration gates, offline handling, and conditional isOnline() calls.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Refactor

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 15 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: applying the shared vote-counting policy in the Bukkit listener.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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

@BenCodez
BenCodez merged commit 0930a85 into master Sep 20, 2026
5 checks passed
@BenCodez
BenCodez deleted the codex/use-shared-vote-policy branch September 20, 2026 21:40
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