diff --git a/paper-api/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/paper-api/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java index 993a8c02af..6bdd9f1dcc 100644 --- a/paper-api/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java +++ b/paper-api/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java @@ -101,7 +101,12 @@ final class PluginClassLoader extends URLClassLoader { Class loadClass0(@NotNull String name, boolean resolve, boolean checkGlobal, boolean checkLibraries) throws ClassNotFoundException { try { - return super.loadClass(name, resolve); + Class result = super.loadClass(name, resolve); + + // SPIGOT-6749: Library classes will appear in the above, but we don't want to return them to other plugins + if (checkGlobal || result.getClassLoader() == this) { + return result; + } } catch (ClassNotFoundException ex) { }