ConfigRemovedRecipes.java 文件源码

java
阅读 20 收藏 0 点赞 0 评论 0

项目:civcraft 作者:
public static void removeRecipes(FileConfiguration cfg, HashMap<Integer, ConfigRemovedRecipes> removedRecipies){

    List<Map<?, ?>> configMaterials = cfg.getMapList("removed_recipes");
    for (Map<?, ?> b : configMaterials) {
        ConfigRemovedRecipes item = new ConfigRemovedRecipes();
        item.type_id = (Integer)b.get("type_id");
        item.data = (Integer)b.get("data");

        removedRecipies.put(item.type_id, item);

        Iterator<Recipe> it = Bukkit.getServer().recipeIterator();
        while (it.hasNext()) {
            Recipe recipe = it.next();

            if (recipe instanceof ShapedRecipe) {
                ShapedRecipe shapedRecipe = (ShapedRecipe)recipe;
                if (ItemManager.getId(shapedRecipe.getResult()) == item.type_id &&
                        shapedRecipe.getResult().getDurability() == (short)item.data) {
                    it.remove();
                    break;
                }
            }
        }
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号