Move the extra check out of hasFormatting
This commit is contained in:
parent
83b0229277
commit
6641d199b3
@ -323,8 +323,7 @@ public abstract class BaseComponent
|
||||
return color != null || bold != null
|
||||
|| italic != null || underlined != null
|
||||
|| strikethrough != null || obfuscated != null
|
||||
|| hoverEvent != null || clickEvent != null
|
||||
|| (extra != null && extra.size() > 0);
|
||||
|| hoverEvent != null || clickEvent != null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -8,9 +8,11 @@ import com.google.gson.JsonParseException;
|
||||
import com.google.gson.JsonPrimitive;
|
||||
import com.google.gson.JsonSerializationContext;
|
||||
import com.google.gson.JsonSerializer;
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.List;
|
||||
|
||||
public class TextComponentSerializer extends BaseComponentSerializer implements JsonSerializer<TextComponent>, JsonDeserializer<TextComponent>
|
||||
{
|
||||
@ -28,7 +30,8 @@ public class TextComponentSerializer extends BaseComponentSerializer implements
|
||||
@Override
|
||||
public JsonElement serialize(TextComponent src, Type typeOfSrc, JsonSerializationContext context)
|
||||
{
|
||||
if ( !src.hasFormatting() )
|
||||
List<BaseComponent> extra = src.getExtra();
|
||||
if ( !src.hasFormatting() && (extra == null || extra.size() > 0) )
|
||||
{
|
||||
return new JsonPrimitive( src.getText() );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user