Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-14 18:40:10 +01:00
Update Java version references, add note on var usages
Dieser Commit ist enthalten in:
Ursprung
b8c454c2ba
Commit
310b47bb96
@ -27,12 +27,12 @@ which can be obtained in (most) package managers such as `apt` (Debian / Ubuntu;
|
||||
you will most likely use this for WSL), `homebrew` (macOS / Linux), and more:
|
||||
|
||||
- `git` (package `git` everywhere);
|
||||
- A Java 17 or later JDK (packages vary, use Google/DuckDuckGo/etc.).
|
||||
- A Java 21 or later JDK (packages vary, use Google/DuckDuckGo/etc.).
|
||||
- [Adoptium](https://adoptium.net/) has builds for most operating systems.
|
||||
- Paper requires JDK 17 to build, however, makes use of Gradle's
|
||||
- Paper requires JDK 21 to build, however, makes use of Gradle's
|
||||
[Toolchains](https://docs.gradle.org/current/userguide/toolchains.html)
|
||||
feature to allow building with only JRE 11 or later installed. (Gradle will
|
||||
automatically provision JDK 17 for compilation if it cannot find an existing
|
||||
automatically provision JDK 21 for compilation if it cannot find an existing
|
||||
install).
|
||||
|
||||
If you're on Windows, check
|
||||
@ -42,11 +42,11 @@ If you're compiling with Docker, you can use Adoptium's
|
||||
[`eclipse-temurin`](https://hub.docker.com/_/eclipse-temurin/) images like so:
|
||||
|
||||
```console
|
||||
# docker run -it -v "$(pwd)":/data --rm eclipse-temurin:17.0.1_12-jdk bash
|
||||
# docker run -it -v "$(pwd)":/data --rm eclipse-temurin:21.0.3_9-jdk bash
|
||||
Pulling image...
|
||||
|
||||
root@abcdefg1234:/# javac -version
|
||||
javac 17.0.1
|
||||
javac 21.0.3
|
||||
```
|
||||
|
||||
## Understanding Patches
|
||||
@ -237,6 +237,10 @@ into most IDEs and formatters by default. There are a few notes, however:
|
||||
There are exceptions, especially in Spigot-related files
|
||||
- When in doubt or the code around your change is in a clearly different style,
|
||||
use the same style as the surrounding code.
|
||||
- `var` usage is heavily discouraged, as it makes reading patch files a lot harder
|
||||
and can lead to confusion during updates due to changed return types. The only
|
||||
exception to this is if a line would otherwise be way too long/filled with hard
|
||||
to parse generics in a case where the base type itself is already obvious
|
||||
|
||||
### Imports
|
||||
When adding new imports to a class in a file not created by the current patch, use the fully qualified class name
|
||||
|
@ -6,7 +6,7 @@ Subject: [PATCH] Improve java version check
|
||||
Co-Authored-By: MiniDigger <admin@benndorf.dev>
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
index caa7fefab037a24713e9f7f15a541d47bc7655ee..cc4f7f5bdb6b930af4130dc775e4ed754be87783 100644
|
||||
index caa7fefab037a24713e9f7f15a541d47bc7655ee..11b1e23ea2a0d4faf7e74d3c9580b7a776ac795b 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
@@ -202,23 +202,27 @@ public class Main {
|
||||
@ -24,7 +24,7 @@ index caa7fefab037a24713e9f7f15a541d47bc7655ee..cc4f7f5bdb6b930af4130dc775e4ed75
|
||||
- System.err.println("Unsupported Java detected (" + javaVersion + "). Only up to Java 22 is supported.");
|
||||
+ boolean isOldVersion = javaVersion < 61.0;
|
||||
+ if (!skip && isOldVersion) {
|
||||
+ System.err.println("Unsupported Java detected (" + javaVersion + "). This version of Minecraft requires at least Java 17. Check your Java version with the command 'java -version'. For more info see https://docs.papermc.io/misc/java-install");
|
||||
+ System.err.println("Unsupported Java detected (" + javaVersion + "). This version of Minecraft requires at least Java 21. Check your Java version with the command 'java -version'. For more info see https://docs.papermc.io/misc/java-install");
|
||||
return;
|
||||
}
|
||||
String javaVersionName = System.getProperty("java.version");
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren