From b374a69b2c05c73b00727d6b385ed4889be77164 Mon Sep 17 00:00:00 2001 From: Brokkonaut Date: Wed, 20 Jul 2016 23:53:03 +0200 Subject: [PATCH] Do not change ComponentBuilder's contents when calling create() This allows continuing to use ComponentBuilder after create() has been called. --- .../main/java/net/md_5/bungee/api/chat/ComponentBuilder.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/chat/src/main/java/net/md_5/bungee/api/chat/ComponentBuilder.java b/chat/src/main/java/net/md_5/bungee/api/chat/ComponentBuilder.java index 5769dc32..4aa2d706 100644 --- a/chat/src/main/java/net/md_5/bungee/api/chat/ComponentBuilder.java +++ b/chat/src/main/java/net/md_5/bungee/api/chat/ComponentBuilder.java @@ -242,8 +242,9 @@ public class ComponentBuilder */ public BaseComponent[] create() { - parts.add( current ); - return parts.toArray( new BaseComponent[ parts.size() ] ); + BaseComponent[] result = parts.toArray( new BaseComponent[ parts.size() + 1 ] ); + result[parts.size()] = current; + return result; } public static enum FormatRetention