From ac5e578969abff123cb28a1f9848e7adab20fb9a Mon Sep 17 00:00:00 2001 From: Karl Essinger Date: Fri, 20 Jul 2018 21:05:16 +0200 Subject: [PATCH] Fix for where the port and IP were not read until after connecting --- SCPDiscordPlugin/SCPDiscord.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/SCPDiscordPlugin/SCPDiscord.cs b/SCPDiscordPlugin/SCPDiscord.cs index fb460144..0105a829 100644 --- a/SCPDiscordPlugin/SCPDiscord.cs +++ b/SCPDiscordPlugin/SCPDiscord.cs @@ -35,10 +35,6 @@ public override void Register() this.AddEventHandlers(new EnvironmentEventHandler(this)); this.AddEventHandlers(new TeamEventHandler(this)); - //Connection settings - this.AddConfig(new Smod2.Config.ConfigSetting("discord_bot_ip", "127.0.0.1", Smod2.Config.SettingType.STRING, true, "IP of the discord bot.")); - this.AddConfig(new Smod2.Config.ConfigSetting("discord_bot_port", 8888, Smod2.Config.SettingType.NUMERIC, true, "Port of the discord bot.")); - //Round events this.AddConfig(new Smod2.Config.ConfigSetting("discord_channel_onroundstart", "off", Smod2.Config.SettingType.STRING, true, "Discord channel to post event messages in.")); this.AddConfig(new Smod2.Config.ConfigSetting("discord_channel_onconnect", "off", Smod2.Config.SettingType.STRING, true, "Discord channel to post event messages in.")); @@ -90,8 +86,13 @@ public override void Register() public override void OnEnable() { + //Connection settings + this.AddConfig(new Smod2.Config.ConfigSetting("discord_bot_ip", "127.0.0.1", Smod2.Config.SettingType.STRING, true, "IP of the discord bot.")); + this.AddConfig(new Smod2.Config.ConfigSetting("discord_bot_port", 8888, Smod2.Config.SettingType.NUMERIC, true, "Port of the discord bot.")); + try { + this.Info("Your Bot IP: " + this.GetConfigString("discord_bot_ip") + ". Your Bot Port: " + this.GetConfigInt("discord_bot_port") + "."); clientSocket.Connect(this.GetConfigString("discord_bot_ip"), this.GetConfigInt("discord_bot_port")); } catch(SocketException e)