Make .replace require a TextReplacementConfig

This commit is contained in:
2022-10-09 19:32:51 +02:00
parent 5b06049265
commit 7ef9b4a64a
2 changed files with 12 additions and 36 deletions
@@ -19,40 +19,8 @@ public class ModifiableString {
this.text = text;
}
public void replace(String match, String replace) {
text = text
.replaceText(
TextReplacementConfig.builder()
.matchLiteral(match)
.replacement(replace)
.build());
}
public void replace(Pattern match, String replace) {
text = text
.replaceText(
TextReplacementConfig.builder()
.match(match)
.replacement(replace)
.build());
}
public void replace(@RegExp String match, Component replace) {
text = text
.replaceText(
TextReplacementConfig.builder()
.matchLiteral(match)
.replacement(replace)
.build());
}
public void replace(Pattern match, Component replace) {
text = text
.replaceText(
TextReplacementConfig.builder()
.match(match)
.replacement(replace)
.build());
public void replace(TextReplacementConfig textReplacementConfig) {
text = text.replaceText(textReplacementConfig);
}
public String string() {