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

Aperta
#62 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
72/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
java
Ambito
backend

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.
Lingua principale
Java
Stelle
1
Fork
0
Merge medio
2h 35m
PR unite (30g)
14

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di BrendonButler/Shops

Tutte le issue di BrendonButler/Shops

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.