From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Paul Sauve Date: Sat, 19 Dec 2020 19:06:37 -0600 Subject: [PATCH] Airplane API Changes Copyright (C) 2020 Technove LLC This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java index 8a39c48fce819d72a94d5309db8dfc42930989af..4c84e3a5c983b7f8fe5515fff6fcfa64106150d2 100644 --- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java +++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java @@ -46,6 +46,8 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot private final Set seenIllegalAccess = Collections.newSetFromMap(new ConcurrentHashMap<>()); private java.util.logging.Logger logger; // Paper - add field + private boolean closed = false; // Airplane + static { ClassLoader.registerAsParallelCapable(); } @@ -151,6 +153,7 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot throw new ClassNotFoundException(name); } + public boolean _airplane_hasClass(@NotNull String name) { return this.classes.containsKey(name); } // Airplane @Override protected Class findClass(String name) throws ClassNotFoundException { if (name.startsWith("org.bukkit.") || name.startsWith("net.minecraft.")) { @@ -158,7 +161,7 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot } Class result = classes.get(name); - if (result == null) { + if (result == null && !this.closed) { // Airplane String path = name.replace('.', '/').concat(".class"); JarEntry entry = jar.getJarEntry(path); @@ -213,6 +216,7 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot try { super.close(); } finally { + this.closed = true; // Airplane jar.close(); } }