Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Aug 16 15:31
    akaJonas opened #340
  • Aug 16 04:04
    essemX commented #294
  • Aug 02 14:28
    Rindula edited #339
  • Aug 02 14:27
    Rindula opened #339
  • Aug 02 01:10
    rogermb commented #338
  • Aug 02 01:07
    rogermb commented #337
  • Aug 02 01:04
    rogermb commented #336
  • Aug 02 00:54
    rogermb commented #335
  • Aug 02 00:41
    rogermb commented #330
  • Jul 31 18:33
    florian262000 commented #330
  • Jul 30 11:34
    NewJavaDeveloper closed #320
  • Jul 30 11:34
    NewJavaDeveloper reopened #320
  • Jul 30 11:34
    NewJavaDeveloper closed #320
  • Jul 30 11:04
    NewJavaDeveloper closed #331
  • Jul 30 11:04
    NewJavaDeveloper reopened #331
  • Jul 30 11:03
    NewJavaDeveloper closed #331
  • Jul 27 16:09
    Jareczeq opened #338
  • Jul 23 21:26
    KarlTheBee opened #337
  • Jul 23 00:33
    essemX opened #336
  • Jun 18 14:03
    PrinzKenny1 opened #335
florian262000
@florian262000
btw What has become of the Teamspeak 5 client?
Roger Baumgartner
@rogermb
No clue. If I recall correctly, they wanted to have a beta program out a whole year ago
florian262000
@florian262000
In February apparently 3 Beta Additions were distributed LUL
exylian
@exylian
Is there a way to get a response from an api command? Trying to get the id from a channel after i created it. As i know the server will return a response with the cId when the command was succesfull...
exylian
@exylian
okay nvm just saw that the method returns an integer :P
Aioanei Alexandru
@mrmalone
I built an application for a TeamSpeak server, and this application contains 3 timers and some instructions that update the records from the database from second to second. The application goes normally the first few minutes, the memory consumption gradually increases from 3.0% but stops at 29-30%, gradually increases without decreasing! And after about 5-6 minutes of operation, the application starts consuming 100% of the processor and its functions no longer work, or work hard.
What is wrong?

That is timer:
public class TimerActivity extends TimerTask {

@Override
public void run() {
    for(Client c : Load.api.getClients()) {
        if(!(c.isOutputMuted()) && c.isRegularClient()) {
            if(FSQL.Client.ClientExist(c.getUniqueIdentifier())) {
                try {
                FSQL.Client.uptodate("users", "timeon = timeon + 1", "uniqid = '"+c.getUniqueIdentifier()+"'");
                }catch (Exception e) {
                    e.printStackTrace();
                }
            }
            else {
                FSQL.Client.CreateClient(c.getUniqueIdentifier());
            }
        }
    }

}

}

And class FSQL:
public class Client extends Connection {

public static Object get(String whereresult, String where, String select, String database) {

    ResultSet rs = mysql.getResult("SELECT " + select + " FROM " + database + " WHERE " + where + "='" + whereresult + "'");
    try {
        if(rs.next()) {
            Object v = rs.getObject(select);
            return v;
        }
    } catch (SQLException e) {
        return "ERROR";
    }

    return "ERROR";
}

public static int getint(String whereresult, String where, String select, String database) {

    ResultSet rs = mysql.getResult("SELECT " + select + " FROM " + database + " WHERE " + where + "='" + whereresult + "'");
    try {
        if(rs.next()) {
            int v = rs.getInt(select);
            return v;
        }
    } catch (SQLException e) {
        return 0;
    }

    return 0;
}

public static boolean exist(String tabela, String conditie, String cautat) {
    try {

        ResultSet rs = mysql.getResult("SELECT * FROM "+tabela+" WHERE "+ conditie + "'");
        if (rs.next()) {
            return rs.getString(cautat) != null;
        }
    } catch (SQLException e) {
        e.printStackTrace();
    }
    return false;
}

public static void uptodate(String tabela, String setul, String conditia) {
    mysql.update("UPDATE "+tabela+" SET "+setul+" WHERE "+conditia); 
}

public static boolean ClientExist(String id)
{
    try {

            ResultSet rs = mysql.getResult("SELECT * FROM users WHERE uniqid= '" +id + "'");
        if(rs.next()) {
            return rs.getString("uniqid") !=null;
        }
    }catch (SQLException e) {
        e.printStackTrace();
    }
    return false;
}

public static void CreateClient(String id)
{
    mysql.update("INSERT INTO users(UNIQID, LEVEL, COINS) VALUES ('"+id+"','0','0')");
    mysql.update("INSERT INTO function(UNIQID, LANG) VALUES ('"+id+"','0')");
}

public static void CreateChannel(String id, String data, int idcanal)
{
    mysql.update("INSERT INTO channelsprivat(CLIENTID, DATE, CHID) VALUES ('"+id+"','"+data+"','"+idcanal+"')");
}

public static void CreateTag(int id)
{
    mysql.update("INSERT INTO tags(IDCHANAL) VALUES ('"+id+"')");
}

