在boom的边缘悬崖勒马,太刺激了

某个类现在跑的更溜了
画了个假的饼
This commit is contained in:
Izzel_Aliz
2018-06-23 15:39:51 +08:00
parent 1a73bc0bd7
commit 8af253c6ec
9 changed files with 78 additions and 13 deletions

View File

@@ -101,11 +101,11 @@ public class Ref {
public static JavaPlugin getCallerPlugin(Class<?> callerClass) {
try {
Field pluginField = callerClass.getClassLoader().getClass().getDeclaredField("plugin");
pluginField.setAccessible(true);
return (JavaPlugin) pluginField.get(callerClass.getClassLoader());
} catch (Exception ignored) {
return JavaPlugin.getProvidingPlugin(callerClass);
} catch (IllegalArgumentException ignored) {
TLocale.Logger.error("LOCALE.CALLER-PLUGIN-NOT-FOUND", callerClass.getName());
} catch (IllegalStateException e) {
TLocale.Logger.error("LOCALE.STATIC-CLASS-LOADER", callerClass.getName());
}
return (JavaPlugin) Main.getInst();
}