Make /give and /item not give more items than needed#3287
Make /give and /item not give more items than needed#3287QuiCM merged 1 commit intoPryaxis:general-develfrom
Conversation
Greptile SummaryThis PR refines the default item quantity behavior in Confidence Score: 5/5Safe to merge — the change is minimal, symmetric across both commands, and all edge cases (maxStack == 1 weapons/armor, explicit 0 input) produce results identical to the previous code. No P0 or P1 findings. The two-branch refactor is logically equivalent to the old code for all cases where OnlyNeedOneInInventory() returns false or maxStack == 1, and correctly limits the default quantity for utility/unique items (OnlyNeedOneInInventory() == true, maxStack > 1) to 1, matching Journey Mode behavior. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["/item or /give called"] --> B{itemAmount\nspecified?}
B -- "No (itemAmount == 0)" --> C{itemAmount > maxStack?}
B -- "Yes (itemAmount > 0)" --> C
C -- "Yes" --> D[itemAmount = maxStack]
C -- "No, and itemAmount == 0" --> E{item.OnlyNeedOneInInventory?}
C -- "No, and itemAmount > 0" --> F[Keep user-specified amount]
E -- "true" --> G[itemAmount = 1]
E -- "false" --> H[itemAmount = maxStack]
D --> I[GiveItemCheck]
F --> I
G --> I
H --> I
Reviews (1): Last reviewed commit: "Make /give and /item not give more items..." | Re-trigger Greptile |
This makes previously unstackable items still being given in stacks of 1 if amount is not specified (all other items are still given in max amounts by default). Also makes it consistent with vanilla's journey mode item duplication.