geforkt von Mirrors/Velocity
We don't need to retain/release the mod list buffer in readModList
Dieser Commit ist enthalten in:
Ursprung
91b295ead5
Commit
cc89a2a1e5
@ -39,21 +39,18 @@ class LegacyForgeUtil {
|
||||
*/
|
||||
static List<ModInfo.Mod> readModList(PluginMessage message) {
|
||||
Preconditions.checkNotNull(message, "message");
|
||||
Preconditions
|
||||
.checkArgument(message.getChannel().equals(FORGE_LEGACY_HANDSHAKE_CHANNEL),
|
||||
Preconditions.checkArgument(message.getChannel().equals(FORGE_LEGACY_HANDSHAKE_CHANNEL),
|
||||
"message is not a FML HS plugin message");
|
||||
|
||||
ByteBuf byteBuf = message.content().retainedSlice();
|
||||
try {
|
||||
byte discriminator = byteBuf.readByte();
|
||||
|
||||
ByteBuf contents = message.content().slice();
|
||||
byte discriminator = contents.readByte();
|
||||
if (discriminator == MOD_LIST_DISCRIMINATOR) {
|
||||
ImmutableList.Builder<ModInfo.Mod> mods = ImmutableList.builder();
|
||||
int modCount = ProtocolUtils.readVarInt(byteBuf);
|
||||
int modCount = ProtocolUtils.readVarInt(contents);
|
||||
|
||||
for (int index = 0; index < modCount; index++) {
|
||||
String id = ProtocolUtils.readString(byteBuf);
|
||||
String version = ProtocolUtils.readString(byteBuf);
|
||||
String id = ProtocolUtils.readString(contents);
|
||||
String version = ProtocolUtils.readString(contents);
|
||||
mods.add(new ModInfo.Mod(id, version));
|
||||
}
|
||||
|
||||
@ -61,9 +58,6 @@ class LegacyForgeUtil {
|
||||
}
|
||||
|
||||
return ImmutableList.of();
|
||||
} finally {
|
||||
byteBuf.release();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren