From f8ecb00e4eeb7a6f933cda5ace8c546a4b2bcdca Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Thu, 15 Mar 2018 11:45:45 +1100 Subject: [PATCH] Allow configuring heartbeat URL --- MCGalaxy/Network/Heartbeat/ClassiCube.cs | 7 +++---- MCGalaxy/Server/ServerConfig.cs | 4 +++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/MCGalaxy/Network/Heartbeat/ClassiCube.cs b/MCGalaxy/Network/Heartbeat/ClassiCube.cs index 3f3692a34..9bc9cf03a 100644 --- a/MCGalaxy/Network/Heartbeat/ClassiCube.cs +++ b/MCGalaxy/Network/Heartbeat/ClassiCube.cs @@ -25,14 +25,13 @@ namespace MCGalaxy.Network { /// Heartbeat to ClassiCube.net's web server. public sealed class ClassiCubeBeat : Heartbeat { - - string url = "http://www.classicube.net/heartbeat.jsp"; string proxyUrl; - public override string URL { get { return url; } } + public override string URL { get { return ServerConfig.HeartbeatURL; } } public override void Init() { try { - IPAddress[] addresses = Dns.GetHostAddresses("www.classicube.net"); + string hostUrl = new Uri(URL).Host; + IPAddress[] addresses = Dns.GetHostAddresses(hostUrl); EnsureIPv4Url(addresses); } catch (Exception ex) { Logger.Log(LogType.Warning, "Error while trying to retrieve DNS information for classicube.net"); diff --git a/MCGalaxy/Server/ServerConfig.cs b/MCGalaxy/Server/ServerConfig.cs index 4e63d3b66..70f44f1e9 100644 --- a/MCGalaxy/Server/ServerConfig.cs +++ b/MCGalaxy/Server/ServerConfig.cs @@ -27,7 +27,9 @@ namespace MCGalaxy { [ConfigString("server-name", "General", "[MCGalaxy] Default", false, asciiChars, 64)] public static string Name = "[MCGalaxy] Default"; [ConfigString("motd", "General", "Welcome", false, asciiChars, 128)] - public static string MOTD = "Welcome!"; + public static string MOTD = "Welcome!"; + [ConfigString("HeartbeatURL", "Other", "http://www.classicube.net/heartbeat.jsp", false, ":/.")] + public static string HeartbeatURL = "http://www.classicube.net/heartbeat.jsp"; [ConfigInt("max-players", "Server", 12, 1, 128)] public static int MaxPlayers = 12; [ConfigInt("max-guests", "Server", 10, 1, 128)]