mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-22 10:36:09 +01:00
Lower char limit for GUI lore newline, fixes #53
This commit is contained in:
parent
7298c490c7
commit
14d9636b09
@ -3377,10 +3377,9 @@ if (quest != null) {
|
||||
meta.setDisplayName(ChatColor.DARK_PURPLE + Quests.parseString(quests.get(i).getName(), npc));
|
||||
|
||||
if (!meta.hasLore()) {
|
||||
String lore = ChatColor.DARK_GREEN + quests.get(i).description;
|
||||
LinkedList<String> lines = new LinkedList<String>();
|
||||
|
||||
lines = MiscUtil.makeLines(lore, " ", 100);
|
||||
lines = MiscUtil.makeLines(quests.get(i).description, " ", 40, ChatColor.DARK_GREEN);
|
||||
|
||||
meta.setLore(lines);
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package me.blackvein.quests.util;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
public class MiscUtil {
|
||||
@ -116,7 +118,7 @@ public class MiscUtil {
|
||||
return s.trim().equals("") ? null : s.trim();
|
||||
}
|
||||
|
||||
public static LinkedList<String> makeLines(String s, String wordDelimiter, int lineLength) {
|
||||
public static LinkedList<String> makeLines(String s, String wordDelimiter, int lineLength, ChatColor lineColor) {
|
||||
|
||||
LinkedList<String> toReturn = new LinkedList<String>();
|
||||
String[] split = s.split(wordDelimiter);
|
||||
@ -126,7 +128,7 @@ public class MiscUtil {
|
||||
for (String piece : split) {
|
||||
|
||||
if ((currentLength + piece.length()) > (lineLength + 1)) {
|
||||
toReturn.add(line.replaceAll("^" + wordDelimiter, ""));
|
||||
toReturn.add(lineColor + line.replaceAll("^" + wordDelimiter, ""));
|
||||
line = piece + wordDelimiter;
|
||||
currentLength = piece.length() + 1;
|
||||
} else {
|
||||
@ -137,7 +139,7 @@ public class MiscUtil {
|
||||
}
|
||||
|
||||
if(line.equals("") == false)
|
||||
toReturn.add(line);
|
||||
toReturn.add(lineColor + line);
|
||||
|
||||
return toReturn;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user