mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-15 21:01:24 +01:00
Use original user input instead of legacy event result for AbstractChatEvent#originalMessage (#5770)
This commit is contained in:
parent
2614cde313
commit
887b02a2ad
@ -292,6 +292,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ private final Component originalMessage;
|
||||
+ private Component message;
|
||||
+
|
||||
+ AbstractChatEvent(final boolean async, final @NotNull Player player, final @NotNull Set<Audience> viewers, final @NotNull ChatRenderer renderer, final @NotNull Component message, final @NotNull Component originalMessage) {
|
||||
+ super(player, async);
|
||||
+ this.viewers = viewers;
|
||||
+ this.recipients = new HashSet<>(Bukkit.getOnlinePlayers());
|
||||
+ this.renderer = renderer;
|
||||
+ this.message = message;
|
||||
+ this.originalMessage = originalMessage;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @deprecated for removal with 1.17
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ AbstractChatEvent(final boolean async, final @NotNull Player player, final @NotNull Set<Audience> viewers, final @NotNull ChatRenderer renderer, final @NotNull Component message) {
|
||||
+ super(player, async);
|
||||
+ this.viewers = viewers;
|
||||
@ -305,6 +318,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ * @deprecated for removal with 1.17
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ AbstractChatEvent(final boolean async, final @NotNull Player player, final @NotNull Set<Player> recipients, final @NotNull Set<Audience> viewers, final @NotNull ChatRenderer renderer, final @NotNull Component message, final @NotNull Component originalMessage) {
|
||||
+ super(player, async);
|
||||
+ this.recipients = recipients;
|
||||
+ this.viewers = viewers;
|
||||
+ this.renderer = renderer;
|
||||
+ this.message = message;
|
||||
+ this.originalMessage = originalMessage;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @deprecated for removal with 1.17
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ AbstractChatEvent(final boolean async, final @NotNull Player player, final @NotNull Set<Player> recipients, final @NotNull Set<Audience> viewers, final @NotNull ChatRenderer renderer, final @NotNull Component message) {
|
||||
+ super(player, async);
|
||||
+ this.recipients = recipients;
|
||||
@ -556,12 +582,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+public final class AsyncChatEvent extends AbstractChatEvent {
|
||||
+ private static final HandlerList HANDLERS = new HandlerList();
|
||||
+
|
||||
+ public AsyncChatEvent(final boolean async, final @NotNull Player player, final @NotNull Set<Audience> viewers, final @NotNull ChatRenderer renderer, final @NotNull Component message, final @NotNull Component originalMessage) {
|
||||
+ super(async, player, viewers, renderer, message, originalMessage);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @deprecated for removal with 1.17, use {@link #AsyncChatEvent(boolean, Player, Set, ChatRenderer, Component, Component)}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public AsyncChatEvent(final boolean async, final @NotNull Player player, final @NotNull Set<Audience> viewers, final @NotNull ChatRenderer renderer, final @NotNull Component message) {
|
||||
+ super(async, player, viewers, renderer, message);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @deprecated for removal with 1.17, use {@link #AsyncChatEvent(boolean, Player, Set, ChatRenderer, Component)}
|
||||
+ * @deprecated for removal with 1.17, use {@link #AsyncChatEvent(boolean, Player, Set, ChatRenderer, Component, Component)}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public AsyncChatEvent(final boolean async, final @NotNull Player player, final @NotNull Set<Player> recipients, final @NotNull Set<Audience> viewers, final @NotNull ChatRenderer renderer, final @NotNull Component message, final @NotNull Component originalMessage) {
|
||||
+ super(async, player, recipients, viewers, renderer, message, originalMessage);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @deprecated for removal with 1.17, use {@link #AsyncChatEvent(boolean, Player, Set, ChatRenderer, Component, Component)}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public AsyncChatEvent(final boolean async, final @NotNull Player player, final @NotNull Set<Player> recipients, final @NotNull Set<Audience> viewers, final @NotNull ChatRenderer renderer, final @NotNull Component message) {
|
||||
@ -569,7 +611,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @deprecated for removal with 1.17, use {@link #AsyncChatEvent(boolean, Player, Set, ChatRenderer, Component)}
|
||||
+ * @deprecated for removal with 1.17, use {@link #AsyncChatEvent(boolean, Player, Set, ChatRenderer, Component, Component)}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public AsyncChatEvent(final boolean async, final @NotNull Player player, final @NotNull Set<Player> recipients, final @NotNull ChatComposer composer, final @NotNull Component message) {
|
||||
@ -577,7 +619,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @deprecated for removal with 1.17, use {@link #AsyncChatEvent(boolean, Player, Set, ChatRenderer, Component)}
|
||||
+ * @deprecated for removal with 1.17, use {@link #AsyncChatEvent(boolean, Player, Set, ChatRenderer, Component, Component)}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public AsyncChatEvent(final boolean async, final @NotNull Player player, final @NotNull Set<Player> recipients, final @NotNull ChatFormatter formatter, final @NotNull Component message) {
|
||||
@ -624,19 +666,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+public final class ChatEvent extends AbstractChatEvent {
|
||||
+ private static final HandlerList HANDLERS = new HandlerList();
|
||||
+
|
||||
+ public ChatEvent(final @NotNull Player player, final @NotNull Set<Audience> viewers, final @NotNull ChatRenderer renderer, final @NotNull Component message, final @NotNull Component originalMessage) {
|
||||
+ super(false, player, viewers, renderer, message, originalMessage);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @deprecated for removal with 1.17, use {@link #ChatEvent(Player, Set, ChatRenderer, Component, Component)}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public ChatEvent(final @NotNull Player player, final @NotNull Set<Audience> viewers, final @NotNull ChatRenderer renderer, final @NotNull Component message) {
|
||||
+ super(false, player, viewers, renderer, message);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @deprecated for removal with 1.17, use {@link #ChatEvent(Player, Set, ChatRenderer, Component)}
|
||||
+ * @deprecated for removal with 1.17, use {@link #ChatEvent(Player, Set, ChatRenderer, Component, Component)}
|
||||
+ */
|
||||
+ public ChatEvent(final @NotNull Player player, final @NotNull Set<Player> recipients, final @NotNull Set<Audience> viewers, final @NotNull ChatRenderer renderer, final @NotNull Component message) {
|
||||
+ super(false, player, recipients, viewers, renderer, message);
|
||||
+ @Deprecated
|
||||
+ public ChatEvent(final @NotNull Player player, final @NotNull Set<Player> recipients, final @NotNull Set<Audience> viewers, final @NotNull ChatRenderer renderer, final @NotNull Component message, final @NotNull Component originalMessage) {
|
||||
+ super(false, player, recipients, viewers, renderer, message, originalMessage);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @deprecated for removal with 1.17, use {@link #ChatEvent(Player, Set, ChatRenderer, Component)}
|
||||
+ * @deprecated for removal with 1.17, use {@link #ChatEvent(Player, Set, ChatRenderer, Component, Component)}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public ChatEvent(final @NotNull Player player, final @NotNull Set<Player> recipients, final @NotNull ChatComposer composer, final @NotNull Component message) {
|
||||
@ -644,7 +695,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @deprecated for removal with 1.17, use {@link #ChatEvent(Player, Set, ChatRenderer, Component)}
|
||||
+ * @deprecated for removal with 1.17, use {@link #ChatEvent(Player, Set, ChatRenderer, Component, Component)}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public ChatEvent(final @NotNull Player player, final @NotNull Set<Player> recipients, final @NotNull ChatFormatter formatter, final @NotNull Component message) {
|
||||
|
@ -157,12 +157,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ final EntityPlayer player;
|
||||
+ final String message;
|
||||
+ final boolean async;
|
||||
+ final Component originalMessage;
|
||||
+
|
||||
+ public ChatProcessor(final MinecraftServer server, final EntityPlayer player, final String message, final boolean async) {
|
||||
+ this.server = server;
|
||||
+ this.player = player;
|
||||
+ this.message = message;
|
||||
+ this.async = async;
|
||||
+ this.originalMessage = Component.text(message);
|
||||
+ }
|
||||
+
|
||||
+ @SuppressWarnings({"CodeBlock2Expr", "deprecated"})
|
||||
@ -280,11 +282,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+
|
||||
+ private AsyncChatEvent createAsync(final ChatRenderer renderer, final Set<Player> recipients, final Set<Audience> viewers, final Component message) {
|
||||
+ return new AsyncChatEvent(this.async, this.player.getBukkitEntity(), recipients, viewers, renderer, message);
|
||||
+ return new AsyncChatEvent(this.async, this.player.getBukkitEntity(), recipients, viewers, renderer, message, this.originalMessage);
|
||||
+ }
|
||||
+
|
||||
+ private ChatEvent createSync(final ChatRenderer renderer, final Set<Player> recipients, final Set<Audience> viewers, final Component message) {
|
||||
+ return new ChatEvent(this.player.getBukkitEntity(), recipients, viewers, renderer, message);
|
||||
+ return new ChatEvent(this.player.getBukkitEntity(), recipients, viewers, renderer, message, this.originalMessage);
|
||||
+ }
|
||||
+
|
||||
+ private static String legacyDisplayName(final CraftPlayer player) {
|
||||
|
Loading…
Reference in New Issue
Block a user