From 0cc94918fa562687a1bce927a5461c00693501e6 Mon Sep 17 00:00:00 2001 From: Hussein Farran Date: Tue, 6 Mar 2018 17:38:41 -0500 Subject: [PATCH 1/8] Update .gitignore Ignore visual studio cruft --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index c7755a6d..5ac4b6aa 100644 --- a/.gitignore +++ b/.gitignore @@ -51,6 +51,7 @@ Thumbs.db *.csproj.user */_ReSharper*/* *.user +.vs/* #Template Bat file# ################### From 733d9aec57e1d23d5e64e77fc808fe42435e2a2f Mon Sep 17 00:00:00 2001 From: Edgar Date: Thu, 19 Apr 2018 16:18:30 +0200 Subject: [PATCH 2/8] TShockAPI.sln -> TShock.sln in readme.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 303f89c9..3ffadf1a 100644 --- a/README.md +++ b/README.md @@ -122,7 +122,7 @@ You need to re-run the patcher any time `OTAPI` updates. You need to rebuild `Te ##### TShock -1. Open the `TShockAPI.sln` solution in the root of the repository. +1. Open the `TShock.sln` solution in the root of the repository. 1. Build the solution. It should correctly download NuGet packages automatically and build against the aforementioned `TerrariaServerAPI` project you just built. @@ -219,4 +219,4 @@ Need help? Join us on [#tshock-programming in Discord](https://discord.gg/ABtrBa > By participating in the TShock for Terraria community, all members will adhere to maintaining decorum with respect to all humans, in and out of the community. Members will not engage in discussion that inappropriately disparages or marginalizes any group of people or any individual. Members will not attempt to further or advance an agenda to the point of being overbearing or close minded (such as through spreading FUD). Members will not abuse services provided to them and will follow the guidance of community leaders on a situational basis about what abuse consists of. Members will adhere to United States and international law. If members notice a violation of this code of conduct, they will not engage but will instead contact the leadership team on either the forums or Discord. -> Do not attempt to circumvent or bypass the code of conduct by using clever logic or reasoning (e.g., insulting Facepunch members, because they weren't directly mentioned here). \ No newline at end of file +> Do not attempt to circumvent or bypass the code of conduct by using clever logic or reasoning (e.g., insulting Facepunch members, because they weren't directly mentioned here). From 8ea9a7d3b9f8e4d47cb274844be273914b551e72 Mon Sep 17 00:00:00 2001 From: Edgar Date: Thu, 19 Apr 2018 18:05:40 +0200 Subject: [PATCH 3/8] remove a semicolon --- scripts/create_release.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/create_release.py b/scripts/create_release.py index b3b103c1..f1f98cec 100755 --- a/scripts/create_release.py +++ b/scripts/create_release.py @@ -182,7 +182,7 @@ def build_software(): if __name__ == '__main__': create_release_folder() update_terraria_source() - run_bootstrapper(); + run_bootstrapper() copy_dependencies() build_software() package_release() From 3f58274ef4d134ae6c51de4a1d7cbd46af89ec04 Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Thu, 19 Apr 2018 18:21:50 -0600 Subject: [PATCH 4/8] Remove the stat tracker The stat tracker has been offline for the last several weeks/months and nobody has done anything to fix that. Because of that, GDPR, and the fact that we haven't used it, we're discarding it. --- CHANGELOG.md | 1 + TShockAPI/StatTracker.cs | 314 ------------------------------------- TShockAPI/TShock.cs | 13 +- TShockAPI/TShockAPI.csproj | 1 - 4 files changed, 2 insertions(+), 327 deletions(-) delete mode 100644 TShockAPI/StatTracker.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 1bb5cefb..8006fcf8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -80,6 +80,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * `Utils.MaxChests()` is now `Utils.HasWorldReachedMaxChests()`. (@hakusaro) * `Utils.GetIPv4Address()` is now `Utils.GetIPv4AddressFromHostname()`. (@hakusaro) * Fixed the disappearing problem when placing tile entities. (@mistzzt) +* Removed the stat tracking system. (@hakusaro) ## TShock 4.3.25 * Fixed a critical exploit in the Terraria protocol that could cause massive unpreventable world corruption as well as a number of other problems. Thanks to @bartico6 for reporting. Fixed by the efforts of @QuiCM, @hakusaro, and tips in the right directioon from @bartico6. diff --git a/TShockAPI/StatTracker.cs b/TShockAPI/StatTracker.cs deleted file mode 100644 index deecfe8c..00000000 --- a/TShockAPI/StatTracker.cs +++ /dev/null @@ -1,314 +0,0 @@ -/* -TShock, a server mod for Terraria -Copyright (C) 2011-2018 Pryaxis & TShock Contributors - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -using System; -using System.Net; -using System.Threading; -using System.Web; -using TerrariaApi.Server; -using System.Diagnostics; -using System.Linq; -using System.Runtime.InteropServices; -using System.Net.Http; -using System.Threading.Tasks; -using TShockAPI.Extensions; -using System.IO; -using System.Text.RegularExpressions; - -namespace TShockAPI -{ - /// - /// StatTracker class for tracking various server metrics - /// - public class StatTracker - { - /// - /// Calls the GetPhysicallyInstalledSystemMemory Windows API function, returning the amount of RAM installed on the host PC - /// - /// The amount of memory (in kilobytes) present on the host PC - /// - [DllImport("kernel32.dll")] - [return: MarshalAs(UnmanagedType.Bool)] - static extern bool GetPhysicallyInstalledSystemMemory(out long totalMemInKb); - - /// - /// A provider token set on the command line. Used by the stats server to group providers - /// - public string ProviderToken = ""; - /// - /// Whether or not to opt out of stat tracking - /// - public bool OptOut = false; - - private PluginItem[] plugins; - - private long totalMem = 0; - private string serverId = ""; - private HttpClient _client; - private const string TrackerUrl = "http://stats.tshock.co/submit/{0}"; - - /// - /// Creates a new instance of - /// - public StatTracker() - { - } - - /// - /// Starts the stat tracker - /// - public void Start() - { - if (OptOut) - { - //If opting out, return and do not start stat tracking - return; - } - - //HttpClient with a 5 second timeout - _client = new HttpClient() - { - Timeout = new TimeSpan(0, 0, 5) - }; - serverId = Guid.NewGuid().ToString(); - - Thread t = new Thread(async () => - { - do - { - //Wait 5 minutes - await Task.Delay(1000 * 60 * 5); - //Then update again - await SendUpdateAsync(); - } while (true); - }) - { - Name = "TShock Stat Tracker Thread", - IsBackground = true - }; - t.Start(); - } - - private async Task SendUpdateAsync() - { - JsonData data = PrepareJsonData(); - var serialized = Newtonsoft.Json.JsonConvert.SerializeObject(data); - var encoded = HttpUtility.UrlEncode(serialized); - var uri = string.Format(TrackerUrl, encoded); - try - { - HttpResponseMessage msg = await _client.GetAsync(uri); - if (msg.StatusCode != HttpStatusCode.OK) - { - string reason = msg.ReasonPhrase; - if (string.IsNullOrWhiteSpace(reason)) - { - reason = "none"; - } - throw new WebException("Stats server did not respond with an OK. " - + $"Server message: [error {msg.StatusCode}] {reason}"); - } - } - catch (Exception ex) - { - string msg = ex.BuildExceptionString(); - - //Give the console a brief - Console.ForegroundColor = ConsoleColor.Yellow; - Console.WriteLine($"StatTracker warning: {msg}"); - Console.ForegroundColor = ConsoleColor.Gray; - - //And log the full exception - TShock.Log.Warn($"StatTracker warning: {ex.ToString()}"); - TShock.Log.ConsoleError("Retrying in 5 minutes."); - } - } - - private JsonData PrepareJsonData() - { - return new JsonData() - { - port = Terraria.Netplay.ListenPort, - currentPlayers = TShock.Utils.GetActivePlayerCount(), - maxPlayers = TShock.Config.MaxSlots, - systemRam = GetTotalSystemRam(ServerApi.RunningMono), - version = TShock.VersionNum.ToString(), - terrariaVersion = Terraria.Main.versionNumber2, - providerId = ProviderToken, - serverId = serverId, - mono = ServerApi.RunningMono, - ignorePluginVersion = ServerApi.IgnoreVersion, - loadedPlugins = GetLoadedPlugins() - }; - } - - private PluginItem[] GetLoadedPlugins() - { - if (plugins != null) - { - return plugins; //Return early - } - - plugins = new PluginItem[ServerApi.Plugins.Count]; //Initialize with enough room to store the ammount of plugins loaded. - for (var i = 0; i < ServerApi.Plugins.Count; i++) - { - var pluginItem = new PluginItem(); - var apiAttribute = (ApiVersionAttribute)ServerApi.Plugins[i].Plugin.GetType().GetCustomAttributes(typeof(ApiVersionAttribute), false).FirstOrDefault(); - //The current implementation of loading plugins doesn't allow for a plugin to be loaded without an ApiVersion, the UNKNOWN is there incase a change is made to allow it - pluginItem.apiVersion = apiAttribute?.ApiVersion.ToString() ?? "UNKNOWN"; - pluginItem.name = ServerApi.Plugins[i].Plugin.Name; - pluginItem.version = ServerApi.Plugins[i].Plugin.Version.ToString(); - plugins[i] = pluginItem; - } - return plugins; - } - - /// - /// Returns the amount of free RAM, in megabytes. - /// - /// Whether or not this program is being executed in a Mono runtime - /// Free RAM memory amount, in megabytes - public long GetFreeSystemRam(bool mono) - { - if (mono) - { - //Temporary in case mono won't work - if (File.Exists("/proc/meminfo")) - { - var l = File.ReadAllLines("/proc/meminfo"); - foreach (string s in l) - { - if (s.StartsWith("MemFree:")) - { - var m = Regex.Match(s, "MemFree:(\\s*)(\\d*) kB"); - if (m.Success) - { - long val; - if (long.TryParse(m.Groups[2].Value, out val)) - { - return val / 1024; - } - } - } - } - } - return -1; - } - else - { - var pc = new PerformanceCounter("Memory", "Available MBytes"); - return pc.RawValue; - } - } - - /// - /// Returns the total amount of installed RAM, in gigabytes. - /// - /// Whether or not this program is being executed in a Mono runtime - /// Total RAM memory amount, in gigabytes - public long GetTotalSystemRam(bool isMono) - { - if (totalMem != 0) - { - return totalMem; //Return early - } - - if (isMono) //Set totalMem so it can be returned later - { - var pc = new PerformanceCounter("Mono Memory", "Total Physical Memory"); - totalMem = (pc.RawValue / 1024 / 1024 / 1024); - } - else - { - GetPhysicallyInstalledSystemMemory(out totalMem); - totalMem = (totalMem / 1024 / 1024); // Super hardcore maths to convert to Gb from Kb - } - - return totalMem; - } - } - /// - /// Holding information regarding loaded plugins - /// - public struct PluginItem - { - /// - /// Plugin name - /// - public string name; - /// - /// Assembly version - /// - public string version; - /// - /// Api version or UNKNOWN if attribute is missing, which is currently impossible - /// - public string apiVersion; - } - - /// - /// Contains JSON-Serializable information about a server - /// - public struct JsonData - { - /// - /// The port the server is running on - /// - public int port; - /// - /// The number of players currently on the server - /// - public int currentPlayers; - /// - /// The maximum number of player slots available on the server - /// - public int maxPlayers; - /// - /// The amount of RAM installed on the server's host PC - /// - public long systemRam; - /// - /// The TShock version being used by the server - /// - public string version; - /// - /// Whether or not server was started with --ignoreversion - /// - public bool ignorePluginVersion; - /// - /// List of loaded plugins and version name: - /// - public PluginItem[] loadedPlugins; - /// - /// The Terraria version supported by the server - /// - public string terrariaVersion; - /// - /// The provider ID set for the server - /// - public string providerId; - /// - /// The server ID set for the server - /// - public string serverId; - /// - /// Whether or not the server is running with Mono - /// - public bool mono; - } -} diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index d309bd07..b851e720 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -116,8 +116,6 @@ namespace TShockAPI public static RestManager RestManager; /// Utils - Static reference to the utilities class, which contains a variety of utility functions. public static Utils Utils = Utils.Instance; - /// StatTracker - Static reference to the stat tracker, which sends some server metrics every 5 minutes. - public static StatTracker StatTracker = new StatTracker(); /// UpdateManager - Static reference to the update checker, which checks for updates and notifies server admins of updates. public static UpdateManager UpdateManager; /// Log - Static reference to the log system, which outputs to either SQL or a text file, depending on user config. @@ -328,12 +326,6 @@ namespace TShockAPI Log.ConsoleInfo("TShock {0} ({1}) now running.", Version, VersionCodename); - var systemRam = StatTracker.GetFreeSystemRam(ServerApi.RunningMono); - if (systemRam > -1 && systemRam < 2048) - { - Log.ConsoleError("This machine has less than 2 gigabytes of RAM free. Be advised that it might not be enough to run TShock."); - } - ServerApi.Hooks.GamePostInitialize.Register(this, OnPostInit); ServerApi.Hooks.GameUpdate.Register(this, OnUpdate); ServerApi.Hooks.GameHardmodeTileUpdate.Register(this, OnHardUpdate); @@ -757,13 +749,11 @@ namespace TShockAPI } }) - .AddFlag("--provider-token", (token) => StatTracker.ProviderToken = token) //Flags without arguments .AddFlag("-logclear", () => LogClear = true) .AddFlag("-autoshutdown", () => Main.instance.EnableAutoShutdown()) - .AddFlag("-dump", () => Utils.Dump()) - .AddFlag("--stats-optout", () => StatTracker.OptOut = true); + .AddFlag("-dump", () => Utils.Dump()); CliParser.ParseFromSource(parms); } @@ -896,7 +886,6 @@ namespace TShockAPI } UpdateManager = new UpdateManager(); - StatTracker.Start(); } /// LastCheck - Used to keep track of the last check for basically all time based checks. diff --git a/TShockAPI/TShockAPI.csproj b/TShockAPI/TShockAPI.csproj index b7bf6f8e..230443c0 100644 --- a/TShockAPI/TShockAPI.csproj +++ b/TShockAPI/TShockAPI.csproj @@ -144,7 +144,6 @@ - From ec44ae6ff6ac1660b78f4419b173862d898a0c19 Mon Sep 17 00:00:00 2001 From: Egor Date: Thu, 26 Apr 2018 22:29:41 +0300 Subject: [PATCH 5/8] Don't send PlayerTeam packet twice in SetTeam --- TShockAPI/TSPlayer.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs index 7ae16eee..cea65d21 100644 --- a/TShockAPI/TSPlayer.cs +++ b/TShockAPI/TSPlayer.cs @@ -1520,7 +1520,6 @@ namespace TShockAPI { Main.player[Index].team = team; NetMessage.SendData((int)PacketTypes.PlayerTeam, -1, -1, NetworkText.Empty, Index); - NetMessage.SendData((int)PacketTypes.PlayerTeam, -1, Index, NetworkText.Empty, Index); } private DateTime LastDisableNotification = DateTime.UtcNow; From 9ac3dfa2289d95cdd8a6214c85fe1e468572b7ed Mon Sep 17 00:00:00 2001 From: Egor Date: Fri, 27 Apr 2018 05:44:22 +0300 Subject: [PATCH 6/8] Make Kick/BanOnMediumcoreDeath behave like their Hardcore equvivalents fixes #1618 --- CHANGELOG.md | 1 + TShockAPI/GetDataHandlers.cs | 41 ++++++++++++------------------------ 2 files changed, 14 insertions(+), 28 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8006fcf8..2bbbd56d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -81,6 +81,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * `Utils.GetIPv4Address()` is now `Utils.GetIPv4AddressFromHostname()`. (@hakusaro) * Fixed the disappearing problem when placing tile entities. (@mistzzt) * Removed the stat tracking system. (@hakusaro) +* Fixed erroneous kicks and bans when using `KickOnMediumcoreDeath` and `BanOnMediumcoreDeath` options. (@DankRank) ## TShock 4.3.25 * Fixed a critical exploit in the Terraria protocol that could cause massive unpreventable world corruption as well as a number of other problems. Thanks to @bartico6 for reporting. Fixed by the efforts of @QuiCM, @hakusaro, and tips in the right directioon from @bartico6. diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index c2998b9a..8a0933a7 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -2380,16 +2380,21 @@ namespace TShockAPI } } - if (args.TPlayer.difficulty == 2 && (TShock.Config.KickOnHardcoreDeath || TShock.Config.BanOnHardcoreDeath)) + if (args.TPlayer.difficulty != 0) { - if (TShock.Config.BanOnHardcoreDeath) - { - if (!args.Player.Ban(TShock.Config.HardcoreBanReason, false, "hardcore-death")) + bool mediumcore = args.TPlayer.difficulty == 1; + bool shouldBan = mediumcore ? TShock.Config.BanOnMediumcoreDeath : TShock.Config.BanOnHardcoreDeath; + bool shouldKick = mediumcore ? TShock.Config.KickOnMediumcoreDeath : TShock.Config.KickOnHardcoreDeath; + string banReason = mediumcore ? TShock.Config.MediumcoreBanReason : TShock.Config.HardcoreBanReason; + string kickReason = mediumcore ? TShock.Config.MediumcoreKickReason : TShock.Config.HardcoreKickReason; + string banAdminName = mediumcore ? "mediumcore-death" : "hardcore-death"; + + if(shouldBan) { + if (!args.Player.Ban(banReason, false, banAdminName)) args.Player.Kick("You died! Normally, you'd be banned.", true, true); } - else - { - args.Player.Kick(TShock.Config.HardcoreKickReason, true, true, null, false); + else if(shouldKick) { + args.Player.Kick(kickReason, true, true, null, false); } } @@ -2440,27 +2445,7 @@ namespace TShockAPI if (OnPlayerSpawn(args.Player, args.Data, player, spawnx, spawny)) return true; - if (args.Player.InitSpawn && args.TPlayer.inventory[args.TPlayer.selectedItem].type != 50) - { - if (args.TPlayer.difficulty == 1 && (TShock.Config.KickOnMediumcoreDeath || TShock.Config.BanOnMediumcoreDeath)) - { - if (args.TPlayer.selectedItem != 50) - { - if (TShock.Config.BanOnMediumcoreDeath) - { - if (!args.Player.Ban(TShock.Config.MediumcoreBanReason, false, "mediumcore-death")) - args.Player.Kick("You died! Normally, you'd be banned.", true, true); - } - else - { - args.Player.Kick(TShock.Config.MediumcoreKickReason, true, true, null, false); - } - return true; - } - } - } - else - args.Player.InitSpawn = true; + args.Player.InitSpawn = true; if ((Main.ServerSideCharacter) && (args.Player.sX > 0) && (args.Player.sY > 0) && (args.TPlayer.SpawnX > 0) && ((args.TPlayer.SpawnX != args.Player.sX) && (args.TPlayer.SpawnY != args.Player.sY))) { From 1eae5ae6711c8bb47fea4bf8177419bf169eef48 Mon Sep 17 00:00:00 2001 From: Egor Date: Fri, 27 Apr 2018 08:41:57 +0300 Subject: [PATCH 7/8] Remove TSPlayer.InitSpawn --- CHANGELOG.md | 1 + TShockAPI/GetDataHandlers.cs | 2 -- TShockAPI/TSPlayer.cs | 2 -- 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2bbbd56d..69a833c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -82,6 +82,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * Fixed the disappearing problem when placing tile entities. (@mistzzt) * Removed the stat tracking system. (@hakusaro) * Fixed erroneous kicks and bans when using `KickOnMediumcoreDeath` and `BanOnMediumcoreDeath` options. (@DankRank) +* Removed `TSPlayer.InitSpawn` field. (@DankRank) ## TShock 4.3.25 * Fixed a critical exploit in the Terraria protocol that could cause massive unpreventable world corruption as well as a number of other problems. Thanks to @bartico6 for reporting. Fixed by the efforts of @QuiCM, @hakusaro, and tips in the right directioon from @bartico6. diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 8a0933a7..fb763465 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -2445,8 +2445,6 @@ namespace TShockAPI if (OnPlayerSpawn(args.Player, args.Data, player, spawnx, spawny)) return true; - args.Player.InitSpawn = true; - if ((Main.ServerSideCharacter) && (args.Player.sX > 0) && (args.Player.sY > 0) && (args.TPlayer.SpawnX > 0) && ((args.TPlayer.SpawnX != args.Player.sX) && (args.TPlayer.SpawnY != args.Player.sY))) { diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs index cea65d21..71531fb3 100644 --- a/TShockAPI/TSPlayer.cs +++ b/TShockAPI/TSPlayer.cs @@ -228,8 +228,6 @@ namespace TShockAPI /// public DateTime LastThreat { get; set; } - public bool InitSpawn; - /// /// Whether the player should see logs. /// From fd83748b9f9c553ce3092c3a750986291b8c0c9e Mon Sep 17 00:00:00 2001 From: Egor Date: Fri, 27 Apr 2018 10:19:26 +0300 Subject: [PATCH 8/8] Change banning admin name for hardcore bans to "TShock" Also added some comments and formatting --- TShockAPI/GetDataHandlers.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index fb763465..02be7f7f 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -2380,17 +2380,17 @@ namespace TShockAPI } } - if (args.TPlayer.difficulty != 0) + // Handle kicks/bans on mediumcore/hardcore deaths. + if (args.TPlayer.difficulty != 0) // Player is not softcore { bool mediumcore = args.TPlayer.difficulty == 1; - bool shouldBan = mediumcore ? TShock.Config.BanOnMediumcoreDeath : TShock.Config.BanOnHardcoreDeath; - bool shouldKick = mediumcore ? TShock.Config.KickOnMediumcoreDeath : TShock.Config.KickOnHardcoreDeath; - string banReason = mediumcore ? TShock.Config.MediumcoreBanReason : TShock.Config.HardcoreBanReason; - string kickReason = mediumcore ? TShock.Config.MediumcoreKickReason : TShock.Config.HardcoreKickReason; - string banAdminName = mediumcore ? "mediumcore-death" : "hardcore-death"; + bool shouldBan = mediumcore ? TShock.Config.BanOnMediumcoreDeath : TShock.Config.BanOnHardcoreDeath; + bool shouldKick = mediumcore ? TShock.Config.KickOnMediumcoreDeath : TShock.Config.KickOnHardcoreDeath; + string banReason = mediumcore ? TShock.Config.MediumcoreBanReason : TShock.Config.HardcoreBanReason; + string kickReason = mediumcore ? TShock.Config.MediumcoreKickReason : TShock.Config.HardcoreKickReason; if(shouldBan) { - if (!args.Player.Ban(banReason, false, banAdminName)) + if (!args.Player.Ban(banReason, false, "TShock")) args.Player.Kick("You died! Normally, you'd be banned.", true, true); } else if(shouldKick) {