mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-08 16:12:18 -07:00
Revert "Updated Upstream (Bukkit/CraftBukkit/Spigot) (#5636)"
This reverts commit 11c2ef5d2f
.
This commit is contained in:
@@ -99,8 +99,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
static {
|
static {
|
||||||
ClassLoader.registerAsParallelCapable();
|
ClassLoader.registerAsParallelCapable();
|
||||||
@@ -0,0 +0,0 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot
|
@@ -0,0 +0,0 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot
|
||||||
|
this.manifest = jar.getManifest();
|
||||||
this.url = file.toURI().toURL();
|
this.url = file.toURI().toURL();
|
||||||
this.libraryLoader = libraryLoader;
|
|
||||||
|
|
||||||
+ this.logger = com.destroystokyo.paper.utils.PaperPluginLogger.getLogger(description); // Paper - Register logger early
|
+ this.logger = com.destroystokyo.paper.utils.PaperPluginLogger.getLogger(description); // Paper - Register logger early
|
||||||
+
|
+
|
||||||
|
@@ -123,8 +123,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
if (plugin.isEnabled()) {
|
if (plugin.isEnabled()) {
|
||||||
@@ -0,0 +0,0 @@ public final class JavaPluginLoader implements PluginLoader {
|
@@ -0,0 +0,0 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||||
} catch (IOException ex) {
|
for (String name : names) {
|
||||||
//
|
removeClass(name);
|
||||||
}
|
}
|
||||||
+ // Paper start - close Class Loader on disable
|
+ // Paper start - close Class Loader on disable
|
||||||
+ try {
|
+ try {
|
||||||
|
@@ -27,4 +27,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ // Paper end
|
+ // Paper end
|
||||||
this.manifest = jar.getManifest();
|
this.manifest = jar.getManifest();
|
||||||
this.url = file.toURI().toURL();
|
this.url = file.toURI().toURL();
|
||||||
this.libraryLoader = libraryLoader;
|
|
||||||
|
@@ -8,31 +8,37 @@ diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/ma
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||||
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||||
@@ -0,0 +0,0 @@ import org.yaml.snakeyaml.error.YAMLException;
|
@@ -0,0 +0,0 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||||
public final class JavaPluginLoader implements PluginLoader {
|
|
||||||
final Server server;
|
final Server server;
|
||||||
private final Pattern[] fileFilters = new Pattern[]{Pattern.compile("\\.jar$")};
|
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, 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 Map<String, Integer> classLoadLockCount = new java.util.HashMap<String, Integer>(); // Paper
|
||||||
private final List<PluginClassLoader> loaders = new CopyOnWriteArrayList<PluginClassLoader>();
|
private final List<PluginClassLoader> loaders = new CopyOnWriteArrayList<PluginClassLoader>();
|
||||||
private final LibraryLoader libraryLoader;
|
|
||||||
|
|
||||||
|
/**
|
||||||
@@ -0,0 +0,0 @@ public final class JavaPluginLoader implements PluginLoader {
|
@@ -0,0 +0,0 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
Class<?> getClassByName(final String name, boolean resolve, PluginDescriptionFile description) {
|
Class<?> getClassByName(final String name) {
|
||||||
+ // Paper start - make MT safe
|
+ // Paper start - make MT safe
|
||||||
|
Class<?> cachedClass = classes.get(name);
|
||||||
|
+ if (cachedClass != null) {
|
||||||
|
+ return cachedClass;
|
||||||
|
+ }
|
||||||
+ java.util.concurrent.locks.ReentrantReadWriteLock lock;
|
+ java.util.concurrent.locks.ReentrantReadWriteLock lock;
|
||||||
+ synchronized (classLoadLock) {
|
+ synchronized (classLoadLock) {
|
||||||
+ lock = classLoadLock.computeIfAbsent(name, (x) -> new java.util.concurrent.locks.ReentrantReadWriteLock());
|
+ lock = classLoadLock.computeIfAbsent(name, (x) -> new java.util.concurrent.locks.ReentrantReadWriteLock());
|
||||||
+ classLoadLockCount.compute(name, (x, prev) -> prev != null ? prev + 1 : 1);
|
+ classLoadLockCount.compute(name, (x, prev) -> prev != null ? prev + 1 : 1);
|
||||||
+ }
|
+ }
|
||||||
+ lock.writeLock().lock();try {
|
+ lock.writeLock().lock();try {
|
||||||
|
+ cachedClass = classes.get(name);
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
for (PluginClassLoader loader : loaders) {
|
|
||||||
try {
|
if (cachedClass != null) {
|
||||||
return loader.loadClass0(name, resolve, false, ((SimplePluginManager) server.getPluginManager()).isTransitiveDepend(description, loader.plugin.getDescription()));
|
return cachedClass;
|
||||||
} catch (ClassNotFoundException cnfe) {
|
@@ -0,0 +0,0 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+ // Paper start - make MT safe
|
+ // Paper start - make MT safe
|
||||||
|
@@ -34,20 +34,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
final Server server;
|
final Server server;
|
||||||
+ private static final boolean DISABLE_CLASS_PRIORITIZATION = Boolean.getBoolean("Paper.DisableClassPrioritization"); // Paper
|
+ private static final boolean DISABLE_CLASS_PRIORITIZATION = Boolean.getBoolean("Paper.DisableClassPrioritization"); // Paper
|
||||||
private final Pattern[] fileFilters = new Pattern[]{Pattern.compile("\\.jar$")};
|
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, 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 {
|
@@ -0,0 +0,0 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
Class<?> getClassByName(final String name, boolean resolve, PluginDescriptionFile description) {
|
Class<?> getClassByName(final String name) {
|
||||||
+ // Paper start - prioritize self
|
+ // 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 end
|
||||||
// Paper start - make MT safe
|
// Paper start - make MT safe
|
||||||
java.util.concurrent.locks.ReentrantReadWriteLock lock;
|
Class<?> cachedClass = classes.get(name);
|
||||||
synchronized (classLoadLock) {
|
if (cachedClass != null) {
|
||||||
@@ -0,0 +0,0 @@ public final class JavaPluginLoader implements PluginLoader {
|
@@ -0,0 +0,0 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||||
classLoadLockCount.compute(name, (x, prev) -> prev != null ? prev + 1 : 1);
|
classLoadLockCount.compute(name, (x, prev) -> prev != null ? prev + 1 : 1);
|
||||||
}
|
}
|
||||||
@@ -55,23 +55,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ // Paper start - prioritize self
|
+ // Paper start - prioritize self
|
||||||
+ if (!DISABLE_CLASS_PRIORITIZATION && requester != null) {
|
+ if (!DISABLE_CLASS_PRIORITIZATION && requester != null) {
|
||||||
+ try {
|
+ try {
|
||||||
+ return requester.loadClass0(name, false, false, ((SimplePluginManager) server.getPluginManager()).isTransitiveDepend(description, requester.plugin.getDescription()));
|
+ cachedClass = requester.findClass(name, false);
|
||||||
+ } catch (ClassNotFoundException cnfe) {}
|
+ } catch (ClassNotFoundException cnfe) {}
|
||||||
|
+ if (cachedClass != null) {
|
||||||
|
+ return cachedClass;
|
||||||
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // 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
|
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
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
|
--- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
|
||||||
+++ b/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
|
@@ -0,0 +0,0 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot
|
||||||
}
|
|
||||||
|
|
||||||
if (checkGlobal) {
|
if (result == null) {
|
||||||
- Class<?> result = loader.getClassByName(name, resolve, description);
|
if (checkGlobal) {
|
||||||
+ Class<?> result = loader.getClassByName(name, resolve, description, this); // Paper - prioritize self
|
- result = loader.getClassByName(name);
|
||||||
|
+ result = loader.getClassByName(name, this); // Paper - prioritize self
|
||||||
|
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
PluginDescriptionFile provider = ((PluginClassLoader) result.getClassLoader()).description;
|
PluginDescriptionFile provider = ((PluginClassLoader) result.getClassLoader()).description;
|
||||||
|
@@ -3459,8 +3459,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||||
@@ -0,0 +0,0 @@ public final class JavaPluginLoader implements PluginLoader {
|
@@ -0,0 +0,0 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||||
private final Pattern[] fileFilters = new Pattern[]{Pattern.compile("\\.jar$")};
|
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 List<PluginClassLoader> loaders = new CopyOnWriteArrayList<PluginClassLoader>();
|
||||||
private final LibraryLoader libraryLoader;
|
|
||||||
- public static final CustomTimingsHandler pluginParentTimer = new CustomTimingsHandler("** Plugins"); // Spigot
|
- public static final CustomTimingsHandler pluginParentTimer = new CustomTimingsHandler("** Plugins"); // Spigot
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -18,3 +18,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
this.playSound(SoundEffects.ENTITY_ITEM_FRAME_ADD_ITEM, 1.0F, 1.0F);
|
this.playSound(SoundEffects.ENTITY_ITEM_FRAME_ADD_ITEM, 1.0F, 1.0F);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftItemFrame.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftItemFrame.java
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItemFrame.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftItemFrame.java
|
||||||
|
@@ -0,0 +0,0 @@ public class CraftItemFrame extends CraftHanging implements ItemFrame {
|
||||||
|
old.die();
|
||||||
|
|
||||||
|
EntityItemFrame frame = new EntityItemFrame(world, position, direction);
|
||||||
|
- frame.setItem(item);
|
||||||
|
+ frame.setItem(item, true, false); // Paper - fix itemframe sound
|
||||||
|
world.addEntity(frame);
|
||||||
|
this.entity = frame;
|
||||||
|
}
|
||||||
|
@@ -58,17 +58,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
- <artifactId>spigot-api</artifactId>
|
- <artifactId>spigot-api</artifactId>
|
||||||
+ <groupId>com.destroystokyo.paper</groupId>
|
+ <groupId>com.destroystokyo.paper</groupId>
|
||||||
+ <artifactId>paper-api</artifactId>
|
+ <artifactId>paper-api</artifactId>
|
||||||
+ <version>${project.version}</version>
|
|
||||||
+ <scope>compile</scope>
|
|
||||||
+ </dependency>
|
|
||||||
+ <dependency>
|
|
||||||
+ <groupId>com.destroystokyo.paper</groupId>
|
|
||||||
+ <artifactId>paper-mojangapi</artifactId>
|
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
- <groupId>org.spigotmc</groupId>
|
- <groupId>org.spigotmc</groupId>
|
||||||
|
+ <groupId>com.destroystokyo.paper</groupId>
|
||||||
|
+ <artifactId>paper-mojangapi</artifactId>
|
||||||
|
+ <version>${project.version}</version>
|
||||||
|
+ <scope>compile</scope>
|
||||||
|
+ </dependency>
|
||||||
|
+ <dependency>
|
||||||
+ <groupId>io.papermc</groupId>
|
+ <groupId>io.papermc</groupId>
|
||||||
<artifactId>minecraft-server</artifactId>
|
<artifactId>minecraft-server</artifactId>
|
||||||
<version>${minecraft.version}-SNAPSHOT</version>
|
<version>${minecraft.version}-SNAPSHOT</version>
|
||||||
@@ -123,7 +123,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ <version>8.0.23</version>
|
+ <version>8.0.23</version>
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- add these back in as they are not exposed by the API -->
|
<!-- testing -->
|
||||||
@@ -0,0 +0,0 @@
|
@@ -0,0 +0,0 @@
|
||||||
|
|
||||||
<!-- This builds a completely 'ready to start' jar with all dependencies inside -->
|
<!-- This builds a completely 'ready to start' jar with all dependencies inside -->
|
||||||
@@ -219,7 +219,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ <exclude>META-INF/org/apache/logging/log4j/core/config/plugins/Log4j2Plugins.dat</exclude>
|
+ <exclude>META-INF/org/apache/logging/log4j/core/config/plugins/Log4j2Plugins.dat</exclude>
|
||||||
</excludes>
|
</excludes>
|
||||||
</filter>
|
</filter>
|
||||||
<filter>
|
</filters>
|
||||||
@@ -0,0 +0,0 @@
|
@@ -0,0 +0,0 @@
|
||||||
<pattern>jline</pattern>
|
<pattern>jline</pattern>
|
||||||
<shadedPattern>org.bukkit.craftbukkit.libs.jline</shadedPattern>
|
<shadedPattern>org.bukkit.craftbukkit.libs.jline</shadedPattern>
|
||||||
|
Submodule work/Bukkit updated: 146a7e4bd7...b9ef9229d4
Submodule work/CraftBukkit updated: b1064c69c4...51e2981b5b
Submodule work/Spigot updated: 9fb885e86d...bd6b566898
Reference in New Issue
Block a user