3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-11-17 13:30:14 +01:00

Change read type of Teams packet display name

Dieser Commit ist enthalten in:
Nassim Jahnke 2023-03-13 09:54:09 +01:00
Ursprung fc565f8cd5
Commit 777059d652
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B
2 geänderte Dateien mit 9 neuen und 8 gelöschten Zeilen

Datei anzeigen

@ -63,6 +63,7 @@ public final class VBMappingDataLoader {
return packedData;
}
ViaBackwards.getPlatform().getLogger().info("Loading " + name + " from plugin folder");
try {
final CompoundTag fileData = NBTIO.readFile(file, false, false);
return mergeTags(packedData, fileData);

Datei anzeigen

@ -219,18 +219,18 @@ public class PlayerPacket1_13 extends RewriterBase<Protocol1_12_2To1_13> {
protocol.registerClientbound(ClientboundPackets1_13.TEAMS, new PacketHandlers() {
@Override
public void register() {
map(Type.STRING);
map(Type.BYTE);
map(Type.STRING); // Name
map(Type.BYTE); // Action
handler(wrapper -> {
byte action = wrapper.get(Type.BYTE, 0);
if (action == 0 || action == 2) {
String displayName = wrapper.read(Type.STRING);
displayName = ChatRewriter.jsonToLegacyText(displayName);
displayName = ChatUtil.removeUnusedColor(displayName, 'f');
if (displayName.length() > 32) {
displayName = displayName.substring(0, 32);
JsonElement displayName = wrapper.read(Type.COMPONENT);
String legacyTextDisplayName = displayName == null || displayName.isJsonNull() ? "" : ChatRewriter.jsonToLegacyText(displayName.toString());
legacyTextDisplayName = ChatUtil.removeUnusedColor(legacyTextDisplayName, 'f');
if (legacyTextDisplayName.length() > 32) {
legacyTextDisplayName = legacyTextDisplayName.substring(0, 32);
}
wrapper.write(Type.STRING, displayName);
wrapper.write(Type.STRING, legacyTextDisplayName);
byte flags = wrapper.read(Type.BYTE);
String nameTagVisibility = wrapper.read(Type.STRING);