completed switch to UDP featuring ingame chat support again

This commit is contained in:
jenzur
2020-07-03 22:50:21 +02:00
parent 91bb936ebb
commit 4cc380a1ff
3 changed files with 30 additions and 44 deletions
@@ -31,17 +31,11 @@ import org.javacord.api.DiscordApiBuilder;
* @author install1
*/
public class DiscordHandler {
public static class update_autismo_ingame_msgs extends TimerTask {
@Override
public void run() {
Datahandler.instance.update_autismo_mysql();
}
}
public static void main(String[] args) {
System.setProperty("java.util.concurrent.ForkJoinPool.common.parallelism", "15");
try {
Datahandler.instance.initiateMYSQL();
//nohup screen -d -m -S nonroot java -Xmx6900M -jar /home/javatests/ArtificialAutism-1.0.jar
//uncomment db fetch when ready, just keep the comment for future reference
System.out.println("finished initiating MYSQL");
} catch (SQLException | IOException ex) {
@@ -56,13 +50,13 @@ public class DiscordHandler {
Datahandler.instance.updateStringCache();
String token = "NTI5NzAxNTk5NjAyMjc4NDAx.Dw0vDg.7-aMjVWdQMYPl8qVNyvTCPS5F_A";
DiscordApi api = new DiscordApiBuilder().setToken(token).login().join();
Timer timer = new Timer();
timer.scheduleAtFixedRate(new update_autismo_ingame_msgs(), 700, 700);
new Thread(() -> {
Datahandler.instance.update_autismo_socket_msg();
}).start();
api.addMessageCreateListener(event -> {
if (!FunctionLayer.DoStuff.isOccupied()) {
FunctionLayer.DoStuff.doStuff(event, api);
}
});
}
}