Update T2Creplace.java
add public static Object replace(Object object,String placeholder,String replacement)
This commit is contained in:
parent
567b0a2442
commit
e97fadfbec
@ -171,4 +171,19 @@ public class T2Creplace {
|
|||||||
.replace("&o", "<italic>").replace("§o", "<italic>")
|
.replace("&o", "<italic>").replace("§o", "<italic>")
|
||||||
.replace("&r", "<reset>").replace("§r", "<reset>");
|
.replace("&r", "<reset>").replace("§r", "<reset>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Object replace(Object object,String placeholder,String replacement) {
|
||||||
|
if (object instanceof String) {
|
||||||
|
object = ((String) object).replace(placeholder, replacement);
|
||||||
|
}
|
||||||
|
if ((object instanceof List) || (object instanceof ArrayList)) {
|
||||||
|
List<String> in = (List<String>) object;
|
||||||
|
List<String> output = new ArrayList<>();
|
||||||
|
for (String input : in) {
|
||||||
|
output.add(input.replace(placeholder, replacement));
|
||||||
|
}
|
||||||
|
object = output;
|
||||||
|
}
|
||||||
|
return object;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user