public void LaunchInterface() { Thread t = new Thread(() => { gui = new Gui(); try { ServerApi.Hooks.ServerJoin.Register(this, gui.ServerJoin); ServerApi.Hooks.ServerLeave.Register(this, gui.ServerLeave); ServerApi.Hooks.GameUpdate.Register(this, gui.OnUpdate); ServerApi.Hooks.GamePostInitialize.Register(this, gui.OnPostInit); gui.ShowDialog(); } catch (Exception ex) { TShock.Log.ConsoleError("TSGui closed because it crashed: " + ex.ToString()); } Environment.Exit(0); }); t.SetApartmentState(ApartmentState.STA); t.Start(); }