mirror of
https://github.com/SpigotMC/BungeeCord.git
synced 2024-11-27 12:46:05 +01:00
Manually wrap serialized components in an extra text component to work around a 1.9 change (Fixes #1770)
This commit is contained in:
parent
b6671cd00c
commit
fc64a6c2ff
@ -39,12 +39,17 @@ public class ComponentSerializer implements JsonDeserializer<BaseComponent>
|
||||
|
||||
public static String toString(BaseComponent component)
|
||||
{
|
||||
return gson.toJson( component );
|
||||
// 1.9 Requires the first component to not be a plain string which can
|
||||
// happen if a text component has no formatting. This optimization is
|
||||
// still useful when nested more so we just manually wrap everything in
|
||||
// an extra text component.
|
||||
return "{\"text\":\"\", \"extra\": [" + gson.toJson( component ) + "]}";
|
||||
}
|
||||
|
||||
public static String toString(BaseComponent... components)
|
||||
{
|
||||
return gson.toJson( new TextComponent( components ) );
|
||||
// See above
|
||||
return "{\"text\":\"\", \"extra\": [" + gson.toJson( new TextComponent( components ) ) + "]}";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user