From c3d10bd410e98d9be097bfcb459f8b35b3044041 Mon Sep 17 00:00:00 2001 From: Timon Seidel Date: Sun, 30 Mar 2025 19:49:36 +0200 Subject: [PATCH] feat: add function to directly pass collections in ServerPing.Builder (#1538) --- .../api/proxy/server/ServerPing.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/api/src/main/java/com/velocitypowered/api/proxy/server/ServerPing.java b/api/src/main/java/com/velocitypowered/api/proxy/server/ServerPing.java index f927228e..9a27dc05 100644 --- a/api/src/main/java/com/velocitypowered/api/proxy/server/ServerPing.java +++ b/api/src/main/java/com/velocitypowered/api/proxy/server/ServerPing.java @@ -14,6 +14,7 @@ import com.velocitypowered.api.util.Favicon; import com.velocitypowered.api.util.ModInfo; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collection; import java.util.List; import java.util.Objects; import java.util.Optional; @@ -196,7 +197,7 @@ public final class ServerPing { /** * Uses the modified {@code players} array in the response. * - * @param players array of SamplePlayers to set + * @param players array of SamplePlayers to add * @return this builder, for chaining */ public Builder samplePlayers(SamplePlayer... players) { @@ -204,6 +205,17 @@ public final class ServerPing { return this; } + /** + * Uses the modified {@code players} collection in the response. + * + * @param players collection of SamplePlayers to add + * @return this builder, for chaining + */ + public Builder samplePlayers(Collection players) { + this.samplePlayers.addAll(players); + return this; + } + /** * Uses the modified {@code modType} in the response. *