示例#1
0
文件: beta.py 项目: dliverman/bravo
    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()
示例#2
0
文件: beta.py 项目: driax/bravo
    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)
示例#3
0
文件: protocol.py 项目: mmcgill/bravo
    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")
示例#4
0
    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)
示例#5
0
    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)
示例#6
0
文件: beta.py 项目: Mortal/bravo
    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)
示例#7
0
文件: beta.py 项目: dliverman/bravo
    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", "")
示例#8
0
文件: beta.py 项目: dliverman/bravo
    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", "")