[SPIGOT-7867] Merchant instanceof AbstractVillager always returns false despite AbstractVillager being a subinterface of Merchant Created: 11/Aug/24  Updated: 25/Dec/24  Resolved: 07/Sep/24

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Athlaeos Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None

Version: CraftBukkit version 4236-Spigot-cb8cf80-f993563 (MC: 1.21) (Implementing API version 1.21-R0.1-SNAPSHOT)
Guidelines Read: Yes

 Description   

While working with TradeSelectEvent listeners I noticed that TradeSelectEvent#getMerchant() instanceof Villager or AbstractVillager always returns false. Villager and AbstractVillager are both noted as subinterfaces of Merchant.



 Comments   
Comment by Y2K_ [ 19/Aug/24 ]

Opened a PR for this CraftBukkit

Comment by Y2K_ [ 12/Aug/24 ]

Seems like an implementation oversight. There really isn't much that can be done without reworking internals surrounding CraftMerchant. Currently the issue is all entities delegate to CraftMerchant, which has no relation to entities because it is used to virtualize Merchant Inventories. I will draft a PR for this in the coming days

For the reporter right now you can use InventoryHolder to find the entity as of now.

Comment by md_5 [ 11/Aug/24 ]

Cc/ Y2K_

Generated at Sat Mar 15 03:08:10 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.