 public static Integer CheckMovePrivat(String id)

{
    int i = 0;
    try {
    ResultSet rs = mysql.getResult("SELECT pmv FROM function WHERE uniqid= '" +id + "'");
    if(!rs.next() || (Integer.valueOf(rs.getInt("pmv")) == null));
        i = rs.getInt("pmv");
        return i;
    }catch (SQLException e) {
        e.printStackTrace();
        }
    return 0;
 }

 public static Integer IDChanal(String id)

    {
        int i = 0;
        try {
        ResultSet rs = mysql.getResult("SELECT chid FROM channelsprivat WHERE clientid= '" +id + "'");
        if(!rs.next() || (Integer.valueOf(rs.getInt("chid")) == null));
            i = rs.getInt("chid");
            return i;
        }catch (SQLException e) {
            e.printStackTrace();
            }
        return 0;
     }

 public static Integer TimeActiv(String id)

    {
        int i = 0;
        try {
        ResultSet rs = mysql.getResult("SELECT timeon FROM users WHERE uniqid= '" +id + "'");
        if(!rs.next() || (Integer.valueOf(rs.getInt("timeon")) == null));
            i = rs.getInt("timeon");
            return i;
        }catch (SQLException e) {
            e.printStackTrace();
            }
        return 0;
     }

}

Roger Baumgartner
@rogermb
@mrmalone Pretty sure that the problem is that you're not closing your JDBC resources - i.e. it's a problem with your database code, not with our API. You need to call close on your Connections, (Prepared)Statements, and ResultSets
Sandro Kierner
@TAXSET

Sooo, I have a somewhat noobish question: When I create a temporary channel (using api.createChannel("SomeChannel", channelProperties);) with a delete delay of 10 (seconds), it is not getting deleted at all after the last user left it. I recall being able to get it working in a previous project, but since I've lost that, I'm unable to look up how.

These are my channel properties:

                HashMap<ChannelProperty, String> channelProperties = new HashMap<>();
                channelProperties.put(ChannelProperty.CHANNEL_FLAG_TEMPORARY, "1");
                channelProperties.put(ChannelProperty.CHANNEL_DELETE_DELAY, "10");
                channelProperties.put(ChannelProperty.CHANNEL_DESCRIPTION, "This is a private channel. You need to ask the owner for the password.");
                channelProperties.put(ChannelProperty.CHANNEL_CODEC_QUALITY, "6");
               // command[1] equals 'somepassword'
                channelProperties.put(ChannelProperty.CHANNEL_PASSWORD, command[1]);
               // Create the new channel as subchannel
                channelProperties.put(ChannelProperty.CPID, "1");

However, I did get it to delete itself after I terminated the APIs connection. So I thought it could be that the API is moved inside the channel during its creation, so I tried to move it back to the default channel using the following code:

api.moveClient(api.whoAmI().getId(), 1);

This did not throw any errors or warning but still did not get the channel to delete itself. I've now run out of ideas and hope you can help me figure out what's going on. Thanks already for any advice.

Sandro Kierner
@TAXSET

Okay, I got it working. I made a really dumb mistake: The temporary channel was created as a child of the default channel. As I discovered in a thread on the Teamspeak forum explaining the delete delay, I overlooked the following:

The server starts to count the seconds after the last user has left the channel and the timer resets when a user joins the channel or its subchannels. Yes, the delay checks for sub and parent channels.

So I changed the parent channel ID to another channel and et voilà, the channel gets deleted.

Roger Baumgartner
@rogermb

So I thought it could be that the API is moved inside the channel during its creation

Yup, the TS3 server automatically moves the query into the newly created channel. This is to prevent a temporary channel without a deletion delay from being deleted immediately after its creation due to being empty :smile:

The server starts to count the seconds after the last user has left the channel and the timer resets when a user joins the channel or its subchannels. Yes, the delay checks for sub and parent channels.

So I changed the parent channel ID to another channel and et voilà, the channel gets deleted.

Interesting! I had no idea that this is how delete_delay worked :smile:

Jakob
@Jakob_Soron_twitter
public void onClientMoved(ClientMovedEvent e) {
                if(e.getTargetChannelId() == 3) {
                    final Map<ChannelProperty, String> OPTION = new HashMap<>();
                    OPTION.put(ChannelProperty.CHANNEL_FLAG_TEMPORARY, "1");
                    OPTION.put(ChannelProperty.CHANNEL_DELETE_DELAY, "10*60*1000");
                    OPTION.put(ChannelProperty.CPID, "3");
                    Load.api.createChannel("Sub", OPTION);
                }
}
why does this function give me this error?
2019-08-20 16:04:36.811 [DEBUG] TS3 command error: {msg=convert error, id=1540}
2019-08-20 16:04:36.815 [ERROR] Event listener threw an exception
com.github.theholywaffle.teamspeak3.api.exception.TS3CommandFailedException: A "channelcreate" command returned with a server error.
>> convert error (ID 1540)
    at com.github.theholywaffle.teamspeak3.api.CommandFuture.checkForFailure(CommandFuture.java:415)
    at com.github.theholywaffle.teamspeak3.api.CommandFuture.getUninterruptibly(CommandFuture.java:356)
    at com.github.theholywaffle.teamspeak3.TS3Api.createChannel(TS3Api.java:709)
    at endside.jb.main.events$1.onClientMoved(events.java:98)
    at com.github.theholywaffle.teamspeak3.api.event.ClientMovedEvent.fire(ClientMovedEvent.java:56)
    at com.github.theholywaffle.teamspeak3.EventManager$ListenerTask.run(EventManager.java:169)
    at com.github.theholywaffle.teamspeak3.TS3Query.lambda$submitUserTask$0(TS3Query.java:232)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Roger Baumgartner
