Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions xmcl-runtime-api/src/services/LaunchService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ export interface LaunchOptions {
host: string
port?: number
}
/**
* Quick play multiplayer server for Minecraft 1.20+
* Format: "server:port" or just "server" for default port 25565
*/
quickPlayMultiplayer?: string
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed quickPlayMultiplayer property from the LaunchService interface. (85a3663)

/**
* Support yushi's yggdrasil agent https://github.com/to2mbn/authlib-injector/wiki
*/
Expand Down
15 changes: 9 additions & 6 deletions xmcl-runtime/launch/LaunchService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,6 @@ export class LaunchService extends AbstractService implements ILaunchService {
minMemory,
maxMemory,
version,
server: options.server
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Restored the server options in the launch options object. (85a3663)

? {
ip: options.server.host,
port: options.server.port,
}
: undefined,
extraExecOption: {
shell: prepend && prepend.length > 0,
detached: true,
Expand Down Expand Up @@ -263,6 +257,15 @@ export class LaunchService extends AbstractService implements ILaunchService {
ip: options.server.host,
port: options.server?.port,
}
// Generate quickPlayMultiplayer from server property if not explicitly provided
if (!options.quickPlayMultiplayer) {
launchOptions.quickPlayMultiplayer = `${options.server.host}${options.server.port ? `:${options.server.port}` : ''}`
}
}

// Handle direct quickPlayMultiplayer option
if (options.quickPlayMultiplayer) {
launchOptions.quickPlayMultiplayer = options.quickPlayMultiplayer
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use options.server to generate, like

if (options.server) launchOptions.quickPlayMultiplayer = `${options.server.host}${options.server.port ? `:${options.server.port}` : ''}`

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the logic to use options.server to generate quickPlayMultiplayer as suggested. (85a3663)

}

return launchOptions
Expand Down