/shop add duplicates damaged, enchanted or renamed items
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 63/100
Hướng nghiên cứu
Read InventoryManagementSystem.canRemove and its countQuantity logic, then trace how AddCommand removes items and how Transaction.process handles leftovers from addItem. Check the existing inventory tests and add coverage for damaged and renamed items during stock addition and purchases into partial stacks. Done when only eligible items are counted and removed, and inventory changes match the quantities recorded by the store.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Problem
/shop add counts items by material, but removes them by exact match. A damaged, enchanted or renamed item passes the check, isn't removed from the player, and is still added to the store. This duplicates items.
InventoryManagementSystem.canRemove uses countQuantity, which only compares the material. AddCommand then calls removeItem(new ItemStack(material, quantity)), which only removes plain items, and ignores the leftovers it returns.
Steps to reproduce
- Have a store selling
diamond_sword, and hold one damaged diamond sword. - Run
/shop add diamond_sword 1. The store's quantity goes up and the player keeps the damaged sword. - Run
/shop remove diamond_sword 1. The player now has two swords, one of them undamaged.
Reproduced in a test: one sword in the inventory became two.
Related
getAvailableSpace also counts partial stacks by material only, so space in a stack of renamed items is treated as free. On a real server addItem can't merge into those stacks, so a purchase could take the player's money and lose the items that didn't fit. Transaction.process ignores the leftovers from addItem. MockBukkit merged those stacks in testing, so this part comes from reading the code and should be confirmed on a test server.
Scope
- Decide how non-plain items are treated. The simplest rule is that only plain items (matching a new
ItemStackof that material) can be added. - Use the same rule when counting, checking space and removing items.
Done when
- A damaged, enchanted or renamed item can't be added as plain stock, and the player's inventory always changes by exactly what the store records.
- Tests cover damaged and renamed items for
add, and for buying into partial stacks.
- Ngôn ngữ chính
- Java
- Star
- 1
- Fork
- 0
- Merge trung bình
- 2 giờ 35 phút
- Pull request đã merge (30 ngày)
- 14
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của BrendonButler/Shops
-
dependencies enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
BrendonButler/Shops#79 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
BrendonButler/Shops#70 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
BrendonButler/Shops#69 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
BrendonButler/Shops#68 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
BrendonButler/Shops#67 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của BrendonButler/Shops
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 85/100
hibernate/hibernate-reactive#4485 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
type: dependency-upgrade
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 61/100
spring-projects/spring-graphql#1556 ·
-
hermes-queue
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 91/100
chrisalunlloyd2-sudo/mindpalace#373 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày