3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-12-24 15:20:19 +01:00

team_name -> target (#469)

Dieser Commit ist enthalten in:
Gero 2022-07-06 18:02:22 +02:00 committet von GitHub
Ursprung 32bd9378e1
Commit 356158a9d4
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23

Datei anzeigen

@ -208,9 +208,9 @@ public final class Protocol1_18_2To1_19_1 extends BackwardsProtocol<ClientboundP
wrapper.write(Type.BYTE, (byte) 1); wrapper.write(Type.BYTE, (byte) 1);
wrapper.passthrough(Type.UUID); wrapper.passthrough(Type.UUID);
final JsonElement senderName = wrapper.read(Type.COMPONENT); final JsonElement senderName = wrapper.read(Type.COMPONENT);
final JsonElement teamName = wrapper.read(Type.OPTIONAL_COMPONENT); final JsonElement targetName = wrapper.read(Type.OPTIONAL_COMPONENT);
final JsonElement element = wrapper.get(Type.COMPONENT, 0); final JsonElement element = wrapper.get(Type.COMPONENT, 0);
final JsonElement decoratedMessage = decorateChatMessage(wrapper, chatTypeId, senderName, teamName, element); final JsonElement decoratedMessage = decorateChatMessage(wrapper, chatTypeId, senderName, targetName, element);
if (decoratedMessage == null) { if (decoratedMessage == null) {
wrapper.cancel(); wrapper.cancel();
} else { } else {
@ -327,7 +327,7 @@ public final class Protocol1_18_2To1_19_1 extends BackwardsProtocol<ClientboundP
return TextReplacementConfig.builder().matchLiteral("%s").replacement(GsonComponentSerializer.gson().deserializeFromTree(replacement)).once().build(); return TextReplacementConfig.builder().matchLiteral("%s").replacement(GsonComponentSerializer.gson().deserializeFromTree(replacement)).once().build();
} }
private JsonElement decorateChatMessage(final PacketWrapper wrapper, final int chatTypeId, final JsonElement senderName, final JsonElement teamName, final JsonElement message) throws Exception { private JsonElement decorateChatMessage(final PacketWrapper wrapper, final int chatTypeId, final JsonElement senderName, final JsonElement targetName, final JsonElement message) throws Exception {
translatableRewriter.processText(message); translatableRewriter.processText(message);
CompoundTag chatType = wrapper.user().get(DimensionRegistryStorage.class).chatType(chatTypeId); CompoundTag chatType = wrapper.user().get(DimensionRegistryStorage.class).chatType(chatTypeId);
@ -372,9 +372,9 @@ public final class Protocol1_18_2To1_19_1 extends BackwardsProtocol<ClientboundP
case "content": case "content":
component = component.replaceText(replace(message)); component = component.replaceText(replace(message));
break; break;
case "team_name": case "target":
Preconditions.checkNotNull(teamName, "Team name is null"); Preconditions.checkNotNull(targetName, "Target name is null");
component = component.replaceText(replace(teamName)); component = component.replaceText(replace(targetName));
break; break;
default: default:
ViaBackwards.getPlatform().getLogger().warning("Unknown parameter for chat decoration: " + element.getValue()); ViaBackwards.getPlatform().getLogger().warning("Unknown parameter for chat decoration: " + element.getValue());