If the location is empty, don't try it. If the language string doesn't
exist, then don't try to parse it either and return an empty string.
This commit is contained in:
@ -88,11 +88,13 @@ public class JailIO {
|
||||
*
|
||||
* @param langString Which {@link LangString} we should be getting to send.
|
||||
* @param variables All the variables to replace, in order from 0 to however many.
|
||||
* @return The message as a colorful message.
|
||||
* @return The message as a colorful message or an empty message if that isn't defined in the language file.
|
||||
*/
|
||||
public String getLanguageString(LangString langString, String... variables) {
|
||||
String message = lang.getString("language." + langString.toString().toLowerCase());
|
||||
|
||||
if(message == null) return "";
|
||||
|
||||
for (int i = 0; i < variables.length; i++) {
|
||||
message = message.replaceAll("%" + i + "%", variables[i]);
|
||||
}
|
||||
|
Reference in New Issue
Block a user