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