Skip to content

Batched Commands for queued rewards #1786

Backlog

Description

@ZepsiZola

Is your feature request related to a problem? Please describe.

When a player joins the server after accumulating a large number of offline votes, VotingPlugin executes each queued reward command individually in rapid succession.

This can cause significant performance issues when the plugins receiving these commands perform expensive operations, such as serialising YAML files or writing to databases, for every command execution.

On my server, a player recently joined and received 149 vote crate keys through 149 individual CrazyCrates commands, alongside numerous GriefPrevention claim block and LuckPerms permission commands.

During this period, the server's memory allocation rate reached approximately 6.7 GiB/s, temporarily exhausting its 48 GiB heap and causing allocation stalls of up to 441 ms.

Although the fault of this bad memory allocation is really on the dev who decided to make all playerdata stored in one giant .yml file, I think having this feature would nonetheless help performance for servers since they'd only have to run a command once instead of dozens of times in situations like this.

Describe the solution you'd like

An opt-in mechanism for batching reward commands that support a quantity argument.

For example, instead of executing:

crazycrates give virtual Vote 1 %player%

149 times, VotingPlugin could execute:

crazycrates give virtual Vote 149 %player%

A possible configuration format could be:

Rewards:
  Commands:
    Batched:
      VoteKeys:
        Command: 'crazycrates give virtual Vote %amount% %player%'
        Amount: 1
      ClaimBlocks:
        Command: 'acb %player% %amount%'
        Amount: 500

When processing queued rewards, VotingPlugin would accumulate the quantities of each explicitly batchable command before executing it once with the combined amount.

This should be optional and backwards compatible, preserving existing reward conditions, milestone rewards, random reward rolls and non-batchable commands.

Describe alternatives you've considered

  • Using ForceOffline to distribute reward execution over time. However, not all reward commands support offline players, and this does not reduce the total number of operations.
  • Migrating other plugins from YAML to database storage. This could reduce the cost of individual commands but would not address the underlying inefficiency of repeatedly executing commands that could be combined.

Additional context

The incident that prompted this feature request involved the following reward operations being executed within approximately two seconds:

Reward Individual executions
Vote crate keys 149
Special crate keys 2
GriefPrevention claim block adjustments 30
LuckPerms temporary permission commands 30

CrazyCrates stores its player data in a single data.yml file containing approximately 59,000 lines, making repeated serialisation a potential source of substantial temporary memory allocations.

Server environment:

  • Canvas 26.3 (Folia-based)
  • Java 26 with generational ZGC
  • 48 GiB JVM heap

I believe this feature would benefit larger servers in particular, where players may accumulate substantial numbers of offline votes and reward commands may trigger expensive persistence operations.

Activity

  1. added
    Possible Feature
    on Dec 3, 2026
  2. github-actions commented on Dec 3, 2026

    @github-actions
    Contributor

    Automated issue investigation

    Workflow run · Download investigation artifacts · Development checkout 4f593d39f03956660ccc990aa74dcc15eb9a2a7d (not necessarily the reported version)

    This is an automated analysis, not confirmation that every check passed. Verification results and limitations are included below.

    Finding: Insufficient evidence to verify behavior in the reported build. Issue #1786 provides no VotingPlugin version or build identifier, so there is no matching historical source to inspect. In the pinned development checkout, queued offline votes are processed in sequence, with a reward flow for each vote-site occurrence. That supports this as a feature request for that snapshot; it does not establish what the reporter’s build did.

    Evidence: Reported version: unavailable; the issue also omits CrazyCrates, GriefPrevention, LuckPerms, and AdvancedCore versions. Current development checkout: VotingPluginUser.java at 4f593d3 chains a reward call for each queued site name. VoteSite.java at 4f593d3 sends the general and site-specific reward paths in sequence.

    Verification: Read-only inspection at 4f593d39f03956660ccc990aa74dcc15eb9a2a7d; git rev-parse HEAD matched that SHA and git status --short was empty. A read-only GitHub API request confirmed the issue contains no version/build metadata. No tests or runtime reproduction were performed.

    Suggested next step: If accepting the feature, aggregate only explicitly configured commands after reward conditions and random rolls resolve. Add regression coverage for repeated queued votes and unchanged behavior for unbatchable or conditional rewards.

    Limitations: The reporter’s build, dependency versions, logs, and downstream plugin behavior are unavailable. The current POM declares AdvancedCore 3.8.2-SNAPSHOT, which does not establish the reporter’s version. The repository’s configured MEX reader was unavailable, so no alternate project memory was used.

    Deliverables: evidence report and verification log.

    Optional development-build retest: If you can safely test on a backed-up/staging server, download the VotingPlugin JAR from the latest successful development build (build history). This is a development build, not a verified fix or stable release. Check plugin compatibility and fully restart before retesting; please share the build number and whether the same steps reproduce.

  3. BenCodez commented on Dec 4, 2026

    @BenCodez
    Owner

    Would this work for you? Added %votes% placeholder on AnySiteRewards, runs once for offline votes, once for each online vote, can try it here:
    https://bencodez.com/job/VotingPlugin/

    AnySiteRewards:
      Commands:
      - 'crazycrates give virtual Vote %votes% %player%'
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Possible Feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions