@@ -95,32 +95,68 @@ public TS3ApiAsync(TS3Query query) {
95
95
}
96
96
97
97
/**
98
- * Adds a new ban entry. At least one of the parameters {@code ip}, {@code name} or {@code uid} needs to be not null.
99
- * Returns the ID of the newly created ban.
98
+ * Adds a new ban entry. At least one of the parameters {@code ip}, {@code name} or {@code uid} needs to be non- null.
99
+ * Returns the ID of the newly created ban entry .
100
100
*
101
101
* @param ip
102
- * a RegEx pattern to match a client's IP against, can be null
102
+ * a RegEx pattern to match a client's IP against, can be {@code null}
103
103
* @param name
104
- * a RegEx pattern to match a client's name against, can be null
104
+ * a RegEx pattern to match a client's name against, can be {@code null}
105
105
* @param uid
106
- * the unique identifier of a client, can be null
106
+ * the unique identifier of a client, can be {@code null}
107
107
* @param timeInSeconds
108
108
* the duration of the ban in seconds. 0 equals a permanent ban
109
109
* @param reason
110
- * the reason for the ban, can be null
110
+ * the reason for the ban, can be {@code null}
111
111
*
112
112
* @return the ID of the newly created ban entry
113
113
*
114
114
* @throws TS3CommandFailedException
115
115
* if the execution of a command fails
116
116
* @querycommands 1
117
117
* @see Pattern RegEx Pattern
118
+ * @see #addBan(String, String, String, String, long, String)
118
119
* @see Client#getId()
119
120
* @see Client#getUniqueIdentifier()
120
121
* @see ClientInfo#getIp()
121
122
*/
122
123
public CommandFuture <Integer > addBan (String ip , String name , String uid , long timeInSeconds , String reason ) {
123
- Command cmd = BanCommands .banAdd (ip , name , uid , timeInSeconds , reason );
124
+ return addBan (ip , name , uid , null , timeInSeconds , reason );
125
+ }
126
+
127
+ /**
128
+ * Adds a new ban entry. At least one of the parameters {@code ip}, {@code name}, {@code uid}, or
129
+ * {@code myTSId} needs to be non-null. Returns the ID of the newly created ban entry.
130
+ * <p>
131
+ * Note that creating a ban entry for the {@code "empty"} "myTeamSpeak" ID will ban all clients who
132
+ * don't have a linked "myTeamSpeak" account.
133
+ * </p>
134
+ *
135
+ * @param ip
136
+ * a RegEx pattern to match a client's IP against, can be {@code null}
137
+ * @param name
138
+ * a RegEx pattern to match a client's name against, can be {@code null}
139
+ * @param uid
140
+ * the unique identifier of a client, can be {@code null}
141
+ * @param myTSId
142
+ * the "myTeamSpeak" ID of a client, the string {@code "empty"}, or {@code null}
143
+ * @param timeInSeconds
144
+ * the duration of the ban in seconds. 0 equals a permanent ban
145
+ * @param reason
146
+ * the reason for the ban, can be {@code null}
147
+ *
148
+ * @return the ID of the newly created ban entry
149
+ *
150
+ * @throws TS3CommandFailedException
151
+ * if the execution of a command fails
152
+ * @querycommands 1
153
+ * @see Pattern RegEx Pattern
154
+ * @see Client#getId()
155
+ * @see Client#getUniqueIdentifier()
156
+ * @see ClientInfo#getIp()
157
+ */
158
+ public CommandFuture <Integer > addBan (String ip , String name , String uid , String myTSId , long timeInSeconds , String reason ) {
159
+ Command cmd = BanCommands .banAdd (ip , name , uid , myTSId , timeInSeconds , reason );
124
160
return executeAndReturnIntProperty (cmd , "banid" );
125
161
}
126
162
@@ -504,8 +540,9 @@ public void addTS3Listeners(TS3Listener... listeners) {
504
540
/**
505
541
* Bans a client with a given client ID for a given time.
506
542
* <p>
507
- * Please note that this will create two separate ban rules,
508
- * one for the targeted client's IP address and their unique identifier.
543
+ * Please note that this will create 2 or 3 separate ban rules,
544
+ * one for the targeted client's IP address, one for their unique identifier,
545
+ * and potentially one more for their "myTeamSpeak" ID.
509
546
* </p><p>
510
547
* <i>Exception:</i> If the banned client connects via a loopback address
511
548
* (i.e. {@code 127.0.0.1} or {@code localhost}), no IP ban is created
@@ -517,7 +554,7 @@ public void addTS3Listeners(TS3Listener... listeners) {
517
554
* @param timeInSeconds
518
555
* the duration of the ban in seconds. 0 equals a permanent ban
519
556
*
520
- * @return an array containing the IDs of the first and the second ban entry
557
+ * @return an array containing the IDs of the created ban entries
521
558
*
522
559
* @throws TS3CommandFailedException
523
560
* if the execution of a command fails
0 commit comments