diff --git a/api/pom.xml b/api/pom.xml index cb49a4430b..aff963d3d2 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -6,13 +6,13 @@ net.md-5 bungeecord-parent - 1.16-R0.4-SNAPSHOT + 1.16-R0.5-SNAPSHOT ../pom.xml net.md-5 bungeecord-api - 1.16-R0.4-SNAPSHOT + 1.16-R0.5-SNAPSHOT jar BungeeCord-API diff --git a/bootstrap/pom.xml b/bootstrap/pom.xml index c10e5d503d..092b6a76b8 100644 --- a/bootstrap/pom.xml +++ b/bootstrap/pom.xml @@ -6,13 +6,13 @@ net.md-5 bungeecord-parent - 1.16-R0.4-SNAPSHOT + 1.16-R0.5-SNAPSHOT ../pom.xml net.md-5 bungeecord-bootstrap - 1.16-R0.4-SNAPSHOT + 1.16-R0.5-SNAPSHOT jar BungeeCord-Bootstrap diff --git a/chat/pom.xml b/chat/pom.xml index 8dcde4f29f..d7aca2adc2 100644 --- a/chat/pom.xml +++ b/chat/pom.xml @@ -6,13 +6,13 @@ net.md-5 bungeecord-parent - 1.16-R0.4-SNAPSHOT + 1.16-R0.5-SNAPSHOT ../pom.xml net.md-5 bungeecord-chat - 1.16-R0.4-SNAPSHOT + 1.16-R0.5-SNAPSHOT jar BungeeCord-Chat diff --git a/chat/src/main/java/net/md_5/bungee/chat/BaseComponentSerializer.java b/chat/src/main/java/net/md_5/bungee/chat/BaseComponentSerializer.java index ae69b231bf..fc9739a80a 100644 --- a/chat/src/main/java/net/md_5/bungee/chat/BaseComponentSerializer.java +++ b/chat/src/main/java/net/md_5/bungee/chat/BaseComponentSerializer.java @@ -22,14 +22,6 @@ public class BaseComponentSerializer protected void deserialize(JsonObject object, BaseComponent component, JsonDeserializationContext context) { - if ( object.has( "color" ) ) - { - component.setColor( ChatColor.of( object.get( "color" ).getAsString() ) ); - } - if ( object.has( "font" ) ) - { - component.setFont( object.get( "font" ).getAsString() ); - } if ( object.has( "bold" ) ) { component.setBold( object.get( "bold" ).getAsBoolean() ); @@ -50,13 +42,13 @@ protected void deserialize(JsonObject object, BaseComponent component, JsonDeser { component.setObfuscated( object.get( "obfuscated" ).getAsBoolean() ); } - if ( object.has( "insertion" ) ) + if ( object.has( "color" ) ) { - component.setInsertion( object.get( "insertion" ).getAsString() ); + component.setColor( ChatColor.of( object.get( "color" ).getAsString() ) ); } - if ( object.has( "extra" ) ) + if ( object.has( "insertion" ) ) { - component.setExtra( Arrays.asList( context.deserialize( object.get( "extra" ), BaseComponent[].class ) ) ); + component.setInsertion( object.get( "insertion" ).getAsString() ); } //Events @@ -121,6 +113,15 @@ protected void deserialize(JsonObject object, BaseComponent component, JsonDeser component.setHoverEvent( hoverEvent ); } } + + if ( object.has( "font" ) ) + { + component.setFont( object.get( "font" ).getAsString() ); + } + if ( object.has( "extra" ) ) + { + component.setExtra( Arrays.asList( context.deserialize( object.get( "extra" ), BaseComponent[].class ) ) ); + } } protected void serialize(JsonObject object, BaseComponent component, JsonSerializationContext context) @@ -135,14 +136,6 @@ protected void serialize(JsonObject object, BaseComponent component, JsonSeriali { Preconditions.checkArgument( !ComponentSerializer.serializedComponents.get().contains( component ), "Component loop" ); ComponentSerializer.serializedComponents.get().add( component ); - if ( component.getColorRaw() != null ) - { - object.addProperty( "color", component.getColorRaw().getName() ); - } - if ( component.getFontRaw() != null ) - { - object.addProperty( "font", component.getFontRaw() ); - } if ( component.isBoldRaw() != null ) { object.addProperty( "bold", component.isBoldRaw() ); @@ -163,14 +156,13 @@ protected void serialize(JsonObject object, BaseComponent component, JsonSeriali { object.addProperty( "obfuscated", component.isObfuscatedRaw() ); } - if ( component.getInsertion() != null ) + if ( component.getColorRaw() != null ) { - object.addProperty( "insertion", component.getInsertion() ); + object.addProperty( "color", component.getColorRaw().getName() ); } - - if ( component.getExtra() != null ) + if ( component.getInsertion() != null ) { - object.add( "extra", context.serialize( component.getExtra() ) ); + object.addProperty( "insertion", component.getInsertion() ); } //Events @@ -195,6 +187,15 @@ protected void serialize(JsonObject object, BaseComponent component, JsonSeriali } object.add( "hoverEvent", hoverEvent ); } + + if ( component.getFontRaw() != null ) + { + object.addProperty( "font", component.getFontRaw() ); + } + if ( component.getExtra() != null ) + { + object.add( "extra", context.serialize( component.getExtra() ) ); + } } finally { ComponentSerializer.serializedComponents.get().remove( component ); diff --git a/chat/src/main/java/net/md_5/bungee/chat/TextComponentSerializer.java b/chat/src/main/java/net/md_5/bungee/chat/TextComponentSerializer.java index a9347fe0bb..8a7e98195e 100644 --- a/chat/src/main/java/net/md_5/bungee/chat/TextComponentSerializer.java +++ b/chat/src/main/java/net/md_5/bungee/chat/TextComponentSerializer.java @@ -8,8 +8,6 @@ import com.google.gson.JsonSerializationContext; import com.google.gson.JsonSerializer; import java.lang.reflect.Type; -import java.util.List; -import net.md_5.bungee.api.chat.BaseComponent; import net.md_5.bungee.api.chat.TextComponent; public class TextComponentSerializer extends BaseComponentSerializer implements JsonSerializer, JsonDeserializer @@ -32,13 +30,9 @@ public TextComponent deserialize(JsonElement json, Type typeOfT, JsonDeserializa @Override public JsonElement serialize(TextComponent src, Type typeOfSrc, JsonSerializationContext context) { - List extra = src.getExtra(); JsonObject object = new JsonObject(); + serialize( object, src, context ); object.addProperty( "text", src.getText() ); - if ( src.hasFormatting() || ( extra != null && !extra.isEmpty() ) ) - { - serialize( object, src, context ); - } return object; } } diff --git a/chat/src/test/java/net/md_5/bungee/api/chat/ComponentsTest.java b/chat/src/test/java/net/md_5/bungee/api/chat/ComponentsTest.java index 23fa3024c3..20c62f1d51 100644 --- a/chat/src/test/java/net/md_5/bungee/api/chat/ComponentsTest.java +++ b/chat/src/test/java/net/md_5/bungee/api/chat/ComponentsTest.java @@ -41,7 +41,7 @@ public void testItemParse() { textComponent } ); - json = "{\"text\":\"Test\",\"hoverEvent\":{\"action\":\"show_item\",\"value\":[{\"text\":\"{id:\\\"minecraft:netherrack\\\",Count:47b}\"}]}}"; + json = "{\"hoverEvent\":{\"action\":\"show_item\",\"value\":[{\"text\":\"{id:\\\"minecraft:netherrack\\\",Count:47b}\"}]},\"text\":\"Test\"}"; testDissembleReassemble( json ); ////////// String hoverVal = "{\"text\":\"{id:\\\"minecraft:dirt\\\",Count:1b}\"}"; diff --git a/config/pom.xml b/config/pom.xml index 8a857dfdbb..298a80ef0b 100644 --- a/config/pom.xml +++ b/config/pom.xml @@ -6,13 +6,13 @@ net.md-5 bungeecord-parent - 1.16-R0.4-SNAPSHOT + 1.16-R0.5-SNAPSHOT ../pom.xml net.md-5 bungeecord-config - 1.16-R0.4-SNAPSHOT + 1.16-R0.5-SNAPSHOT jar BungeeCord-Config diff --git a/event/pom.xml b/event/pom.xml index a705f1a669..6c26e547b4 100644 --- a/event/pom.xml +++ b/event/pom.xml @@ -6,13 +6,13 @@ net.md-5 bungeecord-parent - 1.16-R0.4-SNAPSHOT + 1.16-R0.5-SNAPSHOT ../pom.xml net.md-5 bungeecord-event - 1.16-R0.4-SNAPSHOT + 1.16-R0.5-SNAPSHOT jar BungeeCord-Event diff --git a/log/pom.xml b/log/pom.xml index 64c0ba6738..fd735eb7b3 100644 --- a/log/pom.xml +++ b/log/pom.xml @@ -6,13 +6,13 @@ net.md-5 bungeecord-parent - 1.16-R0.4-SNAPSHOT + 1.16-R0.5-SNAPSHOT ../pom.xml net.md-5 bungeecord-log - 1.16-R0.4-SNAPSHOT + 1.16-R0.5-SNAPSHOT jar BungeeCord-Log diff --git a/module/cmd-alert/pom.xml b/module/cmd-alert/pom.xml index b198f2b921..7d912e9026 100644 --- a/module/cmd-alert/pom.xml +++ b/module/cmd-alert/pom.xml @@ -6,13 +6,13 @@ net.md-5 bungeecord-module - 1.16-R0.4-SNAPSHOT + 1.16-R0.5-SNAPSHOT ../pom.xml net.md-5 bungeecord-module-cmd-alert - 1.16-R0.4-SNAPSHOT + 1.16-R0.5-SNAPSHOT jar cmd_alert diff --git a/module/cmd-find/pom.xml b/module/cmd-find/pom.xml index f9077320ef..c8f2353fa0 100644 --- a/module/cmd-find/pom.xml +++ b/module/cmd-find/pom.xml @@ -6,13 +6,13 @@ net.md-5 bungeecord-module - 1.16-R0.4-SNAPSHOT + 1.16-R0.5-SNAPSHOT ../pom.xml net.md-5 bungeecord-module-cmd-find - 1.16-R0.4-SNAPSHOT + 1.16-R0.5-SNAPSHOT jar cmd_find diff --git a/module/cmd-list/pom.xml b/module/cmd-list/pom.xml index 31b023a7d0..46dd4b651e 100644 --- a/module/cmd-list/pom.xml +++ b/module/cmd-list/pom.xml @@ -6,13 +6,13 @@ net.md-5 bungeecord-module - 1.16-R0.4-SNAPSHOT + 1.16-R0.5-SNAPSHOT ../pom.xml net.md-5 bungeecord-module-cmd-list - 1.16-R0.4-SNAPSHOT + 1.16-R0.5-SNAPSHOT jar cmd_list diff --git a/module/cmd-send/pom.xml b/module/cmd-send/pom.xml index a34006b8dd..6158b2cbe5 100644 --- a/module/cmd-send/pom.xml +++ b/module/cmd-send/pom.xml @@ -6,13 +6,13 @@ net.md-5 bungeecord-module - 1.16-R0.4-SNAPSHOT + 1.16-R0.5-SNAPSHOT ../pom.xml net.md-5 bungeecord-module-cmd-send - 1.16-R0.4-SNAPSHOT + 1.16-R0.5-SNAPSHOT jar cmd_send diff --git a/module/cmd-server/pom.xml b/module/cmd-server/pom.xml index 898aa804f8..7ce143ad7c 100644 --- a/module/cmd-server/pom.xml +++ b/module/cmd-server/pom.xml @@ -6,13 +6,13 @@ net.md-5 bungeecord-module - 1.16-R0.4-SNAPSHOT + 1.16-R0.5-SNAPSHOT ../pom.xml net.md-5 bungeecord-module-cmd-server - 1.16-R0.4-SNAPSHOT + 1.16-R0.5-SNAPSHOT jar cmd_server diff --git a/module/pom.xml b/module/pom.xml index 3bf2f3d390..e0cec205af 100644 --- a/module/pom.xml +++ b/module/pom.xml @@ -6,13 +6,13 @@ net.md-5 bungeecord-parent - 1.16-R0.4-SNAPSHOT + 1.16-R0.5-SNAPSHOT ../pom.xml net.md-5 bungeecord-module - 1.16-R0.4-SNAPSHOT + 1.16-R0.5-SNAPSHOT pom BungeeCord Modules diff --git a/module/reconnect-yaml/pom.xml b/module/reconnect-yaml/pom.xml index 5da5949bca..5d3d81d5e2 100644 --- a/module/reconnect-yaml/pom.xml +++ b/module/reconnect-yaml/pom.xml @@ -6,13 +6,13 @@ net.md-5 bungeecord-module - 1.16-R0.4-SNAPSHOT + 1.16-R0.5-SNAPSHOT ../pom.xml net.md-5 bungeecord-module-reconnect-yaml - 1.16-R0.4-SNAPSHOT + 1.16-R0.5-SNAPSHOT jar reconnect_yaml diff --git a/native/pom.xml b/native/pom.xml index 8d347068ce..cf46174c05 100644 --- a/native/pom.xml +++ b/native/pom.xml @@ -6,13 +6,13 @@ net.md-5 bungeecord-parent - 1.16-R0.4-SNAPSHOT + 1.16-R0.5-SNAPSHOT ../pom.xml net.md-5 bungeecord-native - 1.16-R0.4-SNAPSHOT + 1.16-R0.5-SNAPSHOT jar BungeeCord-Native diff --git a/pom.xml b/pom.xml index 643d865a62..d78f1d4c2c 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ net.md-5 bungeecord-parent - 1.16-R0.4-SNAPSHOT + 1.16-R0.5-SNAPSHOT pom BungeeCord-Parent diff --git a/protocol/pom.xml b/protocol/pom.xml index 186264e049..5ec853a571 100644 --- a/protocol/pom.xml +++ b/protocol/pom.xml @@ -6,13 +6,13 @@ net.md-5 bungeecord-parent - 1.16-R0.4-SNAPSHOT + 1.16-R0.5-SNAPSHOT ../pom.xml net.md-5 bungeecord-protocol - 1.16-R0.4-SNAPSHOT + 1.16-R0.5-SNAPSHOT jar BungeeCord-Protocol diff --git a/proxy/pom.xml b/proxy/pom.xml index ac8e8974cb..d2cdf733d2 100644 --- a/proxy/pom.xml +++ b/proxy/pom.xml @@ -6,13 +6,13 @@ net.md-5 bungeecord-parent - 1.16-R0.4-SNAPSHOT + 1.16-R0.5-SNAPSHOT ../pom.xml net.md-5 bungeecord-proxy - 1.16-R0.4-SNAPSHOT + 1.16-R0.5-SNAPSHOT jar BungeeCord-Proxy diff --git a/query/pom.xml b/query/pom.xml index 7d13eb6043..3023d072b4 100644 --- a/query/pom.xml +++ b/query/pom.xml @@ -6,13 +6,13 @@ net.md-5 bungeecord-parent - 1.16-R0.4-SNAPSHOT + 1.16-R0.5-SNAPSHOT ../pom.xml net.md-5 bungeecord-query - 1.16-R0.4-SNAPSHOT + 1.16-R0.5-SNAPSHOT jar BungeeCord-Query