Skip to content

Commit

Permalink
feat: support non self closing tags for placeholderapi
Browse files Browse the repository at this point in the history
  • Loading branch information
rexlManu committed Oct 28, 2024
1 parent 16f0c48 commit 25f07ed
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ public static String replaceLegacyWithTags(String input) {
final String papiPlaceholder =
argumentQueue.popOr("papi tag requires an argument").value();

boolean notSelfClosing = argumentQueue.hasNext() && argumentQueue.pop().isFalse();

// Then get PAPI to parse the placeholder for the given player.
final String parsedPlaceholder =
PlaceholderAPI.setPlaceholders(player, '%' + papiPlaceholder + '%');
Expand All @@ -110,6 +112,9 @@ public static String replaceLegacyWithTags(String input) {
Component component = parsePossibleLegacy(parsedPlaceholder);

// Finally, return the tag instance to insert the placeholder!
if (notSelfClosing) {
return Tag.inserting(component);
}
return Tag.selfClosingInserting(component);
});
}
Expand Down

0 comments on commit 25f07ed

Please sign in to comment.