@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;
}
java类org.bukkit.inventory.MerchantInventory的实例源码
NMSHandler.java 文件源码
项目:Shopkeepers
阅读 26
收藏 0
点赞 0
评论 0
NMSHandler.java 文件源码
项目:Shopkeepers
阅读 31
收藏 0
点赞 0
评论 0
@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;
}
NMSHandler.java 文件源码
项目:Shopkeepers
阅读 23
收藏 0
点赞 0
评论 0
@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;
}
}
NMSHandler.java 文件源码
项目:Shopkeepers
阅读 23
收藏 0
点赞 0
评论 0
@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;
}
}
NMSHandler.java 文件源码
项目:Shopkeepers
阅读 22
收藏 0
点赞 0
评论 0
@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;
}
}
NMSHandler.java 文件源码
项目:Shopkeepers
阅读 31
收藏 0
点赞 0
评论 0
@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;
}
}
NMSHandler.java 文件源码
项目:Shopkeepers
阅读 23
收藏 0
点赞 0
评论 0
@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;
}
}
NMSHandler.java 文件源码
项目:Shopkeepers
阅读 25
收藏 0
点赞 0
评论 0
@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;
}
}
FailedHandler.java 文件源码
项目:Shopkeepers
阅读 21
收藏 0
点赞 0
评论 0
@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;
}
}
Remover.java 文件源码
项目:attributehider
阅读 22
收藏 0
点赞 0
评论 0
@EventHandler
public void onInventoryOpen(InventoryOpenEvent event) {
Inventory inventory = event.getInventory();
if(inventory instanceof MerchantInventory && inventory.getHolder() != null) modify((Villager)inventory.getHolder(), (Player)event.getPlayer());
}
TradingHandler.java 文件源码
项目:Shopkeepers
阅读 22
收藏 0
点赞 0
评论 0
@Override
public boolean isWindow(Inventory inventory) {
return inventory instanceof MerchantInventory;
}
NMSCallProvider.java 文件源码
项目:Shopkeepers
阅读 21
收藏 0
点赞 0
评论 0
public ItemStack[] getUsedTradingRecipe(MerchantInventory merchantInventory);