Skip to content

Add rewards for votes rejected by vote delay - #1536

Merged
BenCodez merged 1 commit into
masterfrom
agent/wait-until-vote-delay-rewards
Jul 28, 2026
Merged

Add rewards for votes rejected by vote delay#1536
BenCodez merged 1 commit into
masterfrom
agent/wait-until-vote-delay-rewards

Conversation

@BenCodez

@BenCodez BenCodez commented Jul 28, 2026

Copy link
Copy Markdown
Owner

What changed

  • adds a per-site WaitUntilVoteDelayRewards reward section
  • runs that reward when a real vote is rejected because WaitUntilVoteDelay is active and the configured delay has not ended
  • preserves bypass, fake-vote, and queued-proxy behavior
  • adds a dedicated VoteDelayRejected proxy-to-backend envelope so proxy-managed delay rejections can run the configured reward when the player is connected through that proxy
  • respects the global ProcessRewards setting for standalone and proxy-delivered votes
  • exposes the standard %ServiceSite%, %SiteName%, %VoteDelay%, and %VoteURL% reward placeholders
  • registers each vote site's new reward path as a DirectlyDefinedReward in VotingPluginMain
  • initializes auto-generated vote sites with WaitUntilVoteDelayRewards: {}
  • documents the new section in VoteSites.yml

Impact

Servers can notify players, play sounds, run commands, or use other normal reward actions when an early vote is ignored.

Validation

  • verified the branch is based on current master and limited to the intended VotingPlugin implementation, configuration, and test files
  • GitHub Actions provides the full project build and test validation

AI assistance

This pull request was created with AI assistance.

@BenCodez
BenCodez marked this pull request as ready for review July 28, 2026 22:07

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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());

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment on lines +160 to +161
if (plugin.getOptions().isProcessRewards()) {
voteSite.giveWaitUntilVoteDelayRewards(user, online, event.isBungee());

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

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") {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment on lines +160 to +161
if (plugin.getOptions().isProcessRewards()) {
voteSite.giveWaitUntilVoteDelayRewards(user, online, event.isBungee());

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment on lines +1504 to +1506
if (!playerOnline || playerServer == null || !getAllAvailableServers().contains(playerServer)) {
debug("Not sending vote delay rejection for " + player + " because the player is offline");
return;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

@BenCodez
BenCodez force-pushed the agent/wait-until-vote-delay-rewards branch from ec203fe to b48a380 Compare July 28, 2026 22:33

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment on lines +1504 to +1506
if (!playerOnline || playerServer == null || !getAllAvailableServers().contains(playerServer)) {
debug("Not sending vote delay rejection for " + player + " because the player is offline");
return;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

@BenCodez
BenCodez merged commit 961d0dd into master Jul 28, 2026
4 checks passed
@BenCodez
BenCodez deleted the agent/wait-until-vote-delay-rewards branch July 28, 2026 22:42
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