Updated Upstream (Bukkit/CraftBukkit/Spigot) (#5643)
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 146a7e4b SPIGOT-5345: Add automatic library support CraftBukkit Changes: b1064c69 Remove sisu annotation processor from jar 32e40866 SPIGOT-6189: Persistent data disappears when calling setFacingDirection on an item frame d189f78b # 827: Trigger vanilla dimension advancements in non-main worlds 5bbb4a65 Add plumbing for automatic library support Spigot Changes: 9fb885e8 Rebuild patches
This commit is contained in:
parent
ecbf5a38e5
commit
cb896d4710
56 changed files with 228 additions and 232 deletions
|
@ -5,7 +5,7 @@ Subject: [PATCH] POM changes
|
|||
|
||||
|
||||
diff --git a/pom.xml b/pom.xml
|
||||
index 5f3253b9c4a533e746707d602d4a7988519742ef..61b8ee4e3e122dd2671f50ea3b432e4abd4600a2 100644
|
||||
index 0223e94c1243a58955f858c8bf6d5df4ca8cf0ec..fd663f5471516c3ebbab07c27197e5df48c481e6 100644
|
||||
--- a/pom.xml
|
||||
+++ b/pom.xml
|
||||
@@ -2,33 +2,34 @@
|
||||
|
@ -77,7 +77,7 @@ index 5f3253b9c4a533e746707d602d4a7988519742ef..61b8ee4e3e122dd2671f50ea3b432e4a
|
|||
<!-- bundled with Minecraft, should be kept in sync -->
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
@@ -93,6 +108,7 @@
|
||||
@@ -112,6 +127,7 @@
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -85,7 +85,7 @@ index 5f3253b9c4a533e746707d602d4a7988519742ef..61b8ee4e3e122dd2671f50ea3b432e4a
|
|||
<plugins>
|
||||
<plugin>
|
||||
<groupId>net.md-5</groupId>
|
||||
@@ -111,10 +127,6 @@
|
||||
@@ -130,10 +146,6 @@
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
|
@ -96,7 +96,7 @@ index 5f3253b9c4a533e746707d602d4a7988519742ef..61b8ee4e3e122dd2671f50ea3b432e4a
|
|||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
@@ -164,6 +176,7 @@
|
||||
@@ -183,6 +195,7 @@
|
||||
</excludes>
|
||||
</filter>
|
||||
</filters>
|
||||
|
|
|
@ -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 7b9ad3834c9c81220c74a16f1e66fb4da512e9f6..b6d739ca8ad8ebd4b1be7ebd129f9a7ae16b2a2a 100644
|
||||
index a09c3f71ca563b6f40a118ce1344d0eb273bed40..cf2f517765d8f2a23cc4a17d9ee2dcd81f841b1b 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
@@ -53,7 +53,6 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
@@ -54,7 +54,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
|
||||
@@ -301,27 +300,21 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
@@ -292,27 +291,21 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3497,10 +3497,10 @@ index 7b9ad3834c9c81220c74a16f1e66fb4da512e9f6..b6d739ca8ad8ebd4b1be7ebd129f9a7a
|
|||
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 5830e8b9b74d6107e54b6e19e03ab0e8c0da2f19..36f542a85e0f16e97c65c0ca64ec660ddf75d63e 100644
|
||||
index 6843e32438492f380e2e72bb40dd49d45fe675cb..5ffa98bb9c76d802a9d0ea6c572a704a2732c67c 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
|
||||
@@ -28,7 +28,8 @@ import org.jetbrains.annotations.Nullable;
|
||||
@@ -29,7 +29,8 @@ import org.jetbrains.annotations.Nullable;
|
||||
/**
|
||||
* A ClassLoader for plugins, to allow shared classes across multiple plugins
|
||||
*/
|
||||
|
|
|
@ -7,7 +7,7 @@ Co-authored-by: zml <zml@stellardrift.ca>
|
|||
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
|
||||
diff --git a/pom.xml b/pom.xml
|
||||
index e3744ee042e0426a513c4fdf4abedafe85e31cd2..363c66f7ec247820bd8db7b05f861ed40c48f384 100644
|
||||
index 9aafdcc49ed83b403abb96891008103e6d6a69fa..1ced7a212684cee8faf07fa9a083adcd47be7fcb 100644
|
||||
--- a/pom.xml
|
||||
+++ b/pom.xml
|
||||
@@ -22,6 +22,7 @@
|
||||
|
@ -58,7 +58,7 @@ index e3744ee042e0426a513c4fdf4abedafe85e31cd2..363c66f7ec247820bd8db7b05f861ed4
|
|||
<dependency>
|
||||
<groupId>it.unimi.dsi</groupId>
|
||||
<artifactId>fastutil</artifactId>
|
||||
@@ -197,6 +230,12 @@
|
||||
@@ -216,6 +249,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>
|
||||
|
|
|
@ -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 b6d739ca8ad8ebd4b1be7ebd129f9a7ae16b2a2a..c8497cb3021f584a885f4cb21c3be576ce0935a7 100644
|
||||
index cf2f517765d8f2a23cc4a17d9ee2dcd81f841b1b..2e306c7b984a02e12a74fac14589bf29ab6488bf 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
@@ -344,6 +344,10 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
@@ -335,6 +335,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);
|
||||
|
|
|
@ -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 363c66f7ec247820bd8db7b05f861ed40c48f384..88d42ef3b615eb93738faaf453db9e3b5dabc2c2 100644
|
||||
index 1ced7a212684cee8faf07fa9a083adcd47be7fcb..7ec7e6047193a6b390d24f6d2722e35d1d36830d 100644
|
||||
--- a/pom.xml
|
||||
+++ b/pom.xml
|
||||
@@ -144,6 +144,17 @@
|
||||
@@ -163,6 +163,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 c8497cb3021f584a885f4cb21c3be576ce0935a7..5be6460e8eb81381c7e305cb7ab6b77c0c7a8fe5 100644
|
||||
index 2e306c7b984a02e12a74fac14589bf29ab6488bf..79ac529017aac059d13fe342f279e9c8faeba599 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
@@ -300,21 +300,7 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
@@ -291,21 +291,7 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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 88d42ef3b615eb93738faaf453db9e3b5dabc2c2..9d0b4f6224e055f4e1da87d5e70703798bef5fba 100644
|
||||
index 7ec7e6047193a6b390d24f6d2722e35d1d36830d..6b71d9a397dd5b72320402a47b8e7197d24e061c 100644
|
||||
--- a/pom.xml
|
||||
+++ b/pom.xml
|
||||
@@ -125,6 +125,13 @@
|
||||
@@ -144,6 +144,13 @@
|
||||
<version>20.1.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
|
|
@ -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 36f542a85e0f16e97c65c0ca64ec660ddf75d63e..3a02dbe9d183bc907dcce081d8338d5716ed5242 100644
|
||||
index 5ffa98bb9c76d802a9d0ea6c572a704a2732c67c..22abd85da592c79e312928de596e5d552a45ef12 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
|
||||
@@ -42,6 +42,7 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot
|
||||
@@ -44,6 +44,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 36f542a85e0f16e97c65c0ca64ec660ddf75d63e..3a02dbe9d183bc907dcce081d8338d57
|
|||
|
||||
static {
|
||||
ClassLoader.registerAsParallelCapable();
|
||||
@@ -59,6 +60,8 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot
|
||||
this.manifest = jar.getManifest();
|
||||
@@ -62,6 +63,8 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot
|
||||
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 {
|
||||
@@ -203,6 +206,7 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot
|
||||
@@ -220,6 +223,7 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot
|
||||
pluginState = new IllegalStateException("Initial initialization");
|
||||
this.pluginInit = javaPlugin;
|
||||
|
||||
|
|
|
@ -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 5be6460e8eb81381c7e305cb7ab6b77c0c7a8fe5..bef88a6e2e6f7071401a3af0aec31e62aa265566 100644
|
||||
index 79ac529017aac059d13fe342f279e9c8faeba599..816c2b1797447ab315ceb6eda89d25f27d2bce98 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
@@ -331,7 +331,7 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
@@ -322,7 +322,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 5be6460e8eb81381c7e305cb7ab6b77c0c7a8fe5..bef88a6e2e6f7071401a3af0aec31e62
|
|||
return;
|
||||
// Paper end
|
||||
}
|
||||
@@ -344,6 +344,12 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
@@ -335,6 +335,12 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
|
||||
@Override
|
||||
public void disablePlugin(@NotNull Plugin plugin) {
|
||||
|
@ -122,9 +122,9 @@ index 5be6460e8eb81381c7e305cb7ab6b77c0c7a8fe5..bef88a6e2e6f7071401a3af0aec31e62
|
|||
Validate.isTrue(plugin instanceof JavaPlugin, "Plugin is not associated with this PluginLoader");
|
||||
|
||||
if (plugin.isEnabled()) {
|
||||
@@ -370,6 +376,16 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
for (String name : names) {
|
||||
removeClass(name);
|
||||
@@ -367,6 +373,16 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
} catch (IOException ex) {
|
||||
//
|
||||
}
|
||||
+ // Paper start - close Class Loader on disable
|
||||
+ try {
|
||||
|
|
|
@ -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 bef88a6e2e6f7071401a3af0aec31e62aa265566..de44d850d7b3ab3e528eb6f2de375a6c3e0e5cf9 100644
|
||||
index 816c2b1797447ab315ceb6eda89d25f27d2bce98..f26303315c9c93356f0b04440136855dd54d32b7 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
@@ -315,7 +315,14 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
@@ -306,7 +306,14 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
Validate.isTrue(plugin instanceof JavaPlugin, "Plugin is not associated with this PluginLoader");
|
||||
|
||||
if (!plugin.isEnabled()) {
|
||||
|
|
|
@ -5,40 +5,34 @@ 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 de44d850d7b3ab3e528eb6f2de375a6c3e0e5cf9..9d1f7cdf12029c8198792fd299f92be476040222 100644
|
||||
index f26303315c9c93356f0b04440136855dd54d32b7..ce751577623eaad0f31e2eb7bf0842d1ab73e845 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 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
@@ -52,6 +52,8 @@ import org.yaml.snakeyaml.error.YAMLException;
|
||||
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;
|
||||
|
||||
/**
|
||||
@@ -191,7 +193,19 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
@@ -201,12 +203,33 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
|
||||
@Nullable
|
||||
Class<?> getClassByName(final String name) {
|
||||
Class<?> getClassByName(final String name, boolean resolve, PluginDescriptionFile description) {
|
||||
+ // 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
|
||||
|
||||
if (cachedClass != null) {
|
||||
return cachedClass;
|
||||
@@ -205,6 +219,19 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
}
|
||||
for (PluginClassLoader loader : loaders) {
|
||||
try {
|
||||
return loader.loadClass0(name, resolve, false, ((SimplePluginManager) server.getPluginManager()).isTransitiveDepend(description, loader.plugin.getDescription()));
|
||||
} catch (ClassNotFoundException cnfe) {
|
||||
}
|
||||
}
|
||||
+ // Paper start - make MT safe
|
||||
|
|
|
@ -25,56 +25,62 @@ 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 9d1f7cdf12029c8198792fd299f92be476040222..384edf9890dfbd1cddfdcac4db1ebe9a4d761f78 100644
|
||||
index ce751577623eaad0f31e2eb7bf0842d1ab73e845..31793f46e5623729dfb4048e901f274082f57826 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
@@ -50,6 +50,7 @@ import org.yaml.snakeyaml.error.YAMLException;
|
||||
@@ -51,6 +51,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
|
||||
@@ -193,6 +194,11 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
private final Map<String, Integer> classLoadLockCount = new java.util.HashMap<String, Integer>(); // Paper
|
||||
@@ -203,6 +204,11 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
|
||||
@Nullable
|
||||
Class<?> getClassByName(final String name) {
|
||||
Class<?> getClassByName(final String name, boolean resolve, PluginDescriptionFile description) {
|
||||
+ // Paper start - prioritize self
|
||||
+ return getClassByName(name, null);
|
||||
+ return getClassByName(name, resolve, description, null);
|
||||
+ }
|
||||
+ Class<?> getClassByName(final String name, PluginClassLoader requester) {
|
||||
+ Class<?> getClassByName(final String name, boolean resolve, PluginDescriptionFile description, PluginClassLoader requester) {
|
||||
+ // Paper end
|
||||
// Paper start - make MT safe
|
||||
Class<?> cachedClass = classes.get(name);
|
||||
if (cachedClass != null) {
|
||||
@@ -204,6 +210,16 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
java.util.concurrent.locks.ReentrantReadWriteLock lock;
|
||||
synchronized (classLoadLock) {
|
||||
@@ -210,6 +216,13 @@ 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 {
|
||||
+ cachedClass = requester.findClass(name, false);
|
||||
+ return requester.loadClass0(name, false, false, ((SimplePluginManager) server.getPluginManager()).isTransitiveDepend(description, requester.getDescription()));
|
||||
+ } catch (ClassNotFoundException cnfe) {}
|
||||
+ if (cachedClass != null) {
|
||||
+ return cachedClass;
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end-
|
||||
cachedClass = classes.get(name);
|
||||
+ // Paper end
|
||||
// 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 3a02dbe9d183bc907dcce081d8338d5716ed5242..28e5c6591fb594ca79ee92480cedc8f549e3fe01 100644
|
||||
index 22abd85da592c79e312928de596e5d552a45ef12..cfa408e560d85311b474562a6d3860363727eff0 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
|
||||
@@ -108,7 +108,7 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot
|
||||
@@ -33,7 +33,7 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot
|
||||
public JavaPlugin getPlugin() { return plugin; } // Spigot
|
||||
private final JavaPluginLoader loader;
|
||||
private final Map<String, Class<?>> classes = new ConcurrentHashMap<String, Class<?>>();
|
||||
- private final PluginDescriptionFile description;
|
||||
+ private final PluginDescriptionFile description; PluginDescriptionFile getDescription() { return description; } // Paper
|
||||
private final File dataFolder;
|
||||
private final File file;
|
||||
private final JarFile jar;
|
||||
@@ -117,7 +117,7 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot
|
||||
}
|
||||
|
||||
if (result == null) {
|
||||
if (checkGlobal) {
|
||||
- result = loader.getClassByName(name);
|
||||
+ result = loader.getClassByName(name, this); // Paper - prioritize self
|
||||
if (checkGlobal) {
|
||||
- Class<?> result = loader.getClassByName(name, resolve, description);
|
||||
+ Class<?> result = loader.getClassByName(name, resolve, description, this); // Paper - prioritize self
|
||||
|
||||
if (result != null) {
|
||||
PluginDescriptionFile provider = ((PluginClassLoader) result.getClassLoader()).description;
|
||||
if (result != null) {
|
||||
PluginDescriptionFile provider = ((PluginClassLoader) result.getClassLoader()).description;
|
||||
|
|
|
@ -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 28e5c6591fb594ca79ee92480cedc8f549e3fe01..62f7a6817da079513f471e36cd79739d36a36d86 100644
|
||||
index e7a8a221a23d2adc497afd21e512eecba4c63a6b..11e5618ff66385574ba04db0942a75227cf8eb0f 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
|
||||
@@ -209,4 +209,16 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot
|
||||
@@ -226,4 +226,16 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot
|
||||
javaPlugin.logger = this.logger; // Paper - set logger
|
||||
javaPlugin.init(loader, loader.server, description, dataFolder, file, this);
|
||||
}
|
||||
|
|
|
@ -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 62f7a6817da079513f471e36cd79739d36a36d86..7760be3e34fa20825faf145d9fb5b2855c1a4602 100644
|
||||
index 11e5618ff66385574ba04db0942a75227cf8eb0f..c833cee9fddd12afdfe6bde1435559819b9ad656 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
|
||||
@@ -56,7 +56,18 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot
|
||||
@@ -58,7 +58,18 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot
|
||||
this.description = description;
|
||||
this.dataFolder = dataFolder;
|
||||
this.file = file;
|
||||
|
@ -27,4 +27,4 @@ index 62f7a6817da079513f471e36cd79739d36a36d86..7760be3e34fa20825faf145d9fb5b285
|
|||
+ // Paper end
|
||||
this.manifest = jar.getManifest();
|
||||
this.url = file.toURI().toURL();
|
||||
|
||||
this.libraryLoader = libraryLoader;
|
||||
|
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] Better AnnotationTest printout
|
|||
|
||||
|
||||
diff --git a/pom.xml b/pom.xml
|
||||
index 9d0b4f6224e055f4e1da87d5e70703798bef5fba..c2e9ca1cc7f14d3a696385edc3cb341f902fa2fd 100644
|
||||
index 6b71d9a397dd5b72320402a47b8e7197d24e061c..73fbd5d5a591871a3a386fb5c455cd96a3992e7a 100644
|
||||
--- a/pom.xml
|
||||
+++ b/pom.xml
|
||||
@@ -238,6 +238,19 @@
|
||||
@@ -257,6 +257,19 @@
|
||||
<shadedArtifactAttached>true</shadedArtifactAttached>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue