Allow appending BaseComponent arrays in ComponentBuilder
This commit is contained in:
@@ -13,6 +13,23 @@ import org.junit.Test;
|
||||
public class ComponentsTest
|
||||
{
|
||||
|
||||
@Test
|
||||
public void testBuilderAppend()
|
||||
{
|
||||
ClickEvent clickEvent = new ClickEvent( ClickEvent.Action.RUN_COMMAND, "/help " );
|
||||
HoverEvent hoverEvent = new HoverEvent( HoverEvent.Action.SHOW_TEXT, new ComponentBuilder( "Hello world" ).create() );
|
||||
|
||||
ComponentBuilder builder = new ComponentBuilder( "Hello " ).color( ChatColor.YELLOW );
|
||||
builder.append( new ComponentBuilder( "world!" ).color( ChatColor.GREEN ).event( hoverEvent ).event( clickEvent ).create() );
|
||||
|
||||
BaseComponent[] components = builder.create();
|
||||
|
||||
Assert.assertEquals( components[1].getHoverEvent(), hoverEvent );
|
||||
Assert.assertEquals( components[1].getClickEvent(), clickEvent );
|
||||
Assert.assertEquals( "Hello world!", BaseComponent.toPlainText( components ) );
|
||||
Assert.assertEquals( ChatColor.YELLOW + "Hello " + ChatColor.GREEN + "world!", BaseComponent.toLegacyText( components ) );
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBasicComponent()
|
||||
{
|
||||
|
Reference in New Issue
Block a user