Java 类org.bukkit.inventory.Merchant 实例源码

项目:Shopkeepers    文件:NMSHandler.java   
@Override
public boolean openTradeWindow(String title, List<ItemStack[]> recipes, Player player) {
    // create empty merchant:
    Merchant merchant = Bukkit.createMerchant(title);

    // create list of merchant recipes:
    List<MerchantRecipe> merchantRecipes = new ArrayList<MerchantRecipe>();
    for (ItemStack[] recipe : recipes) {
        // skip invalid recipes:
        if (recipe == null || recipe.length != 3 || Utils.isEmpty(recipe[0]) || Utils.isEmpty(recipe[2])) {
            continue;
        }

        // create and add merchant recipe:
        merchantRecipes.add(this.createMerchantRecipe(recipe[0], recipe[1], recipe[2]));
    }

    // set merchant's recipes:
    merchant.setRecipes(merchantRecipes);

    // increase 'talked-to-villager' statistic:
    player.incrementStatistic(Statistic.TALKED_TO_VILLAGER);

    // open merchant:
    return player.openMerchant(merchant, true) != null;
}
项目:Shopkeepers    文件:NMSHandler.java   
@Override
public boolean openTradeWindow(String title, List<ItemStack[]> recipes, Player player) {
    // create empty merchant:
    Merchant merchant = Bukkit.createMerchant(title);

    // create list of merchant recipes:
    List<MerchantRecipe> merchantRecipes = new ArrayList<MerchantRecipe>();
    for (ItemStack[] recipe : recipes) {
        // skip invalid recipes:
        if (recipe == null || recipe.length != 3 || Utils.isEmpty(recipe[0]) || Utils.isEmpty(recipe[2])) {
            continue;
        }

        // create and add merchant recipe:
        merchantRecipes.add(this.createMerchantRecipe(recipe[0], recipe[1], recipe[2]));
    }

    // set merchant's recipes:
    merchant.setRecipes(merchantRecipes);

    // increase 'talked-to-villager' statistic:
    player.incrementStatistic(Statistic.TALKED_TO_VILLAGER);

    // open merchant:
    return player.openMerchant(merchant, true) != null;
}
项目:MockBukkit    文件:PlayerMock.java   
@Override
public InventoryView openMerchant(Merchant merchant, boolean force)
{
    // TODO Auto-generated method stub
    throw new UnimplementedOperationException();
}
项目:GlowNPC    文件:GlowNPC.java   
@Override
public InventoryView openMerchant(Merchant arg0, boolean arg1) {
    return null;
}
项目:HiddenOre    文件:FakePlayer.java   
@Override
public InventoryView openMerchant(Merchant arg0, boolean arg1) {
    return null;
}
项目:ExilePearl    文件:TestServer.java   
@Override
public Merchant createMerchant(String title) {
    // TODO Auto-generated method stub
    return null;
}
项目:Pokkit    文件:PokkitHumanEntity.java   
@Override
public InventoryView openMerchant(Merchant arg0, boolean arg1) {
    throw Pokkit.unsupported();
}
项目:Pokkit    文件:CraftServer.java   
@Override
public Merchant createMerchant(String arg0) {
    throw Pokkit.unsupported();
}
项目:BlockLocker    文件:TestPlayer.java   
@Override
public InventoryView openMerchant(Merchant arg0, boolean arg1) {
    throw new UnsupportedOperationException();

}