mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 12:27:59 +01:00
Fix rendering for translatable death messages (#8534)
This commit is contained in:
parent
7302df8cf7
commit
d922f2e369
@ -315,7 +315,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ this.disconnect(Component.translatable("multiplayer.disconnect.out_of_order_chat"), org.bukkit.event.player.PlayerKickEvent.Cause.OUT_OF_ORDER_CHAT); // Paper - kick event ca
|
+ this.disconnect(Component.translatable("multiplayer.disconnect.out_of_order_chat"), org.bukkit.event.player.PlayerKickEvent.Cause.OUT_OF_ORDER_CHAT); // Paper - kick event ca
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
} else if (this.player.isRemoved() || this.player.getChatVisibility() == ChatVisiblity.HIDDEN) { // CraftBukkit - dead men tell no tales
|
} else if (this.player.isRemoved() || this.player.getChatVisibility() == ChatVisiblity.HIDDEN) { // CraftBukkit - dead men tell no tales
|
||||||
this.send(new ClientboundSystemChatPacket(Component.translatable("chat.disabled.options").withStyle(ChatFormatting.RED), false));
|
this.send(new ClientboundSystemChatPacket(PaperAdventure.asAdventure(Component.translatable("chat.disabled.options").withStyle(ChatFormatting.RED)), false)); // Paper - Adventure
|
||||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||||
|
|
||||||
if (optional.isEmpty()) {
|
if (optional.isEmpty()) {
|
||||||
|
@ -1921,6 +1921,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
-public record ClientboundSystemChatPacket(String content, boolean overlay) implements Packet<ClientGamePacketListener> {
|
-public record ClientboundSystemChatPacket(String content, boolean overlay) implements Packet<ClientGamePacketListener> {
|
||||||
+public record ClientboundSystemChatPacket(@javax.annotation.Nullable net.kyori.adventure.text.Component adventure$content, @javax.annotation.Nullable String content, boolean overlay) implements Packet<ClientGamePacketListener> { // Paper - Adventure
|
+public record ClientboundSystemChatPacket(@javax.annotation.Nullable net.kyori.adventure.text.Component adventure$content, @javax.annotation.Nullable String content, boolean overlay) implements Packet<ClientGamePacketListener> { // Paper - Adventure
|
||||||
|
|
||||||
|
+ @io.papermc.paper.annotation.DoNotUse // Paper - No locale context
|
||||||
public ClientboundSystemChatPacket(Component content, boolean overlay) {
|
public ClientboundSystemChatPacket(Component content, boolean overlay) {
|
||||||
- this(Component.Serializer.toJson(content), overlay);
|
- this(Component.Serializer.toJson(content), overlay);
|
||||||
+ this(null, Component.Serializer.toJson(content), overlay); // Paper - Adventure
|
+ this(null, Component.Serializer.toJson(content), overlay); // Paper - Adventure
|
||||||
@ -1942,8 +1943,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ // Paper end
|
+ // Paper end
|
||||||
|
|
||||||
public ClientboundSystemChatPacket(FriendlyByteBuf buf) {
|
public ClientboundSystemChatPacket(FriendlyByteBuf buf) {
|
||||||
this(buf.readComponent(), buf.readBoolean());
|
- this(buf.readComponent(), buf.readBoolean());
|
||||||
@@ -0,0 +0,0 @@ public record ClientboundSystemChatPacket(String content, boolean overlay) imple
|
+ this(null, io.papermc.paper.adventure.PaperAdventure.asJsonString(buf.readComponent(), buf.adventure$locale), buf.readBoolean()); // Paper - Adventure
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(FriendlyByteBuf buf) {
|
public void write(FriendlyByteBuf buf) {
|
||||||
@ -2126,6 +2128,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
this.connection.send(new ClientboundPlayerCombatKillPacket(this.getCombatTracker(), ichatbasecomponent), PacketSendListener.exceptionallySend(() -> {
|
this.connection.send(new ClientboundPlayerCombatKillPacket(this.getCombatTracker(), ichatbasecomponent), PacketSendListener.exceptionallySend(() -> {
|
||||||
boolean flag1 = true;
|
boolean flag1 = true;
|
||||||
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player {
|
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player {
|
||||||
|
|
||||||
|
public void sendSystemMessage(Component message, boolean overlay) {
|
||||||
|
if (this.acceptsSystemMessages(overlay)) {
|
||||||
|
- this.connection.send(new ClientboundSystemChatPacket(message, overlay), PacketSendListener.exceptionallySend(() -> {
|
||||||
|
+ this.connection.send(new ClientboundSystemChatPacket(PaperAdventure.asAdventure(message), overlay), PacketSendListener.exceptionallySend(() -> { // Paper - Adventure
|
||||||
|
if (this.acceptsSystemMessages(false)) {
|
||||||
|
boolean flag1 = true;
|
||||||
|
String s = message.getString(256);
|
||||||
|
MutableComponent ichatmutablecomponent = Component.literal(s).withStyle(ChatFormatting.YELLOW);
|
||||||
|
|
||||||
|
- return new ClientboundSystemChatPacket(Component.translatable("multiplayer.message_not_delivered", ichatmutablecomponent).withStyle(ChatFormatting.RED), false);
|
||||||
|
+ return new ClientboundSystemChatPacket(PaperAdventure.asAdventure(Component.translatable("multiplayer.message_not_delivered", ichatmutablecomponent).withStyle(ChatFormatting.RED)), false); // Paper - Adventure
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendChatMessage(OutgoingChatMessage message, boolean filterMaskEnabled, ChatType.Bound params) {
|
public void sendChatMessage(OutgoingChatMessage message, boolean filterMaskEnabled, ChatType.Bound params) {
|
||||||
@ -2255,6 +2273,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
this.broadcastChatMessage(playerchatmessage1);
|
this.broadcastChatMessage(playerchatmessage1);
|
||||||
}, this.server.chatExecutor); // CraftBukkit - async chat
|
}, this.server.chatExecutor); // CraftBukkit - async chat
|
||||||
|
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||||
|
this.disconnect(Component.translatable("multiplayer.disconnect.out_of_order_chat"));
|
||||||
|
return Optional.empty();
|
||||||
|
} else if (this.player.isRemoved() || this.player.getChatVisibility() == ChatVisiblity.HIDDEN) { // CraftBukkit - dead men tell no tales
|
||||||
|
- this.send(new ClientboundSystemChatPacket(Component.translatable("chat.disabled.options").withStyle(ChatFormatting.RED), false));
|
||||||
|
+ this.send(new ClientboundSystemChatPacket(PaperAdventure.asAdventure(Component.translatable("chat.disabled.options").withStyle(ChatFormatting.RED)), false)); // Paper - Adventure
|
||||||
|
return Optional.empty();
|
||||||
|
} else {
|
||||||
|
Optional<LastSeenMessages> optional = this.unpackAndApplyLastSeen(acknowledgment);
|
||||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||||
this.handleCommand(s);
|
this.handleCommand(s);
|
||||||
} else if (this.player.getChatVisibility() == ChatVisiblity.SYSTEM) {
|
} else if (this.player.getChatVisibility() == ChatVisiblity.SYSTEM) {
|
||||||
@ -2269,6 +2296,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
Player player = this.getCraftPlayer();
|
Player player = this.getCraftPlayer();
|
||||||
AsyncPlayerChatEvent event = new AsyncPlayerChatEvent(async, player, s, new LazyPlayerSet(this.server));
|
AsyncPlayerChatEvent event = new AsyncPlayerChatEvent(async, player, s, new LazyPlayerSet(this.server));
|
||||||
String originalFormat = event.getFormat(), originalMessage = event.getMessage();
|
String originalFormat = event.getFormat(), originalMessage = event.getMessage();
|
||||||
|
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else if (this.player.getChatVisibility() == ChatVisiblity.SYSTEM) { // Re-add "Command Only" flag check
|
||||||
|
- this.send(new ClientboundSystemChatPacket(Component.translatable("chat.cannotSend").withStyle(ChatFormatting.RED), false));
|
||||||
|
+ this.send(new ClientboundSystemChatPacket(PaperAdventure.asAdventure(Component.translatable("chat.cannotSend").withStyle(ChatFormatting.RED)), false)); // Paper - Adventure
|
||||||
|
} else {
|
||||||
|
this.chat(s, message, true);
|
||||||
|
}
|
||||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,4 +39,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ }); // Paper - push to main
|
+ }); // Paper - push to main
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
} else if (this.player.isRemoved() || this.player.getChatVisibility() == ChatVisiblity.HIDDEN) { // CraftBukkit - dead men tell no tales
|
} else if (this.player.isRemoved() || this.player.getChatVisibility() == ChatVisiblity.HIDDEN) { // CraftBukkit - dead men tell no tales
|
||||||
this.send(new ClientboundSystemChatPacket(Component.translatable("chat.disabled.options").withStyle(ChatFormatting.RED), false));
|
this.send(new ClientboundSystemChatPacket(PaperAdventure.asAdventure(Component.translatable("chat.disabled.options").withStyle(ChatFormatting.RED)), false)); // Paper - Adventure
|
||||||
|
Loading…
Reference in New Issue
Block a user