Skip to content

Commit

Permalink
small improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
zardoy committed Dec 17, 2024
1 parent e1701a3 commit a66ee33
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/integratedServer/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,13 @@ export const updateLocalServerSettings = (settings: Partial<CustomAppSettings>)
export const startLocalServerMain = async (serverOptions: { version: any }) => {
worker = new Worker('./integratedServer.js')
serverChannel = useWorkerProxy<typeof workerProxyType>(worker, true)
const readyPromise = new Promise<void>(resolve => {
const readyPromise = new Promise<void>((resolve, reject) => {
addEventListener('ready', () => {
resolve()
})
worker!.addEventListener('error', (err) => {
reject(err.error ?? 'Unknown error with the worker, check that integratedServer.js could be loaded from the server')
})
})

serverChannel.start({
Expand All @@ -77,6 +80,9 @@ export const startLocalServerMain = async (serverOptions: { version: any }) => {
addEventListener('packet', (data) => {
restorePatchedDataDeep(data)
processData(data)
if (data.name === 'map_chunk') {
addStatPerSec('map_chunk')
}
})
}, options.excludeCommunicationDebugEvents)
setupEvents()
Expand Down
2 changes: 1 addition & 1 deletion src/integratedServer/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export interface CustomAppSettings {
export interface BackEvents {
ready: {}
quit: {}
packet: {}
packet: any
otherPlayerPacket: {
player: string
packet: any
Expand Down

0 comments on commit a66ee33

Please sign in to comment.