Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Nov 24 11:56
    PrinzKenny1 closed #335
  • Nov 18 20:43
    Likqez commented #343
  • Nov 17 14:32
    Likqez commented #343
  • Nov 17 09:55
    Likqez commented #343
  • Nov 16 17:21
    rogermb commented #343
  • Nov 15 18:27
    Likqez commented #343
  • Nov 13 18:07
    Likqez reopened #343
  • Nov 13 18:07
    Likqez commented #343
  • Nov 11 13:04
    Likqez closed #343
  • Nov 11 13:04
    Likqez commented #343
  • Nov 10 22:56
    rogermb commented #340
  • Nov 10 22:56
    rogermb labeled #340
  • Nov 10 22:51
    rogermb commented #343
  • Nov 10 22:48
    Likqez commented #340
  • Nov 10 22:47
    Likqez edited #343
  • Nov 10 22:47
    Likqez edited #343
  • Nov 10 22:47
    Likqez edited #343
  • Nov 10 22:46
    Likqez edited #343
  • Nov 10 22:46
    Likqez opened #343
  • Nov 10 15:05
    Rindula closed #339
JenkePlays
@JenkePlays_twitter
ohhh, iam stupid :D
JenkePlays
@JenkePlays_twitter
How can i get the idle time of a player ?
OVer the Clientinfo ?
Roger Baumgartner
@rogermb
Dude, you're really starting to stretch it. I'm not your personal "google" - use your own brain.
If you're using an IDE, type "idle" and look for any suggestions. If you don't have an IDE, open the file ClientInfo.java and use a search function to look for "idle"
JenkePlays
@JenkePlays_twitter
Thx
Henny022
@Henny022
if you want to work with command args, this is a very nice solution
´´´String args[] = message.split(" ");´´´
String args[] = message.split(" ");
kreidlerflorett
@kreidlerflorett

@rogermb

This wouldn't happen if the API just set overwrite=1 instead of 0. However, I was (probably being overly cautious) afraid of a CRC32 hash collision happening. Basically, I wanted to exclude the possibility of people uploading an icon to the TS3 server which didn't already exist on there and it removing / changing an existing icon to that uploaded icon. At least this way you know that a "collision" has happened and can take the appropriate steps to resolve it

Hmmm, I have sometime problems with the CRC32. How do you mean that with overwrite=1?

How could I do that?
Roger Baumgartner
@rogermb
If you get a collision, you're most likely trying to upload the same icon twice.
Overwriting is in almost every situation the wrong response
JoKer96 | 😴
@JoKer96__twitter

Hey there, i have another Problem.
I try to create a Subchannel, move a client, from the channel above in the subchannel, change the channel to a temporary one and give the client a specific channel group.
But it won't work, the channel is created, and modified to a temporary one, but noething more...
Here is my Code:

// ---- Channel Creation ----
System.out.println("Create Channel");
// Let's customize our channel
final HashMap<ChannelProperty, String> properties = new HashMap<ChannelProperty, String>();
// Make it a permanent channel
properties.put(ChannelProperty.CHANNEL_FLAG_PERMANENT, "1");
// Make it a subchannel of the channel, the user joint.
int mainChannel = headChannelId;
properties.put(ChannelProperty.CPID, String.valueOf(mainChannel));

// Create the (sub-)channel
String name = "";
try {
    name = Core.asyncApi.getChannelInfo(headChannelId).get().getName() + " Ch1";
} catch (InterruptedException ex) {
    ex.printStackTrace();
}

Core.asyncApi.createChannel(name, properties);

// ---- Move user to the created (sub-)channel ----
System.out.println("Move User");
int newChannelId = -1;
try {
newChannelId = Core.asyncApi.getChannelByNameExact(name, false).get().getId();
} catch (InterruptedException ex) {
ex.printStackTrace();
}

if (newChannelId != -1) {
    Core.asyncApi.moveClient(clientId, newChannelId);
}

// ---- Make the channel temporary ----
System.out.println("Make Channel temporary");
HashMap<ChannelProperty, String> newProperties = new HashMap<ChannelProperty, String>();

newProperties.put(ChannelProperty.CHANNEL_FLAG_PERMANENT, "0");
newProperties.put(ChannelProperty.CHANNEL_FLAG_TEMPORARY, "1");

Core.asyncApi.editChannel(newChannelId, newProperties);

// ---- Set the channel-group for the user ----
System.out.println("Set the Channelgroup");
int channelGroupId = 28;
int channelId = newChannelId;
int clientDBId = clientId;

Core.asyncApi.setClientChannelGroup(channelGroupId, channelId, clientDBId);

// ---- Done ----

Maybe you can help me out?

The code again, this time on hastebin... https://hastebin.com/ekapusibik.cs
Roger Baumgartner
@rogermb
Dude, why are you using the asynchronous API like this??
Core.asyncApi.createChannel(name, properties);
is not done when you call
newChannelId = Core.asyncApi.getChannelByNameExact(name, false).get().getId();
And createChannel already returns the ID of the new channel, so that second API call is unnecessary
The whole channel properties map also isn't needed. New channels are temporary by default.
Seriously, just use the normal synchronous API in your code and your problems will magically solve temselves :stuck_out_tongue:
Henny022
@Henny022
is there something like a syncronize() method in the async API?
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