From 539c4e696a6fbe1084ab254e3f0e7241f1b62299 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Sun, 6 Mar 2022 15:41:51 +0100 Subject: [PATCH] Fix long scoreboard objective names for <1.18 clients --- .../Protocol1_17_1To1_18.java | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_17_1to1_18/Protocol1_17_1To1_18.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_17_1to1_18/Protocol1_17_1To1_18.java index 5df1b8d7..8ccdf706 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_17_1to1_18/Protocol1_17_1To1_18.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_17_1to1_18/Protocol1_17_1To1_18.java @@ -26,6 +26,7 @@ import com.viaversion.viabackwards.protocol.protocol1_17_1to1_18.packets.EntityP import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.api.minecraft.RegistryType; import com.viaversion.viaversion.api.minecraft.entities.Entity1_17Types; +import com.viaversion.viaversion.api.protocol.remapper.PacketHandler; import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper; import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.data.entity.EntityTrackerBase; @@ -88,6 +89,49 @@ public final class Protocol1_17_1To1_18 extends BackwardsProtocol { + final String s = wrapper.get(Type.STRING, index); + if (s.length() > maxLength) { + wrapper.set(Type.STRING, index, s.substring(0, maxLength)); + } + }; } @Override