1
0
mirror of https://github.com/GeyserMC/Floodgate.git synced 2026-01-06 15:42:03 +00:00

Fixed compatibility with the latest Velocity dev builds

Co-authored-by: Camotoy <20743703+camotoy@users.noreply.github.com>
This commit is contained in:
Tim203
2021-11-10 00:23:58 +01:00
parent ad41dbedc4
commit f20a13bba4
3 changed files with 39 additions and 4 deletions

View File

@@ -59,6 +59,15 @@ public final class ReflectionUtils {
return getClass(prefix + "." + className);
}
@Nullable
public static Class<?> getPrefixedClassSilently(String className) {
try {
return Class.forName(prefix + "." + className);
} catch (ClassNotFoundException ignored) {
return null;
}
}
/**
* Get the class from a class name. Calling this method is equal to calling {@link
* Class#forName(String)} where String is the class name.<br> This method will return null when
@@ -485,7 +494,9 @@ public final class ReflectionUtils {
* @return the accessibleObject
*/
public static <T extends AccessibleObject> T makeAccessible(T accessibleObject) {
accessibleObject.setAccessible(true);
if (!accessibleObject.isAccessible()) {
accessibleObject.setAccessible(true);
}
return accessibleObject;
}
}