From b7a87866fe2964cbc639cc11dd7daae6dca6c454 Mon Sep 17 00:00:00 2001 From: Shank Date: Tue, 7 Jun 2011 00:08:32 -0600 Subject: [PATCH] Name length check now works. Bans now run by name too. Closes #36 --- TShockAPI/TShock.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) 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.");