Add rewards for votes rejected by vote delay - #1536
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 39ab786974
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (event.isBungee()) { | ||
| online = event.isWasOnline(); | ||
| } | ||
| voteSite.giveWaitUntilVoteDelayRewards(user, online, event.isBungee()); |
There was a problem hiding this comment.
Respect ProcessRewards before dispatching delay rewards
When ProcessRewards is false on a standalone or hub server, this unconditional call still executes the configured reward, including player messages and console commands. Ordinary vote rewards are gated by plugin.getOptions().isProcessRewards() later in this listener, so an early vote now bypasses the server-wide reward-disable setting; apply the same gate before sending WaitUntilVoteDelayRewards.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f7386fda44
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (plugin.getOptions().isProcessRewards()) { | ||
| voteSite.giveWaitUntilVoteDelayRewards(user, online, event.isBungee()); |
There was a problem hiding this comment.
Preserve proxy dispatch when local rewards are disabled
When a proxy-delivered vote reaches a backend with ProcessRewards: false, this guard suppresses the delay reward entirely. The established ordinary-vote path explicitly continues for event.isBungee() at lines 219–220 and then uses server-mode reward dispatch, so proxy processing must likewise remain able to forward this reward even when local reward execution is disabled; gate only non-proxy events here.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
ProcessRewards: false is intended to disable all rewards on that server, including rewards triggered by proxy-delivered votes. The guard here is therefore intentional and should not include an event.isBungee() exception.
| } | ||
| }); | ||
|
|
||
| addDirectlyDefinedRewards(new DirectlyDefinedReward("VoteSites." + site.getKey() + ".WaitUntilVoteDelayRewards") { |
There was a problem hiding this comment.
Register delay rewards for dynamically generated sites
This bulk registration covers sites present during loadDirectlyDefined(), but ConfigVoteSites.generateVoteSite() dynamically reloads sites and then manually registers only Rewards and CoolDownEndRewards. Consequently, an auto-created site has no directly defined WaitUntilVoteDelayRewards entry until a full plugin reload, so reward-editor or migration lookups cannot access the new section immediately; add the new path to the dynamic registration flow as well.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9ef608e14f
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (plugin.getOptions().isProcessRewards()) { | ||
| voteSite.giveWaitUntilVoteDelayRewards(user, online, event.isBungee()); |
There was a problem hiding this comment.
Forward proxy-side delay rejections to the reward handler
When a network enables WaitUntilVoteDelay in bungeeconfig.yml with proxy-managed totals, the proxy rejects the vote at VotingPluginProxy.java:1719-1721 and returns before creating any backend PlayerVoteEvent. Therefore this new call is never reached, and WaitUntilVoteDelayRewards cannot run for votes rejected by the proxy even when the matching backend vote site configures it; the proxy rejection path needs to notify a backend or otherwise dispatch the configured reward before returning.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cc9b21bd5e
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (!playerOnline || playerServer == null || !getAllAvailableServers().contains(playerServer)) { | ||
| debug("Not sending vote delay rejection for " + player + " because the player is offline"); | ||
| return; |
There was a problem hiding this comment.
Forward rejections to the player's secondary proxy
When MultiProxySupport is enabled and the player is connected through a secondary proxy, the primary proxy that performs the managed-total delay check reports playerOnline == false because its isPlayerOnline implementation only sees local connections, so this guard drops the rejection. MultiProxyHandler.handleEnvelope also has no VoteDelayRejected case, meaning the secondary proxy can never relay the reward to the player's backend. Fresh evidence beyond the earlier proxy-dispatch comment is that the newly added path now explicitly returns for non-local players rather than forwarding the rejection through the existing multi-proxy channel.
Useful? React with 👍 / 👎.
ec203fe to
b48a380
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b48a380102
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (!playerOnline || playerServer == null || !getAllAvailableServers().contains(playerServer)) { | ||
| debug("Not sending vote delay rejection for " + player + " because the player is offline"); | ||
| return; |
There was a problem hiding this comment.
Deliver delay-rejection rewards for offline players
When BungeeManageTotals rejects a vote while the player is offline, this guard discards the notification entirely, so even offline-capable rewards such as console commands can never run. The backend handler already accepts wasOnline == false, and the standalone listener dispatches the reward with an offline state, so route the rejection to an appropriate backend instead of returning solely because no current player server exists.
Useful? React with 👍 / 👎.
What changed
WaitUntilVoteDelayRewardsreward sectionWaitUntilVoteDelayis active and the configured delay has not endedVoteDelayRejectedproxy-to-backend envelope so proxy-managed delay rejections can run the configured reward when the player is connected through that proxyProcessRewardssetting for standalone and proxy-delivered votes%ServiceSite%,%SiteName%,%VoteDelay%, and%VoteURL%reward placeholdersDirectlyDefinedRewardinVotingPluginMainWaitUntilVoteDelayRewards: {}VoteSites.ymlImpact
Servers can notify players, play sounds, run commands, or use other normal reward actions when an early vote is ignored.
Validation
masterand limited to the intended VotingPlugin implementation, configuration, and test filesAI assistance
This pull request was created with AI assistance.