Merge branch 'master' of github.com:TShock/TShock
This commit is contained in:
commit
fc2d04ad9f
4 changed files with 36 additions and 13 deletions
|
|
@ -204,6 +204,7 @@ namespace TShockAPI
|
|||
ChatCommands.Add(new Command("spawnrate", "cfg", SpawnRate));
|
||||
ChatCommands.Add(new Command("time", "cfg", Time));
|
||||
ChatCommands.Add(new Command("slap", "pvpfun", Slap));
|
||||
ChatCommands.Add(new Command("antibuild", "editspawn", ToggleAntiBuild));
|
||||
ChatCommands.Add(new Command("protectspawn", "editspawn", ProtectSpawn));
|
||||
ChatCommands.Add(new Command("help", "", Help));
|
||||
ChatCommands.Add(new Command("playing", "", Playing));
|
||||
|
|
@ -213,7 +214,6 @@ namespace TShockAPI
|
|||
ChatCommands.Add(new Command("me", "", ThirdPerson));
|
||||
ChatCommands.Add(new Command("p", "", PartyChat));
|
||||
ChatCommands.Add(new Command("rules", "", Rules));
|
||||
ChatCommands.Add(new Command("antibuild", "editspawn", ToggleAntiBuild));
|
||||
if (ConfigurationManager.DistributationAgent != "terraria-online")
|
||||
{
|
||||
ChatCommands.Add(new Command("kill", "kill", Kill));
|
||||
|
|
@ -229,7 +229,7 @@ namespace TShockAPI
|
|||
|
||||
public static void Rules(CommandArgs args)
|
||||
{
|
||||
Tools.ShowFileToUser(args.PlayerID, "rules.txt");
|
||||
Tools.ShowFileToUser(args.Player, "rules.txt");
|
||||
}
|
||||
|
||||
public static void ToggleAntiBuild(CommandArgs args)
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ namespace TShockAPI
|
|||
{
|
||||
File.Create(file).Close();
|
||||
}
|
||||
|
||||
public static void CreateIfNot(string file, string data = "")
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
|
|
|
|||
|
|
@ -228,6 +228,31 @@ namespace TShockAPI
|
|||
}
|
||||
e.Handled = true;
|
||||
}
|
||||
if (text.StartsWith("exit"))
|
||||
{
|
||||
for (int player = 0; player < Main.maxPlayers; player++)
|
||||
{
|
||||
if (Main.player[player].active)
|
||||
{
|
||||
Tools.ForceKick(player, "Server shutting down!");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (text.StartsWith("playing"))
|
||||
{
|
||||
int count = 0;
|
||||
for (int i = 0; i < Main.maxPlayers; i++)
|
||||
{
|
||||
if (Main.player[i].active)
|
||||
{
|
||||
count++;
|
||||
Console.WriteLine(string.Format("{0} ({1}) [{2}]", Main.player[i].name,
|
||||
Netplay.serverSock[i].tcpClient.Client.RemoteEndPoint, Players[i].Group.Name));
|
||||
}
|
||||
}
|
||||
Console.WriteLine(string.Format("{0} players connected.", count));
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void DeInitialize()
|
||||
|
|
@ -608,9 +633,10 @@ namespace TShockAPI
|
|||
if (Main.netMode != 2)
|
||||
return;
|
||||
|
||||
Log.Info(string.Format("{0} ({1}) from '{2}' group joined.", Players[who].Name, Tools.GetPlayerIP(who), Players[who].Group.Name));
|
||||
TSPlayer player = Players[who];
|
||||
Log.Info(string.Format("{0} ({1}) from '{2}' group joined.", player.Name, Tools.GetPlayerIP(who), player.Group.Name));
|
||||
|
||||
Tools.ShowMOTD(who);
|
||||
Tools.ShowFileToUser(player, "motd.txt");
|
||||
if (HackedHealth(who))
|
||||
{
|
||||
Tools.HandleCheater(who, "Hacked health.");
|
||||
|
|
@ -642,7 +668,7 @@ namespace TShockAPI
|
|||
|
||||
if (tsplr.Group.HasPermission("adminchat") && !text.StartsWith("/"))
|
||||
{
|
||||
Tools.Broadcast(ConfigurationManager.AdminChatPrefix + "<" + Main.player[ply].name + "> " + text, (byte)ConfigurationManager.AdminChatRGB[0], (byte)ConfigurationManager.AdminChatRGB[1], (byte)ConfigurationManager.AdminChatRGB[2]);
|
||||
Tools.Broadcast(ConfigurationManager.AdminChatPrefix + "<" + tsplr.Name + "> " + text, (byte)ConfigurationManager.AdminChatRGB[0], (byte)ConfigurationManager.AdminChatRGB[1], (byte)ConfigurationManager.AdminChatRGB[2]);
|
||||
e.Handled = true;
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -291,18 +291,14 @@ namespace TShockAPI
|
|||
}
|
||||
return false;
|
||||
}
|
||||
[Obsolete("Use ShowFileToUser(int ply, string file) instead.")]
|
||||
public static void ShowMOTD(int ply)
|
||||
{
|
||||
ShowFileToUser(ply, "motd.txt");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Shows a file to the user.
|
||||
/// </summary>
|
||||
/// <param name="ply">int player</param>
|
||||
/// <param name="file">string filename reletave to savedir</param>
|
||||
//Todo: Fix this
|
||||
public static void ShowFileToUser(int ply, string file)
|
||||
public static void ShowFileToUser(TSPlayer player, string file)
|
||||
{
|
||||
string foo = "";
|
||||
TextReader tr = new StreamReader(Path.Combine(TShock.SavePath, file));
|
||||
|
|
@ -321,7 +317,7 @@ namespace TShockAPI
|
|||
{
|
||||
try
|
||||
{
|
||||
TShock.Players[ply].SendMessage(foo, (byte)Convert.ToInt32(pCc[0]), (byte)Convert.ToInt32(pCc[1]), (byte)Convert.ToInt32(pCc[2]));
|
||||
player.SendMessage(foo, (byte)Convert.ToInt32(pCc[0]), (byte)Convert.ToInt32(pCc[1]), (byte)Convert.ToInt32(pCc[2]));
|
||||
continue;
|
||||
}
|
||||
catch (Exception e)
|
||||
|
|
@ -330,7 +326,7 @@ namespace TShockAPI
|
|||
}
|
||||
}
|
||||
}
|
||||
TShock.Players[ply].SendMessage(foo);
|
||||
player.SendMessage(foo);
|
||||
}
|
||||
tr.Close();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue