Alright So I am trying to check and see if a string exists but I don't know what case it's going to be in so How would I use it in my method?
here is my code
if (!p.hasPermission("core.chat.curse")){
String message = e.getMessage().toString().toLowerCase().replace(" ", "");
List<String> cursewords = manager.getCurseFile().getStringList("cursewords");
for (String badword : cursewords){
badword = badword.toString().toLowerCase();
if (message.contains(badword)){
String crossout = "";
for (int x = 0; x < badword.length(); x++){
crossout += "*";
}
e.setMessage(e.getMessage().replace(badword, crossout)); //I need to
//replace Ignore Case Here
}
}
}
.replace
does not take a regex, so I can't use that!
How would I go about doing this, because the player can input the word in any case?