diff options
author | Shane Freeder <[email protected]> | 2021-05-15 22:10:57 +0100 |
---|---|---|
committer | Shane Freeder <[email protected]> | 2021-05-15 22:10:57 +0100 |
commit | ecbf5a38e59fdcfbac08ee7bf22f66846a3f917a (patch) | |
tree | 4e935f6969400511bb94bca16fff51c8fad815f4 /Spigot-API-Patches | |
parent | 20fc4ab700b6e0afbe94b580b027a301312ec1f9 (diff) | |
download | Paper-ecbf5a38e59fdcfbac08ee7bf22f66846a3f917a.tar.gz Paper-ecbf5a38e59fdcfbac08ee7bf22f66846a3f917a.zip |
Revert "Updated Upstream (Bukkit/CraftBukkit/Spigot) (#5636)"
This reverts commit 20fc4ab700b6e0afbe94b580b027a301312ec1f9.
Diffstat (limited to 'Spigot-API-Patches')
14 files changed, 81 insertions, 72 deletions
diff --git a/Spigot-API-Patches/0001-POM-changes.patch b/Spigot-API-Patches/0001-POM-changes.patch index 2cd563eafa..ef977bfb1e 100644 --- a/Spigot-API-Patches/0001-POM-changes.patch +++ b/Spigot-API-Patches/0001-POM-changes.patch @@ -5,7 +5,7 @@ Subject: [PATCH] POM changes diff --git a/pom.xml b/pom.xml -index 0223e94c1243a58955f858c8bf6d5df4ca8cf0ec..fd663f5471516c3ebbab07c27197e5df48c481e6 100644 +index 5f3253b9c4a533e746707d602d4a7988519742ef..61b8ee4e3e122dd2671f50ea3b432e4abd4600a2 100644 --- a/pom.xml +++ b/pom.xml @@ -2,33 +2,34 @@ @@ -77,7 +77,7 @@ index 0223e94c1243a58955f858c8bf6d5df4ca8cf0ec..fd663f5471516c3ebbab07c27197e5df <!-- bundled with Minecraft, should be kept in sync --> <dependency> <groupId>com.google.guava</groupId> -@@ -112,6 +127,7 @@ +@@ -93,6 +108,7 @@ </dependencies> <build> @@ -85,7 +85,7 @@ index 0223e94c1243a58955f858c8bf6d5df4ca8cf0ec..fd663f5471516c3ebbab07c27197e5df <plugins> <plugin> <groupId>net.md-5</groupId> -@@ -130,10 +146,6 @@ +@@ -111,10 +127,6 @@ <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.8.1</version> @@ -96,7 +96,7 @@ index 0223e94c1243a58955f858c8bf6d5df4ca8cf0ec..fd663f5471516c3ebbab07c27197e5df <dependencies> <dependency> <groupId>org.codehaus.plexus</groupId> -@@ -183,6 +195,7 @@ +@@ -164,6 +176,7 @@ </excludes> </filter> </filters> diff --git a/Spigot-API-Patches/0004-Timings-v2.patch b/Spigot-API-Patches/0004-Timings-v2.patch index 31dd690195..7a89931ada 100644 --- a/Spigot-API-Patches/0004-Timings-v2.patch +++ b/Spigot-API-Patches/0004-Timings-v2.patch @@ -3454,18 +3454,18 @@ index 62d0017362204070465c8ff72e5c2ca07501f558..745eaa8f2f2ff83536301db8ca47a8af } } diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -index a09c3f71ca563b6f40a118ce1344d0eb273bed40..cf2f517765d8f2a23cc4a17d9ee2dcd81f841b1b 100644 +index 7b9ad3834c9c81220c74a16f1e66fb4da512e9f6..b6d739ca8ad8ebd4b1be7ebd129f9a7ae16b2a2a 100644 --- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -@@ -54,7 +54,6 @@ public final class JavaPluginLoader implements PluginLoader { +@@ -53,7 +53,6 @@ public final class JavaPluginLoader implements PluginLoader { private final Pattern[] fileFilters = new Pattern[]{Pattern.compile("\\.jar$")}; + private final Map<String, Class<?>> classes = new ConcurrentHashMap<String, Class<?>>(); private final List<PluginClassLoader> loaders = new CopyOnWriteArrayList<PluginClassLoader>(); - private final LibraryLoader libraryLoader; - public static final CustomTimingsHandler pluginParentTimer = new CustomTimingsHandler("** Plugins"); // Spigot /** * This class was not meant to be constructed explicitly -@@ -292,27 +291,21 @@ public final class JavaPluginLoader implements PluginLoader { +@@ -301,27 +300,21 @@ public final class JavaPluginLoader implements PluginLoader { } } @@ -3497,10 +3497,10 @@ index a09c3f71ca563b6f40a118ce1344d0eb273bed40..cf2f517765d8f2a23cc4a17d9ee2dcd8 eventSet.add(new TimedRegisteredListener(listener, executor, eh.priority(), plugin, eh.ignoreCancelled())); } else { diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java -index 6843e32438492f380e2e72bb40dd49d45fe675cb..5ffa98bb9c76d802a9d0ea6c572a704a2732c67c 100644 +index 5830e8b9b74d6107e54b6e19e03ab0e8c0da2f19..36f542a85e0f16e97c65c0ca64ec660ddf75d63e 100644 --- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java +++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java -@@ -29,7 +29,8 @@ import org.jetbrains.annotations.Nullable; +@@ -28,7 +28,8 @@ import org.jetbrains.annotations.Nullable; /** * A ClassLoader for plugins, to allow shared classes across multiple plugins */ diff --git a/Spigot-API-Patches/0005-Adventure.patch b/Spigot-API-Patches/0005-Adventure.patch index 67fbf87202..6b21b6c1ac 100644 --- a/Spigot-API-Patches/0005-Adventure.patch +++ b/Spigot-API-Patches/0005-Adventure.patch @@ -7,7 +7,7 @@ Co-authored-by: zml <[email protected]> Co-authored-by: Jake Potrebic <[email protected]> diff --git a/pom.xml b/pom.xml -index 9aafdcc49ed83b403abb96891008103e6d6a69fa..1ced7a212684cee8faf07fa9a083adcd47be7fcb 100644 +index e3744ee042e0426a513c4fdf4abedafe85e31cd2..363c66f7ec247820bd8db7b05f861ed40c48f384 100644 --- a/pom.xml +++ b/pom.xml @@ -22,6 +22,7 @@ @@ -58,7 +58,7 @@ index 9aafdcc49ed83b403abb96891008103e6d6a69fa..1ced7a212684cee8faf07fa9a083adcd <dependency> <groupId>it.unimi.dsi</groupId> <artifactId>fastutil</artifactId> -@@ -216,6 +249,12 @@ +@@ -197,6 +230,12 @@ <link>https://javadoc.io/doc/org.yaml/snakeyaml/1.27/</link> <link>https://javadoc.io/doc/org.jetbrains/annotations-java5/20.1.0/</link> <link>https://javadoc.io/doc/net.md-5/bungeecord-chat/1.16-R0.4/</link> diff --git a/Spigot-API-Patches/0014-Automatically-disable-plugins-that-fail-to-load.patch b/Spigot-API-Patches/0014-Automatically-disable-plugins-that-fail-to-load.patch index 55aeb559ba..9d44d1360d 100644 --- a/Spigot-API-Patches/0014-Automatically-disable-plugins-that-fail-to-load.patch +++ b/Spigot-API-Patches/0014-Automatically-disable-plugins-that-fail-to-load.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Automatically disable plugins that fail to load diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -index cf2f517765d8f2a23cc4a17d9ee2dcd81f841b1b..2e306c7b984a02e12a74fac14589bf29ab6488bf 100644 +index b6d739ca8ad8ebd4b1be7ebd129f9a7ae16b2a2a..c8497cb3021f584a885f4cb21c3be576ce0935a7 100644 --- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -@@ -335,6 +335,10 @@ public final class JavaPluginLoader implements PluginLoader { +@@ -344,6 +344,10 @@ public final class JavaPluginLoader implements PluginLoader { jPlugin.setEnabled(true); } catch (Throwable ex) { server.getLogger().log(Level.SEVERE, "Error occurred while enabling " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex); diff --git a/Spigot-API-Patches/0023-Use-ASM-for-event-executors.patch b/Spigot-API-Patches/0023-Use-ASM-for-event-executors.patch index bcbe8ec071..2468e909ce 100644 --- a/Spigot-API-Patches/0023-Use-ASM-for-event-executors.patch +++ b/Spigot-API-Patches/0023-Use-ASM-for-event-executors.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Use ASM for event executors. Uses method handles for private or static methods. diff --git a/pom.xml b/pom.xml -index 1ced7a212684cee8faf07fa9a083adcd47be7fcb..7ec7e6047193a6b390d24f6d2722e35d1d36830d 100644 +index 363c66f7ec247820bd8db7b05f861ed40c48f384..88d42ef3b615eb93738faaf453db9e3b5dabc2c2 100644 --- a/pom.xml +++ b/pom.xml -@@ -163,6 +163,17 @@ +@@ -144,6 +144,17 @@ <version>9.1</version> <scope>test</scope> </dependency> @@ -370,10 +370,10 @@ index a850f0780de05463fc0d3f9e15ff7f19d88b2aed..9026e108ccd3a88aee1267ee275137be + // Paper end } diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -index 2e306c7b984a02e12a74fac14589bf29ab6488bf..79ac529017aac059d13fe342f279e9c8faeba599 100644 +index c8497cb3021f584a885f4cb21c3be576ce0935a7..5be6460e8eb81381c7e305cb7ab6b77c0c7a8fe5 100644 --- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -@@ -291,21 +291,7 @@ public final class JavaPluginLoader implements PluginLoader { +@@ -300,21 +300,7 @@ public final class JavaPluginLoader implements PluginLoader { } } diff --git a/Spigot-API-Patches/0067-Allow-plugins-to-use-SLF4J-for-logging.patch b/Spigot-API-Patches/0067-Allow-plugins-to-use-SLF4J-for-logging.patch index 1f987148b3..4801516512 100644 --- a/Spigot-API-Patches/0067-Allow-plugins-to-use-SLF4J-for-logging.patch +++ b/Spigot-API-Patches/0067-Allow-plugins-to-use-SLF4J-for-logging.patch @@ -14,10 +14,10 @@ it without having to shade it in the plugin and going through several layers of logging abstraction. diff --git a/pom.xml b/pom.xml -index 7ec7e6047193a6b390d24f6d2722e35d1d36830d..6b71d9a397dd5b72320402a47b8e7197d24e061c 100644 +index 88d42ef3b615eb93738faaf453db9e3b5dabc2c2..9d0b4f6224e055f4e1da87d5e70703798bef5fba 100644 --- a/pom.xml +++ b/pom.xml -@@ -144,6 +144,13 @@ +@@ -125,6 +125,13 @@ <version>20.1.0</version> <scope>provided</scope> </dependency> diff --git a/Spigot-API-Patches/0068-Add-workaround-for-plugins-modifying-the-parent-of-t.patch b/Spigot-API-Patches/0068-Add-workaround-for-plugins-modifying-the-parent-of-t.patch index af57152197..ff6a815968 100644 --- a/Spigot-API-Patches/0068-Add-workaround-for-plugins-modifying-the-parent-of-t.patch +++ b/Spigot-API-Patches/0068-Add-workaround-for-plugins-modifying-the-parent-of-t.patch @@ -87,10 +87,10 @@ index bb2e55e97bf887a28cac7d4f9a0a23960d22cf56..04fa3991f6ce4e9dad804f28fc6c9476 /** diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java -index 5ffa98bb9c76d802a9d0ea6c572a704a2732c67c..22abd85da592c79e312928de596e5d552a45ef12 100644 +index 36f542a85e0f16e97c65c0ca64ec660ddf75d63e..3a02dbe9d183bc907dcce081d8338d5716ed5242 100644 --- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java +++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java -@@ -44,6 +44,7 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot +@@ -42,6 +42,7 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot private JavaPlugin pluginInit; private IllegalStateException pluginState; private final Set<String> seenIllegalAccess = Collections.newSetFromMap(new ConcurrentHashMap<>()); @@ -98,16 +98,16 @@ index 5ffa98bb9c76d802a9d0ea6c572a704a2732c67c..22abd85da592c79e312928de596e5d55 static { ClassLoader.registerAsParallelCapable(); -@@ -62,6 +63,8 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot +@@ -59,6 +60,8 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot + this.manifest = jar.getManifest(); this.url = file.toURI().toURL(); - this.libraryLoader = libraryLoader; + this.logger = com.destroystokyo.paper.utils.PaperPluginLogger.getLogger(description); // Paper - Register logger early + try { Class<?> jarClass; try { -@@ -220,6 +223,7 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot +@@ -203,6 +206,7 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot pluginState = new IllegalStateException("Initial initialization"); this.pluginInit = javaPlugin; diff --git a/Spigot-API-Patches/0099-Close-Plugin-Class-Loaders-on-Disable.patch b/Spigot-API-Patches/0099-Close-Plugin-Class-Loaders-on-Disable.patch index 6580fe3c76..4272393c94 100644 --- a/Spigot-API-Patches/0099-Close-Plugin-Class-Loaders-on-Disable.patch +++ b/Spigot-API-Patches/0099-Close-Plugin-Class-Loaders-on-Disable.patch @@ -97,10 +97,10 @@ index 8b33d914d29897c0276f9e2e7ce83bd2c316d5e2..a7393d2830b95d7167121b02066a3f35 lookupNames.clear(); dependencyGraph = GraphBuilder.directed().build(); diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -index 79ac529017aac059d13fe342f279e9c8faeba599..816c2b1797447ab315ceb6eda89d25f27d2bce98 100644 +index 5be6460e8eb81381c7e305cb7ab6b77c0c7a8fe5..bef88a6e2e6f7071401a3af0aec31e62aa265566 100644 --- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -@@ -322,7 +322,7 @@ public final class JavaPluginLoader implements PluginLoader { +@@ -331,7 +331,7 @@ public final class JavaPluginLoader implements PluginLoader { } catch (Throwable ex) { server.getLogger().log(Level.SEVERE, "Error occurred while enabling " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex); // Paper start - Disable plugins that fail to load @@ -109,7 +109,7 @@ index 79ac529017aac059d13fe342f279e9c8faeba599..816c2b1797447ab315ceb6eda89d25f2 return; // Paper end } -@@ -335,6 +335,12 @@ public final class JavaPluginLoader implements PluginLoader { +@@ -344,6 +344,12 @@ public final class JavaPluginLoader implements PluginLoader { @Override public void disablePlugin(@NotNull Plugin plugin) { @@ -122,9 +122,9 @@ index 79ac529017aac059d13fe342f279e9c8faeba599..816c2b1797447ab315ceb6eda89d25f2 Validate.isTrue(plugin instanceof JavaPlugin, "Plugin is not associated with this PluginLoader"); if (plugin.isEnabled()) { -@@ -367,6 +373,16 @@ public final class JavaPluginLoader implements PluginLoader { - } catch (IOException ex) { - // +@@ -370,6 +376,16 @@ public final class JavaPluginLoader implements PluginLoader { + for (String name : names) { + removeClass(name); } + // Paper start - close Class Loader on disable + try { diff --git a/Spigot-API-Patches/0119-Add-an-asterisk-to-legacy-API-plugins.patch b/Spigot-API-Patches/0119-Add-an-asterisk-to-legacy-API-plugins.patch index d768a18607..474486c1e0 100644 --- a/Spigot-API-Patches/0119-Add-an-asterisk-to-legacy-API-plugins.patch +++ b/Spigot-API-Patches/0119-Add-an-asterisk-to-legacy-API-plugins.patch @@ -45,10 +45,10 @@ index 4de959bbd1270d7d6ea8e5e69521bcca6abe2138..1aa58c59e1e8738bbdc77752885ff3b1 if (plugin.getDescription().getProvides().size() > 0) { pluginList.append(" (").append(String.join(", ", plugin.getDescription().getProvides())).append(")"); diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -index 816c2b1797447ab315ceb6eda89d25f27d2bce98..f26303315c9c93356f0b04440136855dd54d32b7 100644 +index bef88a6e2e6f7071401a3af0aec31e62aa265566..de44d850d7b3ab3e528eb6f2de375a6c3e0e5cf9 100644 --- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -@@ -306,7 +306,14 @@ public final class JavaPluginLoader implements PluginLoader { +@@ -315,7 +315,14 @@ public final class JavaPluginLoader implements PluginLoader { Validate.isTrue(plugin instanceof JavaPlugin, "Plugin is not associated with this PluginLoader"); if (!plugin.isEnabled()) { diff --git a/Spigot-API-Patches/0193-Make-JavaPluginLoader-thread-safe.patch b/Spigot-API-Patches/0193-Make-JavaPluginLoader-thread-safe.patch index be66a6a695..21dbe589a4 100644 --- a/Spigot-API-Patches/0193-Make-JavaPluginLoader-thread-safe.patch +++ b/Spigot-API-Patches/0193-Make-JavaPluginLoader-thread-safe.patch @@ -5,34 +5,40 @@ Subject: [PATCH] Make JavaPluginLoader thread-safe diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -index f26303315c9c93356f0b04440136855dd54d32b7..ce751577623eaad0f31e2eb7bf0842d1ab73e845 100644 +index de44d850d7b3ab3e528eb6f2de375a6c3e0e5cf9..9d1f7cdf12029c8198792fd299f92be476040222 100644 --- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -@@ -52,6 +52,8 @@ import org.yaml.snakeyaml.error.YAMLException; - public final class JavaPluginLoader implements PluginLoader { +@@ -52,6 +52,8 @@ public final class JavaPluginLoader implements PluginLoader { final Server server; private final Pattern[] fileFilters = new Pattern[]{Pattern.compile("\\.jar$")}; + private final Map<String, Class<?>> classes = new ConcurrentHashMap<String, Class<?>>(); + private final Map<String, java.util.concurrent.locks.ReentrantReadWriteLock> classLoadLock = new java.util.HashMap<String, java.util.concurrent.locks.ReentrantReadWriteLock>(); // Paper + private final Map<String, Integer> classLoadLockCount = new java.util.HashMap<String, Integer>(); // Paper private final List<PluginClassLoader> loaders = new CopyOnWriteArrayList<PluginClassLoader>(); - private final LibraryLoader libraryLoader; -@@ -201,12 +203,33 @@ public final class JavaPluginLoader implements PluginLoader { + /** +@@ -191,7 +193,19 @@ public final class JavaPluginLoader implements PluginLoader { @Nullable - Class<?> getClassByName(final String name, boolean resolve, PluginDescriptionFile description) { + Class<?> getClassByName(final String name) { + // Paper start - make MT safe + Class<?> cachedClass = classes.get(name); ++ if (cachedClass != null) { ++ return cachedClass; ++ } + java.util.concurrent.locks.ReentrantReadWriteLock lock; + synchronized (classLoadLock) { + lock = classLoadLock.computeIfAbsent(name, (x) -> new java.util.concurrent.locks.ReentrantReadWriteLock()); + classLoadLockCount.compute(name, (x, prev) -> prev != null ? prev + 1 : 1); + } + lock.writeLock().lock();try { ++ cachedClass = classes.get(name); + // Paper end - for (PluginClassLoader loader : loaders) { - try { - return loader.loadClass0(name, resolve, false, ((SimplePluginManager) server.getPluginManager()).isTransitiveDepend(description, loader.plugin.getDescription())); - } catch (ClassNotFoundException cnfe) { + + if (cachedClass != null) { + return cachedClass; +@@ -205,6 +219,19 @@ public final class JavaPluginLoader implements PluginLoader { + } } } + // Paper start - make MT safe diff --git a/Spigot-API-Patches/0205-Prioritise-own-classes-where-possible.patch b/Spigot-API-Patches/0205-Prioritise-own-classes-where-possible.patch index 1697c8cc8f..fad10c31db 100644 --- a/Spigot-API-Patches/0205-Prioritise-own-classes-where-possible.patch +++ b/Spigot-API-Patches/0205-Prioritise-own-classes-where-possible.patch @@ -25,53 +25,56 @@ The patch in general terms just loads the class in the plugin's jar before it starts looking elsewhere for it. diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -index ce751577623eaad0f31e2eb7bf0842d1ab73e845..a93cdeb7bb2ad3173031799c552b27c4c8ad21ee 100644 +index 9d1f7cdf12029c8198792fd299f92be476040222..384edf9890dfbd1cddfdcac4db1ebe9a4d761f78 100644 --- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -@@ -51,6 +51,7 @@ import org.yaml.snakeyaml.error.YAMLException; +@@ -50,6 +50,7 @@ import org.yaml.snakeyaml.error.YAMLException; */ public final class JavaPluginLoader implements PluginLoader { final Server server; + private static final boolean DISABLE_CLASS_PRIORITIZATION = Boolean.getBoolean("Paper.DisableClassPrioritization"); // Paper private final Pattern[] fileFilters = new Pattern[]{Pattern.compile("\\.jar$")}; + private final Map<String, Class<?>> classes = new ConcurrentHashMap<String, Class<?>>(); private final Map<String, java.util.concurrent.locks.ReentrantReadWriteLock> classLoadLock = new java.util.HashMap<String, java.util.concurrent.locks.ReentrantReadWriteLock>(); // Paper - private final Map<String, Integer> classLoadLockCount = new java.util.HashMap<String, Integer>(); // Paper -@@ -203,6 +204,11 @@ public final class JavaPluginLoader implements PluginLoader { +@@ -193,6 +194,11 @@ public final class JavaPluginLoader implements PluginLoader { @Nullable - Class<?> getClassByName(final String name, boolean resolve, PluginDescriptionFile description) { + Class<?> getClassByName(final String name) { + // Paper start - prioritize self -+ return getClassByName(name, resolve, description, null); ++ return getClassByName(name, null); + } -+ Class<?> getClassByName(final String name, boolean resolve, PluginDescriptionFile description, PluginClassLoader requester) { ++ Class<?> getClassByName(final String name, PluginClassLoader requester) { + // Paper end // Paper start - make MT safe - java.util.concurrent.locks.ReentrantReadWriteLock lock; - synchronized (classLoadLock) { -@@ -210,6 +216,13 @@ public final class JavaPluginLoader implements PluginLoader { + Class<?> cachedClass = classes.get(name); + if (cachedClass != null) { +@@ -204,6 +210,16 @@ public final class JavaPluginLoader implements PluginLoader { classLoadLockCount.compute(name, (x, prev) -> prev != null ? prev + 1 : 1); } lock.writeLock().lock();try { + // Paper start - prioritize self + if (!DISABLE_CLASS_PRIORITIZATION && requester != null) { + try { -+ return requester.loadClass0(name, false, false, ((SimplePluginManager) server.getPluginManager()).isTransitiveDepend(description, requester.plugin.getDescription())); ++ cachedClass = requester.findClass(name, false); + } catch (ClassNotFoundException cnfe) {} ++ if (cachedClass != null) { ++ return cachedClass; ++ } + } -+ // Paper end ++ // Paper end- + cachedClass = classes.get(name); // Paper end - for (PluginClassLoader loader : loaders) { - try { + diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java -index 22abd85da592c79e312928de596e5d552a45ef12..e7a8a221a23d2adc497afd21e512eecba4c63a6b 100644 +index 3a02dbe9d183bc907dcce081d8338d5716ed5242..28e5c6591fb594ca79ee92480cedc8f549e3fe01 100644 --- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java +++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java -@@ -117,7 +117,7 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot - } +@@ -108,7 +108,7 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot - if (checkGlobal) { -- Class<?> result = loader.getClassByName(name, resolve, description); -+ Class<?> result = loader.getClassByName(name, resolve, description, this); // Paper - prioritize self + if (result == null) { + if (checkGlobal) { +- result = loader.getClassByName(name); ++ result = loader.getClassByName(name, this); // Paper - prioritize self - if (result != null) { - PluginDescriptionFile provider = ((PluginClassLoader) result.getClassLoader()).description; + if (result != null) { + PluginDescriptionFile provider = ((PluginClassLoader) result.getClassLoader()).description; diff --git a/Spigot-API-Patches/0207-Provide-a-useful-PluginClassLoader-toString.patch b/Spigot-API-Patches/0207-Provide-a-useful-PluginClassLoader-toString.patch index 43903ca4e0..056a908da9 100644 --- a/Spigot-API-Patches/0207-Provide-a-useful-PluginClassLoader-toString.patch +++ b/Spigot-API-Patches/0207-Provide-a-useful-PluginClassLoader-toString.patch @@ -8,10 +8,10 @@ however, this provides no indication of the owner of the classloader, making these messages effectively useless, this patch rectifies this diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java -index e7a8a221a23d2adc497afd21e512eecba4c63a6b..11e5618ff66385574ba04db0942a75227cf8eb0f 100644 +index 28e5c6591fb594ca79ee92480cedc8f549e3fe01..62f7a6817da079513f471e36cd79739d36a36d86 100644 --- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java +++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java -@@ -226,4 +226,16 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot +@@ -209,4 +209,16 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot javaPlugin.logger = this.logger; // Paper - set logger javaPlugin.init(loader, loader.server, description, dataFolder, file, this); } diff --git a/Spigot-API-Patches/0241-Enable-multi-release-plugin-jars.patch b/Spigot-API-Patches/0241-Enable-multi-release-plugin-jars.patch index 9f71d1c074..892d1d4874 100644 --- a/Spigot-API-Patches/0241-Enable-multi-release-plugin-jars.patch +++ b/Spigot-API-Patches/0241-Enable-multi-release-plugin-jars.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Enable multi-release plugin jars diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java -index 11e5618ff66385574ba04db0942a75227cf8eb0f..c833cee9fddd12afdfe6bde1435559819b9ad656 100644 +index 62f7a6817da079513f471e36cd79739d36a36d86..7760be3e34fa20825faf145d9fb5b2855c1a4602 100644 --- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java +++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java -@@ -58,7 +58,18 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot +@@ -56,7 +56,18 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot this.description = description; this.dataFolder = dataFolder; this.file = file; @@ -27,4 +27,4 @@ index 11e5618ff66385574ba04db0942a75227cf8eb0f..c833cee9fddd12afdfe6bde143555981 + // Paper end this.manifest = jar.getManifest(); this.url = file.toURI().toURL(); - this.libraryLoader = libraryLoader; + diff --git a/Spigot-API-Patches/0257-Better-AnnotationTest-printout.patch b/Spigot-API-Patches/0257-Better-AnnotationTest-printout.patch index 2a40d2b44f..299741a847 100644 --- a/Spigot-API-Patches/0257-Better-AnnotationTest-printout.patch +++ b/Spigot-API-Patches/0257-Better-AnnotationTest-printout.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Better AnnotationTest printout diff --git a/pom.xml b/pom.xml -index 6b71d9a397dd5b72320402a47b8e7197d24e061c..73fbd5d5a591871a3a386fb5c455cd96a3992e7a 100644 +index 9d0b4f6224e055f4e1da87d5e70703798bef5fba..c2e9ca1cc7f14d3a696385edc3cb341f902fa2fd 100644 --- a/pom.xml +++ b/pom.xml -@@ -257,6 +257,19 @@ +@@ -238,6 +238,19 @@ <shadedArtifactAttached>true</shadedArtifactAttached> </configuration> </plugin> |