/shop delete destroys the store's stock instead of returning it

Đang mở
#62 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

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
72/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
java
Lĩnh vực
backend

Hướng nghiên cứu

Start with DeleteCommand, where the issue says the inventory check and unfinished TODO already exist, then inspect the delete command tests and the wiki's Commands page. Trace how finite stock and negative quantities are handled, and run the relevant tests. Done when a plain delete returns finite stock or leaves the store unchanged if inventory is insufficient, force flags still discard stock, and the wiki matches.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug

Problem

DeleteCommand checks that the player has room for the store's items, then deletes the store without giving them the items. All remaining stock is lost, even on a plain /shop delete <store> with no flags.

The inventory check implies the items should be returned, and so does STORE_DELETE_INSUFFICIENT_INV_PLAYER, which tells players to clear space or use -f to ignore inventory. A TODO in DeleteCommand also notes that removing all items is unfinished. The balance is refunded correctly unless -F is used.

The existing -f and -F tests only cover the forced paths, where an empty inventory is expected.

Steps to reproduce

  1. Create a store and add items to it.
  2. Run /shop delete <store> with enough free inventory space.
  3. The store is deleted, but the items aren't in the player's inventory.

Scope

  • Give the store's stock to the player when deleting without a force flag.
  • Keep -f and -F discarding stock, and make sure the behavior is clear in the command's messages.
  • Handle items with infinite stock (negative quantity) so they don't create items or fail the inventory check.

Done when

  • A plain delete moves all finite stock to the player's inventory.
  • A plain delete with too little space is refused and the store is unchanged.
  • Tests cover the plain delete with stock, and -f and -F still discard it.
  • The wiki's Commands page, which currently warns that stock isn't returned, matches the fix.
  • Fixed before the 0.4.0 full release.
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

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của BrendonButler/Shops

Tất cả issue của BrendonButler/Shops

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.