Fixed Word Wrap not preserving lines

This commit is contained in:
alisolarflare 2016-11-25 20:26:43 -05:00
parent cc365d5555
commit 9afc2f8a96

View file

@ -36,37 +36,46 @@ public class DebugPotato {
/** /**
* Sets the message (lore of the potato). * Sets the message (lore of the potato).
* * @param message The message you wish to set
* @param message * @param forceWordWrap Word Wraps the whole String List, without preserving previous line breaks. Preserves line breaks if false
* The message * @return This potato
*/
public DebugPotato setMessage(List<String> message, boolean forceWordWrap) {
if (forceWordWrap){
this.message = WordWrap(message.toString());
}else{
List<String> outputList = new ArrayList<String>();
List<String> tempList = new ArrayList<String>();
for(String line: message){
tempList = WordWrap(line.toString());
for (String s: tempList){
outputList.add(s);
}
}
this.message = outputList;
}
return this;
}
/**
* Sets the message (lore of the potato). It will be word wrapped automatically.
* @return This potato * @return This potato
*/ */
public DebugPotato setMessage(List<String> message) { public DebugPotato setMessage(List<String> message) {
this.message = WordWrap(message.toString()); return setMessage(message, false);
return this;
}
public DebugPotato setMessage(List<String> message, boolean isWordWrapped) {
this.message = (isWordWrapped) ? WordWrap(message.toString()): message;
return this;
} }
/** /**
* Sets the message (lore of the potato). It will be word wrapped automatically. * Sets the message (lore of the potato). It will be word wrapped automatically.
*
* @param message
* The message
* @return This potato * @return This potato
*/ */
public DebugPotato setMessage(String message) { public DebugPotato setMessage(String message) {
this.message = WordWrap(message); return setMessage(Arrays.asList(message));
return this;
} }
/** /**
* Sets the message (lore of the potato). * Sets the message (lore of the potato). It will be word wrapped automatically.
*
* @param message
* The message
* @return This potato * @return This potato
*/ */
public DebugPotato setMessage(String[] message) { public DebugPotato setMessage(String[] message) {