Open DigTron opened 9 years ago
Actually, that's an original feature of Extender. As far as doing the same for Essentials goes, that should be fairly easy to implement. However, the specific behavior you're talking about with updating sounds like a better idea to just be an auto-updated plugin, specifically, or perhaps an auto-update feature to be built in to extender and/or essentials.
I haven't been pursuing the detection of updates lately, in fact I have disabled updates for Thursdays entirely for the moment, but I will come back to that.
But what I have done to accomplish the triggering of loading the settings file is add a chat command to essentials for this "/admin loadconfig" and I'm going to trigger this through wcf when needed.
Not sure of how to go about sharing this (I'll learn github later) so for the moment (and because its simple) I'll share it here.
2 files were altered: (lines were chosen to keep like with like) EssentialsPlugin\Essentials.cs added at line 922 (the rest pushed down)
new HandleAdminLoadConfig( ),
EssentialsPlugin\EssentialsPlugin.csproj added at at line 93 (the rest pushed down)
<Compile Include="ChatHandlers\Admin\HandleAdminLoadConfig.cs" />
1 file was created: EssentialsPlugin\ChatHandlers\Admin\HandleAdminLoadConfig.cs
using EssentialsPlugin.Utility;
namespace EssentialsPlugin.ChatHandlers
{
public class HandleAdminLoadConfig : ChatHandlerBase
{
public override string GetHelp()
{
return "This will force a reload of the Essentials settings file. Usage: /admin loadconfig";
}
public override string GetCommandText()
{
return "/admin loadconfig";
}
public override bool IsAdminCommand()
{
return true;
}
public override bool AllowedInConsole()
{
return true;
}
public override bool HandleCommand(ulong userId, string[] words)
{
Communication.SendPrivateInformation(userId, string.Format("Loading Essentials settings ..."));
PluginSettings.Instance.Load( );
Communication.SendPrivateInformation(userId, string.Format("Essentials settings load complete ..."));
return true;
}
}
}
Tested on my own servers and is working, but I'm very green so I cant guarantee I haven't done something stupid.
I think this might be better than auto detecting, this way whatever made the changes can trigger the load when needed.
@DigTron, are you in the skype SE modders group?
This is by no means important, I just think it would be very handy for automation. I see that your version of Extender now notices if changes are made to the server config file and then tries to reload it. I think such a feature would be very useful in essentials as it would allow scripts to.. for example, alter server messages and restart times when a Space Engineers update is detected.
Again not important, I can get by fine without it, thanks for your time.