File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed
API/src/main/java/com/comphenix/protocol/utility
ProtocolLib/src/main/java/com/comphenix/protocol Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -63,10 +63,14 @@ public static boolean isUsingSpigot() {
63
63
64
64
/**
65
65
* Gets the currently running major Java version.
66
- * @return The version
66
+ * @return The version or -1 if it could not be found
67
67
*/
68
68
public static int getJavaVersion () {
69
- String version = Runtime .class .getPackage ().getSpecificationVersion ();
70
- return (int ) (Double .valueOf (version ) * 10 % 10 );
69
+ try {
70
+ String version = Runtime .class .getPackage ().getSpecificationVersion ();
71
+ return (int ) (Double .parseDouble (version ) * 10 % 10 );
72
+ } catch (Throwable ex ) {
73
+ return -1 ;
74
+ }
71
75
}
72
76
}
Original file line number Diff line number Diff line change @@ -156,7 +156,7 @@ public void onLoad() {
156
156
ProtocolLogger .init (this );
157
157
158
158
int java = Util .getJavaVersion ();
159
- if (java < 8 && !getConfig ().getBoolean ("ignoreJava" , false )) {
159
+ if (java != - 1 && java < 8 && !getConfig ().getBoolean ("ignoreJava" , false )) {
160
160
logger .warning ("Detected outdated Java version: Java " + java );
161
161
logger .warning ("It is recommended that you update to Java 8 as soon as possible." );
162
162
logger .warning ("Future versions of ProtocolLib many not support Java " + java + "." );
You can’t perform that action at this time.
0 commit comments