Make Java 8 detection work on Java 9

Closes #393.
This commit is contained in:
Kenzie Togami 2017-08-16 16:39:37 -07:00
parent 6c6e1b4ce2
commit d6aa1ad509
No known key found for this signature in database
GPG Key ID: 5D200B325E157A81
3 changed files with 13 additions and 14 deletions

View File

@ -48,7 +48,7 @@ import com.sk89q.worldedit.regions.CylinderRegion;
import com.sk89q.worldedit.regions.Polygonal2DRegion;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.regions.RegionSelector;
import com.sk89q.worldedit.util.Java8Detector;
import com.sk89q.worldedit.util.Java7Detector;
import org.bukkit.World;
import org.bukkit.command.Command;
@ -121,7 +121,7 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter {
loadAdapter(); // Need an adapter to work with special blocks with NBT data
// Check Java version
Java8Detector.notifyIfNot8();
Java7Detector.notifyIfNot8();
}
private void loadConfig() {

View File

@ -18,21 +18,21 @@
*/
package com.sk89q.worldedit.util;
import com.google.common.base.Joiner;
import com.sk89q.worldedit.WorldEdit;
public final class Java8Detector {
public final class Java7Detector {
public static void notifyIfNot8() {
String[] ver = System.getProperty("java.version").split("\\.");
int major = Integer.parseInt(ver[1]);
if (major <= 7) {
// Implicitly java 7 because we compile against 7, so this won't
// even launch on 6.
int major = -1;
try {
String[] ver = System.getProperty("java.version").split("\\.");
major = Integer.parseInt(ver[1]);
} catch (Exception ignored) {
}
if (major == 7) {
WorldEdit.logger.warning(
"WorldEdit has detected you are using Java 7"
+ " (based on detected version "
+ Joiner.on('.').join(ver) + ").");
"WorldEdit has detected you are using Java 7.");
WorldEdit.logger.warning(
"WorldEdit will stop supporting Java less than version 8 in the future,"
+ " due to Java 7 being EOL since April 2015."
@ -40,7 +40,7 @@ public final class Java8Detector {
}
}
private Java8Detector() {
private Java7Detector() {
}
}

View File

@ -30,7 +30,6 @@ import com.sk89q.worldedit.event.platform.PlatformReadyEvent;
import com.sk89q.worldedit.extension.platform.Platform;
import com.sk89q.worldedit.forge.net.LeftClickAirEventMessage;
import com.sk89q.worldedit.internal.LocalWorldAdapter;
import com.sk89q.worldedit.util.Java8Detector;
import java.io.File;
import java.util.Map;