From f8ec3cbd5e89500e130c2b986a1daa5c832536ae Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Sat, 7 Mar 2015 22:35:46 -0700 Subject: [PATCH 1/5] Update README with Slack stuff --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 72479628..ae63c0d8 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# TShock [![Build Status](https://travis-ci.org/NyxStudios/TShock.png?branch=general-devel)](https://travis-ci.org/NyxStudios/TShock) +# TShock [![Build Status](https://travis-ci.org/NyxStudios/TShock.png?branch=general-devel)](https://travis-ci.org/NyxStudios/TShock) [![Slack](https://tshock-chat.herokuapp.com/badge.svg)](http://chat.tshock.co/) TShock is a server modification for Terraria, written in C#, and based upon the [Terraria Server API](https://github.com/Deathmax/TerrariaAPI-Server). It uses JSON for configuration management, and offers several features not present in the Terraria Server normally. From d8d89d136f442bab8798068bf1ca5b946c1893ba Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Sat, 7 Mar 2015 22:39:11 -0700 Subject: [PATCH 2/5] Remove slack icon because icon is svg and svg bad. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ae63c0d8..5d9fbc97 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# TShock [![Build Status](https://travis-ci.org/NyxStudios/TShock.png?branch=general-devel)](https://travis-ci.org/NyxStudios/TShock) [![Slack](https://tshock-chat.herokuapp.com/badge.svg)](http://chat.tshock.co/) +# TShock [![Build Status](https://travis-ci.org/NyxStudios/TShock.png?branch=general-devel)](https://travis-ci.org/NyxStudios/TShock) TShock is a server modification for Terraria, written in C#, and based upon the [Terraria Server API](https://github.com/Deathmax/TerrariaAPI-Server). It uses JSON for configuration management, and offers several features not present in the Terraria Server normally. @@ -18,7 +18,7 @@ Feeling like helping out? Want to find an awesome server? Some awesome plugins? * [Website & Forums](https://tshock.co/xf/) * [Wiki](https://tshock.atlassian.net/wiki/display/TSHOCKPLUGINS/Home) - +* [Join our chat (supports IRC, XMPP, iOS, Android, Web)](http://chat.tshock.co/) ## Download * [Github Releases](https://github.com/TShock/TShock/releases) From 02564b5f9c1f06d86e2db9afb5dbb9ec1ab8065f Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Sat, 7 Mar 2015 22:40:10 -0700 Subject: [PATCH 3/5] Attempt to fix bullet points in readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 5d9fbc97..86aa841b 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ Feeling like helping out? Want to find an awesome server? Some awesome plugins? * [Website & Forums](https://tshock.co/xf/) * [Wiki](https://tshock.atlassian.net/wiki/display/TSHOCKPLUGINS/Home) * [Join our chat (supports IRC, XMPP, iOS, Android, Web)](http://chat.tshock.co/) + ## Download * [Github Releases](https://github.com/TShock/TShock/releases) From 32218f9be09e2cce0b87487d2ca4e028abc863fc Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Sun, 8 Mar 2015 16:00:43 -0600 Subject: [PATCH 4/5] PlayerCommandEventArgs passes the command prefix Fix tab space conflict in PlayerHooks.cs --- TShockAPI/Commands.cs | 2 +- TShockAPI/Hooks/PlayerHooks.cs | 131 +++++++++++++++++---------------- 2 files changed, 67 insertions(+), 66 deletions(-) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index f186e688..c04f2b00 100755 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -623,7 +623,7 @@ namespace TShockAPI IEnumerable cmds = ChatCommands.FindAll(c => c.HasAlias(cmdName)); - if (Hooks.PlayerHooks.OnPlayerCommand(player, cmdName, cmdText, args, ref cmds)) + if (Hooks.PlayerHooks.OnPlayerCommand(player, cmdName, cmdText, args, ref cmds, cmdPrefix)) return true; if (cmds.Count() == 0) diff --git a/TShockAPI/Hooks/PlayerHooks.cs b/TShockAPI/Hooks/PlayerHooks.cs index 73e862a8..08c8ef64 100644 --- a/TShockAPI/Hooks/PlayerHooks.cs +++ b/TShockAPI/Hooks/PlayerHooks.cs @@ -21,30 +21,31 @@ using System.ComponentModel; namespace TShockAPI.Hooks { - public class PlayerPostLoginEventArgs - { - public TSPlayer Player { get; set; } - public PlayerPostLoginEventArgs(TSPlayer ply) - { - Player = ply; - } - } + public class PlayerPostLoginEventArgs + { + public TSPlayer Player { get; set; } + public PlayerPostLoginEventArgs(TSPlayer ply) + { + Player = ply; + } + } - public class PlayerPreLoginEventArgs : HandledEventArgs - { - public TSPlayer Player { get; set; } - public string LoginName { get; set; } - public string Password { get; set; } - } + public class PlayerPreLoginEventArgs : HandledEventArgs + { + public TSPlayer Player { get; set; } + public string LoginName { get; set; } + public string Password { get; set; } + } - public class PlayerCommandEventArgs : HandledEventArgs - { - public TSPlayer Player { get; set; } - public string CommandName { get; set; } - public string CommandText { get; set; } - public List Parameters { get; set; } + public class PlayerCommandEventArgs : HandledEventArgs + { + public TSPlayer Player { get; set; } + public string CommandName { get; set; } + public string CommandText { get; set; } + public List Parameters { get; set; } public IEnumerable CommandList { get; set; } - } + public string CommandPrefix { get; set; } + } public class PlayerChatEventArgs : HandledEventArgs { @@ -53,59 +54,59 @@ namespace TShockAPI.Hooks public string TShockFormattedText { get; set; } } - public static class PlayerHooks - { - public delegate void PlayerPostLoginD(PlayerPostLoginEventArgs e); - public static event PlayerPostLoginD PlayerPostLogin; + public static class PlayerHooks + { + public delegate void PlayerPostLoginD(PlayerPostLoginEventArgs e); + public static event PlayerPostLoginD PlayerPostLogin; - public delegate void PlayerPreLoginD(PlayerPreLoginEventArgs e); - public static event PlayerPreLoginD PlayerPreLogin; + public delegate void PlayerPreLoginD(PlayerPreLoginEventArgs e); + public static event PlayerPreLoginD PlayerPreLogin; - public delegate void PlayerCommandD(PlayerCommandEventArgs e); - public static event PlayerCommandD PlayerCommand; + public delegate void PlayerCommandD(PlayerCommandEventArgs e); + public static event PlayerCommandD PlayerCommand; public delegate void PlayerChatD(PlayerChatEventArgs e); public static event PlayerChatD PlayerChat; - public static void OnPlayerPostLogin(TSPlayer ply) - { - if (PlayerPostLogin == null) - { - return; - } + public static void OnPlayerPostLogin(TSPlayer ply) + { + if (PlayerPostLogin == null) + { + return; + } - PlayerPostLoginEventArgs args = new PlayerPostLoginEventArgs(ply); - PlayerPostLogin(args); - } + PlayerPostLoginEventArgs args = new PlayerPostLoginEventArgs(ply); + PlayerPostLogin(args); + } - public static bool OnPlayerCommand(TSPlayer player, string cmdName, string cmdText, List args, ref IEnumerable commands) - { - if (PlayerCommand == null) - { - return false; - } - PlayerCommandEventArgs playerCommandEventArgs = new PlayerCommandEventArgs() - { - Player = player, - CommandName = cmdName, - CommandText = cmdText, - Parameters = args, - CommandList = commands - }; - PlayerCommand(playerCommandEventArgs); - commands = playerCommandEventArgs.CommandList; - return playerCommandEventArgs.Handled; - } + public static bool OnPlayerCommand(TSPlayer player, string cmdName, string cmdText, List args, ref IEnumerable commands, string cmdPrefix) + { + if (PlayerCommand == null) + { + return false; + } + PlayerCommandEventArgs playerCommandEventArgs = new PlayerCommandEventArgs() + { + Player = player, + CommandName = cmdName, + CommandText = cmdText, + Parameters = args, + CommandList = commands, + CommandPrefix = cmdPrefix, + }; + PlayerCommand(playerCommandEventArgs); + return playerCommandEventArgs.Handled; + } - public static bool OnPlayerPreLogin(TSPlayer ply, string name, string pass) - { - if (PlayerPreLogin == null) - return false; + public static bool OnPlayerPreLogin(TSPlayer ply, string name, string pass) + { + if (PlayerPreLogin == null) + return false; - var args = new PlayerPreLoginEventArgs {Player = ply, LoginName = name, Password = pass}; - PlayerPreLogin(args); - return args.Handled; - } + var args = new PlayerPreLoginEventArgs {Player = ply, LoginName = name, Password = pass}; + PlayerPreLogin(args); + return args.Handled; + } public static void OnPlayerChat(TSPlayer ply, string rawtext, ref string tshockText) { @@ -116,5 +117,5 @@ namespace TShockAPI.Hooks PlayerChat(args); tshockText = args.TShockFormattedText; } - } + } } From fba93e560239ec7920394ac6cfd67b1f665f35ac Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Sun, 8 Mar 2015 21:24:54 -0600 Subject: [PATCH 5/5] Allow server to execute silent specifier Removed erroneous playing command (duplicates /who). Fixes #879 --- TShockAPI/TShock.cs | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 1c8177a7..4374c295 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -1132,26 +1132,12 @@ namespace TShockAPI WorldGen.genRand = new Random(); } - if (args.Command.StartsWith("playing") || args.Command.StartsWith("{0}playing".SFormat(Commands.Specifier))) - { - int count = 0; - foreach (TSPlayer player in Players) - { - if (player != null && player.Active) - { - count++; - TSPlayer.Server.SendInfoMessage("{0} ({1}) [{2}] <{3}>", player.Name, player.IP, - player.Group.Name, player.UserAccountName); - } - } - TSPlayer.Server.SendInfoMessage("{0} players connected.", count); - } - else if (args.Command == "autosave") + if (args.Command == "autosave") { Main.autoSave = Config.AutoSave = !Config.AutoSave; Log.ConsoleInfo("AutoSave " + (Config.AutoSave ? "Enabled" : "Disabled")); } - else if (args.Command.StartsWith(Commands.Specifier)) + else if (args.Command.StartsWith(Commands.Specifier) || args.Command.StartsWith(Commands.SilentSpecifier)) { Commands.HandleCommand(TSPlayer.Server, args.Command); }