Paper/src/main/java/org/bukkit/craftbukkit/TextWrapper.java
2012-09-09 23:19:28 -05:00

25 Zeilen
595 B
Java

package org.bukkit.craftbukkit;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.ChatColor;
public class TextWrapper {
public static List<String> wrapText(final String text) {
ArrayList<String> output = new ArrayList<String>();
String[] lines = text.split("\n");
String lastColor = null;
for (String line : lines) {
if (lastColor != null) {
line = lastColor + line;
}
output.add(line);
lastColor = ChatColor.getLastColors(line);
}
return output;
}
}