ChatFilledLine can now add spaces on the right, if enabled in the builder.
This commit is contained in:
parent
c7b33132a9
commit
0e016881d7
@ -59,6 +59,7 @@ public class ChatFilledLine implements ComponentLike {
|
|||||||
private boolean decorationBold = false;
|
private boolean decorationBold = false;
|
||||||
private int nbSide = ChatConfig.nbCharMargin;
|
private int nbSide = ChatConfig.nbCharMargin;
|
||||||
private boolean spacesAroundText = false;
|
private boolean spacesAroundText = false;
|
||||||
|
private boolean spacesDecorationRightSide = false;
|
||||||
private boolean console = false;
|
private boolean console = false;
|
||||||
private Integer maxWidth = null;
|
private Integer maxWidth = null;
|
||||||
|
|
||||||
@ -116,6 +117,16 @@ public class ChatFilledLine implements ComponentLike {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the {@link #decoChar(char)} is set to space, also add spaces at the right of the text
|
||||||
|
* to reach the desired width.
|
||||||
|
* @return this.
|
||||||
|
*/
|
||||||
|
public ChatFilledLine spacesDecorationRightSide() {
|
||||||
|
spacesDecorationRightSide = true;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configure if the line will be rendered on console or not.
|
* Configure if the line will be rendered on console or not.
|
||||||
* @param console true for console, false for game UI.
|
* @param console true for console, false for game UI.
|
||||||
@ -184,7 +195,7 @@ public class ChatFilledLine implements ComponentLike {
|
|||||||
Chat d = Chat.chat()
|
Chat d = Chat.chat()
|
||||||
.then(Chat.text(ChatUtil.repeatedChar(decorationChar, nbCharLeft)).color(decorationColor).bold(decorationBold))
|
.then(Chat.text(ChatUtil.repeatedChar(decorationChar, nbCharLeft)).color(decorationColor).bold(decorationBold))
|
||||||
.then(text);
|
.then(text);
|
||||||
if (decorationChar != ' ')
|
if (decorationChar != ' ' || spacesDecorationRightSide)
|
||||||
d.then(Chat.text(ChatUtil.repeatedChar(decorationChar, nbCharRight)).color(decorationColor).bold(decorationBold));
|
d.then(Chat.text(ChatUtil.repeatedChar(decorationChar, nbCharRight)).color(decorationColor).bold(decorationBold));
|
||||||
return (FormatableChat) d;
|
return (FormatableChat) d;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user