def _run_disable_plugin_commands(self):
     for cmd in self.config.findall("disable_plugin"):
         try:
             pluginName = cmd.attrib['plugin'].strip().lower()
             plugin = self.plugin.console.getPlugin(pluginName)
             if plugin:
                 if not plugin.isEnabled():
                     self.plugin.info('Plugin %s is already disabled.' % pluginName)
                 else:
                     plugin.disable()
                     self.plugin.info('Plugin %s is now OFF' % pluginName)
             else:
                 self.plugin.warn('No plugin named %s loaded.' % pluginName)
         except Exception, e:
             self.plugin.error("task %s : %s" % (self.name, e))
예제 #2
0
 def _run_disable_plugin_commands(self):
     for cmd in self.config.findall("disable_plugin"):
         try:
             pluginName = cmd.attrib['plugin'].strip().lower()
             plugin = self.plugin.console.getPlugin(pluginName)
             if plugin:
                 if not plugin.isEnabled():
                     self.plugin.info('plugin %s is already disabled', pluginName)
                 else:
                     plugin.disable()
                     self.plugin.info('plugin %s is now OFF', pluginName)
             else:
                 self.plugin.warn('no plugin named %s loaded', pluginName)
         except Exception, e:
             self.plugin.error("task %s : %s", self.name, e)
예제 #3
0
 def do_disable(self, client, name=None):
     """
     Disable a plugin
     :param client: The client who launched the command
     :param name: The name of the plugin to disable
     """
     name = name.lower()
     if name in self._protected:
         client.message('^7Plugin ^1%s ^7is protected' % name)
     else:
         plugin = self.console.getPlugin(name)
         if not plugin:
             client.message('^7Plugin ^1%s ^7is not loaded' % name)
         else:
             if not plugin.isEnabled():
                 client.message('^7Plugin ^3%s ^7is already disabled' % name)
             else:
                 plugin.disable()
                 client.message('^7Plugin ^3%s ^7is now ^1disabled' % name)
예제 #4
0
    def cmd_match(self, data, client, cmd=None):
        """
        <on/off> - Set server match mode on/off
        """
        if not data or str(data).lower() not in ('on', 'off'):
            client.message('Invalid or missing data, expecting "on" or "off"')
        else:

            if data.lower() == 'on':

                self._matchmode = True
                self._enableTeamBalancer = False

                for e in self._match_plugin_disable:
                    self.debug('Disabling plugin %s' % e)
                    plugin = self.console.getPlugin(e)
                    if plugin:
                        plugin.disable()
                        client.message('Plugin %s disabled' % e)

                self.console.say('match mode: ON')
                if self._matchManager:
                    self._matchManager.stop()
                self._matchManager = MatchManager(self)
                self._matchManager.initMatch()

            elif data.lower() == 'off':
                self._matchmode = False
                if self._matchManager:
                    self._matchManager.stop()
                self._matchManager = None

                # enable plugins
                for e in self._match_plugin_disable:
                    self.debug('Enabling plugin %s' % e)
                    plugin = self.console.getPlugin(e)
                    if plugin:
                        plugin.enable()
                        client.message('Plugin %s enabled' % e)

                self.console.say('Match mode: OFF')
예제 #5
0
    def cmd_pamatch(self, data, client, cmd=None):
        """
        <on/off> - set server match mode on/off
        (You can safely use the command without the 'pa' at the beginning)
        """
        if not data or str(data).lower() not in ('on', 'off'):
            client.message('invalid or missing data, try !help pamatch')
        else:
            if data.lower() == 'on':
                self._matchmode = True
                self._enableTeamBalancer = False

                for e in self._match_plugin_disable:
                    self.debug('disabling plugin %s' % e)
                    plugin = self.console.getPlugin(e)
                    if plugin:
                        plugin.disable()
                        client.message('plugin %s disabled' % e)

                self.console.say('match mode: ON')
                if self._matchManager:
                    self._matchManager.stop()
                self._matchManager = MatchManager(self)
                self._matchManager.initMatch()

            elif data.lower() == 'off':
                self._matchmode = False
                if self._matchManager:
                    self._matchManager.stop()
                self._matchManager = None

                # enable plugins
                for e in self._match_plugin_disable:
                    self.debug('enabling plugin %s' % e)
                    plugin = self.console.getPlugin(e)
                    if plugin:
                        plugin.enable()
                        client.message('plugin %s enabled' % e)

                self.console.say('match mode: OFF')