Skip to content
This repository has been archived by the owner on Jul 15, 2022. It is now read-only.

Commit

Permalink
Merge 1.16.5 support from upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
johnfriedrich committed Jan 17, 2021
2 parents 84babbd + 9f6a798 commit c407040
Show file tree
Hide file tree
Showing 21 changed files with 63 additions and 68 deletions.
4 changes: 2 additions & 2 deletions api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
<parent>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-parent</artifactId>
<version>1.16-R0.4-SNAPSHOT</version>
<version>1.16-R0.5-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<groupId>net.md-5</groupId>
<artifactId>bungeecord-api</artifactId>
<version>1.16-R0.4-SNAPSHOT</version>
<version>1.16-R0.5-SNAPSHOT</version>
<packaging>jar</packaging>

<name>BungeeCord-API</name>
Expand Down
4 changes: 2 additions & 2 deletions bootstrap/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
<parent>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-parent</artifactId>
<version>1.16-R0.4-SNAPSHOT</version>
<version>1.16-R0.5-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<groupId>net.md-5</groupId>
<artifactId>bungeecord-bootstrap</artifactId>
<version>1.16-R0.4-SNAPSHOT</version>
<version>1.16-R0.5-SNAPSHOT</version>
<packaging>jar</packaging>

<name>BungeeCord-Bootstrap</name>
Expand Down
4 changes: 2 additions & 2 deletions chat/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
<parent>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-parent</artifactId>
<version>1.16-R0.4-SNAPSHOT</version>
<version>1.16-R0.5-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<groupId>net.md-5</groupId>
<artifactId>bungeecord-chat</artifactId>
<version>1.16-R0.4-SNAPSHOT</version>
<version>1.16-R0.5-SNAPSHOT</version>
<packaging>jar</packaging>

<name>BungeeCord-Chat</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() );
Expand All @@ -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.<BaseComponent[]>deserialize( object.get( "extra" ), BaseComponent[].class ) ) );
component.setInsertion( object.get( "insertion" ).getAsString() );
}

//Events
Expand Down Expand Up @@ -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.<BaseComponent[]>deserialize( object.get( "extra" ), BaseComponent[].class ) ) );
}
}

