Exemple #1
0
        public static void ConsoleReceived(ref ConsoleSystem.Arg arg, bool external)
        {
            string clss        = arg.Class.ToLower();
            string func        = arg.Function.ToLower();
            string name        = "RCON_External";
            bool   adminRights = external;

            if (!external)
            {
                //Fougerite.Player player = Fougerite.Player.FindByPlayerClient (arg.argUser.playerClient);
                Fougerite.Player player = Fougerite.Server.Cache[arg.argUser.playerClient.userID];
                if (player.Admin)
                {
                    adminRights = true;
                }
                name = player.Name;
            }
            if (adminRights)
            {
                if ((clss == "ipm" || clss == "python") && func == "reload" && arg.ArgsStr == "")
                {
                    IPModule.GetInstance().ReloadPlugins();
                    arg.ReplyWith("Python Reloaded!");
                    Logger.LogDebug("[IPModule] " + name + " executed: python.reload");
                }
                else if (clss == "python" && func == "load")
                {
                    IPModule.GetInstance().LoadPlugin(arg.ArgsStr);
                    arg.ReplyWith("Python.load plugin executed!");
                    Logger.LogDebug("[IPModule] " + name + " executed: python.load " + arg.ArgsStr);
                }
                else if (clss == "python" && func == "unload")
                {
                    IPModule.GetInstance().UnloadPlugin(arg.ArgsStr);
                    arg.ReplyWith("Python.unload plugin executed!");
                    Logger.LogDebug("[IPModule] " + name + " executed: python.unload " + arg.ArgsStr);
                }
                else if (clss == "python" && func == "reload")
                {
                    IPModule.GetInstance().ReloadPlugin(arg.ArgsStr);
                    arg.ReplyWith("Python.reload plugin executed!");
                    Logger.LogDebug("[IPModule] " + name + " executed: python.reload " + arg.ArgsStr);
                }
            }

            if (OnConsoleReceived != null)
            {
                OnConsoleReceived(ref arg, external);
            }
        }
Exemple #2
0
 public override void Initialize()
 {
     pluginDirectory = new DirectoryInfo(ModuleFolder);
     if (!Directory.Exists(pluginDirectory.FullName))
     {
         Directory.CreateDirectory(pluginDirectory.FullName);
     }
     plugins = new Dictionary <string, IPPlugin>();
     ReloadPlugins();
     Hooks.OnConsoleReceived -= new Hooks.ConsoleHandlerDelegate(ConsoleReceived);
     Hooks.OnConsoleReceived += new Hooks.ConsoleHandlerDelegate(ConsoleReceived);
     if (instance == null)
     {
         instance = this;
     }
 }