mirror of
https://github.com/RaidMax/IW4M-Admin.git
synced 2025-06-10 15:20:48 -05:00
properly implement sv_sayName for custom say name
prevent trying to register live radar page for every server (oops) optimize event processing to prevent slow plugins from affecting command processing enable database connection resilency trim extra characters from T7 reassembled response
This commit is contained in:
@ -152,36 +152,49 @@ namespace IW4MAdmin
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var plugin in Manager.Plugins)
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
// we don't want to run the events on parser plugins
|
||||
if (plugin is ScriptPlugin scriptPlugin && scriptPlugin.IsParser)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
var loginPlugin = Manager.Plugins.FirstOrDefault(_plugin => _plugin.Name == "Login");
|
||||
|
||||
await plugin.OnEventAsync(E, this);
|
||||
}
|
||||
catch (AuthorizationException e)
|
||||
if (loginPlugin != null)
|
||||
{
|
||||
E.Origin.Tell($"{loc["COMMAND_NOTAUTHORIZED"]} - {e.Message}");
|
||||
canExecuteCommand = false;
|
||||
}
|
||||
catch (Exception Except)
|
||||
{
|
||||
Logger.WriteError($"{loc["SERVER_PLUGIN_ERROR"]} [{plugin.Name}]");
|
||||
Logger.WriteDebug(Except.GetExceptionInfo());
|
||||
await loginPlugin.OnEventAsync(E, this);
|
||||
}
|
||||
}
|
||||
|
||||
catch (AuthorizationException e)
|
||||
{
|
||||
E.Origin.Tell($"{loc["COMMAND_NOTAUTHORIZED"]} - {e.Message}");
|
||||
canExecuteCommand = false;
|
||||
}
|
||||
|
||||
// hack: this prevents commands from getting executing that 'shouldn't' be
|
||||
if (E.Type == GameEvent.EventType.Command && E.Extra is Command command &&
|
||||
(canExecuteCommand || E.Origin?.Level == Permission.Console))
|
||||
{
|
||||
await command.ExecuteAsync(E);
|
||||
}
|
||||
|
||||
var pluginTasks = Manager.Plugins.Where(_plugin => _plugin.Name != "Login").Select(async _plugin =>
|
||||
{
|
||||
try
|
||||
{
|
||||
// we don't want to run the events on parser plugins
|
||||
if (_plugin is ScriptPlugin scriptPlugin && scriptPlugin.IsParser)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
await _plugin.OnEventAsync(E, this);
|
||||
}
|
||||
catch (Exception Except)
|
||||
{
|
||||
Logger.WriteError($"{loc["SERVER_PLUGIN_ERROR"]} [{_plugin.Name}]");
|
||||
Logger.WriteDebug(Except.GetExceptionInfo());
|
||||
}
|
||||
});
|
||||
|
||||
Parallel.ForEach(pluginTasks, async (_task) => await _task);
|
||||
}
|
||||
|
||||
catch (Exception e)
|
||||
@ -944,6 +957,11 @@ namespace IW4MAdmin
|
||||
var logsync = await this.GetDvarAsync<int>("g_logsync");
|
||||
var ip = await this.GetDvarAsync<string>("net_ip");
|
||||
|
||||
if (Manager.GetApplicationSettings().Configuration().EnableCustomSayName)
|
||||
{
|
||||
await this.SetDvarAsync("sv_sayname", Manager.GetApplicationSettings().Configuration().CustomSayName);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var website = await this.GetDvarAsync<string>("_website");
|
||||
|
Reference in New Issue
Block a user