mirror of
https://github.com/YouHaveTrouble/NotJustNameplates.git
synced 2026-05-12 06:26:58 +00:00
potential workaround for placeholders returning minimessage format
This commit is contained in:
+1
-1
@@ -5,7 +5,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = "me.youhavetrouble"
|
group = "me.youhavetrouble"
|
||||||
version = "1.2.0"
|
version = "1.2.1-pre1"
|
||||||
description = "Nameplates using display entities"
|
description = "Nameplates using display entities"
|
||||||
|
|
||||||
java {
|
java {
|
||||||
|
|||||||
@@ -29,18 +29,22 @@ public class TextParser {
|
|||||||
final String placeholder = argumentQueue.popOr("placeholder tag requires an argument").value();
|
final String placeholder = argumentQueue.popOr("placeholder tag requires an argument").value();
|
||||||
switch (placeholder) {
|
switch (placeholder) {
|
||||||
case "name" -> {
|
case "name" -> {
|
||||||
return Tag.selfClosingInserting(player.name()) ;
|
return Tag.selfClosingInserting(player.name());
|
||||||
}
|
}
|
||||||
case "displayname" -> {
|
case "displayname" -> {
|
||||||
return Tag.selfClosingInserting(player.displayName());
|
return Tag.selfClosingInserting(player.displayName());
|
||||||
}
|
}
|
||||||
default -> {
|
default -> {
|
||||||
if (NotJustNameplates.isPapiHooked()) {
|
if (!NotJustNameplates.isPapiHooked()) return Tag.selfClosingInserting(Component.text(placeholder));
|
||||||
|
|
||||||
final String parsedPlaceholder = PlaceholderAPI.setPlaceholders(player, '%' + placeholder + '%');
|
final String parsedPlaceholder = PlaceholderAPI.setPlaceholders(player, '%' + placeholder + '%');
|
||||||
|
|
||||||
|
if (parsedPlaceholder.contains(LegacyComponentSerializer.SECTION_CHAR + "")) {
|
||||||
Component componentPlaceholder = LegacyComponentSerializer.legacySection().deserialize(parsedPlaceholder);
|
Component componentPlaceholder = LegacyComponentSerializer.legacySection().deserialize(parsedPlaceholder);
|
||||||
return Tag.selfClosingInserting(componentPlaceholder);
|
return Tag.selfClosingInserting(componentPlaceholder);
|
||||||
}
|
}
|
||||||
return Tag.selfClosingInserting(Component.text(placeholder));
|
|
||||||
|
return Tag.selfClosingInserting(MiniMessage.miniMessage().deserialize(parsedPlaceholder));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user