SPIGOT-2272: Add API for virtual Merchants

By: Lukas Hennig <lukas@wirsindwir.de>
This commit is contained in:
Bukkit/Spigot
2016-11-21 15:29:10 +11:00
parent b57d05eeea
commit 229ff86864
7 changed files with 113 additions and 65 deletions

View File

@@ -3,6 +3,7 @@ package org.bukkit.entity;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.inventory.MainHand;
import org.bukkit.inventory.Merchant;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.InventoryView;
@@ -117,6 +118,19 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible, Inv
*/
public InventoryView openMerchant(Villager trader, boolean force);
/**
* Starts a trade between the player and the merchant.
*
* Note that only one player may trade with a merchant at once. You must use
* the force parameter for this.
*
* @param merchant The merchant to trade with. Cannot be null.
* @param force whether to force the trade even if another player is trading
* @return The newly opened inventory view, or null if it could not be
* opened.
*/
public InventoryView openMerchant(Merchant merchant, boolean force);
/**
* Force-closes the currently open inventory view for this player, if any.
*/