Implemented player menu with kick option (untested)
This commit is contained in:
@@ -9,11 +9,13 @@ import io.anuke.mindustry.net.Net.SendMode;
|
||||
import io.anuke.mindustry.net.Net.ServerProvider;
|
||||
import io.anuke.mindustry.net.Packets.Connect;
|
||||
import io.anuke.mindustry.net.Packets.Disconnect;
|
||||
import io.anuke.mindustry.net.Packets.KickPacket;
|
||||
import io.anuke.mindustry.net.Registrator;
|
||||
import io.anuke.mindustry.net.Streamable;
|
||||
import io.anuke.mindustry.net.Streamable.StreamBegin;
|
||||
import io.anuke.mindustry.net.Streamable.StreamChunk;
|
||||
import io.anuke.ucore.UCore;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
@@ -99,6 +101,18 @@ public class KryoServer implements ServerProvider {
|
||||
return connections;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void kick(int connection) {
|
||||
Connection conn = getByID(connection);
|
||||
|
||||
conn.sendTCP(new KickPacket());
|
||||
Timers.runTask(1f, () -> {
|
||||
if(conn.isConnected()){
|
||||
conn.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void host(int port) throws IOException {
|
||||
server.bind(port, port);
|
||||
|
||||
Reference in New Issue
Block a user