channel.getTotalClients() showing wrong numbers
My bot gives me -1 as client value, but we are 4 clients in the channel.
I use the latest API version.
I'm not sure what the purpose of the TOTAL_CLIENTS flag in the teamspeak api is, but it wouldn't surprise me if it has some obscure function aside from conveying the number of clients in a channel. For this java wrapper api, the Channel objects aren't updated all the time, nor are client objects, as they are merely local java representations of the channel or client at a particular instant. You'll want to make sure that you have the most up-to-date info by calling TS3Api#getChannels() or #getChannelByName, or whatever method you choose, then perhaps that method will return a useful value. I'm more partial to using TS3Api#getClients(), then filtering by channel instead, since I will use other client info, but I don't know what your intent is for that information.
it was intended, if someone has a music bot in the channel, that this, if all other users leave the channel, he was moved back to his home.
Have solved it so:
public static void moveTeamBots() {
for (Client clients : Main.api.getClients()) {
if (clients.isInServerGroup(GroupIdService.teammusic) && (clients.getChannelId() != ChannelIdService.musikAfkChannel_ID)) {
String tmp = "alone";
for (Client clients2 : Main.api.getClients()) {
if (!clients2.isInServerGroup(GroupIdService.teammusic)) {
if (clients.getChannelId() == clients2.getChannelId()) {
tmp = "not";
}
}
}
if (tmp.equalsIgnoreCase("alone")) Main.api.moveClient(clients.getId(),
ChannelIdService.musikAfkChannel_ID);
}
}
}
i know, funny way to solve my problem xD