def __init__(self, old_process=None): self.console_input_thread = None self.info_reactor_thread = None self.info_queue = queue.Queue(maxsize=constant.MAX_INFO_QUEUE_SIZE) self.process = old_process # the process for the server self.server_status = ServerStatus.STOPPED self.flag_interrupt = False # ctrl-c flag self.flag_rcon_startup = False # set to True after server startup. used to start the rcon server self.flag_exit = False # MCDR exit flag self.starting_server_lock = Lock() # to prevent multiple start_server() call # will be assigned in reload_config() self.encoding_method = None self.decoding_method = None self.logger = logger.Logger(self, constant.NAME_SHORT) self.logger.set_file(constant.LOGGING_FILE) self.server_logger = logger.ServerLogger('Server') self.language_manager = LanguageManager(self, constant.LANGUAGE_FOLDER) self.config = config.Config(self, constant.CONFIG_FILE) self.rcon_manager = RconManager(self) self.parser_manager = ParserManager(self) self.load_config() self.reactors = self.load_reactor(constant.REACTOR_FOLDER) self.server_interface = ServerInterface(self) self.command_manager = CommandManager(self) self.plugin_manager = PluginManager(self, constant.PLUGIN_FOLDER) self.load_plugins() self.permission_manager = PermissionManager(self, constant.PERMISSION_FILE) self.update_helper = UpdateHelper(self) self.update_helper.check_update_start()
def __init__(self): self.console_input_thread = None self.process = None # the process for the server self.server_status = ServerStatus.STOPPED self.flag_interrupt = False # ctrl-c flag self.flag_server_startup = False # set to True after server startup. used to start the rcon server self.starting_server = False # to prevent multiple start_server() call # will be assigned in reload_config() self.parser = None self.encoding_method = None self.decoding_method = None self.rcon_manager = None self.logger = logger.Logger(self, constant.NAME_SHORT) self.logger.set_file(constant.LOGGING_FILE) self.language_manager = LanguageManager(self, constant.LANGUAGE_FOLDER) self.config = config.Config(self, constant.CONFIG_FILE) self.rcon_manager = RconManager(self) self.load_config() self.reactors = self.load_reactor(constant.REACTOR_FOLDER) self.server_interface = ServerInterface(self) self.command_manager = CommandManager(self) self.plugin_manager = PluginManager(self, constant.PLUGIN_FOLDER) self.load_plugins() self.permission_manager = PermissionManager(self, constant.PERMISSION_FILE)
def start(self): # Load config self.load_config() # Load plugin self.server_interface = ServerInterface(self) self.plugin_manager.load_all_plugins() # Start Server self.receive_server.start() # Start Console self.logger.debug('Console thread starting') self.console_input_thread = func.start_thread(self.console_input, name='Console') # Main loop self.loop()
def __init__(self, old_process=None): self.console_input_thread = None self.info_reactor_thread = None self.process = old_process # type: Popen # the process for the server self.server_status = ServerStatus.STOPPED self.flag_interrupt = False # ctrl-c flag self.flag_server_startup = False # set to True after server startup self.flag_server_rcon_ready = False # set to True after server started its rcon. used to start the rcon server self.flag_mcdr_exit = False # MCDR exit flag self.flag_exit_naturally = True # if MCDR exit after server stop. can be modified by plugins self.starting_server_lock = Lock( ) # to prevent multiple start_server() call self.stop_lock = Lock() # to prevent multiple stop() call # will be assigned in reload_config() self.encoding_method = None self.decoding_method = None self.logger = logger.Logger(self, constant.NAME_SHORT) self.logger.set_file(constant.LOGGING_FILE) self.server_logger = logger.ServerLogger('Server') self.language_manager = LanguageManager(self, constant.LANGUAGE_FOLDER) self.config = config.Config(self, constant.CONFIG_FILE) self.rcon_manager = RconManager(self) self.parser_manager = ParserManager(self, constant.PARSER_FOLDER) self.load_config() # loads config, language, parsers self.reactor_manager = ReactorManager(self) self.server_interface = ServerInterface(self) self.command_manager = CommandManager(self) self.plugin_manager = PluginManager(self, constant.PLUGIN_FOLDER) self.load_plugins() self.permission_manager = PermissionManager(self, constant.PERMISSION_FILE) self.update_helper = UpdateHelper(self) self.update_helper.check_update_start()