From d3da0dbe14557231ae9fdcbbc5b1d1a2143d4586 Mon Sep 17 00:00:00 2001 From: Sebi Date: Fri, 8 May 2020 12:17:58 +0200 Subject: [PATCH] change loadLore() to a more generic loadQualityStringList() --- src/com/dre/brewery/recipe/BCauldronRecipe.java | 2 +- src/com/dre/brewery/recipe/BRecipe.java | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/com/dre/brewery/recipe/BCauldronRecipe.java b/src/com/dre/brewery/recipe/BCauldronRecipe.java index 11cefdc..b6afa15 100644 --- a/src/com/dre/brewery/recipe/BCauldronRecipe.java +++ b/src/com/dre/brewery/recipe/BCauldronRecipe.java @@ -79,7 +79,7 @@ public class BCauldronRecipe { } - List> lore = BRecipe.loadLore(cfg, id + ".lore"); + List> lore = BRecipe.loadQualityStringList(cfg, id + ".lore"); if (lore != null && !lore.isEmpty()) { recipe.lore = lore.stream().map(Tuple::second).collect(Collectors.toList()); } diff --git a/src/com/dre/brewery/recipe/BRecipe.java b/src/com/dre/brewery/recipe/BRecipe.java index 0aea473..6a3ab19 100644 --- a/src/com/dre/brewery/recipe/BRecipe.java +++ b/src/com/dre/brewery/recipe/BRecipe.java @@ -127,7 +127,7 @@ public class BRecipe { return null; } - recipe.lore = loadLore(configSectionRecipes, recipeId + ".lore"); + recipe.lore = loadQualityStringList(configSectionRecipes, recipeId + ".lore"); recipe.servercmds = BUtil.loadCfgStringList(configSectionRecipes, recipeId + ".servercommands"); recipe.playercmds = BUtil.loadCfgStringList(configSectionRecipes, recipeId + ".playercommands"); @@ -307,11 +307,14 @@ public class BRecipe { return ingredients; } + /** + * Load a list of strings from a ConfigurationSection and parse preceded pluses. + */ @Nullable - public static List> loadLore(ConfigurationSection cfg, String path) { + public static List> loadQualityStringList(ConfigurationSection cfg, String path) { List load = BUtil.loadCfgStringList(cfg, path); if (load != null) { - List> lore = new ArrayList<>(load.size()); + List> list = new ArrayList<>(load.size()); for (String line : load) { line = P.p.color(line); int plus = 0; @@ -331,9 +334,9 @@ public class BRecipe { if (!line.startsWith("§")) { line = "§9" + line; } - lore.add(new Tuple<>(plus, line)); + list.add(new Tuple<>(plus, line)); } - return lore; + return list; } return null; }