fix: relaunch server on port change
This commit is contained in:
parent
4e81786a2a
commit
6276bea698
|
@ -61,8 +61,7 @@ namespace XIVChatPlugin {
|
|||
|
||||
this.Ui = new PluginUI(this);
|
||||
|
||||
this.Server = new Server(this);
|
||||
this.Server.Spawn();
|
||||
this.LaunchServer();
|
||||
|
||||
this.Interface.UiBuilder.OnBuildUi += this.Ui.Draw;
|
||||
this.Interface.UiBuilder.OnOpenConfigUi += this.Ui.OpenSettings;
|
||||
|
@ -76,6 +75,16 @@ namespace XIVChatPlugin {
|
|||
});
|
||||
}
|
||||
|
||||
public void LaunchServer() {
|
||||
this.Server = new Server(this);
|
||||
this.Server.Spawn();
|
||||
}
|
||||
|
||||
public void RelaunchServer() {
|
||||
this.Server.Dispose();
|
||||
this.LaunchServer();
|
||||
}
|
||||
|
||||
private byte ChangeChatChannelDetour(IntPtr a1, uint channel) {
|
||||
// a1 + 0xfd0 is the chat channel byte (including for when clicking on shout)
|
||||
this.Server.OnChatChannelChange(channel);
|
||||
|
|
|
@ -117,6 +117,8 @@ namespace XIVChatPlugin {
|
|||
ushort realPort = (ushort)Math.Min(ushort.MaxValue, Math.Max(1, port));
|
||||
this.plugin.Config.Port = realPort;
|
||||
this.plugin.Config.Save();
|
||||
|
||||
this.plugin.RelaunchServer();
|
||||
}
|
||||
|
||||
ImGui.Spacing();
|
||||
|
|
Loading…
Reference in New Issue