// ConsoleSystem.SystemRealm.Normal public static void On_ServerConsole(ConsoleSystem.Arg arg, string cmd) { try { if (!Bootstrap.PlutonLoaded) { return; } ServerConsoleEvent ssc = new ServerConsoleEvent(arg, cmd); foreach (KeyValuePair <string, BasePlugin> pl in PluginLoader.GetInstance().Plugins) { ConsoleCommand[] commands = pl.Value.consoleCommands.getConsoleCommands(ssc.cmd); foreach (ConsoleCommand cc in commands) { if (cc.callback == null) { continue; } try { cc.callback(arg.ArgsStr.Split(' ')); } catch (Exception ex) { Logger.LogError(cc.plugin.FormatException(ex)); } } } OnNext("On_ServerConsole", ssc); if (arg.Invalid) { Debug.Log(ssc.Reply); } } catch (Exception ex) { Logger.LogException(ex); } }
/// <summary> /// Called from <c>ConsoleSystem.SystemRealm.Normal(RunOptions, string, params object[])</c> . /// </summary> public static void On_ServerConsole(ConsoleSystem.Arg arg, string cmd) { try { if (!Core.Bootstrap.PlutonLoaded) return; var sce = new ServerConsoleEvent(arg, cmd); foreach (KeyValuePair<string, BasePlugin> pl in PluginLoader.GetInstance().Plugins) { object globalObj = pl.Value.GetGlobalObject("ServerConsoleCommands"); if (globalObj is ConsoleCommands) { ConsoleCommand[] commands = (globalObj as ConsoleCommands).getConsoleCommands(sce.Cmd); foreach (ConsoleCommand cc in commands) { if (cc.callback == null) continue; try { cc.callback(arg.ArgsStr.Split(' ')); } catch (Exception ex) { Logger.LogError(cc.plugin.FormatException(ex)); } } } } OnNext("On_ServerConsole", sce); if (arg.Invalid) { Debug.Log(sce.Reply); } } catch (Exception ex) { Logger.LogException(ex); } }
public void On_ServerConsole(ServerConsoleEvent sce) { SetHookWorking("On_ServerConsole"); Broadcast(sce.Cmd + " command used in server console"); }
public void OnServerConsole(ServerConsoleEvent ce) { this.Invoke("On_ServerConsole", ce); }