potential workaround for placeholders returning minimessage format

This commit is contained in:
2023-08-06 19:44:55 +02:00
parent 3ab23d0ca5
commit 1853d1590f
2 changed files with 9 additions and 5 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ plugins {
}
group = "me.youhavetrouble"
version = "1.2.0"
version = "1.2.1-pre1"
description = "Nameplates using display entities"
java {
@@ -29,18 +29,22 @@ public class TextParser {
final String placeholder = argumentQueue.popOr("placeholder tag requires an argument").value();
switch (placeholder) {
case "name" -> {
return Tag.selfClosingInserting(player.name()) ;
return Tag.selfClosingInserting(player.name());
}
case "displayname" -> {
return Tag.selfClosingInserting(player.displayName());
}
default -> {
if (NotJustNameplates.isPapiHooked()) {
if (!NotJustNameplates.isPapiHooked()) return Tag.selfClosingInserting(Component.text(placeholder));
final String parsedPlaceholder = PlaceholderAPI.setPlaceholders(player, '%' + placeholder + '%');
if (parsedPlaceholder.contains(LegacyComponentSerializer.SECTION_CHAR + "")) {
Component componentPlaceholder = LegacyComponentSerializer.legacySection().deserialize(parsedPlaceholder);
return Tag.selfClosingInserting(componentPlaceholder);
}
return Tag.selfClosingInserting(Component.text(placeholder));
return Tag.selfClosingInserting(MiniMessage.miniMessage().deserialize(parsedPlaceholder));
}
}