From afdedee1c474b18e15bca65dc21aced7276bdba1 Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Fri, 29 Dec 2017 08:04:20 -0700 Subject: [PATCH] Change Utils.Reload to not take a player. There are two occasions in the codebase when Utils.Reload is called and we're competent enough that we can just call the event when the reload happens. Unrelated note, but shouldn't this event be called prior to reloading? I've kept it the same to preserve existing behavior, but I think it should probably happen before the reload event takes place. Either way, I think this is fine. --- TShockAPI/Commands.cs | 3 ++- TShockAPI/Rest/RestManager.cs | 3 ++- TShockAPI/Utils.cs | 3 +-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index 2c593d8f..25860577 100644 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -3798,7 +3798,8 @@ namespace TShockAPI private static void Reload(CommandArgs args) { - TShock.Utils.Reload(args.Player); + TShock.Utils.Reload(); + Hooks.GeneralHooks.OnReloadEvent(args.Player); args.Player.SendSuccessMessage( "Configuration, permissions, and regions reload complete. Some changes may require a server restart."); diff --git a/TShockAPI/Rest/RestManager.cs b/TShockAPI/Rest/RestManager.cs index d47130b6..5174b560 100644 --- a/TShockAPI/Rest/RestManager.cs +++ b/TShockAPI/Rest/RestManager.cs @@ -339,7 +339,8 @@ namespace TShockAPI [Token] private object ServerReload(RestRequestArgs args) { - TShock.Utils.Reload(new TSRestPlayer(args.TokenData.Username, TShock.Groups.GetGroupByName(args.TokenData.UserGroupName))); + TShock.Utils.Reload(); + Hooks.GeneralHooks.OnReloadEvent(new TSRestPlayer(args.TokenData.Username, TShock.Groups.GetGroupByName(args.TokenData.UserGroupName))); return RestResponse("Configuration, permissions, and regions reload complete. Some changes may require a server restart."); } diff --git a/TShockAPI/Utils.cs b/TShockAPI/Utils.cs index 5e5e7580..2c95af15 100644 --- a/TShockAPI/Utils.cs +++ b/TShockAPI/Utils.cs @@ -495,7 +495,7 @@ namespace TShockAPI /// /// Reloads all configuration settings, groups, regions and raises the reload event. /// - public void Reload(TSPlayer player) + public void Reload() { FileTools.SetupConfig(); TShock.HandleCommandLinePostConfigLoad(Environment.GetCommandLineArgs()); @@ -504,7 +504,6 @@ namespace TShockAPI TShock.Itembans.UpdateItemBans(); TShock.ProjectileBans.UpdateBans(); TShock.TileBans.UpdateBans(); - Hooks.GeneralHooks.OnReloadEvent(player); } /// HasBanExpired - Returns whether or not a ban has expired or not.