mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-09 00:22:08 -07:00
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#5636)
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:
@@ -34,20 +34,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
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
|
||||
@@ -0,0 +0,0 @@ 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) {
|
||||
java.util.concurrent.locks.ReentrantReadWriteLock lock;
|
||||
synchronized (classLoadLock) {
|
||||
@@ -0,0 +0,0 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
classLoadLockCount.compute(name, (x, prev) -> prev != null ? prev + 1 : 1);
|
||||
}
|
||||
@@ -55,26 +55,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ // 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.plugin.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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
|
||||
@@ -0,0 +0,0 @@ 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;
|
||||
|
Reference in New Issue
Block a user