protected void serialize(JsonObject object, BaseComponent component, JsonSerializationContext context)
Expand All @@ -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() );
Expand All @@ -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
Expand All @@ -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 );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<TextComponent>, JsonDeserializer<TextComponent>
Expand All @@ -32,13 +30,9 @@ public TextComponent deserialize(JsonElement json, Type typeOfT, JsonDeserializa
@Override
public JsonElement serialize(TextComponent src, Type typeOfSrc, JsonSerializationContext context)
{
List<BaseComponent> 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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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}\"}";
Expand Down
4 changes: 2 additions & 2 deletions config/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
<parent>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-parent</artifactId>
<version>1.16-R0.4-SNAPSHOT</version>
<version>1.16-R0.5-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<groupId>net.md-5</groupId>
<artifactId>bungeecord-config</artifactId>
<version>1.16-R0.4-SNAPSHOT</version>
<version>1.16-R0.5-SNAPSHOT</version>
<packaging>jar</packaging>

<name>BungeeCord-Config</name>
Expand Down
4 changes: 2 additions & 2 deletions event/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
<parent>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-parent</artifactId>
<version>1.16-R0.4-SNAPSHOT</version>
<version>1.16-R0.5-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<groupId>net.md-5</groupId>
<artifactId>bungeecord-event</artifactId>
<version>1.16-R0.4-SNAPSHOT</version>
<version>1.16-R0.5-SNAPSHOT</version>
<packaging>jar</packaging>

<name>BungeeCord-Event</name>
Expand Down
4 changes: 2 additions & 2 deletions log/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
<parent>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-parent</artifactId>
<version>1.16-R0.4-SNAPSHOT</version>
<version>1.16-R0.5-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<groupId>net.md-5</groupId>
<artifactId>bungeecord-log</artifactId>
<version>1.16-R0.4-SNAPSHOT</version>
<version>1.16-R0.5-SNAPSHOT</version>
<packaging>jar</packaging>

<name>BungeeCord-Log</name>
Expand Down
4 changes: 2 additions & 2 deletions module/cmd-alert/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
<parent>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-module</artifactId>
<version>1.16-R0.4-SNAPSHOT</version>
<version>1.16-R0.5-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<groupId>net.md-5</groupId>
<artifactId>bungeecord-module-cmd-alert</artifactId>
<version>1.16-R0.4-SNAPSHOT</version>
<version>1.16-R0.5-SNAPSHOT</version>
<packaging>jar</packaging>

<name>cmd_alert</name>
Expand Down
4 changes: 2 additions & 2 deletions module/cmd-find/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
<parent>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-module</artifactId>
<version>1.16-R0.4-SNAPSHOT</version>
<version>1.16-R0.5-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<groupId>net.md-5</groupId>
<artifactId>bungeecord-module-cmd-find</artifactId>
<version>1.16-R0.4-SNAPSHOT</version>
<version>1.16-R0.5-SNAPSHOT</version>
<packaging>jar</packaging>

<name>cmd_find</name>
Expand Down
4 changes: 2 additions & 2 deletions module/cmd-list/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
<parent>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-module</artifactId>
<version>1.16-R0.4-SNAPSHOT</version>
<version>1.16-R0.5-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<groupId>net.md-5</groupId>
<artifactId>bungeecord-module-cmd-list</artifactId>
<version>1.16-R0.4-SNAPSHOT</version>
<version>1.16-R0.5-SNAPSHOT</version>
<packaging>jar</packaging>

<name>cmd_list</name>
Expand Down
4 changes: 2 additions & 2 deletions module/cmd-send/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
<parent>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-module</artifactId>
<version>1.16-R0.4-SNAPSHOT</version>
<version>1.16-R0.5-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<groupId>net.md-5</groupId>
<artifactId>bungeecord-module-cmd-send</artifactId>
<version>1.16-R0.4-SNAPSHOT</version>
<version>1.16-R0.5-SNAPSHOT</version>
<packaging>jar</packaging>

<name>cmd_send</name>
Expand Down
4 changes: 2 additions & 2 deletions module/cmd-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
<parent>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-module</artifactId>
<version>1.16-R0.4-SNAPSHOT</version>
<version>1.16-R0.5-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<groupId>net.md-5</groupId>
<artifactId>bungeecord-module-cmd-server</artifactId>
<version>1.16-R0.4-SNAPSHOT</version>
<version>1.16-R0.5-SNAPSHOT</version>
<packaging>jar</packaging>

<name>cmd_server</name>
Expand Down
4 changes: 2 additions & 2 deletions module/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
<parent>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-parent</artifactId>
<version>1.16-R0.4-SNAPSHOT</version>
<version>1.16-R0.5-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<groupId>net.md-5</groupId>
<artifactId>bungeecord-module</artifactId>
<version>1.16-R0.4-SNAPSHOT</version>
<version>1.16-R0.5-SNAPSHOT</version>
<packaging>pom</packaging>

<name>BungeeCord Modules</name>
Expand Down
4 changes: 2 additions & 2 deletions module/reconnect-yaml/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
<parent>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-module</artifactId>
<version>1.16-R0.4-SNAPSHOT</version>
<version>1.16-R0.5-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<groupId>net.md-5</groupId>
<artifactId>bungeecord-module-reconnect-yaml</artifactId>
<version>1.16-R0.4-SNAPSHOT</version>
<version>1.16-R0.5-SNAPSHOT</version>
<packaging>jar</packaging>

<name>reconnect_yaml</name>
Expand Down
4 changes: 2 additions & 2 deletions native/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
<parent>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-parent</artifactId>
<version>1.16-R0.4-SNAPSHOT</version>
<version>1.16-R0.5-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<groupId>net.md-5</groupId>
<artifactId>bungeecord-native</artifactId>
<version>1.16-R0.4-SNAPSHOT</version>
<version>1.16-R0.5-SNAPSHOT</version>
<packaging>jar</packaging>

<name>BungeeCord-Native</name>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>net.md-5</groupId>
<artifactId>bungeecord-parent</artifactId>
<version>1.16-R0.4-SNAPSHOT</version>
<version>1.16-R0.5-SNAPSHOT</version>
<packaging>pom</packaging>

<name>BungeeCord-Parent</name>
Expand Down
4 changes: 2 additions & 2 deletions protocol/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
<parent>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-parent</artifactId>
<version>1.16-R0.4-SNAPSHOT</version>
<version>1.16-R0.5-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<groupId>net.md-5</groupId>
<artifactId>bungeecord-protocol</artifactId>
<version>1.16-R0.4-SNAPSHOT</version>
<version>1.16-R0.5-SNAPSHOT</version>
<packaging>jar</packaging>

<name>BungeeCord-Protocol</name>
Expand Down
4 changes: 2 additions & 2 deletions proxy/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
<parent>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-parent</artifactId>
<version>1.16-R0.4-SNAPSHOT</version>
<version>1.16-R0.5-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<groupId>net.md-5</groupId>
<artifactId>bungeecord-proxy</artifactId>
<version>1.16-R0.4-SNAPSHOT</version>
<version>1.16-R0.5-SNAPSHOT</version>
<packaging>jar</packaging>

<name>BungeeCord-Proxy</name>
Expand Down
Loading

0 comments on commit c407040

Please sign in to comment.