fix: never resolve a recipe question to the wrong item
The substring fallback in materialFor returned plausible recipes for items the player did not ask about. "Redstone Repeater" tied on length and resolved to REDSTONE, handing someone asking about repeaters the recipe for redstone dust; "Book and Quill" gave BOOK, "Minecart with Chest" gave MINECART, "Rabbit's Foot" gave RABBIT, "Chestplate" gave CHEST. That is the exact failure this feature exists to remove, and it is worse than no answer because the model states it confidently. Dropped it. Exact match plus a hand-checked alias table, else null. No suffix rule either: "axe" is a suffix of "pickaxe", so tool and armour families would fail the same way. Beds and wool now return null, which is correct. brewing() matched keys as bare substrings and hijacked real questions: "salto" inside basalto, "cura" inside curar, "forca" inside reforcar. Since describe() answers brewing first, each took over the whole answer. Now gated on the question mentioning a potion, and matched on word boundaries. Table corrections: "Fogo do Dragao" is not an item, it is Bafo do Dragao giving a lingering potion; Frasco de Agua, not Garrafa de Agua, which is the empty bottle; Pe de Coelho; Fatia de Melancia Reluzente. Added the in-game item names players actually type (Agilidade, Dano) and stripped hyphens so Mestre-Tartaruga reaches the table. describeShapeless no longer emits a dangling "Sem formato: ". describeChoice could not be covered after all: constructing a MaterialChoice initialises org.bukkit.Registry, which needs a server, and the class is sealed so it cannot be faked. Verified in Task 13. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F3jSvSTrG4qsniLSr6TpC6
This commit is contained in:
@@ -97,8 +97,19 @@ containing "trident", by coincidence rather than translation. So the question's
|
||||
subject is searched on the pt wiki and the article's `prop=langlinks&lllang=en`
|
||||
gives the English title, which uppercases onto the enum: "Espada de Diamante"
|
||||
→ "Diamond Sword" → `DIAMOND_SWORD`. The same twenty questions now resolve
|
||||
**17 of 20**. Articles without an English link (real case: "Mesa de
|
||||
Encantamento") yield no grounding rather than a guess.
|
||||
**17 of 20**. Articles without an English link yield no grounding rather than
|
||||
a guess.
|
||||
|
||||
The match is exact, plus a small hand-checked alias table ("Redstone Repeater"
|
||||
→ `REPEATER`, "Book and Quill" → `WRITABLE_BOOK`). There is deliberately no
|
||||
fuzzy fallback. Resolving to the longest material name contained in the title
|
||||
was tried and returned confidently wrong items: "Redstone Repeater" tied on
|
||||
length and gave `REDSTONE`, so a player asking about repeaters got the recipe
|
||||
for redstone dust; "Minecart with Chest" gave `MINECART`; "Rabbit's Foot" gave
|
||||
`RABBIT`, the raw meat. A suffix rule fails identically — "axe" is a suffix of
|
||||
"pickaxe". Colour and material families (`Bed`, `Wool`) therefore resolve to
|
||||
null, which is correct: a plausible recipe for the wrong item is the failure
|
||||
this feature exists to remove, and it is worse than no answer.
|
||||
|
||||
**Brewing is not exposed by Bukkit at all, so potions use a hardcoded table.**
|
||||
Checked against the 26.2 API: there is no brewing `Recipe` implementation;
|
||||
|
||||
Reference in New Issue
Block a user