Add method to allow Number and Boolean types for placeholders

This commit is contained in:
ceze88 2024-08-26 19:53:41 +02:00
parent 0f2aff788f
commit 265e5864c9

View File

@ -147,7 +147,7 @@ public class Message {
* Interchangeably Supports {@code %value%} and {@code {value}} * Interchangeably Supports {@code %value%} and {@code {value}}
* *
* @param placeholder the placeholder to replace * @param placeholder the placeholder to replace
* @param replacement the replacement object * @param replacement the replacement String
* *
* @return the modified Message * @return the modified Message
*/ */
@ -158,6 +158,19 @@ public class Message {
return this; 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) { Message setPrefix(String prefix) {
this.prefix = AdventureUtils.formatComponent(prefix + " "); this.prefix = AdventureUtils.formatComponent(prefix + " ");
return this; return this;