Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-6057

InventoryCloseEvent MerchantInventory getMerchant() is not an instance of a Villager

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • None
    • git-Spigot-9639cf7-f622793 (MC: 1.16.1) (Implementing API version 1.16.1-R0.1-SNAPSHOT)
    • Yes

      public class Bar implements Listener {
             @EventHandler
      	public void onVillagerFinishTrade(InventoryCloseEvent e) {
      		if (e.getInventory() instanceof MerchantInventory) {
      			MerchantInventory mi = (MerchantInventory) e.getInventory();
      			Merchant m = mi.getMerchant();
      			if (m instanceof Villager) {
      				//this line of code is never reached
      			}
      		}
      	}
      }
      

      When player closes villager trading menu MerchantInventory object does not return a merchant that is an instance of a Villager. This does not allow to perform any actions related to this villager.

            Unassigned Unassigned
            Radiant_Shiny Radiant_Shiny
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: