Example #1
0
        private void PingServer()
        {
            string host = PluginSettings.GetData <string>("Host");
            int    port = PluginSettings.GetData <int>("Port");

            if (string.IsNullOrEmpty(host) || port == 0)
            {
                CachedData.RemoveKey("ServerStatus");
            }
            else if (Uri.CheckHostName(host) == UriHostNameType.Unknown)
            {
                CachedData.RemoveKey("ServerStatus");
            }
            else
            {
                CachedData.SetData("ServerStatus", new MinecraftServerHelper().PingServer(host, port));
            }
        }