13
0
geforkt von Mirrors/Paper

Print warning when loading classes from depends that have not been specified

By: md_5 <git@md-5.net>
Dieser Commit ist enthalten in:
Bukkit/Spigot 2020-01-26 12:40:56 +11:00
Ursprung 750cc90cb7
Commit fe8b567ad1

Datei anzeigen

@ -16,6 +16,7 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.jar.Manifest;
import java.util.logging.Level;
import org.apache.commons.lang.Validate;
import org.bukkit.plugin.InvalidPluginException;
import org.bukkit.plugin.PluginDescriptionFile;
@ -101,6 +102,17 @@ final class PluginClassLoader extends URLClassLoader {
if (result == null) {
if (checkGlobal) {
result = loader.getClassByName(name);
if (result != null) {
JavaPlugin provider = ((PluginClassLoader) result.getClassLoader()).plugin;
if (!description.getDepend().contains(provider.getName())
&& !description.getSoftDepend().contains(provider.getName())
&& !provider.getDescription().getLoadBefore().contains(description.getName())) {
plugin.getLogger().log(Level.WARNING, "Loaded class {0} from {1} which is not a depend, softdepend or loadbefore of this plugin.", new Object[]{name, description.getFullName()});
}
}
}
if (result == null) {