diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 97dcc86f..8c386f07 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -549,7 +549,6 @@ namespace TShockAPI } string ip = Tools.GetPlayerIP(ply); - players[ply] = new TSPlayer(ply); players[ply].group = Tools.GetGroupForIP(ip); @@ -604,7 +603,7 @@ namespace TShockAPI { return; } - for (uint i = 0; i < Main.maxPlayers; i++) + for (int i = 0; i < Main.maxPlayers; i++) { if (Main.player[i].active == false) { @@ -614,9 +613,9 @@ namespace TShockAPI { if (Main.player[i] != null) { - if (Tools.HandleTntUser((int)i, "Kill tile abuse detected.")) + if (Tools.HandleTntUser(i, "Kill tile abuse detected.")) { - RevertKillTile((int)i); + RevertKillTile(i); players[i].tileThreshold = 0; players[i].tilesDestroyed.Clear(); } diff --git a/TShockAPI/Tools.cs b/TShockAPI/Tools.cs index 28c5cb35..a04c5126 100755 --- a/TShockAPI/Tools.cs +++ b/TShockAPI/Tools.cs @@ -226,7 +226,7 @@ namespace TShockAPI /// string reason public static bool Kick(int ply, string reason, string adminUserName = "") { - if (!Main.player[ply].active) + if (!Netplay.serverSock[ply].active || Netplay.serverSock[ply].kill) return true; if (!TShock.players[ply].group.HasPermission("immunetokick")) { @@ -254,7 +254,7 @@ namespace TShockAPI string ip = GetPlayerIP(plr); string playerName = Main.player[plr].name; TShock.Bans.AddBan(ip, playerName, reason); - if (!Main.player[plr].active) + if (!Main.player[plr].active || Netplay.serverSock[ply].kill) NetMessage.SendData(0x2, plr, -1, "Banned: " + reason, 0x0, 0f, 0f, 0f); Log.Info("Banned " + playerName + " for : " + reason); if (adminUserName.Length == 0)