Skip to content

Commit

Permalink
Cleanup motd code
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexProgrammerDE committed May 22, 2024
1 parent de236fe commit 8fdc59e
Showing 1 changed file with 4 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,9 @@ public class MOTDUtil {

public static String getMOTDJson(List<String> motds, boolean supportsHex) {
String unparsedMOTD = motds.get(random.nextInt(motds.size()));

String[] split = unparsedMOTD.contains("%nohexmotd%") ? unparsedMOTD.split("%nohexmotd%") : new String[]{unparsedMOTD};

String returnedString;
if (split.length > 1) {
if (supportsHex) {
returnedString = split[0];
} else {
returnedString = split[1];
}
} else {
returnedString = split[0];
}

return PlaceholderUtil.parseTextToJson(returnedString, supportsHex);
String[] split = unparsedMOTD.split("%nohexmotd%", 2);
return PlaceholderUtil.parseTextToJson(
split.length == 2 ? supportsHex ? split[0] : split[1] : split[0],
supportsHex);
}
}

0 comments on commit 8fdc59e

Please sign in to comment.