Skip to content

Commit

Permalink
Java 21 is required for 1.21.
Browse files Browse the repository at this point in the history
  • Loading branch information
dscalzi committed Apr 7, 2024
1 parent 8366447 commit 17a44be
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
21 changes: 18 additions & 3 deletions lib/common/distribution/DistributionFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,28 @@ export class HeliosServer {
}

private defaultUndefinedJavaOptions(props: JavaVersionProps): Required<JavaVersionProps> {
const [defaultRange, defaultSuggestion] = this.defaultJavaVersion()
return {
supported: props.distribution ?? mcVersionAtLeast('1.17', this.rawServer.minecraftVersion) ? '>=17.x' : '8.x',
distribution: props.distribution ?? process.platform === Platform.DARWIN ? JdkDistribution.CORRETTO : JdkDistribution.TEMURIN,
suggestedMajor: props.suggestedMajor ?? mcVersionAtLeast('1.17', this.rawServer.minecraftVersion) ? 17 : 8,
supported: props.distribution ?? defaultRange,
distribution: props.distribution ?? this.defaultJavaPlatform(),
suggestedMajor: props.suggestedMajor ?? defaultSuggestion,
}
}

private defaultJavaVersion(): [string, number] {
if(mcVersionAtLeast('1.21', this.rawServer.minecraftVersion)) {
return ['>=21.x', 21]
} else if(mcVersionAtLeast('1.17', this.rawServer.minecraftVersion)) {
return ['>=17.x', 17]
} else {
return ['8.x', 8]
}
}

private defaultJavaPlatform(): JdkDistribution {
return process.platform === Platform.DARWIN ? JdkDistribution.CORRETTO : JdkDistribution.TEMURIN
}

}

export class HeliosModule {
Expand Down
2 changes: 1 addition & 1 deletion lib/microsoft/rest/MicrosoftResponse.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DisplayableError, RestResponse } from '../../common/rest/RestResponse'
import { RestResponse } from '../../common/rest/RestResponse'

/**
* Various error codes from any point of the Microsoft authentication process.
Expand Down
2 changes: 1 addition & 1 deletion lib/mojang/rest/MojangResponse.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DisplayableError, RestResponse } from '../../common/rest/RestResponse'
import { RestResponse } from '../../common/rest/RestResponse'

/**
* @see https://wiki.vg/Authentication#Errors
Expand Down

0 comments on commit 17a44be

Please sign in to comment.