13
0
geforkt von Mirrors/Paper

Revert "Updated Upstream (Bukkit/CraftBukkit/Spigot) (#5636)"

This reverts commit 11c2ef5d2f.
Dieser Commit ist enthalten in:
Shane Freeder 2021-05-15 22:10:57 +01:00
Ursprung 11c2ef5d2f
Commit b5488de2ba
11 geänderte Dateien mit 62 neuen und 40 gelöschten Zeilen

Datei anzeigen

@ -99,8 +99,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
static {
ClassLoader.registerAsParallelCapable();
@@ -0,0 +0,0 @@ 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
+

Datei anzeigen

@ -123,8 +123,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (plugin.isEnabled()) {
@@ -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
+ try {

Datei anzeigen

@ -27,4 +27,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper end
this.manifest = jar.getManifest();
this.url = file.toURI().toURL();
this.libraryLoader = libraryLoader;

Datei anzeigen

@ -8,31 +8,37 @@ diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/ma
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/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;
public final class JavaPluginLoader implements PluginLoader {
@@ -0,0 +0,0 @@ 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;
/**
@@ -0,0 +0,0 @@ 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;
@@ -0,0 +0,0 @@ public final class JavaPluginLoader implements PluginLoader {
}
}
}
+ // Paper start - make MT safe

Datei anzeigen

@ -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, 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) {
Class<?> cachedClass = classes.get(name);
if (cachedClass != null) {
@@ -0,0 +0,0 @@ public final class JavaPluginLoader implements PluginLoader {
classLoadLockCount.compute(name, (x, prev) -> prev != null ? prev + 1 : 1);
}
@ -55,23 +55,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // 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 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 (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;

Datei anzeigen

@ -3459,8 +3459,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
@@ -0,0 +0,0 @@ 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
/**

Datei anzeigen

@ -18,3 +18,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
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;
}

Datei anzeigen

@ -58,17 +58,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- <artifactId>spigot-api</artifactId>
+ <groupId>com.destroystokyo.paper</groupId>
+ <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>
<scope>compile</scope>
</dependency>
<dependency>
- <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>
<artifactId>minecraft-server</artifactId>
<version>${minecraft.version}-SNAPSHOT</version>
@ -123,7 +123,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ <version>8.0.23</version>
<scope>runtime</scope>
</dependency>
<!-- add these back in as they are not exposed by the API -->
<!-- testing -->
@@ -0,0 +0,0 @@
<!-- 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>
</excludes>
</filter>
<filter>
</filters>
@@ -0,0 +0,0 @@
<pattern>jline</pattern>
<shadedPattern>org.bukkit.craftbukkit.libs.jline</shadedPattern>

@ -1 +1 @@
Subproject commit 146a7e4bd764990c56bb326643e92eb69f24d27e
Subproject commit b9ef9229d4c10b4068d9fbdce8845cfd4a9f8fc5

@ -1 +1 @@
Subproject commit b1064c69c444b9447a65ad36b6cff39d9e052263
Subproject commit 51e2981b5ba4910e93f87bbf95e111e78ad6f9f3

@ -1 +1 @@
Subproject commit 9fb885e86def1d9d86e25233c9b5a4de45b7a09d
Subproject commit bd6b56689828d8bb08f6b5f46935162f9cc43d87