Class CraftBukkitReflection
java.lang.Object
org.incendo.cloud.bukkit.internal.CraftBukkitReflection
@API(status=INTERNAL,
consumers="org.incendo.cloud.*")
public final class CraftBukkitReflection
extends Object
Utilities for doing reflection on CraftBukkit, used by the cloud implementation.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanclassExists(@NonNull String className) static @Nullable Constructor<?> findConstructor(@NonNull Class<?> holder, @NonNull Class<?>... parameters) findMCClass(@NonNull String name) findNMSClass(@NonNull String className) findOBCClass(@NonNull String className) static <T> @Nullable TfirstNonNullOrNull(@Nullable T @NonNull ... elements) static <T> @NonNull TfirstNonNullOrThrow(@NonNull Supplier<@NonNull String> errorMessage, @Nullable T @NonNull ... elements) static ObjectinvokeConstructorOrStaticMethod(Executable executable, Object... args) static @NonNull Constructor<?> needConstructor(@NonNull Class<?> holder, @NonNull Class<?>... parameters) needMCClass(@NonNull String name) needNMSClass(@NonNull String className) needNMSClassOrElse(@NonNull String nms, @NonNull String... classNames) needOBCClass(@NonNull String className) streamMethods(@NonNull Class<?> clazz)
-
Field Details
-
MAJOR_REVISION
public static final int MAJOR_REVISION
-
-
Method Details
-
firstNonNullOrNull
-
firstNonNullOrThrow
-
needNMSClassOrElse
public static @NonNull Class<?> needNMSClassOrElse(@NonNull String nms, @NonNull String... classNames) throws RuntimeException - Throws:
RuntimeException
-
needMCClass
- Throws:
RuntimeException
-
needNMSClass
- Throws:
RuntimeException
-
needOBCClass
- Throws:
RuntimeException
-
findMCClass
- Throws:
RuntimeException
-
findNMSClass
- Throws:
RuntimeException
-
findOBCClass
- Throws:
RuntimeException
-
needClass
- Throws:
RuntimeException
-
findClass
-
needField
public static @NonNull Field needField(@NonNull Class<?> holder, @NonNull String name) throws RuntimeException - Throws:
RuntimeException
-
findField
public static @Nullable Field findField(@NonNull Class<?> holder, @NonNull String name) throws RuntimeException - Throws:
RuntimeException
-
needConstructor
-
findConstructor
-
classExists
-
findMethod
public static @Nullable Method findMethod(@NonNull Class<?> holder, @NonNull String name, @NonNull Class<?>... params) throws RuntimeException - Throws:
RuntimeException
-
needMethod
public static @NonNull Method needMethod(@NonNull Class<?> holder, @NonNull String name, @NonNull Class<?>... params) throws RuntimeException - Throws:
RuntimeException
-
streamMethods
-
invokeConstructorOrStaticMethod
public static Object invokeConstructorOrStaticMethod(Executable executable, Object... args) throws ReflectiveOperationException - Throws:
ReflectiveOperationException
-