Multiple ComponentBuilders in a BaseComponent?

Discussion in 'BungeeCord Plugin Development' started by inventor02, May 22, 2016.

  1. I was wondering if you could combine multiple ComponentBuilders in a BaseComponent, like this (obviously this does not work):
    Code (Text):
    ComponentBuilder message1 = new ComponentBuilder("First message ").color(ChatColor.GREEN);
    ComponentBuilder message2 = new ComponentBuilder("and the second one.").color(ChatColor.AQUA).italic(true);

    proxiedPlayer.sendMessage(message1.create() + message2.create());
    I know there is a deprecated way of doing this but I prefer to use the BaseComponent method. Your help is appreciated, thanks!
  2. Interesting. Since the ComponentBuilders are actually in JSON format, I don't even know if this is possible, especially with the different colors. I don't know much about JSON so if anyone knows how to do this, surprise us :)
  3. Why not use textcomponent
  4. Indeed, indeed.

    Code (Text):
    proxiedPlayer.sendMessage(fromMsg.create(), toMsg.create());
    I tried that because sendMessage() does accept BaseComponent..., however a ComponentBuilder's create() method returns a BaseComponent array, not a single BaseComponent.
  5. That would work, but I was wondering if there was infact a way to use ComponentBuilders, as they just look cleaner and IMO are easier to work with.