/** * Handler for sending a result. Converts to multiple lines if it is too long, or if the next word * cannot fit on the line * * @param sender {@link CommandSender} to send result to * @param line text to send wordWrap */ public static void sendLine(CommandSender sender, String input) { int n = 65; String s = ""; String[] splitInput = input .replaceAll("\\s+", " ") .replaceAll(String.format(" *(.{1,%d})(?=$| ) *", n), "$1\n") .split("\n"); for (String line : splitInput) { Util.sendMessage(sender, "&8| " + Util.getLastColor(s) + line); s = line; } }