* 清理空World
()
| 340 | * 清理空World |
| 341 | */ |
| 342 | public cleanup(): number { |
| 343 | const worldsToRemove: string[] = []; |
| 344 | |
| 345 | for (const [worldName, world] of this._worlds) { |
| 346 | if (this.shouldCleanupWorld(world)) { |
| 347 | worldsToRemove.push(worldName); |
| 348 | } |
| 349 | } |
| 350 | |
| 351 | for (const worldName of worldsToRemove) { |
| 352 | this.removeWorld(worldName); |
| 353 | } |
| 354 | |
| 355 | if (worldsToRemove.length > 0) { |
| 356 | logger.debug(`清理了 ${worldsToRemove.length} 个World`); |
| 357 | } |
| 358 | |
| 359 | return worldsToRemove.length; |
| 360 | } |
| 361 | |
| 362 | /** |
| 363 | * 销毁WorldManager |
no test coverage detected