Java version warning
This commit is contained in:
parent
32d233f8f2
commit
b2b9a08824
|
@ -23,15 +23,19 @@ import java.util.jar.Manifest;
|
||||||
|
|
||||||
public abstract class ArclightMain {
|
public abstract class ArclightMain {
|
||||||
|
|
||||||
|
private static final int MIN_DEPRECATED_VERSION = 60;
|
||||||
|
private static final int MIN_DEPRECATED_JAVA_VERSION = 16;
|
||||||
|
|
||||||
public void run(String[] args) throws Throwable {
|
public void run(String[] args) throws Throwable {
|
||||||
System.setProperty("java.util.logging.manager", ArclightLazyLogManager.class.getCanonicalName());
|
System.setProperty("java.util.logging.manager", ArclightLazyLogManager.class.getCanonicalName());
|
||||||
System.setProperty("log4j.jul.LoggerAdapter", "io.izzel.arclight.common.mod.util.log.ArclightLoggerAdapter");
|
System.setProperty("log4j.jul.LoggerAdapter", "io.izzel.arclight.common.mod.util.log.ArclightLoggerAdapter");
|
||||||
ArclightLocale.info("i18n.using-language", ArclightConfig.spec().getLocale().getCurrent(), ArclightConfig.spec().getLocale().getFallback());
|
ArclightLocale.info("i18n.using-language", ArclightConfig.spec().getLocale().getCurrent(), ArclightConfig.spec().getLocale().getFallback());
|
||||||
this.afterSetup();
|
this.afterSetup();
|
||||||
try { // Java 9 & Java 兼容性
|
try {
|
||||||
int javaVersion = (int) Float.parseFloat(System.getProperty("java.class.version"));
|
int javaVersion = (int) Float.parseFloat(System.getProperty("java.class.version"));
|
||||||
if (javaVersion == 53) {
|
if (javaVersion < MIN_DEPRECATED_VERSION) {
|
||||||
throw new Exception("Only Java 8 and Java 10+ is supported.");
|
ArclightLocale.error("java.deprecated", System.getProperty("java.version"), MIN_DEPRECATED_JAVA_VERSION);
|
||||||
|
Thread.sleep(3000);
|
||||||
}
|
}
|
||||||
Unsafe.ensureClassInitialized(EnumHelper.class);
|
Unsafe.ensureClassInitialized(EnumHelper.class);
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
|
|
|
@ -30,6 +30,15 @@ arclight {
|
||||||
|
|
||||||
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8'
|
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8'
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
applaunch {
|
||||||
|
java {
|
||||||
|
compileClasspath += main.output
|
||||||
|
runtimeClasspath += main.output
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
configurations {
|
configurations {
|
||||||
embed
|
embed
|
||||||
implementation.extendsFrom(embed)
|
implementation.extendsFrom(embed)
|
||||||
|
@ -97,7 +106,7 @@ processResources {
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
manifest.attributes 'MixinConnector': 'io.izzel.arclight.impl.ArclightConnector_1_16'
|
manifest.attributes 'MixinConnector': 'io.izzel.arclight.impl.ArclightConnector_1_16'
|
||||||
manifest.attributes 'Main-Class': 'io.izzel.arclight.server.Main_1_16'
|
manifest.attributes 'Main-Class': 'io.izzel.arclight.server.Launcher'
|
||||||
manifest.attributes 'Implementation-Title': 'Arclight'
|
manifest.attributes 'Implementation-Title': 'Arclight'
|
||||||
manifest.attributes 'Implementation-Version': "arclight-$minecraftVersion-${project.version}-${getGitHash()}"
|
manifest.attributes 'Implementation-Version': "arclight-$minecraftVersion-${project.version}-${getGitHash()}"
|
||||||
manifest.attributes 'Implementation-Vendor': 'Arclight Team'
|
manifest.attributes 'Implementation-Vendor': 'Arclight Team'
|
||||||
|
@ -112,6 +121,7 @@ jar {
|
||||||
exclude "LICENSE.txt"
|
exclude "LICENSE.txt"
|
||||||
}
|
}
|
||||||
from(project(':arclight-common').tasks.jar.outputs.files.collect { it.isDirectory() ? it : zipTree(it) })
|
from(project(':arclight-common').tasks.jar.outputs.files.collect { it.isDirectory() ? it : zipTree(it) })
|
||||||
|
from sourceSets.applaunch.output.classesDirs
|
||||||
}
|
}
|
||||||
|
|
||||||
remapSpigotJar {
|
remapSpigotJar {
|
||||||
|
@ -128,6 +138,10 @@ compileJava {
|
||||||
options.encoding = 'UTF-8'
|
options.encoding = 'UTF-8'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
compileApplaunchJava {
|
||||||
|
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_6
|
||||||
|
}
|
||||||
|
|
||||||
task srgJar(type: Jar) {
|
task srgJar(type: Jar) {
|
||||||
from(tasks.jar.outputs.files.collect { it.isDirectory() ? it : zipTree(it) }) {
|
from(tasks.jar.outputs.files.collect { it.isDirectory() ? it : zipTree(it) }) {
|
||||||
include 'io/izzel/**'
|
include 'io/izzel/**'
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
package io.izzel.arclight.server;
|
||||||
|
|
||||||
|
public class Launcher {
|
||||||
|
|
||||||
|
private static final int MIN_CLASS_VERSION = 52;
|
||||||
|
private static final int MIN_JAVA_VERSION = 8;
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Throwable {
|
||||||
|
int javaVersion = (int) Float.parseFloat(System.getProperty("java.class.version"));
|
||||||
|
if (javaVersion < MIN_CLASS_VERSION) {
|
||||||
|
System.err.println("Arclight requires Java " + MIN_JAVA_VERSION);
|
||||||
|
System.err.println("Current: " + System.getProperty("java.version"));
|
||||||
|
System.exit(-1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Main_1_16.main(args);
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,15 +4,15 @@ import io.izzel.arclight.api.ArclightVersion;
|
||||||
import io.izzel.arclight.common.ArclightMain;
|
import io.izzel.arclight.common.ArclightMain;
|
||||||
import io.izzel.arclight.forgeinstaller.ForgeInstaller;
|
import io.izzel.arclight.forgeinstaller.ForgeInstaller;
|
||||||
|
|
||||||
public class Main_1_16 extends ArclightMain {
|
public class Main_1_16 {
|
||||||
|
|
||||||
public static void main(String[] args) throws Throwable {
|
public static void main(String[] args) throws Throwable {
|
||||||
new Main_1_16().run(args);
|
new ArclightMain() {
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void afterSetup() throws Throwable {
|
protected void afterSetup() throws Throwable {
|
||||||
ArclightVersion.setVersion(ArclightVersion.v1_16_4);
|
ArclightVersion.setVersion(ArclightVersion.v1_16_4);
|
||||||
ForgeInstaller.install();
|
ForgeInstaller.install();
|
||||||
}
|
}
|
||||||
|
}.run(args);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
allprojects {
|
allprojects {
|
||||||
group 'io.izzel.arclight'
|
group 'io.izzel.arclight'
|
||||||
version '1.0.18'
|
version '1.0.19-SNAPSHOT'
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
agpVersion = '1.15'
|
agpVersion = '1.15'
|
||||||
|
|
|
@ -28,6 +28,13 @@ downloader {
|
||||||
forge-install = "Forge installation is starting, please wait... "
|
forge-install = "Forge installation is starting, please wait... "
|
||||||
access-denied = "Access denied for file {0}: {1}"
|
access-denied = "Access denied for file {0}: {1}"
|
||||||
}
|
}
|
||||||
|
java {
|
||||||
|
deprecated = [
|
||||||
|
"You are running an outdated Java version"
|
||||||
|
"Current {0} Recommended {1}"
|
||||||
|
"Current Java will not be supported in future"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
implementer {
|
implementer {
|
||||||
not-found = "Class not found {}"
|
not-found = "Class not found {}"
|
||||||
|
|
|
@ -28,6 +28,13 @@ downloader {
|
||||||
forge-install = "即将开始 Forge 安装,请等待一段时间"
|
forge-install = "即将开始 Forge 安装,请等待一段时间"
|
||||||
access-denied = "没有对 {0} 操作的权限: {1}"
|
access-denied = "没有对 {0} 操作的权限: {1}"
|
||||||
}
|
}
|
||||||
|
java {
|
||||||
|
deprecated = [
|
||||||
|
"您正在使用过时的 Java 版本"
|
||||||
|
"当前版本 {0} 推荐使用 {1}"
|
||||||
|
"该版本的 Java 未来将不受支持"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
implementer {
|
implementer {
|
||||||
not-found = "找不到类 {}"
|
not-found = "找不到类 {}"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user