Paper/src/main/java/org/bukkit/craftbukkit/TextWrapper.java

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;
2012-09-10 06:19:28 +02:00
for (String line : lines) {
if (lastColor != null) {
line = lastColor + line;
}
output.add(line);
lastColor = ChatColor.getLastColors(line);
}
return output;
}
2012-09-10 06:19:28 +02:00
}