def __init__(self, name): BetaServerProtocol.__init__(self) self.config_name = "world %s" % name log.msg("Registering client hooks...") names = configuration.getlistdefault(self.config_name, "build_hooks", []) self.build_hooks = retrieve_sorted_plugins(IBuildHook, names) names = configuration.getlistdefault(self.config_name, "dig_hooks", []) self.dig_hooks = retrieve_sorted_plugins(IDigHook, names) names = configuration.getlistdefault(self.config_name, "sign_hooks", []) self.sign_hooks = retrieve_sorted_plugins(ISignHook, names) names = configuration.getlistdefault(self.config_name, "use_hooks", []) self.use_hooks = defaultdict(list) for plugin in retrieve_named_plugins(IUseHook, names): for target in plugin.targets: self.use_hooks[target].append(plugin) # Retrieve the MOTD. Only needs to be done once. self.motd = configuration.getdefault(self.config_name, "motd", None) self.last_dig_build_timer = time()
def __init__(self, name): BetaServerProtocol.__init__(self) self.config_name = "world %s" % name log.msg("Registering client hooks...") names = configuration.getlistdefault(self.config_name, "pre_build_hooks", []) self.pre_build_hooks = retrieve_sorted_plugins(IPreBuildHook, names) names = configuration.getlistdefault(self.config_name, "post_build_hooks", []) self.post_build_hooks = retrieve_sorted_plugins(IPostBuildHook, names) names = configuration.getlistdefault(self.config_name, "dig_hooks", []) self.dig_hooks = retrieve_sorted_plugins(IDigHook, names) names = configuration.getlistdefault(self.config_name, "sign_hooks", []) self.sign_hooks = retrieve_sorted_plugins(ISignHook, names) names = configuration.getlistdefault(self.config_name, "use_hooks", []) self.use_hooks = defaultdict(list) for plugin in retrieve_named_plugins(IUseHook, names): for target in plugin.targets: self.use_hooks[target].append(plugin) log.msg("Registering policies...") self.dig_policy = dig_policies["notchy"] # Retrieve the MOTD. Only needs to be done once. self.motd = configuration.getdefault(self.config_name, "motd", None)
def __init__(self, name): BetaServerProtocol.__init__(self) self.config_name = "world %s" % name # Retrieve the MOTD. Only needs to be done once. self.motd = configuration.getdefault(self.config_name, "motd", "BravoServer")
def __init__(self, name): BetaServerProtocol.__init__(self) self.config_name = "world %s" % name log.msg("Registering client hooks...") # Retrieve the MOTD. Only needs to be done once. self.motd = configuration.getdefault(self.config_name, "motd", None)
def __init__(self, name): """ Create a factory and world. ``name`` is the string used to look up factory-specific settings from the configuration. :param str name: internal name of this factory """ log.msg("Initializing factory for world '%s'..." % name) self.name = name self.config_name = "world %s" % name self.port = configuration.getint(self.config_name, "port") self.interface = configuration.getdefault(self.config_name, "host", "") self.world = World(name) self.world.factory = self if configuration.has_option(self.config_name, "perm_cache"): cache_level = configuration.getint(self.config_name, "perm_cache") self.world.enable_cache(cache_level) self.protocols = dict() self.eid = 1 self.time = self.world.time self.time_loop = LoopingCall(self.update_time) self.time_loop.start(2) authenticator = configuration.get(self.config_name, "authenticator") selected = retrieve_named_plugins(IAuthenticator, [authenticator])[0] log.msg("Using authenticator %s" % selected.name) self.handshake_hook = selected.handshake self.login_hook = selected.login generators = configuration.getlist(self.config_name, "generators") generators = retrieve_sorted_plugins(ITerrainGenerator, generators) log.msg("Using generators %s" % ", ".join(i.name for i in generators)) self.world.pipeline = generators self.chat_consumers = set() log.msg("Factory successfully initialized for world '%s'!" % name)
def __init__(self, name): """ Create a factory and world. ``name`` is the string used to look up factory-specific settings from the configuration. :param str name: internal name of this factory """ self.name = name self.config_name = "world %s" % name self.port = configuration.getint(self.config_name, "port") self.interface = configuration.getdefault(self.config_name, "host", "")