Skip to content

Commit

Permalink
Add method to allow Number and Boolean types for placeholders
Browse files Browse the repository at this point in the history
  • Loading branch information
ceze88 committed Aug 26, 2024
1 parent 0f2aff7 commit 265e586
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion Core/src/main/java/com/craftaro/core/locale/Message.java
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public List<Component> getMessageLines() {
* Interchangeably Supports {@code %value%} and {@code {value}}
*
* @param placeholder the placeholder to replace
* @param replacement the replacement object
* @param replacement the replacement String
*
* @return the modified Message
*/
Expand All @@ -158,6 +158,19 @@ public Message processPlaceholder(String placeholder, String replacement) {
return this;
}

/**
* Replace the provided placeholder with the provided object. <br />
* Interchangeably Supports {@code %value%} and {@code {value}}
*
* @param placeholder the placeholder to replace
* @param replacement the replacement Number
*
* @return the modified Message
*/
public Message processPlaceholder(String placeholder, Number replacement) {
return processPlaceholder(placeholder, replacement == null ? "" : replacement.toString());
}

Message setPrefix(String prefix) {
this.prefix = AdventureUtils.formatComponent(prefix + " ");
return this;
Expand Down

0 comments on commit 265e586

Please sign in to comment.