Dieser Commit ist enthalten in:
Ursprung
afef1a6a22
Commit
9d04c2049c
@ -1,6 +1,7 @@
|
|||||||
package com.comphenix.tinyprotocol;
|
package com.comphenix.tinyprotocol;
|
||||||
|
|
||||||
import de.steamwar.core.Core;
|
import de.steamwar.core.Core;
|
||||||
|
import jdk.internal.misc.Unsafe;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
@ -367,7 +368,11 @@ public final class Reflection {
|
|||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public static Object newInstance(Class<?> clazz) {
|
public static Object newInstance(Class<?> clazz) {
|
||||||
try {
|
try {
|
||||||
|
if (Core.getVersion() > 15) {
|
||||||
|
return Unsafe.getUnsafe().allocateInstance(clazz);
|
||||||
|
} else {
|
||||||
return clazz.newInstance();
|
return clazz.newInstance();
|
||||||
|
}
|
||||||
} catch (InstantiationException | IllegalAccessException e) {
|
} catch (InstantiationException | IllegalAccessException e) {
|
||||||
throw new SecurityException("Could not create object", e);
|
throw new SecurityException("Could not create object", e);
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren