Make all BaseComponent.duplicate methods specific

This commit is contained in:
md_5 2020-05-10 09:24:40 +10:00
parent 4e99a32537
commit 727281e69e
3 changed files with 12 additions and 4 deletions

View File

@ -5,7 +5,6 @@ import java.util.List;
import lombok.AccessLevel;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import net.md_5.bungee.api.ChatColor;
@ -14,7 +13,6 @@ import net.md_5.bungee.api.chat.ComponentBuilder.FormatRetention;
@Setter
@ToString(exclude = "parent")
@EqualsAndHashCode(exclude = "parent")
@NoArgsConstructor
public abstract class BaseComponent
{
@ -76,6 +74,16 @@ public abstract class BaseComponent
@Getter
private HoverEvent hoverEvent;
/**
* Default constructor.
*
* @deprecated for use by internal classes only, will be removed.
*/
@Deprecated
public BaseComponent()
{
}
BaseComponent(BaseComponent old)
{
copyFormatting( old, FormatRetention.ALL, true );

View File

@ -44,7 +44,7 @@ public final class KeybindComponent extends BaseComponent
}
@Override
public BaseComponent duplicate()
public KeybindComponent duplicate()
{
return new KeybindComponent( this );
}

View File

@ -88,7 +88,7 @@ public final class TranslatableComponent extends BaseComponent
* @return the duplicate of this TranslatableComponent.
*/
@Override
public BaseComponent duplicate()
public TranslatableComponent duplicate()
{
return new TranslatableComponent( this );
}