Skip to content

Commit

Permalink
Fix Plugin Resource Loading
Browse files Browse the repository at this point in the history
  • Loading branch information
bundabrg committed Jul 7, 2020
1 parent 1d5924c commit 7e62e7c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,6 @@ public File getDataFolder() {
* Return an InputStream for a resource file
*/
public InputStream getResourceAsStream(String name) {
return getClass().getClassLoader().getResourceAsStream(name);
return getPluginClassLoader().getResourceAsStream(name);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,21 @@ protected Class<?> findClass(String name) throws ClassNotFoundException {
return cls;
}

@Override
public URL getResource(String name) {
return findResource(name);
}

@Override
public Enumeration<URL> getResources(String name) throws IOException {
return findResources(name);
}

@Override
public InputStream getResourceAsStream(String name) {
return super.getResourceAsStream(name);
}

public static class InvalidPluginClassLoaderException extends Exception {
InvalidPluginClassLoaderException(String msg) {
super(msg);
Expand Down

0 comments on commit 7e62e7c

Please sign in to comment.