Fixed issue of the client being killed before receiving the disconnect message.
This commit is contained in:
parent
4dae27001c
commit
7b58100546
3 changed files with 55 additions and 29 deletions
|
|
@ -63,7 +63,7 @@ namespace TShockAPI
|
|||
public static ConfigFile Config { get; set; }
|
||||
public static IDbConnection DB;
|
||||
public static bool OverridePort;
|
||||
static PacketBufferer bufferer;
|
||||
public static PacketBufferer PacketBuffer;
|
||||
|
||||
/// <summary>
|
||||
/// Called after TShock is initialized. Useful for plugins that needs hooks before tshock but also depend on tshock being loaded.
|
||||
|
|
@ -178,7 +178,7 @@ namespace TShockAPI
|
|||
ServerHooks.Leave += OnLeave;
|
||||
ServerHooks.Chat += OnChat;
|
||||
ServerHooks.Command += ServerHooks_OnCommand;
|
||||
NetHooks.GetData += GetData;
|
||||
NetHooks.GetData += OnGetData;
|
||||
NetHooks.GreetPlayer += OnGreetPlayer;
|
||||
NpcHooks.StrikeNpc += NpcHooks_OnStrikeNpc;
|
||||
|
||||
|
|
@ -187,7 +187,7 @@ namespace TShockAPI
|
|||
//RconHandler.StartThread();
|
||||
|
||||
if (Config.BufferPackets)
|
||||
bufferer = new PacketBufferer();
|
||||
PacketBuffer = new PacketBufferer();
|
||||
|
||||
Log.ConsoleInfo("AutoSave " + (Config.AutoSave ? "Enabled" : "Disabled"));
|
||||
Log.ConsoleInfo("Backups " + (Backups.Interval > 0 ? "Enabled" : "Disabled"));
|
||||
|
|
@ -211,7 +211,7 @@ namespace TShockAPI
|
|||
ServerHooks.Leave -= OnLeave;
|
||||
ServerHooks.Chat -= OnChat;
|
||||
ServerHooks.Command -= ServerHooks_OnCommand;
|
||||
NetHooks.GetData -= GetData;
|
||||
NetHooks.GetData -= OnGetData;
|
||||
NetHooks.GreetPlayer -= OnGreetPlayer;
|
||||
NpcHooks.StrikeNpc -= NpcHooks_OnStrikeNpc;
|
||||
if (File.Exists(Path.Combine(SavePath, "tshock.pid")))
|
||||
|
|
@ -550,7 +550,7 @@ namespace TShockAPI
|
|||
}
|
||||
}
|
||||
|
||||
private void GetData(GetDataEventArgs e)
|
||||
private void OnGetData(GetDataEventArgs e)
|
||||
{
|
||||
if (e.Handled)
|
||||
return;
|
||||
|
|
@ -569,8 +569,7 @@ namespace TShockAPI
|
|||
return;
|
||||
}
|
||||
|
||||
//if (type == PacketTypes.SyncPlayers)
|
||||
//Debug.WriteLine("Recv: {0:X} ({2}): {3} ({1:XX})", player.Index, (byte)type, player.TPlayer.dead ? "dead " : "alive", type.ToString());
|
||||
//Debug.WriteLine("Recv: {0:X} ({2}): {3} ({1:XX})", player.Index, (byte)type, player.TPlayer.dead ? "dead " : "alive", type);
|
||||
|
||||
// Stop accepting updates from player as this player is going to be kicked/banned during OnUpdate (different thread so can produce race conditions)
|
||||
if ((Config.BanKillTileAbusers || Config.KickKillTileAbusers) &&
|
||||
|
|
@ -655,9 +654,9 @@ namespace TShockAPI
|
|||
/// <returns>False on exception</returns>
|
||||
public static bool SendBytes(ServerSock client, byte[] bytes)
|
||||
{
|
||||
if (bufferer != null)
|
||||
if (PacketBuffer != null)
|
||||
{
|
||||
bufferer.SendBytes(client, bytes);
|
||||
PacketBuffer.SendBytes(client, bytes);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue