示例#1
0
        public bool OnEnable(GameServer gameServer, bool isAfterServerLoad)
        {
            GameServer = gameServer;

            try
            {
                Configuration = gameServer.InitConfiguration <FreeroamConfiguration>(typeof(Freeroam));
            }
            catch (Exception e)
            {
                Configuration = new FreeroamConfiguration();
            }
            gameServer.RegisterCommands <FreeroamCommands>();

            ConnectionEvents.OnJoin.Add(OnJoin);

            return(true);
        }
示例#2
0
        public bool OnEnable(GameServer gameServer, bool isAfterServerLoad)
        {
            GameServer = gameServer;
            _logger    = Util.LoggerFactory.CreateLogger <Freeroam>();

            _logger.LogInformation("Reading configuration");

            try
            {
                Configuration = gameServer.InitConfiguration <FreeroamConfiguration>(typeof(Freeroam));
            }
            catch (Exception e)
            {
                _logger.LogError("Something got wrong while reading configuration of freeroam gamemode, the following exception was thrown: " + e.Message + ". Using default configuration");
                Configuration = new FreeroamConfiguration();
            }

            GameServer.RegisterCommand("respawn", new RespawnCommand());
            gameServer.RegisterCommand("car", new CarCommand());

            ConnectionEvents.OnJoin.Add(OnJoin);

            return(true);
        }