java类org.bukkit.inventory.Merchant的实例源码

NMSHandler.java 文件源码 项目:Shopkeepers 阅读 35 收藏 0 点赞 0 评论 0
@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;
}
NMSHandler.java 文件源码 项目:Shopkeepers 阅读 32 收藏 0 点赞 0 评论 0
@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;
}
PlayerMock.java 文件源码 项目:MockBukkit 阅读 24 收藏 0 点赞 0 评论 0
@Override
public InventoryView openMerchant(Merchant merchant, boolean force)
{
    // TODO Auto-generated method stub
    throw new UnimplementedOperationException();
}
GlowNPC.java 文件源码 项目:GlowNPC 阅读 22 收藏 0 点赞 0 评论 0
@Override
public InventoryView openMerchant(Merchant arg0, boolean arg1) {
    return null;
}
FakePlayer.java 文件源码 项目:HiddenOre 阅读 26 收藏 0 点赞 0 评论 0
@Override
public InventoryView openMerchant(Merchant arg0, boolean arg1) {
    return null;
}
TestServer.java 文件源码 项目:ExilePearl 阅读 24 收藏 0 点赞 0 评论 0
@Override
public Merchant createMerchant(String title) {
    // TODO Auto-generated method stub
    return null;
}
PokkitHumanEntity.java 文件源码 项目:Pokkit 阅读 26 收藏 0 点赞 0 评论 0
@Override
public InventoryView openMerchant(Merchant arg0, boolean arg1) {
    throw Pokkit.unsupported();
}
CraftServer.java 文件源码 项目:Pokkit 阅读 21 收藏 0 点赞 0 评论 0
@Override
public Merchant createMerchant(String arg0) {
    throw Pokkit.unsupported();
}
TestPlayer.java 文件源码 项目:BlockLocker 阅读 25 收藏 0 点赞 0 评论 0
@Override
public InventoryView openMerchant(Merchant arg0, boolean arg1) {
    throw new UnsupportedOperationException();

}


问题


面经


文章

微信
公众号

扫码关注公众号