Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 23 22:08
    DevJoey opened #348
  • Jan 08 16:25
    yannicklamprecht commented #347
  • Jan 08 15:50
    PhillTV edited #347
  • Jan 08 15:49
    PhillTV opened #347
  • Jan 05 17:28
    ololjvNek closed #346
  • Jan 04 16:48
    ololjvNek commented #346
  • Jan 04 16:28
    yannicklamprecht commented #346
  • Jan 04 16:04
    ololjvNek commented #346
  • Jan 04 15:28
    yannicklamprecht commented #346
  • Jan 04 14:41
    ololjvNek edited #346
  • Jan 04 14:39
    ololjvNek opened #346
  • Dec 21 2019 01:57
    CookieArmy closed #344
  • Dec 21 2019 01:57
    CookieArmy commented #344
  • Dec 17 2019 16:12
    CookieArmy commented #344
  • Dec 17 2019 15:22
    rogermb commented #344
  • Dec 17 2019 15:22
    rogermb commented #344
  • Dec 17 2019 15:22
    rogermb labeled #344
  • Dec 17 2019 15:20
    rogermb closed #345
  • Dec 17 2019 15:20
    rogermb commented #345
  • Dec 17 2019 15:20
    rogermb labeled #345
Roger Baumgartner
@rogermb
What do you need to do exactly?
@Henny022
Henny022
@Henny022
if i got that right, the async api does not wait for an anwser bevor continuing with the code, so i can send multiple commands at the same time
so is there a method, that waits, untill i got al the anwsers from the server, bevor continuing with the code
Roger Baumgartner
@rogermb
Call .get() or .getUninterruptibly() on the last command you've sent
Both of these will wait until the answer to the command has arrived and return that answer. One of them throws an InterruptedException if an interrupt occurs, the other doesn't
Oh, and both of these also have a method that accepts a timeout value, so your code doesn't just hang forever if no answer from the server arrives
Henny022
@Henny022
ok thanks
Cpt. Corner
@Cpt_Corner_twitter
Is there a way to give the query like a "body", so it is displayed on the TS3 Server like a normal user? I need that to make sure every user can send Private Messages to the Bot.
Henny022
@Henny022
not by default, because it is a querry, not a client.
Cpt. Corner
@Cpt_Corner_twitter
Yea I know, but is there maybe a workaround for this problem?
Henny022
@Henny022
there is an option in the ts3 client, to show querrys, but everyone has to enable that themself
you could do someting like write to every client when they join, so they have a chat tab open
you could make a normal client with a plugin or something else, to function as an interface for the querry
Cpt. Corner
@Cpt_Corner_twitter
Mhm okay. I will propably go for the "write to everyone"-option. Thanks. :)
Henny022
@Henny022
no problem
JoKer96 | 😴
@JoKer96__twitter
Hey there, is there is a simpler way to check if a channel is empty than this: api.getChannelByNameExact(api.getChannelInfo(id).getName(), false).isEmpty()
Roger Baumgartner
@rogermb
There's a small problem with the channelinfo command - it doesn't actually tell us how many clients are in this channel. Only the data sent back with the channellist command contains this info
The only thing you can check directly from a ChannelInfo object is whether the channel and all subchannels of this channel are empty. If your channel doesn't have any child channels, then you can just use isFamilyEmpty to access this information
@JoKer96__twitter
JoKer96 | 😴
@JoKer96__twitter
Okey, thank you for this information
Invicjusz To Kurwa
@dekros987
hello guys i have problem, in this line: name.equalsIgnoreCase(getCore().getApi().getChannelInfo(channelID).getName())
error: java.lang.NullPointerException [2017-02-19 23:30:00.053] [SEVERE] TS3 command error: {msg=invalid channelID, id=768}
but getCore() is not null, getApi() is not null and channelID is 234 no 768;/
Roger Baumgartner
@rogermb

getCore().getApi().getChannelInfo(channelID)

returns null because there is no channel on the server with the channel ID you've provided, which leads to the error.
Are you absolutely sure that the channelID you're using is correct and not some kind of database ID?

