Various code simplification/fixes and a lot of typo/grammar fixes (may brake some stuff)

This commit is contained in:
2023-06-20 00:15:46 +02:00
parent c984b63cee
commit 5edd8cdfec
151 changed files with 909 additions and 983 deletions

View File

@@ -23,6 +23,7 @@ import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.chat.BaseComponent;
import org.jetbrains.annotations.NotNull;
/**
* A builder for chat components.
@@ -30,10 +31,10 @@ import net.md_5.bungee.api.chat.BaseComponent;
* Use one of the provided static methods to create a new instance.
* <p>
* This class implements {@link ComponentLike} and {@link HoverEventSource} so they can be used directly in
* Adventure API and its implentation without using the final methods of this builder.
* Adventure API and its implementation without using the final methods of this builder.
* <p>
* The unique possible concrete subclass of this class, {@link FormatableChat}, takes care of the formating of the
* builded component. The rationale for this design is explained in the documentation of {@link FormatableChat}.
* The unique possible concrete subclass of this class, {@link FormatableChat}, takes care of the formatting of the
* built component. The rationale for this design is explained in the documentation of {@link FormatableChat}.
*/
public abstract sealed class Chat extends ChatStatic implements HoverEventSource<Component>, ComponentLike {
@@ -60,7 +61,7 @@ public abstract sealed class Chat extends ChatStatic implements HoverEventSource
/**
* Builds the component into Adventure Component instance.
* @return the {@link Component} builded from this {@link Chat} component.
* @return the {@link Component} built from this {@link Chat} component.
*/
public Component getAdv() {
return builder.build();
@@ -68,7 +69,7 @@ public abstract sealed class Chat extends ChatStatic implements HoverEventSource
/**
* Builds the component into BungeeCord {@link BaseComponent} instance.
* @return the {@link BaseComponent} builded from this {@link Chat} component.
* @return the {@link BaseComponent} built from this {@link Chat} component.
*/
public BaseComponent get() {
return toBungee(getAdv());
@@ -76,27 +77,27 @@ public abstract sealed class Chat extends ChatStatic implements HoverEventSource
/**
* Builds the component into BungeeCord {@link BaseComponent} array.
* @return the {@link BaseComponent} array builded from this {@link Chat} component.
* @return the {@link BaseComponent} array built from this {@link Chat} component.
*/
public BaseComponent[] getAsArray() {
return toBungeeArray(getAdv());
}
private static final LegacyComponentSerializer LEGACY_SERIALIZER_BUNGEE_FIENDLY = LegacyComponentSerializer.builder()
private static final LegacyComponentSerializer LEGACY_SERIALIZER_BUNGEE_FRIENDLY = LegacyComponentSerializer.builder()
.hexColors()
.useUnusualXRepeatedCharacterHexFormat()
.build();
/**
* Converts the builded component into legacy text.
* Converts the built component into legacy text.
* @return the legacy text. RGB colors are in BungeeCord format.
*/
public String getLegacyText() {
return LEGACY_SERIALIZER_BUNGEE_FIENDLY.serialize(getAdv());
return LEGACY_SERIALIZER_BUNGEE_FRIENDLY.serialize(getAdv());
}
/**
* Converts the builded component into plain text.
* Converts the built component into plain text.
* @return the plain text of this component.
*/
public String getPlainText() {
@@ -104,16 +105,16 @@ public abstract sealed class Chat extends ChatStatic implements HoverEventSource
}
@Override
public HoverEvent<Component> asHoverEvent(UnaryOperator<Component> op) {
public @NotNull HoverEvent<Component> asHoverEvent(@NotNull UnaryOperator<Component> op) {
return HoverEvent.showText(op.apply(getAdv()));
}
/**
* Builds the component into Adventure Component instance.
* @return the {@link Component} builded from this {@link Chat} component.
* @return the {@link Component} built from this {@link Chat} component.
*/
@Override
public Component asComponent() {
public @NotNull Component asComponent() {
return getAdv();
}
@@ -284,8 +285,8 @@ public abstract sealed class Chat extends ChatStatic implements HoverEventSource
public Chat thenTranslation(String key, Object... with) { return then(translation(key, with)); }
/**
* Appends a component with the provided keybind.
* @param key the keybind to display.
* Appends a component with the provided keybinding.
* @param key the keybinding to display.
* @return this.
*/
public Chat thenKeyBind(String key) { return then(keybind(key)); }
@@ -443,19 +444,19 @@ public abstract sealed class Chat extends ChatStatic implements HoverEventSource
/**
* Appends a component filling a line of chat (or console) with the configured decoration character and
* Appends a component filling a chat line with the configured decoration character and
* color and a left-aligned text.
* @param leftText the text aligned to the left.
* @return a new {@link FormatableChat} filling a line of chat (or console) with the configured decoration character
* @return a new {@link FormatableChat} filling a chat line with the configured decoration character
* and color and a left-aligned text.
*/
public Chat thenLeftText(ComponentLike leftText) { return then(leftText(leftText, console)); }
/**
* Appends a component filling a line of chat (or console) with the configured decoration character and
* Appends a component filling a chat line with the configured decoration character and
* color and a left-aligned text.
* @param leftText the text aligned to the left.
* @return a new {@link FormatableChat} filling a line of chat (or console) with the configured decoration character
* @return a new {@link FormatableChat} filling a chat line with the configured decoration character
* and color and a left-aligned text.
* @deprecated uses Bungeecord chat API.
*/
@@ -463,19 +464,19 @@ public abstract sealed class Chat extends ChatStatic implements HoverEventSource
public Chat thenLeftText(BaseComponent leftText) { return thenLeftText(chatComponent(leftText)); }
/**
* Appends a component filling a line of chat (or console) with the configured decoration character and
* Appends a component filling a chat line with the configured decoration character and
* color and a right-aligned text.
* @param rightText the text aligned to the right.
* @return a new {@link FormatableChat} filling a line of chat (or console) with the configured decoration character
* @return a new {@link FormatableChat} filling a chat line with the configured decoration character
* and color and a right-aligned text.
*/
public Chat thenRightText(ComponentLike rightText) { return then(rightText(rightText, console)); }
/**
* Appends a component filling a line of chat (or console) with the configured decoration character and
* Appends a component filling a chat line with the configured decoration character and
* color and a right-aligned text.
* @param rightText the text aligned to the right.
* @return a new {@link FormatableChat} filling a line of chat (or console) with the configured decoration character
* @return a new {@link FormatableChat} filling a chat line with the configured decoration character
* and color and a right-aligned text.
* @deprecated uses Bungeecord chat API.
*/
@@ -483,10 +484,10 @@ public abstract sealed class Chat extends ChatStatic implements HoverEventSource
public Chat thenRightText(BaseComponent rightText) { return thenRightText(chatComponent(rightText)); }
/**
* Appends a component filling a line of chat (or console) with the configured decoration character and
* Appends a component filling a chat line with the configured decoration character and
* color and a centered text.
* @param centerText the text aligned to the center.
* @return a new {@link FormatableChat} filling a line of chat (or console) with the configured decoration character
* @return a new {@link FormatableChat} filling a chat line with the configured decoration character
* and color and a centered text.
*/
public Chat thenCenterText(ComponentLike centerText) {
@@ -494,10 +495,10 @@ public abstract sealed class Chat extends ChatStatic implements HoverEventSource
}
/**
* Appends a component filling a line of chat (or console) with the configured decoration character and
* Appends a component filling a chat line with the configured decoration character and
* color and a centered text.
* @param centerText the text aligned to the center.
* @return a new {@link FormatableChat} filling a line of chat (or console) with the configured decoration character
* @return a new {@link FormatableChat} filling a chat line with the configured decoration character
* and color and a centered text.
* @deprecated uses Bungeecord chat API.
*/
@@ -507,8 +508,8 @@ public abstract sealed class Chat extends ChatStatic implements HoverEventSource
}
/**
* Appends a component filling a line of chat (or console) with the configured decoration character and color.
* @return a new {@link FormatableChat} filling a line of chat (or console) with a decoration character and color.
* Appends a component filling a chat line with the configured decoration character and color.
* @return a new {@link FormatableChat} filling a chat line with a decoration character and color.
*/
public Chat thenFilledLine() { return then(filledLine(console)); }
@@ -534,11 +535,11 @@ public abstract sealed class Chat extends ChatStatic implements HoverEventSource
* .append("!").color(ChatColor.RED)
* .create();
* }</pre>
* Here, when you call a formating method (like {@code bold(boolean)} or {@code color(ChatColor)}) after the
* {@code append(String)} method, the formating apply to the last sub-component appended.
* Here, when you call a formatting method (like {@code bold(boolean)} or {@code color(ChatColor)}) after the
* {@code append(String)} method, the formatting apply to the last subcomponent appended.
* <p>
* In our design, we want the formating to apply to the currently builded component, not the last appended one.
* The purpose is to make the component structure clearer and have better control of the formating over the
* In our design, we want the formatting to apply to the currently built component, not the last appended one.
* The purpose is to make the component structure clearer and have better control of the formatting over the
* component hierarchy.
* Here is the equivalent of the above code, with the {@link Chat} API:
* <pre>{@code
@@ -547,9 +548,9 @@ public abstract sealed class Chat extends ChatStatic implements HoverEventSource
* .thenText("!"); // short for .then(Chat.text("!"))
* // the red color for "!" is not needed because the parent component is already red.
* }</pre>
* When calling {@link #then(Component) #then(...)} on a {@link FormatableChat}, the method returns itself, casted
* to {@link Chat}, to prevent future formating (that the programmer would think it formats the previously appended
* sub-component). If the formatting of the currently builded component is needed, since {@link Chat} is a sealed
* When calling {@link #then(Component) #then(...)} on a {@link FormatableChat}, the method returns itself, cast
* to {@link Chat}, to prevent future formatting (that the programmer would think it formats the previously appended
* subcomponent). If the formatting of the currently built component is needed, since {@link Chat} is a sealed
* class which only subclass is {@link FormatableChat}, you can cast the builder, and use the format methods again.
* <pre>{@code
* Chat component = Chat.text("Hello ").red()
@@ -986,7 +987,7 @@ public abstract sealed class Chat extends ChatStatic implements HoverEventSource
}
/**
* Force the italic formating to be set to false if it is not explicitely set in the component.
* Force the italic formatting to be set to false if it is not explicitly set in the component.
* This is useful for item lores that defaults to italic in the game UI.
* @param c the {@link Chat} in which to set the italic property if needed.
* @return the provided {@link Chat} instance.

View File

@@ -6,7 +6,7 @@ import java.util.List;
import net.kyori.adventure.text.format.TextColor;
/**
* A custom gradient with a least 2 colors in it.
* A custom gradient with at least 2 colors in it.
*/
public class ChatColorGradient {
private record GradientColor(float location, TextColor color) { }

View File

@@ -14,7 +14,7 @@ public class ChatColorUtil {
/**
* All characters that represent a colorcode.
* All characters that represent a color code.
*/
public static final String ALL_COLORS = "0123456789AaBbCcDdEeFf";
/**
@@ -30,7 +30,7 @@ public class ChatColorUtil {
* Returns the legacy format needed to reproduce the format at the end of the provided legacy text.
* Supports standard chat colors and formats, BungeeCord Chat rgb format and EssentialsX rgb format.
* The RGB value from EssentialsX format is converted to BungeeCord Chat when included in the returned value.
* @param legacyText the legacy formated text.
* @param legacyText the legacy formatted text.
* @return the active format at the end of the provided text.
*/
public static String getLastColors(String legacyText) {
@@ -84,8 +84,8 @@ public class ChatColorUtil {
}
/**
* Returns the {@link ChatColor} associated with the provided char, case insensitive.
* @param code the case insensitive char code.
* Returns the {@link ChatColor} associated with the provided char, case-insensitive.
* @param code the case-insensitive char code.
* @return the corresponding {@link ChatColor}.
*/
public static ChatColor getChatColorByChar(char code) {

View File

@@ -8,6 +8,7 @@ import net.kyori.adventure.text.format.TextColor;
/**
* Class holding static configuration values for chat component rendering.
*/
@SuppressWarnings("CanBeFinal")
public class ChatConfig {
/**
@@ -29,7 +30,7 @@ public class ChatConfig {
/**
* The color used for successful messages.
*/
public static TextColor successColor = PandaTheme.CHAT_GREEN_SATMAX;
public static TextColor successColor = PandaTheme.CHAT_GREEN_MAX_SAT;
/**
* The color used for error/failure messages.
@@ -67,14 +68,14 @@ public class ChatConfig {
public static TextColor highlightedCommandColor = NamedTextColor.WHITE;
/**
* The color used for broadcasted messages.
* The color used for broadcast messages.
* It is often used in combination with {@link #prefix}.
*/
public static TextColor broadcastColor = NamedTextColor.YELLOW;
/**
* The prefix used for prefixed messages.
* It can be a sylized name of the server, like {@code "[Pandacube] "}.
* It can be a stylized name of the server, like {@code "[Pandacube] "}.
* It is often used in combination with {@link #broadcastColor}.
*/
public static Supplier<Chat> prefix = PandaTheme::CHAT_MESSAGE_PREFIX;
@@ -104,7 +105,7 @@ public class ChatConfig {
public static final TextColor CHAT_GREEN_4 = TextColor.fromHexString("#abe3b0"); // h=126 s=50 l=78
/** Green max saturation color. */
public static final TextColor CHAT_GREEN_SATMAX = TextColor.fromHexString("#00ff19"); // h=126 s=100 l=50
public static final TextColor CHAT_GREEN_MAX_SAT = TextColor.fromHexString("#00ff19"); // h=126 s=100 l=50
/** Green 1 saturated color. */
public static final TextColor CHAT_GREEN_1_SAT = TextColor.fromHexString("#20d532"); // h=126 s=50 l=48
/** Green 2 saturated color. */

View File

@@ -140,7 +140,7 @@ public class ChatFilledLine implements ComponentLike {
/**
* Renders this line to a {@link FormatableChat}.
* @return a new {@link FormatableChat} builded by this {@link ChatFilledLine}.
* @return a new {@link FormatableChat} built by this {@link ChatFilledLine}.
*/
public FormatableChat toChat() {
int maxWidth = (this.maxWidth != null)

View File

@@ -227,9 +227,9 @@ public abstract class ChatStatic {
}
/**
* Creates a {@link FormatableChat} with the provided keybind.
* @param key the keybind to display.
* @return a new {@link FormatableChat} with the provided keybind.
* Creates a {@link FormatableChat} with the provided keybinding.
* @param key the keybinding to display.
* @return a new {@link FormatableChat} with the provided keybinding.
*/
public static FormatableChat keybind(String key) {
return new FormatableChat(Component.keybind().keybind(key));
@@ -451,12 +451,12 @@ public abstract class ChatStatic {
/**
* Creates a {@link FormatableChat} filling a line of chat (or console) with decoration and a left-aligned text.
* Creates a {@link FormatableChat} filling a chat line with decoration and a left-aligned text.
* @param text the text aligned to the left.
* @param decorationChar the character used for decoration around the text.
* @param decorationColor the color used for the decoration characters.
* @param console if the line is rendered on console (true) or IG (false).
* @return a new {@link FormatableChat} filling a line of chat (or console) with decoration and a left-aligned text.
* @return a new {@link FormatableChat} filling a chat line with decoration and a left-aligned text.
* @see ChatFilledLine#leftText(ComponentLike)
*/
public static FormatableChat leftText(ComponentLike text, char decorationChar, TextColor decorationColor, boolean console) {
@@ -464,11 +464,11 @@ public abstract class ChatStatic {
}
/**
* Creates a {@link FormatableChat} filling a line of chat (or console) with the configured decoration character and
* Creates a {@link FormatableChat} filling a chat line with the configured decoration character and
* color and a left-aligned text.
* @param text the text aligned to the left.
* @param console if the line is rendered on console (true) or IG (false).
* @return a new {@link FormatableChat} filling a line of chat (or console) with the configured decoration character
* @return a new {@link FormatableChat} filling a chat line with the configured decoration character
* and color and a left-aligned text.
* @see ChatFilledLine#leftText(ComponentLike)
* @see ChatConfig#decorationChar
@@ -479,12 +479,12 @@ public abstract class ChatStatic {
}
/**
* Creates a {@link FormatableChat} filling a line of chat (or console) with decoration and a right-aligned text.
* Creates a {@link FormatableChat} filling a chat line with decoration and a right-aligned text.
* @param text the text aligned to the right.
* @param decorationChar the character used for decoration around the text.
* @param decorationColor the color used for the decoration characters.
* @param console if the line is rendered on console (true) or IG (false).
* @return a new {@link FormatableChat} filling a line of chat (or console) with decoration and a right-aligned
* @return a new {@link FormatableChat} filling a chat line with decoration and a right-aligned
* text.
* @see ChatFilledLine#rightText(ComponentLike)
*/
@@ -493,11 +493,11 @@ public abstract class ChatStatic {
}
/**
* Creates a {@link FormatableChat} filling a line of chat (or console) with the configured decoration character and
* Creates a {@link FormatableChat} filling a chat line with the configured decoration character and
* color and a right-aligned text.
* @param text the text aligned to the right.
* @param console if the line is rendered on console (true) or IG (false).
* @return a new {@link FormatableChat} filling a line of chat (or console) with the configured decoration character
* @return a new {@link FormatableChat} filling a chat line with the configured decoration character
* and color and a right-aligned text.
* @see ChatFilledLine#rightText(ComponentLike)
* @see ChatConfig#decorationChar
@@ -508,12 +508,12 @@ public abstract class ChatStatic {
}
/**
* Creates a {@link FormatableChat} filling a line of chat (or console) with decoration and a centered text.
* Creates a {@link FormatableChat} filling a chat line with decoration and a centered text.
* @param text the text aligned to the center.
* @param decorationChar the character used for decoration around the text.
* @param decorationColor the color used for the decoration characters.
* @param console if the line is rendered on console (true) or IG (false).
* @return a new {@link FormatableChat} filling a line of chat (or console) with decoration and a centered text.
* @return a new {@link FormatableChat} filling a chat line with decoration and a centered text.
* @see ChatFilledLine#centerText(ComponentLike)
*/
public static FormatableChat centerText(ComponentLike text, char decorationChar, TextColor decorationColor, boolean console) {
@@ -521,11 +521,11 @@ public abstract class ChatStatic {
}
/**
* Creates a {@link FormatableChat} filling a line of chat (or console) with the configured decoration character and
* Creates a {@link FormatableChat} filling a chat line with the configured decoration character and
* color and a centered text.
* @param text the text aligned to the center.
* @param console if the line is rendered on console (true) or IG (false).
* @return a new {@link FormatableChat} filling a line of chat (or console) with the configured decoration character
* @return a new {@link FormatableChat} filling a chat line with the configured decoration character
* and color and a centered text.
* @see ChatFilledLine#centerText(ComponentLike)
* @see ChatConfig#decorationChar
@@ -536,11 +536,11 @@ public abstract class ChatStatic {
}
/**
* Creates a {@link FormatableChat} filling a line of chat (or console) with a decoration character and color.
* Creates a {@link FormatableChat} filling a chat line with a decoration character and color.
* @param decorationChar the character used for decoration.
* @param decorationColor the color used for the decoration characters.
* @param console if the line is rendered on console (true) or IG (false).
* @return a new {@link FormatableChat} filling a line of chat (or console) with a decoration character and color.
* @return a new {@link FormatableChat} filling a chat line with a decoration character and color.
* @see ChatFilledLine#filled()
*/
public static FormatableChat filledLine(char decorationChar, TextColor decorationColor, boolean console) {
@@ -548,10 +548,10 @@ public abstract class ChatStatic {
}
/**
* Creates a {@link FormatableChat} filling a line of chat (or console) with the configured decoration character and
* Creates a {@link FormatableChat} filling a chat line with the configured decoration character and
* color.
* @param console if the line is rendered on console (true) or IG (false).
* @return a new {@link FormatableChat} filling a line of chat (or console) with a decoration character and color.
* @return a new {@link FormatableChat} filling a chat line with a decoration character and color.
* @see ChatFilledLine#filled()
* @see ChatConfig#decorationChar
* @see ChatConfig#decorationColor
@@ -633,7 +633,7 @@ public abstract class ChatStatic {
.storage(((StorageNBTComponent) c).storage());
}
else {
throw new IllegalArgumentException("Unknows component type " + c.getClass());
throw new IllegalArgumentException("Unknown component type " + c.getClass());
}
return builder.style(c.style()).append(c.children());
}

View File

@@ -27,7 +27,7 @@ public class ChatTreeNode {
public final List<ChatTreeNode> children = new ArrayList<>();
/**
* Construct an new {@link ChatTreeNode}.
* Construct a new {@link ChatTreeNode}.
* @param cmp the component for the current node.
*/
public ChatTreeNode(Chat cmp) {
@@ -48,7 +48,7 @@ public class ChatTreeNode {
* Generate a tree view based on this tree structure.
* <p>
* Each element in the returned list represent 1 line of this tree view.
* Thus, the caller may send each line separately or at once depending of the quantity of data.
* Thus, the caller may send each line separately or at once, depending on the quantity of data.
* @param console true to render for console, false otherwise.
* @return an array of component, each element being a single line.
*/

View File

@@ -22,7 +22,7 @@ import net.md_5.bungee.api.ChatColor;
import fr.pandacube.lib.chat.Chat.FormatableChat;
/**
* Provides various methods and properties to manipulate text displayed in chat an other parts of the game.
* Provides various methods and properties to manipulate text displayed in chat and other parts of the game.
*/
public class ChatUtil {
@@ -48,7 +48,7 @@ public class ChatUtil {
/**
* Mapping indicating the text pixel with for specific characters in the default Minecraft font.
* If a character doesnt have a mapping in this map, then its width is {@link #DEFAULT_CHAR_SIZE}.
* If a character doesn't have a mapping in this map, then its width is {@link #DEFAULT_CHAR_SIZE}.
*/
public static final Map<Character, Integer> CHAR_SIZES;
static {
@@ -112,7 +112,7 @@ public class ChatUtil {
* @param nbPages the number of pages.
* @param nbPagesToDisplay the number of pages to display around the first page, the last page and the
* {@code currentPage}.
* @return a {@link Chat} containging the created page navigator.
* @return a {@link Chat} containing the created page navigator.
*/
public static Chat createPagination(String prefix, String cmdFormat, int currentPage, int nbPages, int nbPagesToDisplay) {
Set<Integer> pagesToDisplay = new TreeSet<>();
@@ -149,11 +149,11 @@ public class ChatUtil {
else
first = false;
FormatableChat pDisp = Chat.clickableCommand(Chat.text(page), String.format(cmdFormat, page), Chat.text("Aller à la page " + page));
FormatableChat pDisplay = Chat.clickableCommand(Chat.text(page), String.format(cmdFormat, page), Chat.text("Aller à la page " + page));
if (page == currentPage) {
pDisp.highlightedCommandColor();
pDisplay.highlightedCommandColor();
}
d.then(pDisp);
d.then(pDisplay);
previous = page;
}
@@ -258,7 +258,7 @@ public class ChatUtil {
/**
* Wraps the provided text in multiple lines, taking into account the legacy formating.
* Wraps the provided text in multiple lines, taking into account the legacy formatting.
* <p>
* This method only takes into account IG text width. Use a regular text-wrapper for console instead.
* @param legacyText the text to wrap.
@@ -272,7 +272,7 @@ public class ChatUtil {
}
/**
* Wraps the provided text in multiple lines, taking into account the legacy formating.
* Wraps the provided text in multiple lines, taking into account the legacy formatting.
* <p>
* This method only takes into account IG text width. Use a regular text-wrapper for console instead.
* @param legacyText the text to wrap.
@@ -369,7 +369,7 @@ public class ChatUtil {
/**
* Try to render a matrix of {@link Chat} components into a table in the chat or console.
* @param data the component, in the form of {@link List} of {@link List} of {@link Chat}. The englobing list holds
* @param data the component, in the form of {@link List} of {@link List} of {@link Chat}. The parent list holds
* the table lines (line 0 being the top line). Each sublist holds the cells content (element 0 is the
* leftText one). The row lengths can be different.
* @param space a spacer to put between columns.
@@ -392,7 +392,7 @@ public class ChatUtil {
/**
* Try to render a matrix of {@link Component} components into a table in the chat or console.
* @param data the component, in the form of {@link List} of {@link List} of {@link Component}. The englobing list holds
* @param data the component, in the form of {@link List} of {@link List} of {@link Component}. The parent list holds
* the table lines (line 0 being the top line). Each sublist holds the cells content (element 0 is the
* leftText one). The row lengths can be different.
* @param space a spacer to put between columns.
@@ -505,9 +505,9 @@ public class ChatUtil {
private static final char PROGRESS_BAR_FULL_CHAR = '|';
/**
* Generate a (eventually multi-part) progress bar using text.
* Generate a (eventually multipart) progress bar using text.
* @param values the values to render in the progress bar.
* @param colors the colors attributed to each values.
* @param colors the colors attributed to each value.
* @param total the total value of the progress bar.
* @param width the width in which the progress bar should fit (in pixel for IG, in character count for console)
* @param console true if the progress bar is intended to be displayed on the console, false if its in game chat.