diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index c59b9e8e..48b12108 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -201,6 +201,15 @@ namespace TShockAPI { if (e.MsgID == 4) { + var ban = Bans.GetBanByName(Main.player[e.Msg.whoAmI].name); + if (ban != null) + { + Tools.Kick(e.Msg.whoAmI, "You are banned: " + ban.Reason); + } + if (Main.player[e.Msg.whoAmI].name.Length > 32) + { + Tools.Kick(e.Msg.whoAmI, "Name exceeded 32 characters."); + } if (players[e.Msg.whoAmI] == null) { Tools.Kick(e.Msg.whoAmI, "Player doesn't exist"); @@ -612,11 +621,6 @@ namespace TShockAPI { Tools.Kick(ply, "You are banned: " + ban.Reason); } - else if (Tools.FindPlayer(ply).Length > 32) - { - Tools.Kick(ply, "Your name was too long."); - Tools.Broadcast(ip + " was kicked because their name exceeded 32 characters."); - } if (!FileTools.OnWhitelist(ip)) { Tools.Kick(ply, "Not on whitelist.");