diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index 648b357b..b1b3db61 100644 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -2288,10 +2288,11 @@ namespace TShockAPI FileTools.SetupConfig(); TShock.HandleCommandLinePostConfigLoad(Environment.GetCommandLineArgs()); TShock.Groups.LoadPermisions(); - //todo: Create an event for reloads to propegate to plugins. TShock.Regions.ReloadAllRegions(); args.Player.SendSuccessMessage( "Configuration, permissions, and regions reload complete. Some changes may require a server restart."); + + Hooks.GeneralHooks.OnReloadEvent(args.Player); } private static void ServerPassword(CommandArgs args) diff --git a/TShockAPI/Hooks/GeneralHooks.cs b/TShockAPI/Hooks/GeneralHooks.cs new file mode 100644 index 00000000..d01ded4c --- /dev/null +++ b/TShockAPI/Hooks/GeneralHooks.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace TShockAPI.Hooks +{ + public class ReloadEventArgs + { + public TSPlayer Player { get; set; } + public ReloadEventArgs(TSPlayer ply) + { + Player = ply; + } + } + + public class GeneralHooks + { + public delegate void ReloadEventD(ReloadEventArgs e); + public static event ReloadEventD ReloadEvent; + + public static void OnReloadEvent(TSPlayer ply) + { + if(ReloadEvent == null) + return; + + ReloadEvent(new ReloadEventArgs(ply)); + } + } +} diff --git a/TShockAPI/TShockAPI.csproj b/TShockAPI/TShockAPI.csproj index beed07b1..697474e2 100644 --- a/TShockAPI/TShockAPI.csproj +++ b/TShockAPI/TShockAPI.csproj @@ -83,6 +83,7 @@ + @@ -186,7 +187,7 @@ - +