Fixeds kick not working

This commit is contained in:
high 2011-06-07 08:46:33 -04:00
parent 693e279a78
commit d7987ac633
2 changed files with 11 additions and 6 deletions

View file

@ -611,7 +611,6 @@ namespace TShockAPI
} }
string ip = Tools.GetPlayerIP(ply); string ip = Tools.GetPlayerIP(ply);
;
players[ply] = new TSPlayer(ply); players[ply] = new TSPlayer(ply);
players[ply].group = Tools.GetGroupForIP(ip); players[ply].group = Tools.GetGroupForIP(ip);
@ -619,6 +618,7 @@ namespace TShockAPI
!players[ply].group.HasPermission("reservedslot")) !players[ply].group.HasPermission("reservedslot"))
{ {
Tools.Kick(ply, "Server is full"); Tools.Kick(ply, "Server is full");
handler.Handled = true;
return; return;
} }
@ -626,10 +626,14 @@ namespace TShockAPI
if (ban != null) if (ban != null)
{ {
Tools.Kick(ply, "You are banned: " + ban.Reason); Tools.Kick(ply, "You are banned: " + ban.Reason);
handler.Handled = true;
return;
} }
if (!FileTools.OnWhitelist(ip)) if (!FileTools.OnWhitelist(ip))
{ {
Tools.Kick(ply, "Not on whitelist."); Tools.Kick(ply, "Not on whitelist.");
handler.Handled = true;
return;
} }
} }
@ -662,7 +666,7 @@ namespace TShockAPI
{ {
return; return;
} }
for (uint i = 0; i < Main.maxPlayers; i++) for (int i = 0; i < Main.maxPlayers; i++)
{ {
if (Main.player[i].active == false) if (Main.player[i].active == false)
{ {
@ -675,12 +679,13 @@ namespace TShockAPI
if (ConfigurationManager.kickTnt || ConfigurationManager.banTnt) if (ConfigurationManager.kickTnt || ConfigurationManager.banTnt)
{ {
if (ConfigurationManager.banTnt) if (ConfigurationManager.banTnt)
Ban((int)i, "Explosives"); Ban(i, "Kill Tile Abuse");
Tools.Kick((int)i, "Kill tile abuse detected."); else
Tools.Kick(i, "Kill tile abuse detected.");
Tools.Broadcast(Main.player[i].name + " was " + Tools.Broadcast(Main.player[i].name + " was " +
(ConfigurationManager.banTnt ? "banned" : "kicked") + (ConfigurationManager.banTnt ? "banned" : "kicked") +
" for kill tile abuse."); " for kill tile abuse.");
RevertKillTile((int)i); RevertKillTile(i);
players[i].tileThreshold = 0; players[i].tileThreshold = 0;
players[i].tilesDestroyed.Clear(); players[i].tilesDestroyed.Clear();
} }

View file

@ -214,7 +214,7 @@ namespace TShockAPI
/// <param name="reason">string reason</param> /// <param name="reason">string reason</param>
public static void Kick(int ply, string reason) public static void Kick(int ply, string reason)
{ {
if (!Main.player[ply].active) if (!Netplay.serverSock[ply].active || Netplay.serverSock[ply].kill)
return; return;
if (!TShock.players[ply].group.HasPermission("immunetokick") || reason.Contains("Banned: ")) if (!TShock.players[ply].group.HasPermission("immunetokick") || reason.Contains("Banned: "))
{ {