geforkt von Mirrors/Velocity
Cleaned up Java plugin loader
Dieser Commit ist enthalten in:
Ursprung
8c98395d51
Commit
e6c178aae7
@ -43,21 +43,18 @@ public class JavaPluginLoader implements PluginLoader {
|
|||||||
throw new InvalidPluginException("Did not find a valid velocity-info.json.");
|
throw new InvalidPluginException("Did not find a valid velocity-info.json.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SerializedPluginDescription pd = serialized.get();
|
||||||
|
if (!PluginDescription.ID_PATTERN.matcher(pd.getId()).matches()) {
|
||||||
|
throw new InvalidPluginException("Plugin ID '" + pd.getId() + "' must match pattern " +
|
||||||
|
PluginDescription.ID_PATTERN.pattern());
|
||||||
|
}
|
||||||
|
|
||||||
PluginClassLoader loader = new PluginClassLoader(
|
PluginClassLoader loader = new PluginClassLoader(
|
||||||
new URL[] {source.toUri().toURL() }
|
new URL[] {source.toUri().toURL() }
|
||||||
);
|
);
|
||||||
|
|
||||||
Class mainClass = loader.loadClass(serialized.get().getMain());
|
Class mainClass = loader.loadClass(pd.getMain());
|
||||||
VelocityPluginDescription description = createDescription(serialized.get(), source, mainClass);
|
return createDescription(pd, source, mainClass);
|
||||||
|
|
||||||
String pluginId = description.getId();
|
|
||||||
Pattern pattern = PluginDescription.ID_PATTERN;
|
|
||||||
|
|
||||||
if (!pattern.matcher(pluginId).matches()) {
|
|
||||||
throw new InvalidPluginException("Plugin ID '" + pluginId + "' must match pattern " + pattern.pattern());
|
|
||||||
}
|
|
||||||
|
|
||||||
return description;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren