mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
59 lines
2.6 KiB
Diff
59 lines
2.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Paul Sauve <paul@technove.co>
|
|
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 <http://www.gnu.org/licenses/>.
|
|
|
|
diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
|
|
index 1ab107d5bb20b9a12fc8843513bd9a3ada50c0a3..70aa79c0bfde6aea8031eeb69124344ab3af5c27 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<String> seenIllegalAccess = Collections.newSetFromMap(new ConcurrentHashMap<>());
|
|
private java.util.logging.Logger logger; // Paper - add field
|
|
|
|
+ private boolean closed = false; // Airplane
|
|
+
|
|
static {
|
|
ClassLoader.registerAsParallelCapable();
|
|
}
|
|
@@ -146,6 +148,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.")) {
|
|
@@ -153,7 +156,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);
|
|
|
|
@@ -208,6 +211,7 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot
|
|
try {
|
|
super.close();
|
|
} finally {
|
|
+ this.closed = true; // Airplane
|
|
jar.close();
|
|
}
|
|
}
|