Skip to content

Commit

Permalink
๐Ÿบ๐Ÿšง๐Ÿ“•๐Ÿ”ง๐Ÿ’ปโœ”๏ธ๐Ÿ’พ๐Ÿš€๏ธ
Browse files Browse the repository at this point in the history
  • Loading branch information
AmarokIce committed Dec 22, 2024
1 parent 832924b commit 1656796
Show file tree
Hide file tree
Showing 43 changed files with 898 additions and 1,294 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ public static void loadModule(Class<?> moduleCommonClass) {
String moduleName;
try {
Field field = moduleCommonClass.getField("NAME");
if (!Modifier.isStatic(field.getModifiers()))
if (!Modifier.isStatic(field.getModifiers())) {
throw new IllegalArgumentException("NAME in " + moduleCommonClass.getPackageName() + " is not static!");
}
field.setAccessible(true);
moduleName = (String) field.get(null);
} catch (NoSuchFieldException e) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package band.kessoku.lib.api.base.reflect;

import band.kessoku.lib.api.KessokuLib;

import java.lang.reflect.AccessibleObject;
import java.lang.reflect.Field;
import java.util.Arrays;

Expand All @@ -11,4 +14,14 @@ public static boolean isAssignableFrom(Field field, Class<?>... clazzs) {
var flag = Arrays.stream(clazzs).anyMatch(clazz -> !field.getType().isAssignableFrom(clazz));
return !flag;
}

public static boolean markAccessible(AccessibleObject obj) {
try {
obj.setAccessible(true);
return true;
} catch (Exception e) {
KessokuLib.getLogger().error(e.getMessage(), e);
return false;
}
}
}

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 1656796

Please sign in to comment.