Merge branch 'master' of github.com:TShock/TShock

This commit is contained in:
Shank 2011-06-13 15:20:43 -06:00
commit 6d65fda5b7
2 changed files with 30 additions and 1 deletions

View file

@ -36,7 +36,7 @@ namespace TShockAPI
public static string saveDir = "./tshock/";
public static Version VersionNum = new Version(2, 1, 0, 1);
public static Version VersionNum = new Version(2, 1, 0, 2);
public static string VersionCodename = "Forgot to close the issue.";
@ -173,6 +173,8 @@ namespace TShockAPI
Log.Info("Hooks initialized");
Commands.InitCommands();
Log.Info("Commands initialized");
HandleCommandLine(Environment.GetCommandLineArgs());
}
/// <summary>
@ -259,6 +261,13 @@ namespace TShockAPI
Tools.ForceKick(e.Msg.whoAmI, string.Format("You are banned: {0}", ban.Reason));
return true;
}
byte hair = e.Msg.readBuffer[e.Index + 1];
if (hair > 0x10)
{
Tools.ForceKick(e.Msg.whoAmI, "Hair crash exploit.");
return true;
}
string name = Encoding.ASCII.GetString(e.Msg.readBuffer, e.Index + 23, (e.Length - (e.Index + 23)) + e.Index - 1);
if (name.Length > 32)
{
@ -682,6 +691,26 @@ namespace TShockAPI
}
}
void HandleCommandLine(string[] parms)
{
for (int i = 0; i < parms.Length; i++)
{
if (parms[i].ToLower() == "-ip")
{
IPAddress ip;
if (IPAddress.TryParse(parms[++i], out ip))
{
Netplay.serverListenIP = ip;
Console.Write("Using IP: {0}", ip);
}
else
{
Console.WriteLine("Bad IP: {0}", parms[i]);
}
}
}
}
private void OnUpdate(GameTime time)
{
UpdateManager.UpdateProcedureCheck();

Binary file not shown.