コード例 #1
0
        public async Task <Server> CreateServerFromConfigurationAsync(AbstractServerConfiguration configuration)
        {
            await ValidateNewServerConfiguration(configuration);

            if (configuration is MinecraftConfiguration minecraftConfiguration)
            {
                var wrappedServer = await MinecraftServer.CreateAsync(minecraftConfiguration, this);

                return(wrappedServer.ServerEntity);
            }

            if (configuration is TerrariaConfiguration terrariaConfiguration)
            {
                var wrappedServer = await TerrariaServer.CreateAsync(terrariaConfiguration, this);

                return(wrappedServer.ServerEntity);
            }

            throw new Exception($"Unrecognised server configuration: {configuration.GetType().Name}");
        }
コード例 #2
0
        /// <summary>
        /// Get string from specific language
        /// </summary>
        /// <param name="key">Key of the string</param>
        /// <returns>String in specific language</returns>
        public static string GetString(string key)
        {
            string word = "";
            string l    = TerrariaServer.Configuration.GetData("lang");

            if (!languages.ContainsKey(l))
            {
                TerrariaServer.Warning("This language doesn't exists : " + l);
                l = "en";
            }
            if (languages[l].ContainsKey(key))
            {
                word = languages[l][key];
            }
            else
            {
                TerrariaServer.Warning("Problem with the language : " + l + " with the key : " + key);
                word = englishDic[key];
            }
            return(word);
        }
コード例 #3
0
 /// <summary>
 /// Main method
 /// </summary>
 /// <param name="args">Execution's args</param>
 static void Main(string[] args)
 {
     terrariaServer = new TerrariaServer();
     terrariaServer.Start();
 }