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,9 +840,12 @@ 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"))
{
Tools.Kick(plr,"Banned: " + reason);
Bans.AddBan(Tools.GetPlayerIP(plr), Main.player[plr].name, reason); Bans.AddBan(Tools.GetPlayerIP(plr), Main.player[plr].name, reason);
} }
}
public class Position public class Position
{ {

View file

@ -214,11 +214,14 @@ namespace TShockAPI
/// <param name="ply">int player</param> /// <param name="ply">int player</param>
/// <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 (!TShock.players[ply].group.HasPermission("immunetokick") || reason.Contains("Banned: "))
{ {
string displayName = FindPlayer(ply).Equals("") ? GetPlayerIP(ply) : FindPlayer(ply); string displayName = FindPlayer(ply).Equals("") ? GetPlayerIP(ply) : FindPlayer(ply);
NetMessage.SendData(0x2, ply, -1, reason, 0x0, 0f, 0f, 0f); NetMessage.SendData(0x2, ply, -1, reason, 0x0, 0f, 0f, 0f);
Log.Info("Kicked " + displayName + " for : " + reason); Log.Info("Kicked " + displayName + " for : " + reason);
} }
}
/// <summary> /// <summary>
/// Shows a MOTD to the player /// Shows a MOTD to the player