mirror of
https://github.com/exituser/Brewery.git
synced 2026-09-17 05:28:59 +00:00
change loadLore() to a more generic loadQualityStringList()
This commit is contained in:
@@ -79,7 +79,7 @@ public class BCauldronRecipe {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
List<Tuple<Integer,String>> lore = BRecipe.loadLore(cfg, id + ".lore");
|
List<Tuple<Integer,String>> lore = BRecipe.loadQualityStringList(cfg, id + ".lore");
|
||||||
if (lore != null && !lore.isEmpty()) {
|
if (lore != null && !lore.isEmpty()) {
|
||||||
recipe.lore = lore.stream().map(Tuple::second).collect(Collectors.toList());
|
recipe.lore = lore.stream().map(Tuple::second).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ public class BRecipe {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
recipe.lore = loadLore(configSectionRecipes, recipeId + ".lore");
|
recipe.lore = loadQualityStringList(configSectionRecipes, recipeId + ".lore");
|
||||||
|
|
||||||
recipe.servercmds = BUtil.loadCfgStringList(configSectionRecipes, recipeId + ".servercommands");
|
recipe.servercmds = BUtil.loadCfgStringList(configSectionRecipes, recipeId + ".servercommands");
|
||||||
recipe.playercmds = BUtil.loadCfgStringList(configSectionRecipes, recipeId + ".playercommands");
|
recipe.playercmds = BUtil.loadCfgStringList(configSectionRecipes, recipeId + ".playercommands");
|
||||||
@@ -307,11 +307,14 @@ public class BRecipe {
|
|||||||
return ingredients;
|
return ingredients;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load a list of strings from a ConfigurationSection and parse preceded pluses.
|
||||||
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
public static List<Tuple<Integer, String>> loadLore(ConfigurationSection cfg, String path) {
|
public static List<Tuple<Integer, String>> loadQualityStringList(ConfigurationSection cfg, String path) {
|
||||||
List<String> load = BUtil.loadCfgStringList(cfg, path);
|
List<String> load = BUtil.loadCfgStringList(cfg, path);
|
||||||
if (load != null) {
|
if (load != null) {
|
||||||
List<Tuple<Integer, String>> lore = new ArrayList<>(load.size());
|
List<Tuple<Integer, String>> list = new ArrayList<>(load.size());
|
||||||
for (String line : load) {
|
for (String line : load) {
|
||||||
line = P.p.color(line);
|
line = P.p.color(line);
|
||||||
int plus = 0;
|
int plus = 0;
|
||||||
@@ -331,9 +334,9 @@ public class BRecipe {
|
|||||||
if (!line.startsWith("§")) {
|
if (!line.startsWith("§")) {
|
||||||
line = "§9" + line;
|
line = "§9" + line;
|
||||||
}
|
}
|
||||||
lore.add(new Tuple<>(plus, line));
|
list.add(new Tuple<>(plus, line));
|
||||||
}
|
}
|
||||||
return lore;
|
return list;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user