#2750: Don't special case TextComponent constructor with a single extra

This commit is contained in:
BlackHole 2020-01-14 19:30:07 +01:00 committed by md_5
parent b70cb01413
commit b7e7274b98

View File

@ -173,27 +173,13 @@ public final class TextComponent extends BaseComponent
*/
public TextComponent(BaseComponent... extras)
{
this();
if ( extras.length == 0 )
{
return;
}
if ( extras.length == 1 && extras[0] instanceof TextComponent )
{
setText( ( (TextComponent) extras[0] ).getText() );
List<BaseComponent> headExtra = extras[0].getExtra();
if ( headExtra != null )
{
for ( BaseComponent extra : headExtra )
{
addExtra( extra.duplicate() );
}
}
} else
{
setText( "" );
setExtra( new ArrayList<BaseComponent>( Arrays.asList( extras ) ) );
}
}
/**
* Creates a duplicate of this TextComponent.