forcefully disconnect from server
This commit is contained in:
parent
5f1b5b9834
commit
a360b2eee3
2 changed files with 6 additions and 2 deletions
|
|
@ -71,7 +71,7 @@ class PauseScreen extends LitElement {
|
|||
<pmui-button pmui-width="98px" pmui-label="Discord" @pmui-click=${() => openURL('https://discord.gg/4Ucm684Fq3')}></pmui-button>
|
||||
</div>
|
||||
<pmui-button pmui-width="204px" pmui-label="Options" @pmui-click=${() => showModal(document.getElementById('options-screen'))}></pmui-button>
|
||||
<pmui-button pmui-width="204px" pmui-label="${!fsState.syncFs && !fsState.isReadonly ? 'Save & Quit' : 'Disconnect'}" @pmui-click=${async () => {
|
||||
<pmui-button pmui-width="204px" pmui-label="${localServer && !fsState.syncFs && !fsState.isReadonly ? 'Save & Quit' : 'Disconnect'}" @pmui-click=${async () => {
|
||||
disconnect()
|
||||
}}></pmui-button>
|
||||
</main>
|
||||
|
|
|
|||
|
|
@ -153,8 +153,12 @@ export const disconnect = async () => {
|
|||
if (window.localServer) {
|
||||
await saveWorld()
|
||||
localServer.quit()
|
||||
} else {
|
||||
// workaround bot.end doesn't end the socket and emit end event
|
||||
bot.end()
|
||||
bot._client.socket.end()
|
||||
}
|
||||
bot._client.emit('end')
|
||||
bot._client.emit('end', 'You left the server')
|
||||
miscUiState.gameLoaded = false
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue