Fixed player disconnect events not getting shown properly
This commit is contained in:
@@ -207,6 +207,11 @@ public class NetClient extends Module {
|
||||
ui.traces.show(player, info);
|
||||
}
|
||||
|
||||
@Remote
|
||||
public static void onPlayerDisconnect(int playerid){
|
||||
playerGroup.removeByID(playerid);
|
||||
}
|
||||
|
||||
@Remote(variants = Variant.one, unreliable = true)
|
||||
public static void onSnapshot(byte[] snapshot, int snapshotID){
|
||||
//skip snapshot IDs that have already been recieved
|
||||
@@ -215,7 +220,6 @@ public class NetClient extends Module {
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
byte[] result;
|
||||
int length;
|
||||
if (snapshotID == 0) { //fresh snapshot
|
||||
|
||||
@@ -67,8 +67,7 @@ public class NetServer extends Module{
|
||||
Net.handleServer(Disconnect.class, (id, packet) -> {
|
||||
Player player = connections.get(id);
|
||||
if(player != null){
|
||||
Call.sendMessage("[accent]" + player.name + " has disconnected.");
|
||||
player.remove();
|
||||
onDisconnect(player);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -311,8 +310,7 @@ public class NetServer extends Module{
|
||||
|
||||
if(connection == null){
|
||||
//player disconnected, ignore them
|
||||
connections.remove(player.clientid);
|
||||
player.remove();
|
||||
onDisconnect(player);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -408,6 +406,13 @@ public class NetServer extends Module{
|
||||
}
|
||||
}
|
||||
|
||||
private static void onDisconnect(Player player){
|
||||
Call.sendMessage("[accent]" + player.name + " has disconnected.");
|
||||
Call.onPlayerDisconnect(player.id);
|
||||
player.remove();
|
||||
netServer.connections.remove(player.clientid);
|
||||
}
|
||||
|
||||
@Remote(targets = Loc.client, called = Loc.server)
|
||||
public static void onAdminRequest(Player player, Player other, AdminAction action){
|
||||
|
||||
|
||||
Reference in New Issue
Block a user