Invicjusz To Kurwa
@dekros987
Yea f.e when i make this:
int channelID = CHANNELS.get(i - 1);
name = channelID + " channel";
System.out.println(channelID);
if (name.equalsIgnoreCase(getCore().getApi().getChannelInfo(channelID).getName())) {
continue;
}
and CHANNELS is: public List<Integer> CHANNELS = Arrays.asList(new Integer[]{246, 247, 248, 249});
is all work and System.out print correct value But when i move this list to myConfig and make
getConfig().CHANNELS.get(i-1); System.out print still good number, but getChannelInfo() return null;/
Invicjusz To Kurwa
@dekros987

I have one question why when i register this event:
getApi().addTS3Listeners(new TS3Listener() {
and here when try system.out.println
@Override
public void onClientJoin(ClientJoinEvent cje) {
System.out.println("JOIN");
}

In the console, nothing was printer, what is reason? ofc i make api.registerAllEvents(); before addTS3Listeners, and f.e ClientMovedEvent work

Roger Baumgartner
@rogermb
ClientJoinEvent fires when a client joins the server, not a channel
Invicjusz To Kurwa
@dekros987
yes i know but when i join to the server, nothing was printed
Roger Baumgartner
@rogermb
Huh, that's weird
Roger Baumgartner
@rogermb
Everything is working fine for me, so it's likely either a very subtle bug in the API or a problem with your code. Could you upload more of your code to gist.github.com (or similar) so I can check out what could be going on?
Invicjusz To Kurwa
@dekros987
ofc give me 5minutes
https://gist.github.com/dekros987/2dac721712cbd4968e2c43f486cacf9e and registerListener is: getCore().getApi().addTS3Listeners(listener);
and this print System.out.println("Move channel"); work but this: System.out.println("JoinClient"); not :D
Roger Baumgartner
@rogermb
Very interesting. As an aside: You can use new TS3EventAdapter() { instead of new TS3Listener() {
Then you can remove all of those empty method stubs
Invicjusz To Kurwa
@dekros987
ok i replace this, but when i put this registerListener(..content...); in other class this onClientJoin now work :D
Roger Baumgartner
@rogermb
Wait, what exactly did you change?
Invicjusz To Kurwa
@dekros987
hmm, when i make more than one new Ts3EventAdapter() f.e in two class, the events will be merge? or override?
Roger Baumgartner
@rogermb
Both listeners will fire
    api.addTS3Listeners(new TS3EventAdapter() {
        @Override
        public void onClientJoin(ClientJoinEvent e) {
            System.out.println("Join");
        }
    });
    api.addTS3Listeners(new TS3EventAdapter() {
        @Override
        public void onClientLeave(ClientLeaveEvent e) {
            System.out.println("Leave");
        }
    });

and

    api.addTS3Listeners(new TS3EventAdapter() {
        @Override
        public void onClientJoin(ClientJoinEvent e) {
            System.out.println("Join");
        }

        @Override
        public void onClientLeave(ClientLeaveEvent e) {
            System.out.println("Leave");
        }
    });

are equivalent, as well.

Invicjusz To Kurwa
@dekros987
Roger Baumgartner
@rogermb
Wait, so you fixed the problem and now it's broken again? :stuck_out_tongue:
Invicjusz To Kurwa
@dekros987
no i think i fixed but i make mistake in debug :D
i don't know why but when i remove in Main class addTs3Listener, otther listener now work but when i add in Main class addTs3listener which save data to redis, other listener stop work XD
Roger Baumgartner
@rogermb
Could it be that one of your event listeners just never completes?
EventManager#fireEvent:
TS3Event event = createEvent(notifyName, notifyBody);
for (final TS3Listener listener : listeners) {
    event.fire(listener);
}
So in case one of your event listeners doesn't complete, this method will just hang forever
Invicjusz To Kurwa
@dekros987
i will check this
Invicjusz To Kurwa
@dekros987
why when i use in ClientJoinEvent: System.out.println("Client join: " + e.getInvokerName());
in console i see "Client join: " when name is null?
Roger Baumgartner
@rogermb
ClientJoinEvent doesn't have an invoker
An invoker is an external client that caused the event to happen
No other client can make you join a server