Skip to content

Adventure 5.0 #1253

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main/4
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
187 changes: 2 additions & 185 deletions api/src/main/java/net/kyori/adventure/audience/Audience.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@
import net.kyori.adventure.chat.ChatType;
import net.kyori.adventure.chat.SignedMessage;
import net.kyori.adventure.dialog.DialogLike;
import net.kyori.adventure.identity.Identified;
import net.kyori.adventure.identity.Identity;
import net.kyori.adventure.inventory.Book;
import net.kyori.adventure.pointer.Pointered;
import net.kyori.adventure.resource.ResourcePackInfo;
Expand All @@ -52,7 +50,6 @@
import net.kyori.adventure.text.ComponentLike;
import net.kyori.adventure.title.Title;
import net.kyori.adventure.title.TitlePart;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;

/**
Expand Down Expand Up @@ -200,8 +197,6 @@ default void forEachAudience(final @NotNull Consumer<? super Audience> action) {
*
* @param message a message
* @see Component
* @see #sendMessage(Identified, ComponentLike)
* @see #sendMessage(Identity, ComponentLike)
* @since 4.1.0
*/
@ForwardingAudienceOverrideNotRequired
Expand All @@ -214,180 +209,12 @@ default void sendMessage(final @NotNull ComponentLike message) {
*
* @param message a message
* @see Component
* @see #sendMessage(Identified, Component)
* @see #sendMessage(Identity, Component)
* @since 4.1.0
*/
@SuppressWarnings("deprecation")
default void sendMessage(final @NotNull Component message) {
this.sendMessage(message, MessageType.SYSTEM);
}

/**
* Sends a system chat message to this {@link Audience} ignoring the provided {@link MessageType}.
*
* @param message a message
* @param type the type
* @see Component
* @see #sendMessage(Identified, ComponentLike, MessageType)
* @see #sendMessage(Identity, ComponentLike, MessageType)
* @since 4.1.0
* @deprecated for removal since 4.12.0, {@link MessageType} is deprecated for removal, use {@link #sendMessage(ComponentLike)}
*/
@ApiStatus.ScheduledForRemoval(inVersion = "5.0.0")
@Deprecated
@ForwardingAudienceOverrideNotRequired
default void sendMessage(final @NotNull ComponentLike message, final @NotNull MessageType type) {
this.sendMessage(message.asComponent(), type);
}

/**
* Sends a system chat message to this {@link Audience} ignoring the provided {@link MessageType}.
*
* @param message a message
* @param type the type
* @see Component
* @see #sendMessage(Identified, Component, MessageType)
* @see #sendMessage(Identity, Component, MessageType)
* @since 4.1.0
* @deprecated for removal since 4.12.0, {@link MessageType} is deprecated for removal, use {@link #sendMessage(Component)} instead
*/
@ApiStatus.ScheduledForRemoval(inVersion = "5.0.0")
@Deprecated
@ForwardingAudienceOverrideNotRequired
default void sendMessage(final @NotNull Component message, final @NotNull MessageType type) {
this.sendMessage(Identity.nil(), message, type);
}
/* End: system messages */

/* Start: unsigned player messages */
/**
* Sends an unsigned player chat message from the given {@link Identified} to this {@link Audience} with the {@link ChatType#CHAT system} chat type.
*
* @param source the source of the message
* @param message a message
* @see Component
* @since 4.0.0
* @deprecated since 4.12.0, the client errors on and can reject identified messages without {@link SignedMessage} data, this may be unsupported in the future, use {@link #sendMessage(SignedMessage, ChatType.Bound)} instead
*/
@Deprecated
@ForwardingAudienceOverrideNotRequired
default void sendMessage(final @NotNull Identified source, final @NotNull ComponentLike message) {
this.sendMessage(source, message.asComponent());
}

/**
* Sends an unsigned player chat message from the entity represented by the given {@link Identity} to this {@link Audience} with the {@link ChatType#CHAT system} chat type.
*
* @param source the identity of the source of the message
* @param message a message
* @see Component
* @since 4.0.0
* @deprecated since 4.12.0, the client errors on and can reject identified messages without {@link SignedMessage} data, this may be unsupported in the future, use {@link #sendMessage(SignedMessage, ChatType.Bound)} instead
*/
@Deprecated
@ForwardingAudienceOverrideNotRequired
default void sendMessage(final @NotNull Identity source, final @NotNull ComponentLike message) {
this.sendMessage(source, message.asComponent());
}

/**
* Sends an unsigned player chat message from the given {@link Identified} to this {@link Audience} with the {@link ChatType#CHAT system} chat type.
*
* @param source the source of the message
* @param message a message
* @see Component
* @since 4.0.0
* @deprecated since 4.12.0, the client errors on receiving and can reject identified messages without {@link SignedMessage} data, this may be unsupported in the future, use {@link #sendMessage(SignedMessage, ChatType.Bound)} instead
*/
@Deprecated
@ForwardingAudienceOverrideNotRequired
default void sendMessage(final @NotNull Identified source, final @NotNull Component message) {
this.sendMessage(source, message, MessageType.CHAT);
}

/**
* Sends an unsigned player chat message from the entity represented by the given {@link Identity} to this {@link Audience} with the {@link ChatType#CHAT system} chat type.
*
* @param source the identity of the source of the message
* @param message a message
* @see Component
* @since 4.0.0
* @deprecated since 4.12.0, the client errors on receiving and can reject identified messages without {@link SignedMessage} data, this may be unsupported in the future, use {@link #sendMessage(SignedMessage, ChatType.Bound)} instead
*/
@Deprecated
@ForwardingAudienceOverrideNotRequired
default void sendMessage(final @NotNull Identity source, final @NotNull Component message) {
this.sendMessage(source, message, MessageType.CHAT);
}

/**
* Sends an unsigned player chat message from the given {@link Identified} to this {@link Audience} with the {@link ChatType} corresponding to the provided {@link MessageType}.
*
* @param source the source of the message
* @param message a message
* @param type the type
* @see Component
* @since 4.0.0
* @deprecated for removal since 4.12.0, {@link MessageType} is deprecated for removal and the client errors on receiving and can reject identified messages without {@link SignedMessage} data, use {@link #sendMessage(SignedMessage, ChatType.Bound)} instead
*/
@ApiStatus.ScheduledForRemoval(inVersion = "5.0.0")
@Deprecated
@ForwardingAudienceOverrideNotRequired
default void sendMessage(final @NotNull Identified source, final @NotNull ComponentLike message, final @NotNull MessageType type) {
this.sendMessage(source, message.asComponent(), type);
}

/**
* Sends an unsigned player chat message from the entity represented by the given {@link Identity} to this {@link Audience}.
*
* @param source the identity of the source of the message
* @param message a message
* @param type the type
* @see Component
* @since 4.0.0
* @deprecated for removal since 4.12.0, {@link MessageType} is deprecated for removal and the client errors on receiving and can reject identified messages without {@link SignedMessage} data, use {@link #sendMessage(SignedMessage, ChatType.Bound)} instead
*/
@ApiStatus.ScheduledForRemoval(inVersion = "5.0.0")
@Deprecated
@ForwardingAudienceOverrideNotRequired
default void sendMessage(final @NotNull Identity source, final @NotNull ComponentLike message, final @NotNull MessageType type) {
this.sendMessage(source, message.asComponent(), type);
}

/**
* Sends an unsigned player chat message from the given {@link Identified} to this {@link Audience} with the {@link ChatType} corresponding to the provided {@link MessageType}.
*
* @param source the source of the message
* @param message a message
* @param type the type
* @see Component
* @since 4.0.0
* @deprecated for removal since 4.12.0, {@link MessageType} is deprecated for removal and the client errors on receiving and can reject identified messages without {@link SignedMessage} data, use {@link #sendMessage(SignedMessage, ChatType.Bound)} instead
*/
@ApiStatus.ScheduledForRemoval(inVersion = "5.0.0")
@Deprecated
default void sendMessage(final @NotNull Identified source, final @NotNull Component message, final @NotNull MessageType type) {
this.sendMessage(source.identity(), message, type);
}

/**
* Sends a player chat message from the entity represented by the given {@link Identity} to this {@link Audience} with the {@link ChatType} corresponding to the provided {@link MessageType}.
*
* @param source the identity of the source of the message
* @param message a message
* @param type the type
* @see Component
* @since 4.0.0
* @deprecated for removal since 4.12.0, {@link MessageType} is deprecated for removal and the client errors on receiving and can reject identified messages without {@link SignedMessage} data, use {@link #sendMessage(SignedMessage, ChatType.Bound)} instead
*/
@ApiStatus.ScheduledForRemoval(inVersion = "5.0.0")
@Deprecated
default void sendMessage(final @NotNull Identity source, final @NotNull Component message, final @NotNull MessageType type) {
// implementation required
}
/* End: unsigned player messages */

/* Start: disguised player messages */
/**
* Sends a message to this {@link Audience} with the provided {@link ChatType.Bound bound chat type}.
Expand All @@ -397,9 +224,7 @@ default void sendMessage(final @NotNull Identity source, final @NotNull Componen
* @since 4.12.0
* @sinceMinecraft 1.19
*/
@SuppressWarnings("deprecation")
default void sendMessage(final @NotNull Component message, final ChatType.@NotNull Bound boundChatType) {
this.sendMessage(message, MessageType.CHAT);
}

/**
Expand All @@ -425,14 +250,7 @@ default void sendMessage(final @NotNull ComponentLike message, final ChatType.@N
* @since 4.12.0
* @sinceMinecraft 1.19
*/
@SuppressWarnings("deprecation")
default void sendMessage(final @NotNull SignedMessage signedMessage, final ChatType.@NotNull Bound boundChatType) {
final Component content = signedMessage.unsignedContent() != null ? signedMessage.unsignedContent() : Component.text(signedMessage.message());
if (signedMessage.isSystem()) {
this.sendMessage(content);
} else {
this.sendMessage(signedMessage.identity(), content, MessageType.CHAT);
}
}

/**
Expand Down Expand Up @@ -581,7 +399,6 @@ default void showTitle(final @NotNull Title title) {
* @param part the part
* @param value the value
* @param <T> the type of the value of the part
* @throws IllegalArgumentException if a title part that is not in {@link TitlePart} is used
* @since 4.9.0
*/
default <T> void sendTitlePart(final @NotNull TitlePart<T> part, final @NotNull T value) {
Expand Down Expand Up @@ -782,7 +599,7 @@ default void removeResourcePacks(final @NotNull ResourcePackRequestLike request)
default void removeResourcePacks(final @NotNull ResourcePackRequest request) {
final List<ResourcePackInfo> infos = request.packs();
if (infos.size() == 1) {
this.removeResourcePacks(infos.get(0).id());
this.removeResourcePacks(infos.getFirst().id());
} else if (infos.isEmpty()) {
return;
}
Expand All @@ -791,7 +608,7 @@ default void removeResourcePacks(final @NotNull ResourcePackRequest request) {
for (int i = 0; i < otherReqs.length; i++) {
otherReqs[i] = infos.get(i + 1).id();
}
this.removeResourcePacks(infos.get(0).id(), otherReqs);
this.removeResourcePacks(infos.getFirst().id(), otherReqs);
}

/**
Expand Down
12 changes: 0 additions & 12 deletions api/src/main/java/net/kyori/adventure/audience/EmptyAudience.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
import java.util.function.Supplier;
import net.kyori.adventure.chat.ChatType;
import net.kyori.adventure.chat.SignedMessage;
import net.kyori.adventure.identity.Identified;
import net.kyori.adventure.identity.Identity;
import net.kyori.adventure.inventory.Book;
import net.kyori.adventure.pointer.Pointer;
import net.kyori.adventure.resource.ResourcePackInfoLike;
Expand Down Expand Up @@ -78,16 +76,6 @@ public void sendMessage(final @NotNull ComponentLike message) {
public void sendMessage(final @NotNull Component message) {
}

@Override
@Deprecated
public void sendMessage(final @NotNull Identified source, final @NotNull Component message, final @NotNull MessageType type) {
}

@Override
@Deprecated
public void sendMessage(final @NotNull Identity source, final @NotNull Component message, final @NotNull MessageType type) {
}

@Override
public void sendMessage(final @NotNull Component message, final ChatType.@NotNull Bound boundChatType) {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
import net.kyori.adventure.chat.ChatType;
import net.kyori.adventure.chat.SignedMessage;
import net.kyori.adventure.dialog.DialogLike;
import net.kyori.adventure.identity.Identified;
import net.kyori.adventure.identity.Identity;
import net.kyori.adventure.inventory.Book;
import net.kyori.adventure.pointer.Pointer;
import net.kyori.adventure.pointer.Pointers;
Expand Down Expand Up @@ -120,18 +118,6 @@ default void deleteMessage(final SignedMessage.@NotNull Signature signature) {
for (final Audience audience : this.audiences()) audience.deleteMessage(signature);
}

@Override
@Deprecated
default void sendMessage(final @NotNull Identified source, final @NotNull Component message, final @NotNull MessageType type) {
for (final Audience audience : this.audiences()) audience.sendMessage(source, message, type);
}

@Override
@Deprecated
default void sendMessage(final @NotNull Identity source, final @NotNull Component message, final @NotNull MessageType type) {
for (final Audience audience : this.audiences()) audience.sendMessage(source, message, type);
}

@Override
default void sendActionBar(final @NotNull Component message) {
for (final Audience audience : this.audiences()) audience.sendActionBar(message);
Expand Down Expand Up @@ -253,7 +239,7 @@ interface Single extends ForwardingAudience {
* @return {@link #audience()}
* @deprecated this audience only supports forwarding to a single audience
*/
@Deprecated(/* forRemoval = false */)
@Deprecated
@Override
default @NotNull Iterable<? extends Audience> audiences() {
return Collections.singleton(this.audience());
Expand Down Expand Up @@ -313,18 +299,6 @@ default void deleteMessage(final SignedMessage.@NotNull Signature signature) {
this.audience().deleteMessage(signature);
}

@Override
@Deprecated
default void sendMessage(final @NotNull Identified source, final @NotNull Component message, final @NotNull MessageType type) {
this.audience().sendMessage(source, message, type);
}

@Override
@Deprecated
default void sendMessage(final @NotNull Identity source, final @NotNull Component message, final @NotNull MessageType type) {
this.audience().sendMessage(source, message, type);
}

@Override
default void sendActionBar(final @NotNull Component message) {
this.audience().sendActionBar(message);
Expand Down
56 changes: 0 additions & 56 deletions api/src/main/java/net/kyori/adventure/audience/MessageType.java

This file was deleted.

Loading
Loading