mirror of
https://github.com/SpigotMC/BungeeCord.git
synced 2024-12-24 17:47:41 +01:00
#2396: Add way to select reset color when parsing legacy chat
This commit is contained in:
parent
7241eb37c9
commit
dce4ea193a
@ -28,6 +28,21 @@ public final class TextComponent extends BaseComponent
|
||||
* @return the components needed to print the message to the client
|
||||
*/
|
||||
public static BaseComponent[] fromLegacyText(String message)
|
||||
{
|
||||
return fromLegacyText( message, ChatColor.WHITE );
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the old formatting system that used
|
||||
* {@link net.md_5.bungee.api.ChatColor#COLOR_CHAR} into the new json based
|
||||
* system.
|
||||
*
|
||||
* @param message the text to convert
|
||||
* @param defaultColor color to use when no formatting is to be applied
|
||||
* (i.e. after ChatColor.RESET).
|
||||
* @return the components needed to print the message to the client
|
||||
*/
|
||||
public static BaseComponent[] fromLegacyText(String message, ChatColor defaultColor)
|
||||
{
|
||||
ArrayList<BaseComponent> components = new ArrayList<BaseComponent>();
|
||||
StringBuilder builder = new StringBuilder();
|
||||
@ -79,7 +94,7 @@ public final class TextComponent extends BaseComponent
|
||||
component.setObfuscated( true );
|
||||
break;
|
||||
case RESET:
|
||||
format = ChatColor.WHITE;
|
||||
format = defaultColor;
|
||||
default:
|
||||
component = new TextComponent();
|
||||
component.setColor( format );
|
||||
|
Loading…
Reference in New Issue
Block a user