|
24 | 24 | */ |
25 | 25 | package org.spongepowered.common.ipforward.velocity; |
26 | 26 |
|
| 27 | +import com.google.common.collect.ImmutableMultimap; |
27 | 28 | import com.google.common.net.InetAddresses; |
28 | 29 | import com.mojang.authlib.GameProfile; |
29 | 30 | import com.mojang.authlib.properties.Property; |
| 31 | +import com.mojang.authlib.properties.PropertyMap; |
30 | 32 | import io.netty.buffer.ByteBuf; |
31 | 33 | import net.kyori.adventure.text.Component; |
32 | 34 | import net.minecraft.network.Connection; |
@@ -135,18 +137,20 @@ public static InetAddress readAddress(final ChannelBuf buf) { |
135 | 137 | } |
136 | 138 |
|
137 | 139 | public static GameProfile createProfile(final ChannelBuf buf) { |
138 | | - final GameProfile profile = new GameProfile(buf.readUniqueId(), ((FriendlyByteBuf) buf).readUtf(16)); // TODO: ChannelBuf length-limited strings |
139 | | - VelocityForwardingInfo.readProperties(buf, profile); |
140 | | - return profile; |
| 140 | + // TODO: ChannelBuf length-limited strings |
| 141 | + return new GameProfile(buf.readUniqueId(), ((FriendlyByteBuf) buf).readUtf(16), VelocityForwardingInfo.readProperties(buf)); |
141 | 142 | } |
142 | 143 |
|
143 | | - private static void readProperties(final ChannelBuf buf, final GameProfile profile) { |
| 144 | + private static PropertyMap readProperties(final ChannelBuf buf) { |
| 145 | + final ImmutableMultimap.Builder<String, Property> propertiesBuilder = ImmutableMultimap.builder(); |
144 | 146 | final int properties = buf.readVarInt(); |
145 | 147 | for (int i1 = 0; i1 < properties; i1++) { |
146 | 148 | final String name = buf.readString(); |
147 | 149 | final String value = buf.readString(); |
148 | 150 | final String signature = buf.readBoolean() ? buf.readString() : null; |
149 | | - profile.properties().put(name, new Property(name, value, signature)); |
| 151 | + propertiesBuilder.put(name, new Property(name, value, signature)); |
150 | 152 | } |
| 153 | + final ImmutableMultimap<String, Property> propertiesMap = propertiesBuilder.build(); |
| 154 | + return new PropertyMap(propertiesMap); |
151 | 155 | } |
152 | 156 | } |
0 commit comments