@@ -548,13 +548,12 @@ public void addTS3Listeners(TS3Listener... listeners) {
548548 /**
549549 * Bans a client with a given client ID for a given time.
550550 * <p>
551- * Please note that this will create 2 or 3 separate ban rules,
551+ * Please note that this will create up to three separate ban rules,
552552 * one for the targeted client's IP address, one for their unique identifier,
553- * and potentially one more for their "myTeamSpeak" ID.
553+ * and potentially one more entry for their "myTeamSpeak" ID, if available .
554554 * </p><p>
555555 * <i>Exception:</i> If the banned client connects via a loopback address
556- * (i.e. {@code 127.0.0.1} or {@code localhost}), no IP ban is created
557- * and the returned array will only have 1 entry.
556+ * (i.e. {@code 127.0.0.1} or {@code localhost}), no IP ban is created.
558557 * </p>
559558 *
560559 * @param clientId
@@ -577,12 +576,12 @@ public CommandFuture<int[]> banClient(int clientId, long timeInSeconds) {
577576 /**
578577 * Bans a client with a given client ID for a given time for the specified reason.
579578 * <p>
580- * Please note that this will create two separate ban rules,
581- * one for the targeted client's IP address and their unique identifier.
579+ * Please note that this will create up to three separate ban rules,
580+ * one for the targeted client's IP address, one for their unique identifier,
581+ * and potentially one more entry for their "myTeamSpeak" ID, if available.
582582 * </p><p>
583583 * <i>Exception:</i> If the banned client connects via a loopback address
584- * (i.e. {@code 127.0.0.1} or {@code localhost}), no IP ban is created
585- * and the returned array will only have 1 entry.
584+ * (i.e. {@code 127.0.0.1} or {@code localhost}), no IP ban is created.
586585 * </p>
587586 *
588587 * @param clientId
@@ -592,7 +591,7 @@ public CommandFuture<int[]> banClient(int clientId, long timeInSeconds) {
592591 * @param reason
593592 * the reason for the ban, can be null
594593 *
595- * @return an array containing the IDs of the first and the second ban entry
594+ * @return an array containing the IDs of the created ban entries
596595 *
597596 * @throws TS3CommandFailedException
598597 * if the execution of a command fails
@@ -601,27 +600,27 @@ public CommandFuture<int[]> banClient(int clientId, long timeInSeconds) {
601600 * @see #addBan(String, String, String, long, String)
602601 */
603602 public CommandFuture <int []> banClient (int clientId , long timeInSeconds , String reason ) {
604- Command cmd = BanCommands .banClient (clientId , timeInSeconds , reason );
603+ Command cmd = BanCommands .banClient (Collections . singletonList ( clientId ) , timeInSeconds , reason , false );
605604 return executeAndReturnIntArray (cmd , "banid" );
606605 }
607606
608607 /**
609608 * Bans a client with a given client ID permanently for the specified reason.
610609 * <p>
611- * Please note that this will create two separate ban rules,
612- * one for the targeted client's IP address and their unique identifier.
610+ * Please note that this will create up to three separate ban rules,
611+ * one for the targeted client's IP address, one for their unique identifier,
612+ * and potentially one more entry for their "myTeamSpeak" ID, if available.
613613 * </p><p>
614614 * <i>Exception:</i> If the banned client connects via a loopback address
615- * (i.e. {@code 127.0.0.1} or {@code localhost}), no IP ban is created
616- * and the returned array will only have 1 entry.
615+ * (i.e. {@code 127.0.0.1} or {@code localhost}), no IP ban is created.
617616 * </p>
618617 *
619618 * @param clientId
620619 * the ID of the client
621620 * @param reason
622621 * the reason for the ban, can be null
623622 *
624- * @return an array containing the IDs of the first and the second ban entry
623+ * @return an array containing the IDs of the created ban entries
625624 *
626625 * @throws TS3CommandFailedException
627626 * if the execution of a command fails
@@ -633,6 +632,42 @@ public CommandFuture<int[]> banClient(int clientId, String reason) {
633632 return banClient (clientId , 0 , reason );
634633 }
635634
635+ /**
636+ * Bans multiple clients by their client ID for a given time for the specified reason.
637+ * <p>
638+ * Please note that this will create up to three separate ban rules for each client,
639+ * one for the targeted client's IP address, one for their unique identifier,
640+ * and potentially one more entry for their "myTeamSpeak" ID, if available.
641+ * </p><p>
642+ * <i>Exception:</i> If the banned client connects via a loopback address
643+ * (i.e. {@code 127.0.0.1} or {@code localhost}), no IP ban is created.
644+ * </p><p>
645+ * <i>Exception:</i> If two or more clients are connecting from the
646+ * same IP address, only one IP ban entry for that IP will be created.
647+ * </p>
648+ *
649+ * @param clientIds
650+ * the IDs of the clients to be banned
651+ * @param timeInSeconds
652+ * the duration of the ban in seconds. 0 equals a permanent ban
653+ * @param reason
654+ * the reason for the ban, can be null
655+ * @param continueOnError
656+ * if true, continue to the next client if banning one client fails, else do not create any bans on error
657+ *
658+ * @return an array containing the IDs of the created ban entries
659+ *
660+ * @throws TS3CommandFailedException
661+ * if the execution of a command fails
662+ * @querycommands 1
663+ * @see Client#getId()
664+ * @see #addBan(String, String, String, long, String)
665+ */
666+ public CommandFuture <int []> banClients (Collection <Integer > clientIds , long timeInSeconds , String reason , boolean continueOnError ) {
667+ Command cmd = BanCommands .banClient (clientIds , timeInSeconds , reason , continueOnError );
668+ return executeAndReturnIntArray (cmd , "banid" );
669+ }
670+
636671 /**
637672 * Sends a text message to all clients on all virtual servers.
638673 * These messages will appear to clients in the tab for server messages.
0 commit comments