From 727281e69e256916088e4e63f0000e82c7c7538a Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 10 May 2020 09:24:40 +1000 Subject: [PATCH] Make all BaseComponent.duplicate methods specific --- .../java/net/md_5/bungee/api/chat/BaseComponent.java | 12 ++++++++++-- .../net/md_5/bungee/api/chat/KeybindComponent.java | 2 +- .../md_5/bungee/api/chat/TranslatableComponent.java | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/chat/src/main/java/net/md_5/bungee/api/chat/BaseComponent.java b/chat/src/main/java/net/md_5/bungee/api/chat/BaseComponent.java index 72521862..17bad50b 100644 --- a/chat/src/main/java/net/md_5/bungee/api/chat/BaseComponent.java +++ b/chat/src/main/java/net/md_5/bungee/api/chat/BaseComponent.java @@ -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 ); diff --git a/chat/src/main/java/net/md_5/bungee/api/chat/KeybindComponent.java b/chat/src/main/java/net/md_5/bungee/api/chat/KeybindComponent.java index 039a3489..4cefe259 100644 --- a/chat/src/main/java/net/md_5/bungee/api/chat/KeybindComponent.java +++ b/chat/src/main/java/net/md_5/bungee/api/chat/KeybindComponent.java @@ -44,7 +44,7 @@ public final class KeybindComponent extends BaseComponent } @Override - public BaseComponent duplicate() + public KeybindComponent duplicate() { return new KeybindComponent( this ); } diff --git a/chat/src/main/java/net/md_5/bungee/api/chat/TranslatableComponent.java b/chat/src/main/java/net/md_5/bungee/api/chat/TranslatableComponent.java index 5c268d19..4b9a1c54 100644 --- a/chat/src/main/java/net/md_5/bungee/api/chat/TranslatableComponent.java +++ b/chat/src/main/java/net/md_5/bungee/api/chat/TranslatableComponent.java @@ -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 ); }