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:
parent
b37552ff27
commit
e37ada8749
3 changed files with 34 additions and 2 deletions
|
|
@ -2288,10 +2288,11 @@ namespace TShockAPI
|
||||||
FileTools.SetupConfig();
|
FileTools.SetupConfig();
|
||||||
TShock.HandleCommandLinePostConfigLoad(Environment.GetCommandLineArgs());
|
TShock.HandleCommandLinePostConfigLoad(Environment.GetCommandLineArgs());
|
||||||
TShock.Groups.LoadPermisions();
|
TShock.Groups.LoadPermisions();
|
||||||
//todo: Create an event for reloads to propegate to plugins.
|
|
||||||
TShock.Regions.ReloadAllRegions();
|
TShock.Regions.ReloadAllRegions();
|
||||||
args.Player.SendSuccessMessage(
|
args.Player.SendSuccessMessage(
|
||||||
"Configuration, permissions, and regions reload complete. Some changes may require a server restart.");
|
"Configuration, permissions, and regions reload complete. Some changes may require a server restart.");
|
||||||
|
|
||||||
|
Hooks.GeneralHooks.OnReloadEvent(args.Player);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ServerPassword(CommandArgs args)
|
private static void ServerPassword(CommandArgs args)
|
||||||
|
|
|
||||||
30
TShockAPI/Hooks/GeneralHooks.cs
Normal file
30
TShockAPI/Hooks/GeneralHooks.cs
Normal 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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -83,6 +83,7 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="BackupManager.cs" />
|
<Compile Include="BackupManager.cs" />
|
||||||
<Compile Include="DB\RegionManager.cs" />
|
<Compile Include="DB\RegionManager.cs" />
|
||||||
|
<Compile Include="Hooks\GeneralHooks.cs" />
|
||||||
<Compile Include="Hooks\PlayerHooks.cs" />
|
<Compile Include="Hooks\PlayerHooks.cs" />
|
||||||
<Compile Include="SaveManager.cs" />
|
<Compile Include="SaveManager.cs" />
|
||||||
<Compile Include="DB\BanManager.cs" />
|
<Compile Include="DB\BanManager.cs" />
|
||||||
|
|
@ -186,7 +187,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ProjectExtensions>
|
<ProjectExtensions>
|
||||||
<VisualStudio>
|
<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>
|
</VisualStudio>
|
||||||
</ProjectExtensions>
|
</ProjectExtensions>
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue