From a51711e4bb59b4c59a9e3980cfba049a22c470f2 Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Sat, 12 Apr 2025 16:20:07 +0100 Subject: [PATCH] Use an ImmutableList Builder --- .../proxy/protocol/util/PluginMessageUtil.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/util/PluginMessageUtil.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/util/PluginMessageUtil.java index 800ca5df..76d6f727 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/util/PluginMessageUtil.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/util/PluginMessageUtil.java @@ -112,7 +112,7 @@ public final class PluginMessageUtil { } String payload = message.content().toString(StandardCharsets.UTF_8); String[] channels = payload.split("\0"); - List channelIdentifiers = new ArrayList<>(); + ImmutableList.Builder channelIdentifiers = ImmutableList.builderWithExpectedSize(channels.length); try { for (String channel : channels) { if (protocolVersion.noLessThan(ProtocolVersion.MINECRAFT_1_13)) { @@ -128,7 +128,7 @@ public final class PluginMessageUtil { throw ILLEGAL_CHANNEL; } } - return ImmutableList.copyOf(channelIdentifiers); + return channelIdentifiers.build(); } /**