当前位置: 首页>>代码示例>>Java>>正文


Java MerchantInventory类代码示例

本文整理汇总了Java中org.bukkit.inventory.MerchantInventory的典型用法代码示例。如果您正苦于以下问题:Java MerchantInventory类的具体用法?Java MerchantInventory怎么用?Java MerchantInventory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MerchantInventory类属于org.bukkit.inventory包,在下文中一共展示了MerchantInventory类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getUsedTradingRecipe

import org.bukkit.inventory.MerchantInventory; //导入依赖的package包/类
@Override
public ItemStack[] getUsedTradingRecipe(MerchantInventory merchantInventory) {
	MerchantRecipe merchantRecipe = merchantInventory.getSelectedRecipe();
	List<ItemStack> ingredients = merchantRecipe.getIngredients();
	ItemStack[] recipe = new ItemStack[3];
	recipe[0] = ingredients.get(0);
	recipe[1] = null;
	if (ingredients.size() > 1) {
		ItemStack buyItem2 = ingredients.get(1);
		if (!Utils.isEmpty(buyItem2)) {
			recipe[1] = buyItem2;
		}
	}
	recipe[2] = merchantRecipe.getResult();
	return recipe;
}
 
开发者ID:nisovin,项目名称:Shopkeepers,代码行数:17,代码来源:NMSHandler.java

示例2: getUsedTradingRecipe

import org.bukkit.inventory.MerchantInventory; //导入依赖的package包/类
@Override
public ItemStack[] getUsedTradingRecipe(MerchantInventory merchantInventory) {
	try {
		InventoryMerchant handle = (InventoryMerchant) ((CraftInventoryMerchant) merchantInventory).getInventory();
		MerchantRecipe merchantRecipe = handle.getRecipe();
		ItemStack[] recipe = new ItemStack[3];
		recipe[0] = merchantRecipe.getBuyItem1() != null ? CraftItemStack.asBukkitCopy(merchantRecipe.getBuyItem1()) : null;
		recipe[1] = merchantRecipe.getBuyItem2() != null ? CraftItemStack.asBukkitCopy(merchantRecipe.getBuyItem2()) : null;
		recipe[2] = merchantRecipe.getBuyItem3() != null ? CraftItemStack.asBukkitCopy(merchantRecipe.getBuyItem3()) : null;
		return recipe;
	} catch (Exception e) {
		return null;
	}
}
 
开发者ID:nisovin,项目名称:Shopkeepers,代码行数:15,代码来源:NMSHandler.java

示例3: getUsedTradingRecipe

import org.bukkit.inventory.MerchantInventory; //导入依赖的package包/类
@Override
public ItemStack[] getUsedTradingRecipe(MerchantInventory merchantInventory) {
	try {
		Object inventoryMerchant = craftInventoryGetInventory.invoke(merchantInventory);
		Object merchantRecipe = getRecipeMethod.invoke(inventoryMerchant);
		ItemStack[] recipe = new ItemStack[3];
		recipe[0] = asBukkitCopy(getBuyItem1Method.invoke(merchantRecipe));
		recipe[1] = asBukkitCopy(getBuyItem2Method.invoke(merchantRecipe));
		recipe[2] = asBukkitCopy(getBuyItem3Method.invoke(merchantRecipe));
		return recipe;
	} catch (Exception e) {
		return null;
	}
}
 
开发者ID:nisovin,项目名称:Shopkeepers,代码行数:15,代码来源:FailedHandler.java

示例4: onInventoryOpen

import org.bukkit.inventory.MerchantInventory; //导入依赖的package包/类
@EventHandler
public void onInventoryOpen(InventoryOpenEvent event) {
	Inventory inventory = event.getInventory();
	if(inventory instanceof MerchantInventory && inventory.getHolder() != null) modify((Villager)inventory.getHolder(), (Player)event.getPlayer());
}
 
开发者ID:Warren1001,项目名称:attributehider,代码行数:6,代码来源:Remover.java

示例5: isWindow

import org.bukkit.inventory.MerchantInventory; //导入依赖的package包/类
@Override
public boolean isWindow(Inventory inventory) {
	return inventory instanceof MerchantInventory;
}
 
开发者ID:nisovin,项目名称:Shopkeepers,代码行数:5,代码来源:TradingHandler.java

示例6: getUsedTradingRecipe

import org.bukkit.inventory.MerchantInventory; //导入依赖的package包/类
public ItemStack[] getUsedTradingRecipe(MerchantInventory merchantInventory); 
开发者ID:nisovin,项目名称:Shopkeepers,代码行数:2,代码来源:NMSCallProvider.java


注:本文中的org.bukkit.inventory.MerchantInventory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。