diff --git a/SCPDiscordPlugin/EventListeners/AdminEventListener.cs b/SCPDiscordPlugin/EventListeners/AdminEventListener.cs index e596be23..e83b806a 100644 --- a/SCPDiscordPlugin/EventListeners/AdminEventListener.cs +++ b/SCPDiscordPlugin/EventListeners/AdminEventListener.cs @@ -21,21 +21,45 @@ public void OnAdminQuery(AdminQueryEvent ev) { return; } - Dictionary variables = new Dictionary + + if (ev.Admin == null) { - { "ipaddress", ev.Admin.IPAddress }, - { "name", ev.Admin.Name }, - { "playerid", ev.Admin.PlayerID.ToString() }, - { "steamid", ev.Admin.GetParsedUserID() }, - { "class", ev.Admin.PlayerRole.RoleID.ToString() }, - { "team", ev.Admin.PlayerRole.Team.ToString() }, - { "handled", ev.Handled.ToString() }, - { "output", ev.Output }, - { "query", ev.Query }, - { "successful", ev.Successful.ToString() } - }; + Dictionary variables = new Dictionary + { + { "ipaddress", "" }, + { "name", "Server" }, + { "playerid", "" }, + { "steamid", "" }, + { "class", "" }, + { "team", "" }, + { "handled", ev.Handled.ToString() }, + { "output", ev.Output }, + { "query", ev.Query }, + { "successful", ev.Successful.ToString() } + }; + + this.plugin.SendMessage(Config.GetArray("channels.onadminquery"), "admin.onadminquery", variables); + } + else + { + Dictionary variables = new Dictionary + { + { "ipaddress", ev.Admin.IPAddress }, + { "name", ev.Admin.Name }, + { "playerid", ev.Admin.PlayerID.ToString() }, + { "steamid", ev.Admin.GetParsedUserID() }, + { "class", ev.Admin.PlayerRole.RoleID.ToString() }, + { "team", ev.Admin.PlayerRole.Team.ToString() }, + { "handled", ev.Handled.ToString() }, + { "output", ev.Output }, + { "query", ev.Query }, + { "successful", ev.Successful.ToString() } + }; + + this.plugin.SendMessage(Config.GetArray("channels.onadminquery"), "admin.onadminquery", variables); + } + - this.plugin.SendMessage(Config.GetArray("channels.onadminquery"), "admin.onadminquery", variables); } public void OnBan(BanEvent ev)