fixed kicking and banning, and removed a unused variable

This commit is contained in:
Maverick Motherfucker 2011-06-06 17:11:49 -07:00
parent a7e912c9f4
commit df9e2bb423
3 changed files with 11 additions and 6 deletions

View file

@ -17,7 +17,6 @@ namespace TShockAPI
public static bool infiniteInvasion; public static bool infiniteInvasion;
public static bool permaPvp; public static bool permaPvp;
public static int killCount; public static int killCount;
public static bool startedInvasion;
public static bool kickCheater = true; public static bool kickCheater = true;
public static bool banCheater = true; public static bool banCheater = true;
public static bool kickGriefer = true; public static bool kickGriefer = true;

View file

@ -840,8 +840,11 @@ namespace TShockAPI
public static void Ban(int plr, string reason = "") public static void Ban(int plr, string reason = "")
{ {
Tools.Kick(plr, reason); if (!players[plr].group.HasPermission("immunetoban"))
Bans.AddBan(Tools.GetPlayerIP(plr), Main.player[plr].name, reason); {
Tools.Kick(plr,"Banned: " + reason);
Bans.AddBan(Tools.GetPlayerIP(plr), Main.player[plr].name, reason);
}
} }
public class Position public class Position

View file

@ -215,9 +215,12 @@ 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)
{ {
string displayName = FindPlayer(ply).Equals("") ? GetPlayerIP(ply) : FindPlayer(ply); if (!TShock.players[ply].group.HasPermission("immunetokick") || reason.Contains("Banned: "))
NetMessage.SendData(0x2, ply, -1, reason, 0x0, 0f, 0f, 0f); {
Log.Info("Kicked " + displayName + " for : " + reason); string displayName = FindPlayer(ply).Equals("") ? GetPlayerIP(ply) : FindPlayer(ply);
NetMessage.SendData(0x2, ply, -1, reason, 0x0, 0f, 0f, 0f);
Log.Info("Kicked " + displayName + " for : " + reason);
}
} }
/// <summary> /// <summary>