public static bool Prefix(RemoteAdmin.QueryProcessor __instance, ref string query, ref bool encrypted) { if (EventPlugin.PlayerConsoleCommandPatchDisable) { return(true); } try { Events.InvokeConsoleCommand(__instance.gameObject, query, encrypted, out string returnMessage, out string color); if (string.IsNullOrEmpty(color)) { color = "white"; } if (!string.IsNullOrEmpty(returnMessage)) { __instance.GCT.SendToClient(__instance.connectionToClient, returnMessage, color); } return(false); } catch (Exception exception) { Log.Error($"ConsoleCommandEvent error: {exception}"); return(true); } }
private static bool Prefix(RemoteAdmin.QueryProcessor __instance, ref string query, bool encrypted) { (string name, string[] arguments) = query.ExtractCommand(); var ev = new SendingConsoleCommandEventArgs(API.Features.Player.Get(__instance.gameObject), name, arguments.ToList(), encrypted); Server.OnSendingConsoleCommand(ev); if (!string.IsNullOrEmpty(ev.ReturnMessage)) { __instance.GCT.SendToClient(__instance.connectionToClient, ev.ReturnMessage, ev.Color); } return(ev.Allow); }