Migrate project to Java 21
Summary
Migrate the project compilation target from Java 16 to Java 21.
Is this feature is related to a specific Minecraft Version ? NO
Feature Description
Update all pom.xml files to use Java 21 as the compilation target. This includes:
- Root pom.xml
- core/pom.xml
- All NMS module pom.xml files (API, v1_19_R3, v1_20_R1, v1_20_R2, v1_20_R3)
Also fix deprecated reflection API usage in NMSManager.java.
Motivation and Benefits
- Java 21 is an LTS version with better performance and new features
- Paper 1.19.4+ servers commonly run on Java 21
- Avoid deprecation warnings and potential future incompatibilities
Use Cases
- Running the plugin on modern Paper servers using Java 21
- Using new Java 21 language features in future development
Additional Context
All supported NMS versions (1.19.4, 1.20.1, 1.20.2, 1.20.4) are compatible with Java 21.
Possible Implementation
- Update maven.compiler.source and maven.compiler.target to 21 in all pom.xml
- Replace deprecated Class.newInstance() with getDeclaredConstructor().newInstance()