Fixed Ban not checking socket status correctly.

Fixed unban/unbanip for real this time
This commit is contained in:
high 2011-06-08 06:44:53 -04:00
parent d23db067e9
commit e66c57450a
2 changed files with 5 additions and 4 deletions

View file

@ -249,13 +249,14 @@ namespace TShockAPI
/// <param name="reason">string reason</param>
public static bool Ban(int plr, string reason, string adminUserName = "")
{
if (!Netplay.serverSock[plr].active || Netplay.serverSock[plr].kill)
return true;
if (!TShock.players[plr].group.HasPermission("immunetoban"))
{
string ip = GetPlayerIP(plr);
string playerName = Main.player[plr].name;
TShock.Bans.AddBan(ip, playerName, reason);
if (Main.player[plr].active || !Netplay.serverSock[plr].kill)
NetMessage.SendData(0x2, plr, -1, "Banned: " + reason, 0x0, 0f, 0f, 0f);
NetMessage.SendData(0x2, plr, -1, "Banned: " + reason, 0x0, 0f, 0f, 0f);
Log.Info("Banned " + playerName + " for : " + reason);
if (adminUserName.Length == 0)
Broadcast(playerName + " was banned for " + reason.ToLower());