Better placeholder replacing

This commit is contained in:
ceze88 2024-07-08 18:26:42 +02:00
parent 3a43b55e70
commit 4ba9254913

View File

@ -422,10 +422,13 @@ public class AdventureUtils {
}
public static Component formatPlaceholder(Component message, MiniMessagePlaceholder... placeholder) {
return AdventureUtils.formatComponent(AdventureUtils.replaceLegacy(AdventureUtils.toLegacy(message)), placeholder);
return message.replaceText(builder -> {
for (MiniMessagePlaceholder place : placeholder) {
builder.matchLiteral(place.getPlaceholder()).replacement(place.getValue());
}
});
}
//Bukkit defaults for time
public static Title createTitle (Component title, Component subtitle) {
return Title.title(title, subtitle, Title.Times.times(