forked from Upstream/mmocore
Fixed an issue with PAPI math expansion in GUIs
This commit is contained in:
parent
d30dcfe77e
commit
33b9841182
@ -2,6 +2,7 @@ package net.Indyuce.mmocore.gui.api.item;
|
|||||||
|
|
||||||
import net.Indyuce.mmocore.MMOCore;
|
import net.Indyuce.mmocore.MMOCore;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -21,7 +22,9 @@ public class Placeholders {
|
|||||||
// Internal placeholders
|
// Internal placeholders
|
||||||
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"));
|
@Nullable String found = placeholders.get(holder);
|
||||||
|
if (found != null)
|
||||||
|
str = str.replace("{" + holder + "}", found);
|
||||||
}
|
}
|
||||||
|
|
||||||
// External placeholders
|
// External placeholders
|
||||||
|
Loading…
Reference in New Issue
Block a user