Add UtilText.splitLine(String, int)

This commit is contained in:
Spencer 2018-01-04 19:39:51 -05:00 committed by Alexander Meech
parent 0ea229a8b4
commit 3b844b02af
2 changed files with 8 additions and 3 deletions

View File

@ -293,7 +293,7 @@ public class UtilText
return splitLinesToArray(string.split("\n"), lineFormat);
}
public static ArrayList<String> splitLine(String string, LineFormat lineFormat)
public static ArrayList<String> splitLine(String string, int lineLength)
{
ArrayList<String> strings = new ArrayList<String>();
@ -321,7 +321,7 @@ public class UtilText
String word = split[i];
int wordLength = getLength(colors + word);
if (currentLength + wordLength + 4 > lineFormat.getLength() && !current.isEmpty())
if (currentLength + wordLength + 4 > lineLength && !current.isEmpty())
{
strings.add(current);
current = colors + word;
@ -348,6 +348,11 @@ public class UtilText
return strings;
}
public static ArrayList<String> splitLine(String string, LineFormat lineFormat)
{
return splitLine(string, lineFormat.getLength());
}
public static String fillLine(String filler, int maxPixels)
{
int pixels = getLength(filler);

View File

@ -85,7 +85,7 @@ public class QuestPage extends ShopPageBase<QuestManager, QuestShop>
ItemMeta meta = item.getItemMeta();
meta.setDisplayName(ChatColor.YELLOW + "" + ChatColor.BOLD + quest.getName());
List<String> lore = UtilText.splitLine(ChatColor.LIGHT_PURPLE + quest.getTask(), LineFormat.LORE);
List<String> lore = UtilText.splitLine(ChatColor.LIGHT_PURPLE + quest.getTask(), 64);
lore.addAll(Arrays.asList(
"",
ChatColor.GRAY + "Cost: " + ChatColor.GREEN + quest.getCost() + " Gems",