Skip to content

Add support for ranged item amounts in Give and GiveAll commands - #48

Open
AerWyn81 wants to merge 1 commit into
emanondev:masterfrom
AerWyn81:master
Open

Add support for ranged item amounts in Give and GiveAll commands#48
AerWyn81 wants to merge 1 commit into
emanondev:masterfrom
AerWyn81:master

Conversation

@AerWyn81

Copy link
Copy Markdown
Contributor

This pull request adds support for specifying a random amount range when using the give and giveall server item commands. Users can now enter an amount as a single number or as a range (e.g., 1-10), and the command will randomly select an amount within that range. Additionally, tab completion has been updated to suggest common ranges.

Command functionality improvements:

  • Added support for amount ranges (e.g., 1-10) in the give and giveall commands. The code parses the range, validates it, and randomly selects an amount within the specified range.

Tab completion enhancements:

  • Updated tab completion for the amount argument in both Give.java and GiveAll.java to suggest common ranges like 1-10 and 1-64, in addition to single values.

Tested in production.

@TheOne-Player

Copy link
Copy Markdown

Thank you for your PR @AerWyn81!
This looks useful, thanks for adding range support. One thing to clarify: when an amount range (e.g. 1-10) is passed to giveall, does the command sample a single random value and give that same amount to every target, or does it sample independently for each target? That distinction is potentially surprising to users.

Could you:

  • State the intended behavior in the command help/usage text (and in the PR description).
  • If you want to support both modes, consider adding an explicit option/flag (for example --per-target or --same-for-all) or a config setting so users can choose the behavior.
  • Add a small test or example in the help showing the difference.

This will avoid confusion when people run giveall expecting either identical or per-player randomized amounts.

Why: users will reasonably expect either behavior and the current PR text doesn't say which one is implemented. Making it explicit (or adding a flag) avoids accidental surprises.

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.

2 participants