Prevent further things from clients who dont handshake
- The player will only finish the handshake once they spawn their player, a normal client would always do this eventually. - They cannot chat, even if they request world data but just not spawn their player. - Other clients will not be notified of their join/leave in both cases (dont request WD or do but dont spawn) - And most importantly, they do not show on the in game player list but still show on the server console /playing cmd.
This commit is contained in:
parent
d35934b3a2
commit
53789b40e4
5 changed files with 22 additions and 6 deletions
|
|
@ -1399,7 +1399,8 @@ namespace TShockAPI
|
|||
return;
|
||||
}
|
||||
|
||||
Bans.CheckBan(player);
|
||||
if (Bans.CheckBan(player))
|
||||
return;
|
||||
}
|
||||
|
||||
/// <summary>OnLeave - Called when a player leaves the server.</summary>
|
||||
|
|
@ -1439,7 +1440,7 @@ namespace TShockAPI
|
|||
|
||||
if (tsplr.ReceivedInfo)
|
||||
{
|
||||
if (!tsplr.SilentKickInProgress && tsplr.State >= 3)
|
||||
if (!tsplr.SilentKickInProgress && tsplr.State >= 3 && tsplr.FinishedHandshake) //The player has left, do not broadcast any clients exploiting the behaviour of not spawning their player.
|
||||
Utils.Broadcast(GetString("{0} has left.", tsplr.Name), Color.Yellow);
|
||||
Log.Info(GetString("{0} disconnected.", tsplr.Name));
|
||||
|
||||
|
|
@ -1460,6 +1461,9 @@ namespace TShockAPI
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
tsplr.FinishedHandshake = false;
|
||||
|
||||
// Fire the OnPlayerLogout hook too, if the player was logged in and they have a TSPlayer object.
|
||||
if (tsplr.IsLoggedIn)
|
||||
{
|
||||
|
|
@ -1489,6 +1493,12 @@ namespace TShockAPI
|
|||
return;
|
||||
}
|
||||
|
||||
if (!tsplr.FinishedHandshake)
|
||||
{
|
||||
args.Handled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.Text.Length > 500)
|
||||
{
|
||||
tsplr.Kick(GetString("Crash attempt via long chat packet."), true);
|
||||
|
|
@ -1705,14 +1715,14 @@ namespace TShockAPI
|
|||
Log.Info(GetString("{0} ({1}) from '{2}' group from '{3}' joined. ({4}/{5})", player.Name, player.IP,
|
||||
player.Group.Name, player.Country, TShock.Utils.GetActivePlayerCount(),
|
||||
TShock.Config.Settings.MaxSlots));
|
||||
if (!player.SilentJoinInProgress)
|
||||
if (!player.SilentJoinInProgress && player.FinishedHandshake)
|
||||
Utils.Broadcast(GetString("{0} ({1}) has joined.", player.Name, player.Country), Color.Yellow);
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Info(GetString("{0} ({1}) from '{2}' group joined. ({3}/{4})", player.Name, player.IP,
|
||||
player.Group.Name, TShock.Utils.GetActivePlayerCount(), TShock.Config.Settings.MaxSlots));
|
||||
if (!player.SilentJoinInProgress)
|
||||
if (!player.SilentJoinInProgress && player.FinishedHandshake)
|
||||
Utils.Broadcast(GetString("{0} has joined.", player.Name), Color.Yellow);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue