Added event for reloading configs, so when a user does /reload it informs plugins that a config reload is requested.

This commit is contained in:
Zack Piispanen 2013-04-21 19:26:17 -04:00
parent b37552ff27
commit e37ada8749
3 changed files with 34 additions and 2 deletions

View file

@ -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)

View file

@ -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));
}
}
}

View file

@ -83,6 +83,7 @@
<ItemGroup>
<Compile Include="BackupManager.cs" />
<Compile Include="DB\RegionManager.cs" />
<Compile Include="Hooks\GeneralHooks.cs" />
<Compile Include="Hooks\PlayerHooks.cs" />
<Compile Include="SaveManager.cs" />
<Compile Include="DB\BanManager.cs" />
@ -186,7 +187,7 @@
</PropertyGroup>
<ProjectExtensions>
<VisualStudio>
<UserProperties BuildVersion_UpdateAssemblyVersion="True" BuildVersion_UpdateFileVersion="True" BuildVersion_BuildAction="Both" BuildVersion_BuildVersioningStyle="None.None.None.MonthAndDayStamp" BuildVersion_StartDate="2011/6/17" BuildVersion_IncrementBeforeBuild="False" />
<UserProperties BuildVersion_IncrementBeforeBuild="False" BuildVersion_StartDate="2011/6/17" BuildVersion_BuildVersioningStyle="None.None.None.MonthAndDayStamp" BuildVersion_BuildAction="Both" BuildVersion_UpdateFileVersion="True" BuildVersion_UpdateAssemblyVersion="True" />
</VisualStudio>
</ProjectExtensions>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.