Users shouldn't "leave" when they enter an incorrect password anymore. Just as soon as someone reimplements the OnLeave hook.

This commit is contained in:
Lucas Nicodemus 2012-01-01 18:46:06 -07:00
parent 62bc28332a
commit 4b77ca549e
5 changed files with 17 additions and 3 deletions

View file

@ -83,7 +83,7 @@ namespace TShockAPI
[Description("Not implemented")] public string RconPassword = "";
[Description("Not implemented")] public int RconPort = 7777;
[Description("Not implemented")] public string ServerName = "";
[Description("Used when replying to a rest /status request.")] public string ServerName = "";
[Description("Not implemented")] public string MasterServer = "127.0.0.1";
[Description("Valid types are \"sqlite\" and \"mysql\"")] public string StorageType = "sqlite";

View file

@ -932,7 +932,7 @@ namespace TShockAPI
Log.ConsoleInfo(args.Player.Name + " authenticated successfully as user: " + args.Player.Name);
return true;
}
TShock.Utils.ForceKick(args.Player, "Incorrect User Account Password");
TShock.Utils.ForceKick(args.Player, "Invalid user account password.", true);
return true;
}
if (!string.IsNullOrEmpty(TShock.Config.ServerPassword))

View file

@ -73,6 +73,7 @@ namespace TShockAPI
public bool IgnoreActionsForClearingTrashCan;
public PlayerData PlayerData;
public bool RequiresPassword;
public bool SilentKickInProgress;
public bool RealPlayer
{

View file

@ -656,7 +656,11 @@ namespace TShockAPI
if (tsplr != null && tsplr.ReceivedInfo)
{
Utils.Broadcast(tsplr.Name + " has left", Color.Yellow);
if (!tsplr.SilentKickInProgress)
{
Utils.Broadcast(tsplr.Name + " left", Color.Yellow);
}
Log.Info(string.Format("{0} left.", tsplr.Name));
if (tsplr.IsLoggedIn)

View file

@ -408,6 +408,15 @@ namespace TShockAPI
Log.ConsoleInfo(string.Format("{0} was force kicked for : {1}", player.IP, reason));
}
public void ForceKick(TSPlayer player, string reason, bool silent)
{
player.SilentKickInProgress = true;
if (!player.ConnectionAlive)
return;
player.Disconnect(reason);
Log.ConsoleInfo(string.Format("{0} was force kicked for : {1}", player.IP, reason));
}
/// <summary>
/// Kicks a player from the server.
/// </summary>