mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-01-10 12:12:54 +08:00
Update PluginManager.java
This commit is contained in:
parent
f8bc471d4d
commit
84c1cd7aa7
@ -52,8 +52,8 @@ public final class PluginManager {
|
|||||||
plugins.forEach(plugin -> {
|
plugins.forEach(plugin -> {
|
||||||
try {
|
try {
|
||||||
pluginNames[plugins.indexOf(plugin)] = plugin.toURI().toURL();
|
pluginNames[plugins.indexOf(plugin)] = plugin.toURI().toURL();
|
||||||
} catch (MalformedURLException e) {
|
} catch (MalformedURLException exception) {
|
||||||
e.printStackTrace();
|
Grasscutter.getLogger().warn("Unable to load plugin.", exception);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ public final class PluginManager {
|
|||||||
JarEntry entry = entries.nextElement();
|
JarEntry entry = entries.nextElement();
|
||||||
if(entry.isDirectory() || !entry.getName().endsWith(".class") || entry.getName().contains("module-info")) continue;
|
if(entry.isDirectory() || !entry.getName().endsWith(".class") || entry.getName().contains("module-info")) continue;
|
||||||
String className = entry.getName().replace(".class", "").replace("/", ".");
|
String className = entry.getName().replace(".class", "").replace("/", ".");
|
||||||
classLoader.loadClass(className); //For all plugin we use the same class loader.
|
classLoader.loadClass(className); // Use the same class loader for ALL plugins.
|
||||||
}
|
}
|
||||||
|
|
||||||
Class<?> pluginClass = classLoader.loadClass(pluginConfig.mainClass);
|
Class<?> pluginClass = classLoader.loadClass(pluginConfig.mainClass);
|
||||||
@ -182,4 +182,4 @@ public final class PluginManager {
|
|||||||
(event.isCanceled() && handler.ignoresCanceled())
|
(event.isCanceled() && handler.ignoresCanceled())
|
||||||
) handler.getCallback().consume((T) event);
|
) handler.getCallback().consume((T) event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user