Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-28 09:00:09 +01:00
Add Java version warning
We will update the required Java version at some point, the only question is when.
Dieser Commit ist enthalten in:
Ursprung
d89f916546
Commit
38b3f40f7d
@ -121,7 +121,6 @@ public class BukkitViaLoader implements ViaPlatformLoader {
|
|||||||
|| Bukkit.getVersion().toLowerCase(Locale.ROOT).contains("taco")
|
|| Bukkit.getVersion().toLowerCase(Locale.ROOT).contains("taco")
|
||||||
|| Bukkit.getVersion().toLowerCase(Locale.ROOT).contains("torch"))
|
|| Bukkit.getVersion().toLowerCase(Locale.ROOT).contains("torch"))
|
||||||
&& serverProtocolVersion < ProtocolVersion.v1_12.getVersion()) {
|
&& serverProtocolVersion < ProtocolVersion.v1_12.getVersion()) {
|
||||||
plugin.getLogger().info("Enabling Paper/TacoSpigot/Torch patch: Fixes block placement.");
|
|
||||||
storeListener(new PaperPatch(plugin)).register();
|
storeListener(new PaperPatch(plugin)).register();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,6 +44,8 @@ import java.util.Arrays;
|
|||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
public class ViaManagerImpl implements ViaManager {
|
public class ViaManagerImpl implements ViaManager {
|
||||||
private final ProtocolManagerImpl protocolManager = new ProtocolManagerImpl();
|
private final ProtocolManagerImpl protocolManager = new ProtocolManagerImpl();
|
||||||
@ -140,6 +142,8 @@ public class ViaManagerImpl implements ViaManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
checkJavaVersion();
|
||||||
|
|
||||||
// Check for unsupported plugins/software
|
// Check for unsupported plugins/software
|
||||||
unsupportedSoftwareWarning();
|
unsupportedSoftwareWarning();
|
||||||
|
|
||||||
@ -204,7 +208,31 @@ public class ViaManagerImpl implements ViaManager {
|
|||||||
loader.unload();
|
loader.unload();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void unsupportedSoftwareWarning() {
|
private final void checkJavaVersion() { // Stolen from Paper
|
||||||
|
String javaVersion = System.getProperty("java.version");
|
||||||
|
Matcher matcher = Pattern.compile("(?:1\\.)?(\\d+)").matcher(javaVersion);
|
||||||
|
if (!matcher.find()) {
|
||||||
|
platform.getLogger().warning("Failed to determine Java version; could not parse: " + javaVersion);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String versionString = matcher.group(1);
|
||||||
|
int version;
|
||||||
|
try {
|
||||||
|
version = Integer.parseInt(versionString);
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
platform.getLogger().warning("Failed to determine Java version; could not parse: " + versionString);
|
||||||
|
e.printStackTrace();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (version < 16) {
|
||||||
|
platform.getLogger().warning("You are running an outdated Java version, please consider updating it to at least Java 16 (your version is " + javaVersion + "). "
|
||||||
|
+ "At some point in the future, ViaVersion will no longer be compatible with this version of Java.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private final void unsupportedSoftwareWarning() {
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
for (UnsupportedSoftware software : platform.getUnsupportedSoftwareClasses()) {
|
for (UnsupportedSoftware software : platform.getUnsupportedSoftwareClasses()) {
|
||||||
if (!software.findMatch()) {
|
if (!software.findMatch()) {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren