Added version check, fixed chat being open in singleplayer

This commit is contained in:
Anuken
2018-01-21 10:38:34 -05:00
parent 33dafa77d8
commit 40f7bf51c2
10 changed files with 58 additions and 47 deletions

View File

@@ -117,11 +117,11 @@ public class KryoServer implements ServerProvider {
}
@Override
public void kick(int connection) {
public void kick(int connection, KickReason reason) {
KryoConnection con = getByID(connection);
KickPacket p = new KickPacket();
p.reason = KickReason.kick;
p.reason = reason;
con.send(p, SendMode.tcp);
Timers.runTask(1f, con::close);
@@ -345,10 +345,16 @@ public class KryoServer implements ServerProvider {
connections.remove(this);
}
}else if (connection != null) {
if (mode == SendMode.tcp) {
connection.sendTCP(object);
} else {
connection.sendUDP(object);
try {
if (mode == SendMode.tcp) {
connection.sendTCP(object);
} else {
connection.sendUDP(object);
}
}catch (Exception e){
e.printStackTrace();
UCore.log("Disconnecting invalid client!");
connection.close();
}
}
}