Changed the way placeholders are parsed in the GUI

This commit is contained in:
Indyuce 2022-03-20 14:41:53 +01:00
parent 56996788a9
commit 735baac901

View File

@ -15,17 +15,14 @@ public class Placeholders {
public String apply(Player player, String str) { public String apply(Player player, String str) {
/* // Internal placeholders
* Remove potential conditions, apply color codes
* and external placeholders if needed.
*/
str = MMOCore.plugin.placeholderParser.parse(player, removeCondition(str));
while (str.contains("{") && str.substring(str.indexOf("{")).contains("}")) { while (str.contains("{") && str.substring(str.indexOf("{")).contains("}")) {
String holder = str.substring(str.indexOf("{") + 1, str.indexOf("}")); String holder = str.substring(str.indexOf("{") + 1, str.indexOf("}"));
str = str.replace("{" + holder + "}", placeholders.getOrDefault(holder, "Error")); str = str.replace("{" + holder + "}", placeholders.getOrDefault(holder, "Error"));
} }
return str;
// External placeholders
return MMOCore.plugin.placeholderParser.parse(player, removeCondition(str));
} }
private String removeCondition(String str) { private String removeCondition(String str) {