diff --git a/chat/src/main/java/net/md_5/bungee/api/chat/TranslatableComponent.java b/chat/src/main/java/net/md_5/bungee/api/chat/TranslatableComponent.java index 53ee9b0da..16e8d2a46 100644 --- a/chat/src/main/java/net/md_5/bungee/api/chat/TranslatableComponent.java +++ b/chat/src/main/java/net/md_5/bungee/api/chat/TranslatableComponent.java @@ -71,12 +71,12 @@ public final class TranslatableComponent extends BaseComponent List temp = new ArrayList(); for ( Object w : with ) { - if ( w instanceof String ) - { - temp.add( new TextComponent( (String) w ) ); - } else + if ( w instanceof BaseComponent ) { temp.add( (BaseComponent) w ); + } else + { + temp.add( new TextComponent( String.valueOf( w ) ) ); } } setWith( temp ); diff --git a/chat/src/test/java/net/md_5/bungee/api/chat/TranslatableComponentTest.java b/chat/src/test/java/net/md_5/bungee/api/chat/TranslatableComponentTest.java index 0837c6729..2391c22f7 100644 --- a/chat/src/test/java/net/md_5/bungee/api/chat/TranslatableComponentTest.java +++ b/chat/src/test/java/net/md_5/bungee/api/chat/TranslatableComponentTest.java @@ -9,7 +9,7 @@ public class TranslatableComponentTest @Test public void testMissingPlaceholdersAdded() { - TranslatableComponent testComponent = new TranslatableComponent( "Test string with %s placeholders: %s", "2", "aoeu" ); + TranslatableComponent testComponent = new TranslatableComponent( "Test string with %s placeholders: %s", 2, "aoeu" ); assertEquals( "Test string with 2 placeholders: aoeu", testComponent.toPlainText() ); assertEquals( "§fTest string with §f2§f placeholders: §faoeu", testComponent.toLegacyText() ); }