mirror of
https://github.com/Vale54321/schafkopf-bot.git
synced 2025-12-18 12:39:34 +01:00
refactored a lot and added possibility to play games on DedicatedServer (#43)
This commit is contained in:
committed by
GitHub
parent
6259d0bef3
commit
cab2d36f48
@@ -0,0 +1,26 @@
|
||||
package org.schafkopf;
|
||||
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
/** Creates an Instance of the Backend Server. */
|
||||
public class HeartbeatSender {
|
||||
private static final int HEARTBEAT_INTERVAL = 15000; // 1 minute
|
||||
|
||||
private final DedicatedServerConnection client;
|
||||
|
||||
public HeartbeatSender(DedicatedServerConnection client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
/** Creates an Instance of the Backend Server. */
|
||||
public void start() {
|
||||
Timer timer = new Timer();
|
||||
timer.scheduleAtFixedRate(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
client.sendMessage("HEARTBEAT SYN"); // Send a heartbeat message
|
||||
}
|
||||
}, HEARTBEAT_INTERVAL, HEARTBEAT_INTERVAL);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user