Few javadoc update

This commit is contained in:
Marc Baloup 2024-12-27 23:15:55 +01:00
parent c9af5ad308
commit 44dc690736
2 changed files with 20 additions and 1 deletions

View File

@ -71,4 +71,7 @@ public class ChatBungee {
BaseComponent[] arr = toBungeeArray(component); BaseComponent[] arr = toBungeeArray(component);
return arr.length == 1 ? arr[0] : new net.md_5.bungee.api.chat.TextComponent(arr); return arr.length == 1 ? arr[0] : new net.md_5.bungee.api.chat.TextComponent(arr);
} }
private ChatBungee() {}
} }

View File

@ -16,15 +16,27 @@ public class ReflectionWrapperBypass {
private static final AtomicBoolean enabled = new AtomicBoolean(false); private static final AtomicBoolean enabled = new AtomicBoolean(false);
/**
* Enables bypassing the eventual translation of the class names when using {@link Class#forName(String)}.
*/
public static void enable() { public static void enable() {
enabled.set(true); enabled.set(true);
} }
/**
* Disables bypassing the eventual translation of the class names when using {@link Class#forName(String)}.
*/
public static void disable() { public static void disable() {
enabled.set(false); enabled.set(false);
} }
/**
* Calls {@link Class#forName(String)}, but detects if the returned class has been translated and if so, uses
* reflection to call {@link Class#forName(String)} (some sort of reflection-ception).
* @param className the binary name of the class or the string representing an array type.
* @return the {@link Class} object for the class with the specified name.
* @throws ClassNotFoundException if the class cannot be located.
*/
public static Class<?> getClass(String className) throws ClassNotFoundException { public static Class<?> getClass(String className) throws ClassNotFoundException {
if (!enabled.get()) { if (!enabled.get()) {
return Class.forName(className); return Class.forName(className);
@ -51,4 +63,8 @@ public class ReflectionWrapperBypass {
} }
private ReflectionWrapperBypass() {}
} }