@rogermb
Because CHANNEL_DELETE_DELAY expects some numeric value, and "10*60*1000" is not a valid number :smile:
Try String.valueOf(10*60*1000)
Jakob
@Jakob_Soron_twitter
2019-08-20 19:21:47.951 [DEBUG] TS3 command error: {msg=insufficient client permissions, id=2568, failed_permid=104}
2019-08-20 19:21:47.953 [ERROR] Event listener threw an exception
com.github.theholywaffle.teamspeak3.api.exception.TS3CommandFailedException: A "channelcreate" command returned with a server error.
>> insufficient client permissions (ID 2568), failed permission with ID 104
    at com.github.theholywaffle.teamspeak3.api.CommandFuture.checkForFailure(CommandFuture.java:415)
    at com.github.theholywaffle.teamspeak3.api.CommandFuture.getUninterruptibly(CommandFuture.java:356)
    at com.github.theholywaffle.teamspeak3.TS3Api.createChannel(TS3Api.java:709)
    at endside.jb.main.events$1.onTextMessage(events.java:128)
    at com.github.theholywaffle.teamspeak3.api.event.TextMessageEvent.fire(TextMessageEvent.java:69)
    at com.github.theholywaffle.teamspeak3.EventManager$ListenerTask.run(EventManager.java:169)
    at com.github.theholywaffle.teamspeak3.TS3Query.lambda$submitUserTask$0(TS3Query.java:232)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
wont work either
and the bot got the admin server query
Roger Baumgartner
@rogermb
Did you remember to call the login method?
Or set the login credentials in your TS3Config
Also, the permission you're failing is 104, i.e. i_channel_create_modify_with_temp_delete_delay, so this does make sense. Make sure that your query actually has that permission set
Jakob
@Jakob_Soron_twitter
got the problem the permission is set to a really low value, which you need to increase
Jakob
@Jakob_Soron_twitter
@rogermb do you do german support?
Roger Baumgartner
@rogermb
The language of this channel is English, so I'm afraid I don't
Jakob
@Jakob_Soron_twitter
Could you give me an example how i can create a channel if some channels are taken by one or more people?
Roger Baumgartner
@rogermb
What do you mean by "taken by one or more people" here?
Jakob
@Jakob_Soron_twitter
that some people are in these channel
Roger Baumgartner
@rogermb
So correct me if I'm wrong: your question is about channels with identical names?
Or what exactly stops you from just creating the channels you want?
Jakob
@Jakob_Soron_twitter
i want only the needed channels
Roger Baumgartner
@rogermb
So in other words, you want to delete all empty channels?
Jakob
@Jakob_Soron_twitter
yeah and create them if needed
Roger Baumgartner
@rogermb
Delete all empty channels: Just make them temporary channels
Create 1 channel per client? Add an event listener that creates a channel when a client joins the server
I probably still didn't quite understand the exact problem you're trying to solve :sweat_smile:
Jakob
@Jakob_Soron_twitter
ok thanks thats why i asked for german
Roger Baumgartner
@rogermb
Oh, I think I'm starting to understand what the problem is. So for example, you have some channels for each game, e.g.
SomeGame_Channel1, SomeGame_Channel2, etc.
And you want to create a new channel SomeGame_ChannelN if all previous N+1 channels contain clients
Correct?
Jakob
@Jakob_Soron_twitter
yeah
Roger Baumgartner
@rogermb
Hmm, in that case I'd just run some "fix everything" method every time an event occurs that could lead to a client joining or leaving a channel
i.e. onClientJoin, onClientLeave, onClientMoved
And in that "fix everything" method, you could get a list of all channels using TS3Api#getChannels
Jakob
@Jakob_Soron_twitter
could you give me some example code ?
Roger Baumgartner
@rogermb
Then
  1. Remove all channels from that list that you don't care about (all channels except for channels "SomeGame_ChannelN" for some N)
  2. Sort by N
  3. Check if all channels [except for one] contain clients and there are no "holes", i.e. you always have successive channels "SomeGame_ChannelN-1", "SomeGame_ChannelN", "SomeGame_ChannelN+1"
If everything is alright, don't do anything. If something's not right:
  • Delete all empty channels except for one
  • Rename the channels to "SomeGame_ChannelN" for the right value "N"
Hmm, but I'm not sure if the whole renaming stuff is really such a good idea. Users would probably get a "your channel has been edited" notification
Sooo.... ¯\_(ツ)_/¯
Jakob
@Jakob_Soron_twitter
thanks for your help
Roger Baumgartner
@rogermb
You're welcome :smile: