diff --git a/LICENSE.md b/LICENSE.md index 6a10bab905..a191154cc1 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -54,4 +54,5 @@ vytskalt TheFruxz Kieran Wallbanks Denery +Jakubk15 ``` diff --git a/build.gradle.kts b/build.gradle.kts index faed50c617..8125f5c25f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -5,7 +5,7 @@ plugins { java `maven-publish` id("com.github.johnrengelman.shadow") version "7.1.2" apply false - id("io.papermc.paperweight.core") version "1.4.1" + id("io.papermc.paperweight.core") version "1.5.1" } allprojects { diff --git a/patches/api/0003-Annotation-Test-changes.patch b/patches/api/0003-Annotation-Test-changes.patch deleted file mode 100644 index 404635ede1..0000000000 --- a/patches/api/0003-Annotation-Test-changes.patch +++ /dev/null @@ -1,114 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Shane Freeder -Date: Sun, 17 Mar 2019 23:04:30 +0000 -Subject: [PATCH] Annotation Test changes - -- Allow use of TYPE_USE annotations -- Ignore package-private methods for nullability annotations -- Add excludes for classes which don't pass - -diff --git a/src/test/java/org/bukkit/AnnotationTest.java b/src/test/java/org/bukkit/AnnotationTest.java -index 4ac3dd977e75cd8464163351d306e037ee32cb48..1a71bb8861150c1add6446aa2fad0f7035dd6873 100644 ---- a/src/test/java/org/bukkit/AnnotationTest.java -+++ b/src/test/java/org/bukkit/AnnotationTest.java -@@ -40,7 +40,17 @@ public class AnnotationTest { - "org/bukkit/util/io/Wrapper", - "org/bukkit/plugin/java/PluginClassLoader", - // Generic functional interface -- "org/bukkit/util/Consumer" -+ "org/bukkit/util/Consumer", -+ // Paper start -+ // Timings history is broken in terms of nullability due to guavas Function defining that the param is NonNull -+ "co/aikar/timings/TimingHistory$2", -+ "co/aikar/timings/TimingHistory$2$1", -+ "co/aikar/timings/TimingHistory$2$1$1", -+ "co/aikar/timings/TimingHistory$2$1$2", -+ "co/aikar/timings/TimingHistory$3", -+ "co/aikar/timings/TimingHistory$4", -+ "co/aikar/timings/TimingHistoryEntry$1" -+ // Paper end - }; - - @Test -@@ -67,14 +77,40 @@ public class AnnotationTest { - } - - if (mustBeAnnotated(Type.getReturnType(method.desc)) && !isWellAnnotated(method.invisibleAnnotations)) { -+ // Paper start - Allow use of TYPE_USE annotations -+ boolean warn = true; -+ if (isWellAnnotated(method.visibleTypeAnnotations)) { -+ warn = false; -+ } else if (method.invisibleTypeAnnotations != null) { -+ dance: for (final org.objectweb.asm.tree.TypeAnnotationNode invisibleTypeAnnotation : method.invisibleTypeAnnotations) { -+ final org.objectweb.asm.TypeReference ref = new org.objectweb.asm.TypeReference(invisibleTypeAnnotation.typeRef); -+ if (ref.getSort() == org.objectweb.asm.TypeReference.METHOD_RETURN && java.util.Arrays.binarySearch(ACCEPTED_ANNOTATIONS, invisibleTypeAnnotation.desc) >= 0) { -+ warn = false; -+ break dance; // cha cha real smooth -+ } -+ } -+ } -+ if (warn) -+ // Paper end - warn(errors, clazz, method, "return value"); - } - - Type[] paramTypes = Type.getArgumentTypes(method.desc); - List parameters = method.parameters; - -+ dancing: // Paper - for (int i = 0; i < paramTypes.length; i++) { - if (mustBeAnnotated(paramTypes[i]) ^ isWellAnnotated(method.invisibleParameterAnnotations == null ? null : method.invisibleParameterAnnotations[i])) { -+ // Paper start -+ if (method.invisibleTypeAnnotations != null) { -+ for (final org.objectweb.asm.tree.TypeAnnotationNode invisibleTypeAnnotation : method.invisibleTypeAnnotations) { -+ final org.objectweb.asm.TypeReference ref = new org.objectweb.asm.TypeReference(invisibleTypeAnnotation.typeRef); -+ if (ref.getSort() == org.objectweb.asm.TypeReference.METHOD_FORMAL_PARAMETER && ref.getTypeParameterIndex() == i && java.util.Arrays.binarySearch(ACCEPTED_ANNOTATIONS, invisibleTypeAnnotation.desc) >= 0) { -+ continue dancing; -+ } -+ } -+ } -+ // Paper end - Allow use of TYPE_USE annotations - ParameterNode paramNode = parameters == null ? null : parameters.get(i); - String paramName = paramNode == null ? null : paramNode.name; - -@@ -91,13 +127,18 @@ public class AnnotationTest { - - Collections.sort(errors); - -- System.out.println(errors.size() + " missing annotation(s):"); -+ StringBuilder builder = new StringBuilder() -+ .append("There ") -+ .append(errors.size() != 1 ? "are " : "is ") -+ .append(errors.size()) -+ .append(" missing annotation") -+ .append(errors.size() != 1 ? "s:\n" : ":\n"); -+ - for (String message : errors) { -- System.out.print("\t"); -- System.out.println(message); -+ builder.append("\t").append(message).append("\n"); - } - -- Assert.fail("There " + errors.size() + " are missing annotation(s)"); -+ Assert.fail(builder.toString()); - } - - private static void collectClasses(@NotNull File from, @NotNull Map to) throws IOException { -@@ -152,7 +193,7 @@ public class AnnotationTest { - - private static boolean isMethodIncluded(@NotNull ClassNode clazz, @NotNull MethodNode method, @NotNull Map allClasses) { - // Exclude private, synthetic and deprecated methods -- if ((method.access & (Opcodes.ACC_PRIVATE | Opcodes.ACC_SYNTHETIC | Opcodes.ACC_DEPRECATED)) != 0) { -+ if ((method.access & (Opcodes.ACC_PRIVATE | Opcodes.ACC_SYNTHETIC | Opcodes.ACC_DEPRECATED)) != 0 || (method.access & (Opcodes.ACC_PRIVATE | Opcodes.ACC_PROTECTED | Opcodes.ACC_PUBLIC)) == 0) { // Paper - ignore package-private - return false; - } - -@@ -174,7 +215,7 @@ public class AnnotationTest { - return true; - } - -- private static boolean isWellAnnotated(@Nullable List annotations) { -+ private static boolean isWellAnnotated(@Nullable List annotations) { // Paper - if (annotations == null) { - return false; - } diff --git a/patches/api/0003-Test-changes.patch b/patches/api/0003-Test-changes.patch new file mode 100644 index 0000000000..ade12ea30c --- /dev/null +++ b/patches/api/0003-Test-changes.patch @@ -0,0 +1,513 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Shane Freeder +Date: Sun, 17 Mar 2019 23:04:30 +0000 +Subject: [PATCH] Test changes + +- convert to mockito for mocking of types +- Allow use of TYPE_USE annotations +- Ignore package-private methods for nullability annotations +- Add excludes for classes which don't pass + +Co-authored-by: Jake Potrebic + +diff --git a/build.gradle.kts b/build.gradle.kts +index 2b3288057d67e5add4e22e6b7072527057bcd808..4b3453f8dab6008b6fad6245fb7205da33b4bfb8 100644 +--- a/build.gradle.kts ++++ b/build.gradle.kts +@@ -34,6 +34,7 @@ dependencies { + compileOnlyApi(checkerQual) + testCompileOnly(checkerQual) + // Paper end ++ testImplementation("org.mockito:mockito-core:4.9.0") // Paper - add mockito + + testImplementation("org.apache.commons:commons-lang3:3.12.0") + testImplementation("junit:junit:4.13.2") +diff --git a/src/test/java/io/papermc/paper/testing/EmptyRegistry.java b/src/test/java/io/papermc/paper/testing/EmptyRegistry.java +new file mode 100644 +index 0000000000000000000000000000000000000000..ba9ddce87a9f385e729a5c2cf7c5eec120e388a7 +--- /dev/null ++++ b/src/test/java/io/papermc/paper/testing/EmptyRegistry.java +@@ -0,0 +1,23 @@ ++package io.papermc.paper.testing; ++ ++import java.util.Collections; ++import java.util.Iterator; ++import org.bukkit.Keyed; ++import org.bukkit.NamespacedKey; ++import org.bukkit.Registry; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; ++ ++public record EmptyRegistry() implements Registry { ++ ++ @NotNull ++ @Override ++ public Iterator iterator() { ++ return Collections.emptyIterator(); ++ } ++ ++ @Override ++ public @Nullable Keyed get(@NotNull final NamespacedKey key) { ++ return null; ++ } ++} +diff --git a/src/test/java/io/papermc/paper/testing/EmptyTag.java b/src/test/java/io/papermc/paper/testing/EmptyTag.java +new file mode 100644 +index 0000000000000000000000000000000000000000..77154095cfb8b259bdb318e8ff40cb6f559ebc18 +--- /dev/null ++++ b/src/test/java/io/papermc/paper/testing/EmptyTag.java +@@ -0,0 +1,31 @@ ++package io.papermc.paper.testing; ++ ++import java.util.Collections; ++import java.util.Set; ++import org.bukkit.Keyed; ++import org.bukkit.NamespacedKey; ++import org.bukkit.Tag; ++import org.jetbrains.annotations.NotNull; ++ ++public record EmptyTag(NamespacedKey key) implements Tag { ++ ++ @SuppressWarnings("deprecation") ++ public EmptyTag() { ++ this(NamespacedKey.randomKey()); ++ } ++ ++ @Override ++ public @NotNull NamespacedKey getKey() { ++ return this.key; ++ } ++ ++ @Override ++ public boolean isTagged(@NotNull final Keyed item) { ++ return false; ++ } ++ ++ @Override ++ public @NotNull Set getValues() { ++ return Collections.emptySet(); ++ } ++} +diff --git a/src/test/java/io/papermc/paper/testing/TestServer.java b/src/test/java/io/papermc/paper/testing/TestServer.java +new file mode 100644 +index 0000000000000000000000000000000000000000..756acf231b1b076b08046d86992ba7ce7f62a94f +--- /dev/null ++++ b/src/test/java/io/papermc/paper/testing/TestServer.java +@@ -0,0 +1,48 @@ ++package io.papermc.paper.testing; ++ ++import java.util.logging.Logger; ++import org.bukkit.Bukkit; ++import org.bukkit.NamespacedKey; ++import org.bukkit.Server; ++import org.bukkit.command.SimpleCommandMap; ++import org.bukkit.plugin.PluginManager; ++import org.bukkit.plugin.SimplePluginManager; ++ ++import static org.mockito.ArgumentMatchers.anyString; ++import static org.mockito.Mockito.any; ++import static org.mockito.Mockito.mock; ++import static org.mockito.Mockito.when; ++ ++public final class TestServer { ++ ++ @SuppressWarnings("removal") ++ public static void setup() { ++ //noinspection ConstantValue ++ if (Bukkit.getServer() != null) { ++ return; ++ } ++ ++ final Server dummyServer = mock(Server.class); ++ ++ final Logger logger = Logger.getLogger(TestServer.class.getCanonicalName()); ++ when(dummyServer.getLogger()).thenReturn(logger); ++ when(dummyServer.getName()).thenReturn(TestServer.class.getSimpleName()); ++ when(dummyServer.getVersion()).thenReturn("Version_" + TestServer.class.getPackage().getImplementationVersion()); ++ when(dummyServer.getBukkitVersion()).thenReturn("BukkitVersion_" + TestServer.class.getPackage().getImplementationVersion()); ++ ++ ++ final Thread currentThread = Thread.currentThread(); ++ when(dummyServer.isPrimaryThread()).thenAnswer(ignored -> Thread.currentThread().equals(currentThread)); ++ ++ when(dummyServer.getTag(anyString(), any(NamespacedKey.class), any())).thenAnswer(ignored -> new EmptyTag()); ++ ++ final PluginManager pluginManager = new SimplePluginManager(dummyServer, new SimpleCommandMap(dummyServer)); ++ when(dummyServer.getPluginManager()).thenReturn(pluginManager); ++ ++ when(dummyServer.getRegistry(any())).thenAnswer(ignored -> new EmptyRegistry()); ++ when(dummyServer.getScoreboardCriteria(anyString())).thenReturn(null); ++ ++ Bukkit.setServer(dummyServer); ++ } ++ ++} +diff --git a/src/test/java/org/bukkit/AnnotationTest.java b/src/test/java/org/bukkit/AnnotationTest.java +index 4ac3dd977e75cd8464163351d306e037ee32cb48..8f35cda0d67ec66646c6096a5bf1c84891b8b0fd 100644 +--- a/src/test/java/org/bukkit/AnnotationTest.java ++++ b/src/test/java/org/bukkit/AnnotationTest.java +@@ -40,7 +40,17 @@ public class AnnotationTest { + "org/bukkit/util/io/Wrapper", + "org/bukkit/plugin/java/PluginClassLoader", + // Generic functional interface +- "org/bukkit/util/Consumer" ++ "org/bukkit/util/Consumer", ++ // Paper start ++ // Timings history is broken in terms of nullability due to guavas Function defining that the param is NonNull ++ "co/aikar/timings/TimingHistory$2", ++ "co/aikar/timings/TimingHistory$2$1", ++ "co/aikar/timings/TimingHistory$2$1$1", ++ "co/aikar/timings/TimingHistory$2$1$2", ++ "co/aikar/timings/TimingHistory$3", ++ "co/aikar/timings/TimingHistory$4", ++ "co/aikar/timings/TimingHistoryEntry$1" ++ // Paper end + }; + + @Test +@@ -67,14 +77,40 @@ public class AnnotationTest { + } + + if (mustBeAnnotated(Type.getReturnType(method.desc)) && !isWellAnnotated(method.invisibleAnnotations)) { ++ // Paper start - Allow use of TYPE_USE annotations ++ boolean warn = true; ++ if (isWellAnnotated(method.visibleTypeAnnotations)) { ++ warn = false; ++ } else if (method.invisibleTypeAnnotations != null) { ++ dance: for (final org.objectweb.asm.tree.TypeAnnotationNode invisibleTypeAnnotation : method.invisibleTypeAnnotations) { ++ final org.objectweb.asm.TypeReference ref = new org.objectweb.asm.TypeReference(invisibleTypeAnnotation.typeRef); ++ if (ref.getSort() == org.objectweb.asm.TypeReference.METHOD_RETURN && java.util.Arrays.binarySearch(ACCEPTED_ANNOTATIONS, invisibleTypeAnnotation.desc) >= 0) { ++ warn = false; ++ break dance; // cha cha real smooth ++ } ++ } ++ } ++ if (warn) ++ // Paper end + warn(errors, clazz, method, "return value"); + } + + Type[] paramTypes = Type.getArgumentTypes(method.desc); + List parameters = method.parameters; + ++ dancing: // Paper + for (int i = 0; i < paramTypes.length; i++) { + if (mustBeAnnotated(paramTypes[i]) ^ isWellAnnotated(method.invisibleParameterAnnotations == null ? null : method.invisibleParameterAnnotations[i])) { ++ // Paper start ++ if (method.invisibleTypeAnnotations != null) { ++ for (final org.objectweb.asm.tree.TypeAnnotationNode invisibleTypeAnnotation : method.invisibleTypeAnnotations) { ++ final org.objectweb.asm.TypeReference ref = new org.objectweb.asm.TypeReference(invisibleTypeAnnotation.typeRef); ++ if (ref.getSort() == org.objectweb.asm.TypeReference.METHOD_FORMAL_PARAMETER && ref.getTypeParameterIndex() == i && java.util.Arrays.binarySearch(ACCEPTED_ANNOTATIONS, invisibleTypeAnnotation.desc) >= 0) { ++ continue dancing; ++ } ++ } ++ } ++ // Paper end - Allow use of TYPE_USE annotations + ParameterNode paramNode = parameters == null ? null : parameters.get(i); + String paramName = paramNode == null ? null : paramNode.name; + +@@ -91,13 +127,18 @@ public class AnnotationTest { + + Collections.sort(errors); + +- System.out.println(errors.size() + " missing annotation(s):"); ++ StringBuilder builder = new StringBuilder() ++ .append("There ") ++ .append(errors.size() != 1 ? "are " : "is ") ++ .append(errors.size()) ++ .append(" missing annotation") ++ .append(errors.size() != 1 ? "s:\n" : ":\n"); ++ + for (String message : errors) { +- System.out.print("\t"); +- System.out.println(message); ++ builder.append("\t").append(message).append("\n"); + } + +- Assert.fail("There " + errors.size() + " are missing annotation(s)"); ++ Assert.fail(builder.toString()); + } + + private static void collectClasses(@NotNull File from, @NotNull Map to) throws IOException { +@@ -140,6 +181,11 @@ public class AnnotationTest { + // Exceptions are excluded + return false; + } ++ // Paper start ++ if (isInternal(clazz.invisibleAnnotations)) { ++ return false; ++ } ++ // Paper end + + for (String excludedClass : EXCLUDED_CLASSES) { + if (excludedClass.equals(clazz.name)) { +@@ -152,7 +198,7 @@ public class AnnotationTest { + + private static boolean isMethodIncluded(@NotNull ClassNode clazz, @NotNull MethodNode method, @NotNull Map allClasses) { + // Exclude private, synthetic and deprecated methods +- if ((method.access & (Opcodes.ACC_PRIVATE | Opcodes.ACC_SYNTHETIC | Opcodes.ACC_DEPRECATED)) != 0) { ++ if ((method.access & (Opcodes.ACC_PRIVATE | Opcodes.ACC_SYNTHETIC | Opcodes.ACC_DEPRECATED)) != 0 || (method.access & (Opcodes.ACC_PRIVATE | Opcodes.ACC_PROTECTED | Opcodes.ACC_PUBLIC)) == 0) { // Paper - ignore package-private + return false; + } + +@@ -170,11 +216,30 @@ public class AnnotationTest { + if ("".equals(method.name) && isAnonymous(clazz)) { + return false; + } ++ // Paper start ++ if (isInternal(method.invisibleAnnotations)) { ++ return false; ++ } ++ // Paper end + + return true; + } ++ // Paper start ++ private static boolean isInternal(List annotations) { ++ if (annotations == null) { ++ return false; ++ } ++ for (AnnotationNode node : annotations) { ++ if (node.desc.equals("Lorg/jetbrains/annotations/ApiStatus$Internal;")) { ++ return true; ++ } ++ } ++ ++ return false; ++ } ++ // Paper end + +- private static boolean isWellAnnotated(@Nullable List annotations) { ++ private static boolean isWellAnnotated(@Nullable List annotations) { // Paper + if (annotations == null) { + return false; + } +diff --git a/src/test/java/org/bukkit/TestServer.java b/src/test/java/org/bukkit/TestServer.java +deleted file mode 100644 +index 701a17c10f31cd345238a3c568264178ce372faa..0000000000000000000000000000000000000000 +--- a/src/test/java/org/bukkit/TestServer.java ++++ /dev/null +@@ -1,139 +0,0 @@ +-package org.bukkit; +- +-import com.google.common.collect.ImmutableMap; +-import java.lang.reflect.InvocationHandler; +-import java.lang.reflect.Method; +-import java.lang.reflect.Proxy; +-import java.util.Iterator; +-import java.util.Map; +-import java.util.logging.Logger; +-import org.bukkit.command.SimpleCommandMap; +-import org.bukkit.plugin.PluginManager; +-import org.bukkit.plugin.SimplePluginManager; +-import org.jetbrains.annotations.NotNull; +-import org.jetbrains.annotations.Nullable; +- +-public final class TestServer implements InvocationHandler { +- private static interface MethodHandler { +- Object handle(TestServer server, Object[] args); +- } +- +- private static final Map methods; +- +- static { +- try { +- ImmutableMap.Builder methodMap = ImmutableMap.builder(); +- methodMap.put( +- Server.class.getMethod("isPrimaryThread"), +- new MethodHandler() { +- @Override +- public Object handle(TestServer server, Object[] args) { +- return Thread.currentThread().equals(server.creatingThread); +- } +- } +- ); +- methodMap.put( +- Server.class.getMethod("getPluginManager"), +- new MethodHandler() { +- @Override +- public Object handle(TestServer server, Object[] args) { +- return server.pluginManager; +- } +- } +- ); +- methodMap.put( +- Server.class.getMethod("getLogger"), +- new MethodHandler() { +- final Logger logger = Logger.getLogger(TestServer.class.getCanonicalName()); +- @Override +- public Object handle(TestServer server, Object[] args) { +- return logger; +- } +- } +- ); +- methodMap.put( +- Server.class.getMethod("getName"), +- new MethodHandler() { +- @Override +- public Object handle(TestServer server, Object[] args) { +- return TestServer.class.getSimpleName(); +- } +- } +- ); +- methodMap.put( +- Server.class.getMethod("getVersion"), +- new MethodHandler() { +- @Override +- public Object handle(TestServer server, Object[] args) { +- return "Version_" + TestServer.class.getPackage().getImplementationVersion(); +- } +- } +- ); +- methodMap.put( +- Server.class.getMethod("getBukkitVersion"), +- new MethodHandler() { +- @Override +- public Object handle(TestServer server, Object[] args) { +- return "BukkitVersion_" + TestServer.class.getPackage().getImplementationVersion(); +- } +- } +- ); +- methodMap.put( +- Server.class.getMethod("getRegistry", Class.class), +- new MethodHandler() { +- @Override +- public Object handle(TestServer server, Object[] args) { +- return new Registry() { +- @NotNull +- @Override +- public Iterator iterator() { +- return null; +- } +- +- @Nullable +- @Override +- public Keyed get(@NotNull NamespacedKey key) { +- return null; +- } +- }; +- } +- } +- ); +- methodMap.put( +- Server.class.getMethod("getScoreboardCriteria", String.class), +- new MethodHandler() { +- @Override +- public Object handle(TestServer server, Object[] args) { +- // Does not need to return anything. Exists solely to test CriteriaTest which has static init fields +- return null; +- } +- } +- ); +- methods = methodMap.build(); +- +- TestServer server = new TestServer(); +- Server instance = Proxy.getProxyClass(Server.class.getClassLoader(), Server.class).asSubclass(Server.class).getConstructor(InvocationHandler.class).newInstance(server); +- Bukkit.setServer(instance); +- server.pluginManager = new SimplePluginManager(instance, new SimpleCommandMap(instance)); +- } catch (Throwable t) { +- throw new Error(t); +- } +- } +- +- private Thread creatingThread = Thread.currentThread(); +- private PluginManager pluginManager; +- private TestServer() {}; +- +- public static Server getInstance() { +- return Bukkit.getServer(); +- } +- +- @Override +- public Object invoke(Object proxy, Method method, Object[] args) { +- MethodHandler handler = methods.get(method); +- if (handler != null) { +- return handler.handle(this, args); +- } +- throw new UnsupportedOperationException(String.valueOf(method)); +- } +-} +diff --git a/src/test/java/org/bukkit/TestWorld.java b/src/test/java/org/bukkit/TestWorld.java +index ab34f1199921d415fa2ca6e281a8125c9e6d7173..f64d024f5bbf9482aaddb56597b23b04c66f21bf 100644 +--- a/src/test/java/org/bukkit/TestWorld.java ++++ b/src/test/java/org/bukkit/TestWorld.java +@@ -18,7 +18,7 @@ public final class TestWorld implements InvocationHandler { + + static { + try { +- TestServer.getInstance(); ++ io.papermc.paper.testing.TestServer.setup(); // Paper + + ImmutableMap.Builder methodMap = ImmutableMap.builder(); + methodMap.put( +diff --git a/src/test/java/org/bukkit/event/SyntheticEventTest.java b/src/test/java/org/bukkit/event/SyntheticEventTest.java +index d402cb59f508205ebe9ee450594826b04cecb90b..09886568ae6167141b463b6262565fa212af3385 100644 +--- a/src/test/java/org/bukkit/event/SyntheticEventTest.java ++++ b/src/test/java/org/bukkit/event/SyntheticEventTest.java +@@ -1,6 +1,5 @@ + package org.bukkit.event; + +-import org.bukkit.TestServer; + import org.bukkit.plugin.PluginLoader; + import org.bukkit.plugin.SimplePluginManager; + import org.bukkit.plugin.TestPlugin; +@@ -12,14 +11,15 @@ public class SyntheticEventTest { + @SuppressWarnings("deprecation") + @Test + public void test() { +- final JavaPluginLoader loader = new JavaPluginLoader(TestServer.getInstance()); ++ io.papermc.paper.testing.TestServer.setup(); // Paper ++ final JavaPluginLoader loader = new JavaPluginLoader(org.bukkit.Bukkit.getServer()); // Paper + TestPlugin plugin = new TestPlugin(getClass().getName()) { + @Override + public PluginLoader getPluginLoader() { + return loader; + } + }; +- SimplePluginManager pluginManager = new SimplePluginManager(TestServer.getInstance(), null); ++ SimplePluginManager pluginManager = new SimplePluginManager(org.bukkit.Bukkit.getServer(), null); // Paper + + TestEvent event = new TestEvent(false); + Impl impl = new Impl(); +diff --git a/src/test/java/org/bukkit/plugin/PluginManagerTest.java b/src/test/java/org/bukkit/plugin/PluginManagerTest.java +index f188cd4f3b07027c30d41f1162db77a506b7b6bb..c46ed2acb82db814d660459b705dd49e6d44240f 100644 +--- a/src/test/java/org/bukkit/plugin/PluginManagerTest.java ++++ b/src/test/java/org/bukkit/plugin/PluginManagerTest.java +@@ -2,7 +2,6 @@ package org.bukkit.plugin; + + import static org.hamcrest.Matchers.*; + import static org.junit.Assert.*; +-import org.bukkit.TestServer; + import org.bukkit.event.Event; + import org.bukkit.event.TestEvent; + import org.bukkit.permissions.Permission; +@@ -14,7 +13,7 @@ public class PluginManagerTest { + volatile Object value = null; + } + +- private static final PluginManager pm = TestServer.getInstance().getPluginManager(); ++ private static final PluginManager pm = org.bukkit.Bukkit.getServer().getPluginManager(); // Paper + + private final MutableObject store = new MutableObject(); + +diff --git a/src/test/java/org/bukkit/scoreboard/CriteriaTest.java b/src/test/java/org/bukkit/scoreboard/CriteriaTest.java +index eb94b6f4d58cd9f66b07791c57af7e359992e28c..a93f28e2f987a36e2c7e4f7d31506b750bdb222b 100644 +--- a/src/test/java/org/bukkit/scoreboard/CriteriaTest.java ++++ b/src/test/java/org/bukkit/scoreboard/CriteriaTest.java +@@ -2,7 +2,6 @@ package org.bukkit.scoreboard; + + import org.bukkit.Material; + import org.bukkit.Statistic; +-import org.bukkit.TestServer; + import org.bukkit.entity.EntityType; + import org.junit.Assert; + import org.junit.Test; +@@ -11,7 +10,7 @@ public class CriteriaTest { + + @Test + public void testStatistic() { +- TestServer.getInstance(); ++ io.papermc.paper.testing.TestServer.setup(); // Paper + + Assert.assertThrows(IllegalArgumentException.class, () -> Criteria.statistic(Statistic.AVIATE_ONE_CM, Material.STONE)); // Generic statistic with block + Assert.assertThrows(IllegalArgumentException.class, () -> Criteria.statistic(Statistic.AVIATE_ONE_CM, EntityType.CREEPER)); // Generic statistic with entity type diff --git a/patches/api/0005-Adventure.patch b/patches/api/0005-Adventure.patch index 169e054512..ad99c9b606 100644 --- a/patches/api/0005-Adventure.patch +++ b/patches/api/0005-Adventure.patch @@ -7,7 +7,7 @@ Co-authored-by: zml Co-authored-by: Jake Potrebic diff --git a/build.gradle.kts b/build.gradle.kts -index c2928c6f2d54de0ffde164fd9407085cf9fa18a6..c9f9174a085174b96897c013e0ecb79738c2e9e3 100644 +index d217f708b5bc57e402f4c2179ae3aea555b40f92..558fa62d87af1103efa703ef9114481cb928cf8d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,17 +8,37 @@ java { @@ -49,7 +49,7 @@ index c2928c6f2d54de0ffde164fd9407085cf9fa18a6..c9f9174a085174b96897c013e0ecb797 // Paper end compileOnly("org.apache.maven:maven-resolver-provider:3.8.5") -@@ -78,9 +98,24 @@ tasks.withType { +@@ -79,9 +99,24 @@ tasks.withType { "https://guava.dev/releases/31.0.1-jre/api/docs/", "https://javadoc.io/doc/org.yaml/snakeyaml/1.33/", "https://javadoc.io/doc/org.jetbrains/annotations/23.0.0/", // Paper - we don't want Java 5 annotations @@ -1048,10 +1048,10 @@ index fee814e01a653d2b53c56e8b566383ca44aa5346..b71b780792b672b37c8fe65d43489b86 public void setCustomName(@Nullable String name); } diff --git a/src/main/java/org/bukkit/NamespacedKey.java b/src/main/java/org/bukkit/NamespacedKey.java -index 803fa0019869127ee8c7e4fb1777a59c43e66f8a..c65f0d6569c130b4920a9e71ad24af6427f1f030 100644 +index c559f38fdb92cfee9f2e0ffb7088d1cf74a7f73d..f4540ceee4937a496a10a08429093adf8ae2cfc0 100644 --- a/src/main/java/org/bukkit/NamespacedKey.java +++ b/src/main/java/org/bukkit/NamespacedKey.java -@@ -19,7 +19,7 @@ import org.jetbrains.annotations.Nullable; +@@ -18,7 +18,7 @@ import org.jetbrains.annotations.Nullable; * underscores, hyphens, and forward slashes. * */ @@ -1060,7 +1060,7 @@ index 803fa0019869127ee8c7e4fb1777a59c43e66f8a..c65f0d6569c130b4920a9e71ad24af64 /** * The namespace representing all inbuilt keys. -@@ -212,4 +212,24 @@ public final class NamespacedKey { +@@ -246,4 +246,24 @@ public final class NamespacedKey { public static NamespacedKey fromString(@NotNull String key) { return fromString(key, null); } @@ -1384,10 +1384,10 @@ index ac5e263d737973af077e3406a84a84baca4370db..2d91924b7f5ef16a91d40cdc1bfc3d68 + // Paper end } diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index 01e11f882abb6c631f810584aa23646042688435..4f339debf113d103ffe0b5fdb03dfc82eafd1bd5 100644 +index ba69db36a2a7640fc2a63a1d9fd1b204e00d7ce7..876072a6c91bd02c9c7de53556419b8e1ac48f27 100644 --- a/src/main/java/org/bukkit/UnsafeValues.java +++ b/src/main/java/org/bukkit/UnsafeValues.java -@@ -22,6 +22,15 @@ import org.bukkit.plugin.PluginDescriptionFile; +@@ -23,6 +23,15 @@ import org.bukkit.plugin.PluginDescriptionFile; */ @Deprecated public interface UnsafeValues { @@ -1416,7 +1416,7 @@ index efb97712cc9dc7c1e12a59f5b94e4f2ad7c6b7d8..3024468af4c073324e536c1cb26beffb return warning == null || warning.value(); } diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 3a5251cb3b45f50d1ea4ab2c9b430e990cdfc8d5..425cad3b6c365560f6614767d763ad61a92e6722 100644 +index 98b9818fa10be7a36e862b3afafc9ed2d0a64209..ed57cd69d88504b78782271c9a3d423a29471674 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -43,7 +43,7 @@ import org.jetbrains.annotations.Nullable; @@ -1561,20 +1561,19 @@ index ab6b0ec328e94bf65a0dafd0403e5ee3b870296c..c8d37184d8e882a4084a1bfef85faa33 /** diff --git a/src/main/java/org/bukkit/command/Command.java b/src/main/java/org/bukkit/command/Command.java -index 80209bb88a0294d4eedc78509533a6257315d856..57ade3963faae3724d9a01eeeb6d02168acb567e 100644 +index 80209bb88a0294d4eedc78509533a6257315d856..caa29be46e8541b69ec47c181eb3320d6515b544 100644 --- a/src/main/java/org/bukkit/command/Command.java +++ b/src/main/java/org/bukkit/command/Command.java -@@ -32,8 +32,7 @@ public abstract class Command { +@@ -32,7 +32,7 @@ public abstract class Command { protected String description; protected String usageMessage; private String permission; - private String permissionMessage; -- public org.spigotmc.CustomTimingsHandler timings; // Spigot + private net.kyori.adventure.text.Component permissionMessage; // Paper + public org.spigotmc.CustomTimingsHandler timings; // Spigot protected Command(@NotNull String name) { - this(name, "", "/" + name, new ArrayList()); -@@ -186,10 +185,10 @@ public abstract class Command { +@@ -186,10 +186,10 @@ public abstract class Command { if (permissionMessage == null) { target.sendMessage(ChatColor.RED + "I'm sorry, but you do not have permission to perform this command. Please contact the server administrators if you believe that this is a mistake."); @@ -1589,7 +1588,7 @@ index 80209bb88a0294d4eedc78509533a6257315d856..57ade3963faae3724d9a01eeeb6d0216 } return false; -@@ -317,10 +316,12 @@ public abstract class Command { +@@ -317,10 +317,12 @@ public abstract class Command { * command * * @return Permission check failed message @@ -1603,7 +1602,7 @@ index 80209bb88a0294d4eedc78509533a6257315d856..57ade3963faae3724d9a01eeeb6d0216 } /** -@@ -381,10 +382,12 @@ public abstract class Command { +@@ -381,10 +383,12 @@ public abstract class Command { * @param permissionMessage new permission message, null to indicate * default message, or an empty string to indicate no message * @return this command object, for chaining @@ -1617,7 +1616,7 @@ index 80209bb88a0294d4eedc78509533a6257315d856..57ade3963faae3724d9a01eeeb6d0216 return this; } -@@ -399,13 +402,47 @@ public abstract class Command { +@@ -399,13 +403,47 @@ public abstract class Command { this.usageMessage = (usage == null) ? "" : usage; return this; } @@ -1666,7 +1665,7 @@ index 80209bb88a0294d4eedc78509533a6257315d856..57ade3963faae3724d9a01eeeb6d0216 if (source instanceof BlockCommandSender) { BlockCommandSender blockCommandSender = (BlockCommandSender) source; -@@ -424,7 +461,12 @@ public abstract class Command { +@@ -424,7 +462,12 @@ public abstract class Command { } Set users = Bukkit.getPluginManager().getPermissionSubscriptions(Server.BROADCAST_CHANNEL_ADMINISTRATIVE); @@ -1921,7 +1920,7 @@ index 8489a0b009223b727b0393840374550a1cc192ff..bdcf5219ff1e4d4c0dc8a3423bc17b45 + // Paper end } diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index a060b8b022c600e43aaef79a2942a384d47b300d..5a2c072c95cad8485e281e080e5e606194b05b30 100644 +index 74152aa68883973c896c35f538c402fce377144b..4053c086a9ef9aa071402818672643bd800851d6 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java @@ -39,7 +39,28 @@ import org.jetbrains.annotations.Nullable; @@ -2099,7 +2098,7 @@ index a060b8b022c600e43aaef79a2942a384d47b300d..5a2c072c95cad8485e281e080e5e6061 /** * Says a message (or runs a command). * -@@ -538,6 +624,90 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -563,6 +649,90 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM */ public void sendEquipmentChange(@NotNull LivingEntity entity, @NotNull EquipmentSlot slot, @NotNull ItemStack item); @@ -2190,7 +2189,7 @@ index a060b8b022c600e43aaef79a2942a384d47b300d..5a2c072c95cad8485e281e080e5e6061 /** * Send a sign change. This fakes a sign change packet for a user at * a certain location. This will not actually change the world in any way. -@@ -552,7 +722,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -577,7 +747,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM * @param lines the new text on the sign or null to clear it * @throws IllegalArgumentException if location is null * @throws IllegalArgumentException if lines is non-null and has a length less than 4 @@ -2200,7 +2199,7 @@ index a060b8b022c600e43aaef79a2942a384d47b300d..5a2c072c95cad8485e281e080e5e6061 public void sendSignChange(@NotNull Location loc, @Nullable String[] lines) throws IllegalArgumentException; /** -@@ -571,7 +743,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -596,7 +768,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM * @throws IllegalArgumentException if location is null * @throws IllegalArgumentException if dyeColor is null * @throws IllegalArgumentException if lines is non-null and has a length less than 4 @@ -2210,7 +2209,7 @@ index a060b8b022c600e43aaef79a2942a384d47b300d..5a2c072c95cad8485e281e080e5e6061 public void sendSignChange(@NotNull Location loc, @Nullable String[] lines, @NotNull DyeColor dyeColor) throws IllegalArgumentException; /** -@@ -591,7 +765,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -616,7 +790,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM * @throws IllegalArgumentException if location is null * @throws IllegalArgumentException if dyeColor is null * @throws IllegalArgumentException if lines is non-null and has a length less than 4 @@ -2220,7 +2219,7 @@ index a060b8b022c600e43aaef79a2942a384d47b300d..5a2c072c95cad8485e281e080e5e6061 public void sendSignChange(@NotNull Location loc, @Nullable String[] lines, @NotNull DyeColor dyeColor, boolean hasGlowingText) throws IllegalArgumentException; /** -@@ -1023,6 +1199,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -1048,6 +1224,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM * pack correctly. * * @@ -2228,7 +2227,7 @@ index a060b8b022c600e43aaef79a2942a384d47b300d..5a2c072c95cad8485e281e080e5e6061 * @param url The URL from which the client will download the resource * pack. The string must contain only US-ASCII characters and should * be encoded as per RFC 1738. -@@ -1079,8 +1256,10 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -1104,8 +1281,10 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM * @throws IllegalArgumentException Thrown if the hash is not 20 bytes * long. */ @@ -2239,7 +2238,7 @@ index a060b8b022c600e43aaef79a2942a384d47b300d..5a2c072c95cad8485e281e080e5e6061 /** * Request that the player's client download and switch resource packs. *

-@@ -1116,6 +1295,54 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -1141,6 +1320,54 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM * @param hash The sha1 hash sum of the resource pack file which is used * to apply a cached version of the pack directly without downloading * if it is available. Hast to be 20 bytes long! @@ -2294,7 +2293,7 @@ index a060b8b022c600e43aaef79a2942a384d47b300d..5a2c072c95cad8485e281e080e5e6061 * @param force If true, the client will be disconnected from the server * when it declines to use the resource pack. * @throws IllegalArgumentException Thrown if the URL is null. -@@ -1170,8 +1397,57 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -1195,8 +1422,57 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM * @throws IllegalArgumentException Thrown if the hash is not 20 bytes * long. */ @@ -2352,7 +2351,7 @@ index a060b8b022c600e43aaef79a2942a384d47b300d..5a2c072c95cad8485e281e080e5e6061 /** * Gets the Scoreboard displayed to this player * -@@ -1287,7 +1563,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -1312,7 +1588,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM * * @param title Title text * @param subtitle Subtitle text @@ -2361,7 +2360,7 @@ index a060b8b022c600e43aaef79a2942a384d47b300d..5a2c072c95cad8485e281e080e5e6061 */ @Deprecated public void sendTitle(@Nullable String title, @Nullable String subtitle); -@@ -1306,7 +1582,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -1331,7 +1607,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM * @param fadeIn time in ticks for titles to fade in. Defaults to 10. * @param stay time in ticks for titles to stay. Defaults to 70. * @param fadeOut time in ticks for titles to fade out. Defaults to 20. @@ -2371,7 +2370,7 @@ index a060b8b022c600e43aaef79a2942a384d47b300d..5a2c072c95cad8485e281e080e5e6061 public void sendTitle(@Nullable String title, @Nullable String subtitle, int fadeIn, int stay, int fadeOut); /** -@@ -1533,6 +1811,14 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -1558,6 +1836,14 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM */ public int getClientViewDistance(); @@ -2386,7 +2385,7 @@ index a060b8b022c600e43aaef79a2942a384d47b300d..5a2c072c95cad8485e281e080e5e6061 /** * Gets the player's estimated ping in milliseconds. * -@@ -1558,8 +1844,10 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -1583,8 +1869,10 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM * they wish. * * @return the player's locale @@ -2397,7 +2396,7 @@ index a060b8b022c600e43aaef79a2942a384d47b300d..5a2c072c95cad8485e281e080e5e6061 public String getLocale(); /** -@@ -1601,6 +1889,14 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -1626,6 +1914,14 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM */ public boolean isAllowingServerListings(); @@ -2412,7 +2411,7 @@ index a060b8b022c600e43aaef79a2942a384d47b300d..5a2c072c95cad8485e281e080e5e6061 // Spigot start public class Spigot extends Entity.Spigot { -@@ -1655,11 +1951,13 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -1680,11 +1976,13 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM throw new UnsupportedOperationException("Not supported yet."); } @@ -2426,7 +2425,7 @@ index a060b8b022c600e43aaef79a2942a384d47b300d..5a2c072c95cad8485e281e080e5e6061 @Override public void sendMessage(@NotNull net.md_5.bungee.api.chat.BaseComponent... components) { throw new UnsupportedOperationException("Not supported yet."); -@@ -1670,7 +1968,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -1695,7 +1993,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM * * @param position the screen position * @param component the components to send @@ -2436,7 +2435,7 @@ index a060b8b022c600e43aaef79a2942a384d47b300d..5a2c072c95cad8485e281e080e5e6061 public void sendMessage(@NotNull net.md_5.bungee.api.ChatMessageType position, @NotNull net.md_5.bungee.api.chat.BaseComponent component) { throw new UnsupportedOperationException("Not supported yet."); } -@@ -1680,7 +1980,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -1705,7 +2005,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM * * @param position the screen position * @param components the components to send @@ -2446,7 +2445,7 @@ index a060b8b022c600e43aaef79a2942a384d47b300d..5a2c072c95cad8485e281e080e5e6061 public void sendMessage(@NotNull net.md_5.bungee.api.ChatMessageType position, @NotNull net.md_5.bungee.api.chat.BaseComponent... components) { throw new UnsupportedOperationException("Not supported yet."); } -@@ -1691,7 +1993,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -1716,7 +2018,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM * @param position the screen position * @param sender the sender of the message * @param component the components to send @@ -2456,7 +2455,7 @@ index a060b8b022c600e43aaef79a2942a384d47b300d..5a2c072c95cad8485e281e080e5e6061 public void sendMessage(@NotNull net.md_5.bungee.api.ChatMessageType position, @Nullable UUID sender, @NotNull net.md_5.bungee.api.chat.BaseComponent component) { throw new UnsupportedOperationException("Not supported yet."); } -@@ -1702,7 +2006,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -1727,7 +2031,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM * @param position the screen position * @param sender the sender of the message * @param components the components to send @@ -3705,21 +3704,21 @@ index f89d71b77d1200314df6ca23614d5ca6fb15ceb3..af4a7ce37eb10bab06eadb6583c7894b + // Paper end } diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index 7b904dd2c0a660df8874d4800919e16981877163..d168a836d655b369f67200d7afe101b56ff815b1 100644 +index d80b0a52968920b990a75cff85e436a16d782500..9da047582e9648d84875b6d3c136960bbb97b70e 100644 --- a/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -22,7 +22,7 @@ import org.jetbrains.annotations.Nullable; +@@ -23,7 +23,7 @@ import org.jetbrains.annotations.Nullable; * use this class to encapsulate Materials for which {@link Material#isItem()} * returns false. */ --public class ItemStack implements Cloneable, ConfigurationSerializable { -+public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyori.adventure.text.event.HoverEventSource { // Paper +-public class ItemStack implements Cloneable, ConfigurationSerializable, Translatable { ++public class ItemStack implements Cloneable, ConfigurationSerializable, Translatable, net.kyori.adventure.text.event.HoverEventSource { // Paper private Material type = Material.AIR; private int amount = 0; private MaterialData data = null; -@@ -595,4 +595,21 @@ public class ItemStack implements Cloneable, ConfigurationSerializable { - - return true; +@@ -602,4 +602,21 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat + public String getTranslationKey() { + return Bukkit.getUnsafe().getTranslationKey(this); } + + // Paper start @@ -4677,7 +4676,7 @@ index 0db7fe1b9fe5621ceed3f4f046691e359f5949dd..47b10df619ad2520b9bb673e2220f363 /** diff --git a/src/test/java/org/bukkit/AnnotationTest.java b/src/test/java/org/bukkit/AnnotationTest.java -index 1a71bb8861150c1add6446aa2fad0f7035dd6873..8275a5d7e1de39a5171e254f449a42c6defd3445 100644 +index 8f35cda0d67ec66646c6096a5bf1c84891b8b0fd..9825db30d42701aad5d9970bbb989fbff0142fb1 100644 --- a/src/test/java/org/bukkit/AnnotationTest.java +++ b/src/test/java/org/bukkit/AnnotationTest.java @@ -26,6 +26,12 @@ import org.objectweb.asm.tree.ParameterNode; diff --git a/patches/api/0027-Use-ASM-for-event-executors.patch b/patches/api/0007-Use-ASM-for-event-executors.patch similarity index 90% rename from patches/api/0027-Use-ASM-for-event-executors.patch rename to patches/api/0007-Use-ASM-for-event-executors.patch index a54f62a007..a96b5596a3 100644 --- a/patches/api/0027-Use-ASM-for-event-executors.patch +++ b/patches/api/0007-Use-ASM-for-event-executors.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Use ASM for event executors. Uses method handles for private or static methods. diff --git a/build.gradle.kts b/build.gradle.kts -index c9f9174a085174b96897c013e0ecb79738c2e9e3..9d650b937610d83748b30d724cee97afd715167f 100644 +index 558fa62d87af1103efa703ef9114481cb928cf8d..359e7bd7e3c76cec89d638f940006dc9c944f98b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -39,6 +39,9 @@ dependencies { @@ -368,30 +368,3 @@ 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 5eb24f38f158d43fb42836b83c108f808c89512e..5d74fab03a15d7099e5dacb780eade4cdc185797 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 { - } - } - -- EventExecutor executor = new co.aikar.timings.TimedEventExecutor(new EventExecutor() { // Paper -- @Override -- public void execute(@NotNull Listener listener, @NotNull Event event) throws EventException { // Paper -- try { -- if (!eventClass.isAssignableFrom(event.getClass())) { -- return; -- } -- method.invoke(listener, event); -- } catch (InvocationTargetException ex) { -- throw new EventException(ex.getCause()); -- } catch (Throwable t) { -- throw new EventException(t); -- } -- } -- }, plugin, method, eventClass); // Paper -+ EventExecutor executor = new co.aikar.timings.TimedEventExecutor(EventExecutor.create(method, eventClass), plugin, method, eventClass); // Paper // Paper (Yes.) - Use factory method `EventExecutor.create()` - if (false) { // Spigot - RL handles useTimings check now - eventSet.add(new TimedRegisteredListener(listener, executor, eh.priority(), plugin, eh.ignoreCancelled())); - } else { diff --git a/patches/api/0008-Paper-Plugins.patch b/patches/api/0008-Paper-Plugins.patch new file mode 100644 index 0000000000..e3442bd201 --- /dev/null +++ b/patches/api/0008-Paper-Plugins.patch @@ -0,0 +1,2477 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> +Date: Wed, 6 Jul 2022 23:00:36 -0400 +Subject: [PATCH] Paper Plugins + + +diff --git a/build.gradle.kts b/build.gradle.kts +index 359e7bd7e3c76cec89d638f940006dc9c944f98b..f5f217a3a786bf4c95bea74c135289d12205cf7b 100644 +--- a/build.gradle.kts ++++ b/build.gradle.kts +@@ -44,7 +44,7 @@ dependencies { + implementation("org.ow2.asm:asm-commons:9.2") + // Paper end + +- compileOnly("org.apache.maven:maven-resolver-provider:3.8.5") ++ api("org.apache.maven:maven-resolver-provider:3.8.5") // Paper, expose + compileOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.7.3") + compileOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.7.3") + compileOnly("com.google.code.findbugs:jsr305:1.3.9") // Paper +diff --git a/src/main/java/io/papermc/paper/plugin/PermissionManager.java b/src/main/java/io/papermc/paper/plugin/PermissionManager.java +new file mode 100644 +index 0000000000000000000000000000000000000000..cdbc93b317b3bab47bf6552c29cfbb2c27846933 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/PermissionManager.java +@@ -0,0 +1,171 @@ ++package io.papermc.paper.plugin; ++ ++import org.bukkit.permissions.Permissible; ++import org.bukkit.permissions.Permission; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; ++ ++import java.util.List; ++import java.util.Set; ++ ++/** ++ * A permission manager implementation to keep backwards compatibility partially alive with existing plugins that used ++ * the bukkit one before. ++ */ ++@ApiStatus.Experimental ++public interface PermissionManager { ++ ++ /** ++ * Gets a {@link Permission} from its fully qualified name ++ * ++ * @param name Name of the permission ++ * @return Permission, or null if none ++ */ ++ @Nullable ++ Permission getPermission(@NotNull String name); ++ ++ /** ++ * Adds a {@link Permission} to this plugin manager. ++ *

++ * If a permission is already defined with the given name of the new ++ * permission, an exception will be thrown. ++ * ++ * @param perm Permission to add ++ * @throws IllegalArgumentException Thrown when a permission with the same ++ * name already exists ++ */ ++ void addPermission(@NotNull Permission perm); ++ ++ /** ++ * Removes a {@link Permission} registration from this plugin manager. ++ *

++ * If the specified permission does not exist in this plugin manager, ++ * nothing will happen. ++ *

++ * Removing a permission registration will not remove the ++ * permission from any {@link Permissible}s that have it. ++ * ++ * @param perm Permission to remove ++ */ ++ void removePermission(@NotNull Permission perm); ++ ++ /** ++ * Removes a {@link Permission} registration from this plugin manager. ++ *

++ * If the specified permission does not exist in this plugin manager, ++ * nothing will happen. ++ *

++ * Removing a permission registration will not remove the ++ * permission from any {@link Permissible}s that have it. ++ * ++ * @param name Permission to remove ++ */ ++ void removePermission(@NotNull String name); ++ ++ /** ++ * Gets the default permissions for the given op status ++ * ++ * @param op Which set of default permissions to get ++ * @return The default permissions ++ */ ++ @NotNull ++ Set getDefaultPermissions(boolean op); ++ ++ /** ++ * Recalculates the defaults for the given {@link Permission}. ++ *

++ * This will have no effect if the specified permission is not registered ++ * here. ++ * ++ * @param perm Permission to recalculate ++ */ ++ void recalculatePermissionDefaults(@NotNull Permission perm); ++ ++ /** ++ * Subscribes the given Permissible for information about the requested ++ * Permission, by name. ++ *

++ * If the specified Permission changes in any form, the Permissible will ++ * be asked to recalculate. ++ * ++ * @param permission Permission to subscribe to ++ * @param permissible Permissible subscribing ++ */ ++ void subscribeToPermission(@NotNull String permission, @NotNull Permissible permissible); ++ ++ /** ++ * Unsubscribes the given Permissible for information about the requested ++ * Permission, by name. ++ * ++ * @param permission Permission to unsubscribe from ++ * @param permissible Permissible subscribing ++ */ ++ void unsubscribeFromPermission(@NotNull String permission, @NotNull Permissible permissible); ++ ++ /** ++ * Gets a set containing all subscribed {@link Permissible}s to the given ++ * permission, by name ++ * ++ * @param permission Permission to query for ++ * @return Set containing all subscribed permissions ++ */ ++ @NotNull ++ Set getPermissionSubscriptions(@NotNull String permission); ++ ++ /** ++ * Subscribes to the given Default permissions by operator status ++ *

++ * If the specified defaults change in any form, the Permissible will be ++ * asked to recalculate. ++ * ++ * @param op Default list to subscribe to ++ * @param permissible Permissible subscribing ++ */ ++ void subscribeToDefaultPerms(boolean op, @NotNull Permissible permissible); ++ ++ /** ++ * Unsubscribes from the given Default permissions by operator status ++ * ++ * @param op Default list to unsubscribe from ++ * @param permissible Permissible subscribing ++ */ ++ void unsubscribeFromDefaultPerms(boolean op, @NotNull Permissible permissible); ++ ++ /** ++ * Gets a set containing all subscribed {@link Permissible}s to the given ++ * default list, by op status ++ * ++ * @param op Default list to query for ++ * @return Set containing all subscribed permissions ++ */ ++ @NotNull ++ Set getDefaultPermSubscriptions(boolean op); ++ ++ /** ++ * Gets a set of all registered permissions. ++ *

++ * This set is a copy and will not be modified live. ++ * ++ * @return Set containing all current registered permissions ++ */ ++ @NotNull ++ Set getPermissions(); ++ ++ /** ++ * Adds a list of permissions. ++ *

++ * This is meant as an optimization for adding multiple permissions without recalculating each permission. ++ * ++ * @param perm permission ++ */ ++ void addPermissions(@NotNull List perm); ++ ++ /** ++ * Clears the current registered permissinos. ++ *

++ * This is used for reloading. ++ */ ++ void clearPermissions(); ++ ++} +diff --git a/src/main/java/io/papermc/paper/plugin/bootstrap/PluginBootstrap.java b/src/main/java/io/papermc/paper/plugin/bootstrap/PluginBootstrap.java +new file mode 100644 +index 0000000000000000000000000000000000000000..ea84b11e8682e73fcd563fec65e76b707546a99e +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/bootstrap/PluginBootstrap.java +@@ -0,0 +1,41 @@ ++package io.papermc.paper.plugin.bootstrap; ++ ++import io.papermc.paper.plugin.provider.util.ProviderUtil; ++import org.bukkit.plugin.java.JavaPlugin; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * A plugin boostrap is meant for loading certain parts of the plugin before the server is loaded. ++ *

++ * Plugin bootstrapping allows values to be initialized in certain parts of the server that might not be allowed ++ * when the server is running. ++ *

++ * Your bootstrap class will be on the same classloader as your JavaPlugin. ++ *

++ * All calls to Bukkit may throw a NullPointerExceptions or return null unexpectedly. You should only call api methods that are explicitly documented to work in the bootstrapper ++ */ ++@ApiStatus.OverrideOnly ++@ApiStatus.Experimental ++public interface PluginBootstrap { ++ ++ /** ++ * Called by the server, allowing you to bootstrap the plugin with a context that provides things like a logger and your shared plugin configuration file. ++ * ++ * @param context the server provided context ++ */ ++ void bootstrap(@NotNull PluginProviderContext context); ++ ++ /** ++ * Called by the server to instantiate your main class. ++ * Plugins may override this logic to define custom creation logic for said instance, like passing addition ++ * constructor arguments. ++ * ++ * @param context the server created bootstrap object ++ * @return the server requested instance of the plugins main class. ++ */ ++ @NotNull ++ default JavaPlugin createPlugin(@NotNull PluginProviderContext context) { ++ return ProviderUtil.loadClass(context.getConfiguration().getMainClass(), JavaPlugin.class, this.getClass().getClassLoader()); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/bootstrap/PluginProviderContext.java b/src/main/java/io/papermc/paper/plugin/bootstrap/PluginProviderContext.java +new file mode 100644 +index 0000000000000000000000000000000000000000..a4467fe1ba0dc348eab681900dbcac1770963591 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/bootstrap/PluginProviderContext.java +@@ -0,0 +1,53 @@ ++package io.papermc.paper.plugin.bootstrap; ++ ++import io.papermc.paper.plugin.configuration.PluginMeta; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++import java.nio.file.Path; ++import java.util.logging.Logger; ++ ++/** ++ * Represents the context provided to a {@link PluginBootstrap} during both the bootstrapping and plugin ++ * instanciation logic. ++ * A boostrap context may be used to access data or logic usually provided to {@link org.bukkit.plugin.Plugin} instances ++ * like the plugin's configuration or logger during the plugins bootstrap. ++ */ ++@ApiStatus.NonExtendable ++@ApiStatus.Experimental ++public interface PluginProviderContext { ++ ++ /** ++ * Provides the plugin's configuration. ++ * ++ * @return the plugin's configuration ++ */ ++ @NotNull ++ PluginMeta getConfiguration(); ++ ++ /** ++ * Provides the path to the data directory of the plugin. ++ * ++ * @return the previously described path ++ */ ++ @NotNull ++ Path getDataDirectory(); ++ ++ /** ++ * Provides the logger used for this plugin. ++ * ++ * @return the logger instance ++ */ ++ @NotNull ++ Logger getLogger(); ++ ++ /** ++ * Provides the SLF4J logger assigned to this plugin. ++ * ++ * @return SLF4J logger ++ */ ++ @NotNull ++ default org.slf4j.Logger getSLF4JLogger() { ++ return org.slf4j.LoggerFactory.getLogger(this.getLogger().getName()); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/configuration/PluginMeta.java b/src/main/java/io/papermc/paper/plugin/configuration/PluginMeta.java +new file mode 100644 +index 0000000000000000000000000000000000000000..ef393f1f93ca48264fc1b6e3a27787f6a9152e1b +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/configuration/PluginMeta.java +@@ -0,0 +1,203 @@ ++package io.papermc.paper.plugin.configuration; ++ ++import org.bukkit.permissions.Permission; ++import org.bukkit.permissions.PermissionDefault; ++import org.bukkit.plugin.PluginLoadOrder; ++import org.bukkit.plugin.java.JavaPlugin; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; ++ ++import java.util.List; ++ ++/** ++ * This class acts as an abstraction for a plugin configuration. ++ */ ++@ApiStatus.NonExtendable ++@ApiStatus.Experimental // Subject to change! ++public interface PluginMeta { ++ ++ /** ++ * Provides the name of the plugin. This name uniquely identifies the plugin amongst all loaded plugins on the ++ * server. ++ *

    ++ *
  • Will only contain alphanumeric characters, underscores, hyphens, ++ * and periods: [a-zA-Z0-9_\-\.]. ++ *
  • Typically used for identifying the plugin data folder. ++ *
  • The name also acts as the token referenced in {@link #getPluginDependencies()}, ++ * {@link #getPluginSoftDependencies()}, and {@link #getLoadBeforePlugins()}. ++ *
++ *

++ * In the plugin.yml, this entry is named name. ++ *

++ * Example:

name: MyPlugin
++ * ++ * @return the name of the plugin ++ */ ++ @NotNull ++ String getName(); ++ ++ /** ++ * Returns the display name of the plugin, including the version. ++ * ++ * @return a descriptive name of the plugin and respective version ++ */ ++ @NotNull ++ default String getDisplayName() { ++ return this.getName() + " v" + this.getVersion(); ++ } ++ ++ /** ++ * Provides the fully qualified class name of the main class for the plugin. ++ * A subtype of {@link JavaPlugin} is expected at this location. ++ * ++ * @return the fully qualified class name of the plugin's main class. ++ */ ++ @NotNull ++ String getMainClass(); ++ ++ /** ++ * Returns the phase of the server startup logic that the plugin should be loaded. ++ * ++ * @return the plugin load order ++ * @see PluginLoadOrder for further details regards the available load orders. ++ */ ++ @NotNull ++ PluginLoadOrder getLoadOrder(); ++ ++ /** ++ * Provides the version of this plugin as defined by the plugin. ++ * There is no inherit format defined/enforced for the version of a plugin, however a common approach ++ * might be schematic versioning. ++ * ++ * @return the string representation of the plugin's version ++ */ ++ @NotNull ++ String getVersion(); ++ ++ /** ++ * Provides the prefix that should be used for the plugin logger. ++ * The logger prefix allows plugins to overwrite the usual default of the logger prefix, which is the name of the ++ * plugin. ++ * ++ * @return the specific overwrite of the logger prefix as defined by the plugin. If the plugin did not define a ++ * custom logger prefix, this method will return null ++ */ ++ @Nullable ++ String getLoggerPrefix(); ++ ++ /** ++ * Provides a list of dependencies that are required for this plugin to load. ++ * The list holds the unique identifiers, following the constraints laid out in {@link #getName()}, of the ++ * dependencies. ++ *

++ * If any of the dependencies defined by this list are not installed on the server, this plugin will fail to load. ++ * ++ * @return an immutable list of required dependency names ++ */ ++ @NotNull ++ List getPluginDependencies(); ++ ++ /** ++ * Provides a list of dependencies that are used but not required by this plugin. ++ * The list holds the unique identifiers, following the constraints laid out in {@link #getName()}, of the soft ++ * dependencies. ++ *

++ * If these dependencies are installed on the server, they will be loaded first and supplied as dependencies to this ++ * plugin, however the plugin will load even if these dependencies are not installed. ++ * ++ * @return immutable list of soft dependencies ++ */ ++ @NotNull ++ List getPluginSoftDependencies(); ++ ++ /** ++ * Provides a list of plugins that should be loaded before this plugin is loaded. ++ * The list holds the unique identifiers, following the constraints laid out in {@link #getName()}, of the ++ * plugins that should be loaded before the plugin described by this plugin meta. ++ *

++ * The plugins referenced in the list provided by this method are not considered dependencies of this plugin and ++ * are hence not available to the plugin at runtime. They merely load before this plugin. ++ * ++ * @return immutable list of plugins to load before this plugin ++ */ ++ @NotNull ++ List getLoadBeforePlugins(); ++ ++ /** ++ * Returns the list of plugins/dependencies that this plugin provides. ++ * The list holds the unique identifiers, following the constraints laid out in {@link #getName()}, for each plugin ++ * it provides the expected classes for. ++ * ++ * @return immutable list of provided plugins/dependencies ++ */ ++ @NotNull ++ List getProvidedPlugins(); ++ ++ /** ++ * Provides the list of authors that are credited with creating this plugin. ++ * The author names are in no particular format. ++ * ++ * @return an immutable list of the plugin's authors ++ */ ++ @NotNull ++ List getAuthors(); ++ ++ /** ++ * Provides a list of contributors that contributed to the plugin but are not considered authors. ++ * The names of the contributors are in no particular format. ++ * ++ * @return an immutable list of the plugin's contributors ++ */ ++ @NotNull ++ List getContributors(); ++ ++ /** ++ * Gives a human-friendly description of the functionality the plugin ++ * provides. ++ * ++ * @return description or null if the plugin did not define a human readable description. ++ */ ++ @Nullable ++ String getDescription(); ++ ++ /** ++ * Provides the website for the plugin or the plugin's author. ++ * The defined string value is not guaranteed to be in the form of a url. ++ * ++ * @return a string representation of the website that serves as the main hub for this plugin/its author. ++ */ ++ @Nullable ++ String getWebsite(); ++ ++ /** ++ * Provides the list of permissions that are defined via the plugin meta instance. ++ * ++ * @return an immutable list of permissions ++ */ ++ // TODO: Do we even want this? Why not just use the bootstrapper ++ @NotNull ++ List getPermissions(); ++ ++ /** ++ * Provides the default values that apply to the permissions defined in this plugin meta. ++ * ++ * @return the bukkit permission default container. ++ * @see #getPermissions() ++ */ ++ // TODO: Do we even want this? Why not just use the bootstrapper ++ @NotNull ++ PermissionDefault getPermissionDefault(); ++ ++ /** ++ * Gets the api version that this plugin supports. ++ * Nullable if this version is not specified, and should be ++ * considered legacy (spigot plugins only) ++ * ++ * @return the version string made up of the major and minor version (e.g. 1.18 or 1.19). Minor versions like 1.18.2 ++ * are unified to their major release version (in this example 1.18) ++ */ ++ @Nullable ++ String getAPIVersion(); ++ ++} +diff --git a/src/main/java/io/papermc/paper/plugin/configuration/package-info.java b/src/main/java/io/papermc/paper/plugin/configuration/package-info.java +new file mode 100644 +index 0000000000000000000000000000000000000000..ddb3076124365d0d1a5caa32d4dcb1f4314dd7ae +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/configuration/package-info.java +@@ -0,0 +1,8 @@ ++/** ++ * The paper configuration package contains the new java representation of a plugins configuration file. ++ * While most values are described in detail on {@link io.papermc.paper.plugin.configuration.PluginMeta}, a full ++ * entry on the paper contains a full and extensive example of possible configurations of the paper-plugin.yml. ++ * @see Extensive documentation and examples of the paper-plugin.yml ++ * ++ */ ++package io.papermc.paper.plugin.configuration; +diff --git a/src/main/java/io/papermc/paper/plugin/loader/PluginClasspathBuilder.java b/src/main/java/io/papermc/paper/plugin/loader/PluginClasspathBuilder.java +new file mode 100644 +index 0000000000000000000000000000000000000000..28cbc09b7c1ded1f4515969cef4a669adac85703 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/loader/PluginClasspathBuilder.java +@@ -0,0 +1,38 @@ ++package io.papermc.paper.plugin.loader; ++ ++import io.papermc.paper.plugin.bootstrap.PluginProviderContext; ++import io.papermc.paper.plugin.loader.library.ClassPathLibrary; ++import io.papermc.paper.plugin.loader.library.LibraryStore; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Contract; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * A mutable builder that may be used to collect and register all {@link ClassPathLibrary} instances a ++ * {@link PluginLoader} aims to provide to its plugin at runtime. ++ */ ++@ApiStatus.NonExtendable ++@ApiStatus.Experimental ++public interface PluginClasspathBuilder { ++ ++ /** ++ * Adds a new classpath library to this classpath builder. ++ *

++ * As a builder, this method does not invoke {@link ClassPathLibrary#register(LibraryStore)} and ++ * may hence be run without invoking potential IO performed by a {@link ClassPathLibrary} during resolution. ++ *

++ * The paper api provides pre implemented {@link ClassPathLibrary} types that allow easy inclusion of existing ++ * libraries on disk or on remote maven repositories. ++ * ++ * @param classPathLibrary the library instance to add to this builder ++ * @return self ++ * @see io.papermc.paper.plugin.loader.library.impl.JarLibrary ++ * @see io.papermc.paper.plugin.loader.library.impl.MavenLibraryResolver ++ */ ++ @NotNull ++ @Contract("_ -> this") ++ PluginClasspathBuilder addLibrary(@NotNull ClassPathLibrary classPathLibrary); ++ ++ @NotNull ++ PluginProviderContext getContext(); ++} +diff --git a/src/main/java/io/papermc/paper/plugin/loader/PluginLoader.java b/src/main/java/io/papermc/paper/plugin/loader/PluginLoader.java +new file mode 100644 +index 0000000000000000000000000000000000000000..c9e31f78ff6ff969436c6d99755845786c4d383f +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/loader/PluginLoader.java +@@ -0,0 +1,30 @@ ++package io.papermc.paper.plugin.loader; ++ ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * A plugin loader is responsible for creating certain aspects of a plugin before it is created. ++ *

++ * The goal of the plugin loader is the creation of an expected/dynamic environment for the plugin to load into. ++ * This, as of right now, only applies to creating the expected classpath for the plugin, e.g. supplying external ++ * libraries to the plugin. ++ *

++ * It should be noted that this class will be called from a different classloader, this will cause any static values ++ * set in this class/any other classes loaded not to persist when the plugin loads. ++ */ ++@ApiStatus.OverrideOnly ++@ApiStatus.Experimental ++public interface PluginLoader { ++ ++ /** ++ * Called by the server to allows plugins to configure the runtime classpath that the plugin is run on. ++ * This allows plugin loaders to configure dependencies for the plugin where jars can be downloaded or ++ * provided during runtime. ++ * ++ * @param classpathBuilder a mutable classpath builder that may be used to register custom runtime dependencies ++ * for the plugin the loader was registered for. ++ */ ++ void classloader(@NotNull PluginClasspathBuilder classpathBuilder); ++ ++} +diff --git a/src/main/java/io/papermc/paper/plugin/loader/library/ClassPathLibrary.java b/src/main/java/io/papermc/paper/plugin/loader/library/ClassPathLibrary.java +new file mode 100644 +index 0000000000000000000000000000000000000000..1347b535d90c2c281c184d0459e7ac59c0350c9f +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/loader/library/ClassPathLibrary.java +@@ -0,0 +1,20 @@ ++package io.papermc.paper.plugin.loader.library; ++ ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * The classpath library interface represents libraries that are capable of registering themselves via ++ * {@link #register(LibraryStore)} on any given {@link LibraryStore}. ++ */ ++public interface ClassPathLibrary { ++ ++ /** ++ * Called to register the library this class path library represents into the passed library store. ++ * This method may either be implemented by the plugins themselves if they need complex logic, or existing ++ * API exposed implementations of this interface may be used. ++ * ++ * @param store the library store instance to register this library into ++ * @throws LibraryLoadingException if library loading failed for this classpath library ++ */ ++ void register(@NotNull LibraryStore store) throws LibraryLoadingException; ++} +diff --git a/src/main/java/io/papermc/paper/plugin/loader/library/LibraryLoadingException.java b/src/main/java/io/papermc/paper/plugin/loader/library/LibraryLoadingException.java +new file mode 100644 +index 0000000000000000000000000000000000000000..79ba423a364b50588f3ee87fdc69155cb8e64ad0 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/loader/library/LibraryLoadingException.java +@@ -0,0 +1,15 @@ ++package io.papermc.paper.plugin.loader.library; ++ ++/** ++ * Indicates that an exception has occured while loading a library. ++ */ ++public class LibraryLoadingException extends RuntimeException { ++ ++ public LibraryLoadingException(String s) { ++ super(s); ++ } ++ ++ public LibraryLoadingException(String s, Exception e) { ++ super(s, e); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/loader/library/LibraryStore.java b/src/main/java/io/papermc/paper/plugin/loader/library/LibraryStore.java +new file mode 100644 +index 0000000000000000000000000000000000000000..0546fa1e9dcd7155086a8650806a8c086b6fc458 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/loader/library/LibraryStore.java +@@ -0,0 +1,26 @@ ++package io.papermc.paper.plugin.loader.library; ++ ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++import java.nio.file.Path; ++ ++/** ++ * Represents a storage that stores library jars. ++ *

++ * The library store api allows plugins to register specific dependencies into their runtime classloader when their ++ * {@link io.papermc.paper.plugin.loader.PluginLoader} is processed. ++ * ++ * @see io.papermc.paper.plugin.loader.PluginLoader ++ */ ++@ApiStatus.Internal ++public interface LibraryStore { ++ ++ /** ++ * Adds the provided library path to this library store. ++ * ++ * @param library path to the libraries jar file on the disk ++ */ ++ void addLibrary(@NotNull Path library); ++ ++} +diff --git a/src/main/java/io/papermc/paper/plugin/loader/library/impl/JarLibrary.java b/src/main/java/io/papermc/paper/plugin/loader/library/impl/JarLibrary.java +new file mode 100644 +index 0000000000000000000000000000000000000000..3327595d154700890c862a2ced5eff93da4bd634 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/loader/library/impl/JarLibrary.java +@@ -0,0 +1,45 @@ ++package io.papermc.paper.plugin.loader.library.impl; ++ ++import io.papermc.paper.plugin.loader.library.ClassPathLibrary; ++import io.papermc.paper.plugin.loader.library.LibraryLoadingException; ++import io.papermc.paper.plugin.loader.library.LibraryStore; ++import org.jetbrains.annotations.NotNull; ++ ++import java.nio.file.Files; ++import java.nio.file.Path; ++ ++/** ++ * A simple jar library implementation of the {@link ClassPathLibrary} that allows {@link io.papermc.paper.plugin.loader.PluginLoader}s to ++ * append a jar stored on the local file system into their runtime classloader. ++ *

++ * An example creation of the jar library type may look like this: ++ *

{@code
++ *   final JarLibrary customLibrary = new JarLibrary(Path.of("libs/custom-library-1.24.jar"));
++ * }
++ * resulting in a jar library that provides the jar at {@code libs/custom-library-1.24.jar} to the plugins classloader ++ * at runtime. ++ *

++ * The jar library implementation will error if file exists at the specified path. ++ */ ++public class JarLibrary implements ClassPathLibrary { ++ ++ private final Path path; ++ ++ /** ++ * Creates a new jar library that references the jar file found at the provided path. ++ * ++ * @param path the path, relative to the JVMs start directory. ++ */ ++ public JarLibrary(@NotNull Path path) { ++ this.path = path; ++ } ++ ++ @Override ++ public void register(@NotNull LibraryStore store) throws LibraryLoadingException { ++ if (Files.notExists(this.path)) { ++ throw new LibraryLoadingException("Could not find library at " + this.path); ++ } ++ ++ store.addLibrary(this.path); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/loader/library/impl/MavenLibraryResolver.java b/src/main/java/io/papermc/paper/plugin/loader/library/impl/MavenLibraryResolver.java +new file mode 100644 +index 0000000000000000000000000000000000000000..e3e902a708a760be167cb1bba8e845c5fa5b9141 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/loader/library/impl/MavenLibraryResolver.java +@@ -0,0 +1,132 @@ ++package io.papermc.paper.plugin.loader.library.impl; ++ ++import io.papermc.paper.plugin.loader.library.ClassPathLibrary; ++import io.papermc.paper.plugin.loader.library.LibraryLoadingException; ++import io.papermc.paper.plugin.loader.library.LibraryStore; ++import org.apache.maven.repository.internal.MavenRepositorySystemUtils; ++import org.eclipse.aether.DefaultRepositorySystemSession; ++import org.eclipse.aether.RepositorySystem; ++import org.eclipse.aether.collection.CollectRequest; ++import org.eclipse.aether.connector.basic.BasicRepositoryConnectorFactory; ++import org.eclipse.aether.graph.Dependency; ++import org.eclipse.aether.impl.DefaultServiceLocator; ++import org.eclipse.aether.repository.LocalRepository; ++import org.eclipse.aether.repository.RemoteRepository; ++import org.eclipse.aether.repository.RepositoryPolicy; ++import org.eclipse.aether.resolution.ArtifactResult; ++import org.eclipse.aether.resolution.DependencyRequest; ++import org.eclipse.aether.resolution.DependencyResolutionException; ++import org.eclipse.aether.resolution.DependencyResult; ++import org.eclipse.aether.spi.connector.RepositoryConnectorFactory; ++import org.eclipse.aether.spi.connector.transport.TransporterFactory; ++import org.eclipse.aether.transfer.AbstractTransferListener; ++import org.eclipse.aether.transfer.TransferCancelledException; ++import org.eclipse.aether.transfer.TransferEvent; ++import org.eclipse.aether.transport.http.HttpTransporterFactory; ++import org.jetbrains.annotations.NotNull; ++ ++import java.io.File; ++import java.util.ArrayList; ++import java.util.List; ++import java.util.logging.Level; ++import java.util.logging.Logger; ++ ++/** ++ * The maven library resolver acts as a resolver for yet to be resolved jar libraries that may be pulled from a ++ * remote maven repository. ++ *

++ * Plugins may create and configure a {@link MavenLibraryResolver} by creating a new one and registering both ++ * a dependency artifact that should be resolved to a library at runtime and the repository it is found in. ++ * An example of this would be the inclusion of the jooq library for typesafe SQL queries: ++ *

{@code
++ * MavenLibraryResolver resolver = new MavenLibraryResolver();
++ * resolver.addDependency(new Dependency(new DefaultArtifact("org.jooq:jooq:3.17.7"), null));
++ * resolver.addRepository(new RemoteRepository.Builder(
++ *     "central", "default", "https://repo1.maven.org/maven2/"
++ * ).build());
++ * }
++ * ++ * Plugins may create and register a {@link MavenLibraryResolver} after configuring it. ++ */ ++public class MavenLibraryResolver implements ClassPathLibrary { ++ ++ private static final Logger logger = Logger.getLogger("MavenLibraryResolver"); ++ ++ private final RepositorySystem repository; ++ private final DefaultRepositorySystemSession session; ++ private final List repositories = new ArrayList<>(); ++ private final List dependencies = new ArrayList<>(); ++ ++ /** ++ * Creates a new maven library resolver instance. ++ *

++ * The created instance will use the servers {@code libraries} folder to cache fetched libraries in. ++ * Notably, the resolver is created without any repository, not even maven central. ++ * It is hence crucial that plugins which aim to use this api register all required repositories before ++ * submitting the {@link MavenLibraryResolver} to the {@link io.papermc.paper.plugin.loader.PluginClasspathBuilder}. ++ */ ++ public MavenLibraryResolver() { ++ DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator(); ++ locator.addService(RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class); ++ locator.addService(TransporterFactory.class, HttpTransporterFactory.class); ++ ++ this.repository = locator.getService(RepositorySystem.class); ++ this.session = MavenRepositorySystemUtils.newSession(); ++ ++ this.session.setChecksumPolicy(RepositoryPolicy.CHECKSUM_POLICY_FAIL); ++ this.session.setLocalRepositoryManager(this.repository.newLocalRepositoryManager(this.session, new LocalRepository("libraries"))); ++ this.session.setTransferListener(new AbstractTransferListener() { ++ @Override ++ public void transferInitiated(@NotNull TransferEvent event) throws TransferCancelledException { ++ logger.log(Level.INFO, "Downloading {0}", event.getResource().getRepositoryUrl() + event.getResource().getResourceName()); ++ } ++ }); ++ this.session.setReadOnly(); ++ } ++ ++ /** ++ * Adds the provided dependency to the library resolver. ++ * The artifact from the first valid repository matching the passed dependency will be chosen. ++ * ++ * @param dependency the definition of the dependency the maven library resolver should resolve when running ++ * @see MavenLibraryResolver#addRepository(RemoteRepository) ++ */ ++ public void addDependency(@NotNull Dependency dependency) { ++ this.dependencies.add(dependency); ++ } ++ ++ /** ++ * Adds the provided repository to the library resolver. ++ * The order in which these are added does matter, as dependency resolving will start at the first added ++ * repository. ++ * ++ * @param remoteRepository the configuration that defines the maven repository this library resolver should fetch ++ * dependencies from ++ */ ++ public void addRepository(@NotNull RemoteRepository remoteRepository) { ++ this.repositories.add(remoteRepository); ++ } ++ ++ /** ++ * Resolves the provided dependencies and adds them to the library store. ++ * ++ * @param store the library store the then resolved and downloaded dependencies are registered into ++ * @throws LibraryLoadingException if resolving a dependency failed ++ */ ++ @Override ++ public void register(@NotNull LibraryStore store) throws LibraryLoadingException { ++ List repos = this.repository.newResolutionRepositories(this.session, this.repositories); ++ ++ DependencyResult result; ++ try { ++ result = this.repository.resolveDependencies(this.session, new DependencyRequest(new CollectRequest((Dependency) null, this.dependencies, repos), null)); ++ } catch (DependencyResolutionException ex) { ++ throw new LibraryLoadingException("Error resolving libraries", ex); ++ } ++ ++ for (ArtifactResult artifact : result.getArtifactResults()) { ++ File file = artifact.getArtifact().getFile(); ++ store.addLibrary(file.toPath()); ++ } ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/provider/classloader/ClassLoaderAccess.java b/src/main/java/io/papermc/paper/plugin/provider/classloader/ClassLoaderAccess.java +new file mode 100644 +index 0000000000000000000000000000000000000000..64e46fdfa4d404cb08c67a456e5990b729296b98 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/provider/classloader/ClassLoaderAccess.java +@@ -0,0 +1,34 @@ ++package io.papermc.paper.plugin.provider.classloader; ++ ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * The class loader access interface is an internal representation of a class accesses' ability to see types ++ * from other {@link ConfiguredPluginClassLoader}. ++ *

++ * An example of this would be a class loader access representing a plugin. The class loader access in that case would ++ * only return {@code true} on calls for {@link #canAccess(ConfiguredPluginClassLoader)} if the passed class loader ++ * is owned by a direct or transitive dependency of the plugin, preventing the plugin for accidentally discovering and ++ * using class types that are supplied by plugins/libraries the plugin did not actively define as a dependency. ++ */ ++@ApiStatus.Internal ++public interface ClassLoaderAccess { ++ ++ /** ++ * Evaluates if this class loader access is allowed to access types provided by the passed {@link ++ * ConfiguredPluginClassLoader}. ++ *

++ * This interface method does not offer any further contracts on the interface level, as the logic to determine ++ * what class loaders this class loader access is allowed to retrieve types from depends heavily on the type of ++ * access. ++ * Legacy spigot types for example may access any class loader available on the server, while modern paper plugins ++ * are properly limited to their dependency tree. ++ * ++ * @param classLoader the class loader for which access should be evaluated ++ * @return a plain boolean flag, {@code true} indicating that this class loader access is allowed to access types ++ * from the passed configured plugin class loader, {@code false} indicating otherwise. ++ */ ++ boolean canAccess(ConfiguredPluginClassLoader classLoader); ++ ++} +diff --git a/src/main/java/io/papermc/paper/plugin/provider/classloader/ConfiguredPluginClassLoader.java b/src/main/java/io/papermc/paper/plugin/provider/classloader/ConfiguredPluginClassLoader.java +new file mode 100644 +index 0000000000000000000000000000000000000000..ab1fb50912e411e708ba1e40303b1c08dabb086d +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/provider/classloader/ConfiguredPluginClassLoader.java +@@ -0,0 +1,63 @@ ++package io.papermc.paper.plugin.provider.classloader; ++ ++import io.papermc.paper.plugin.configuration.PluginMeta; ++import org.bukkit.plugin.java.JavaPlugin; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++import java.io.Closeable; ++import org.jetbrains.annotations.Nullable; ++ ++/** ++ * The configured plugin class loader represents an internal abstraction over the classloaders used by the server ++ * to load and access a plugins classes during runtime. ++ *

++ * It implements {@link Closeable} to define the ability to shutdown and close the classloader that implements this ++ * interface. ++ */ ++@ApiStatus.Internal ++public interface ConfiguredPluginClassLoader extends Closeable { ++ ++ /** ++ * Provides the configuration of the plugin that this plugin classloader provides type access to. ++ * ++ * @return the plugin meta instance, holding all meta information about the plugin instance. ++ */ ++ PluginMeta getConfiguration(); ++ ++ /** ++ * Attempts to load a class from this plugin class loader using the passed fully qualified name. ++ * This lookup logic can be configured through the following parameters to define how wide or how narrow the ++ * class lookup should be. ++ * ++ * @param name the fully qualified name of the class to load ++ * @param resolve whether the class should be resolved if needed or not ++ * @param checkGlobal whether this lookup should check transitive dependencies, including either the legacy spigot ++ * global class loader or the paper {@link PluginClassLoaderGroup} ++ * @param checkLibraries whether the defined libraries should be checked for the class or not ++ * @return the class found at the fully qualified class name passed under the passed restrictions ++ * @throws ClassNotFoundException if the class could not be found considering the passed restrictions ++ * @see ClassLoader#loadClass(String) ++ * @see Class#forName(String, boolean, ClassLoader) ++ */ ++ Class loadClass(@NotNull String name, ++ boolean resolve, ++ boolean checkGlobal, ++ boolean checkLibraries) throws ClassNotFoundException; ++ ++ /** ++ * Initializes both this configured plugin class loader and the java plugin passed to link to each other. ++ * This logic is to be called exactly once when the initial setup between the class loader and the instantiated ++ * {@link JavaPlugin} is loaded. ++ * ++ * @param plugin the {@link JavaPlugin} that should be interlinked with this class loader. ++ */ ++ void init(JavaPlugin plugin); ++ ++ /** ++ * Gets the plugin held by this class loader. ++ * ++ * @return the plugin or null if it doesn't exist yet ++ */ ++ @Nullable JavaPlugin getPlugin(); ++} +diff --git a/src/main/java/io/papermc/paper/plugin/provider/classloader/PaperClassLoaderStorage.java b/src/main/java/io/papermc/paper/plugin/provider/classloader/PaperClassLoaderStorage.java +new file mode 100644 +index 0000000000000000000000000000000000000000..fefc87d5ffd36b848a7adb326a3a741e9edb28df +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/provider/classloader/PaperClassLoaderStorage.java +@@ -0,0 +1,92 @@ ++package io.papermc.paper.plugin.provider.classloader; ++ ++import org.bukkit.plugin.java.PluginClassLoader; ++import org.jetbrains.annotations.ApiStatus; ++ ++/** ++ * The plugin classloader storage is an internal type that is used to manage existing classloaders on the server. ++ *

++ * The paper classloader storage is also responsible for storing added {@link ConfiguredPluginClassLoader}s into ++ * {@link PluginClassLoaderGroup}s, via {@link #registerOpenGroup(ConfiguredPluginClassLoader)}, ++ * {@link #registerSpigotGroup(PluginClassLoader)} and {@link ++ * #registerAccessBackedGroup(ConfiguredPluginClassLoader, ClassLoaderAccess)}. ++ *

++ * Groups are differentiated into the global group or plugin owned groups. ++ *

    ++ *
  • The global group holds all registered class loaders and merely exists to maintain backwards compatibility with ++ * spigots legacy classloader handling.
  • ++ *
  • The plugin groups only contains the classloaders that each plugin has access to and hence serves to properly ++ * separates unrelated classloaders.
  • ++ *
++ */ ++@ApiStatus.Internal ++public interface PaperClassLoaderStorage { ++ ++ /** ++ * Access to the shared instance of the {@link PaperClassLoaderStorageAccess}. ++ * ++ * @return the singleton instance of the {@link PaperClassLoaderStorage} used throughout the server ++ */ ++ static PaperClassLoaderStorage instance() { ++ return PaperClassLoaderStorageAccess.INSTANCE; ++ } ++ ++ /** ++ * Registers a legacy spigot {@link PluginClassLoader} into the loader storage, creating a group wrapping ++ * the single plugin class loader with transitive access to the global group. ++ * ++ * @param pluginClassLoader the legacy spigot plugin class loader to register ++ * @return the group the plugin class loader was placed into ++ */ ++ PluginClassLoaderGroup registerSpigotGroup(PluginClassLoader pluginClassLoader); ++ ++ /** ++ * Registers a paper configured plugin classloader into a new open group, with full access to the global ++ * plugin class loader group. ++ *

++ * This method hence allows the configured plugin class loader to access all other class loaders registered in this ++ * storage. ++ * ++ * @param classLoader the configured plugin class loader to register ++ * @return the group the plugin class loader was placed into ++ */ ++ PluginClassLoaderGroup registerOpenGroup(ConfiguredPluginClassLoader classLoader); ++ ++ /** ++ * Registers a paper configured classloader into a new, access backed group. ++ * The access backed classloader group, different from an open group, only has access to the classloaders ++ * the passed {@link ClassLoaderAccess} grants access to. ++ * ++ * @param classLoader the configured plugin class loader to register ++ * @param access the class loader access that defines what other classloaders the passed plugin class loader ++ * should be granted access to. ++ * @return the group the plugin class loader was placed into. ++ */ ++ PluginClassLoaderGroup registerAccessBackedGroup(ConfiguredPluginClassLoader classLoader, ClassLoaderAccess access); ++ ++ /** ++ * Unregisters a configured class loader from this storage. ++ * This removes the passed class loaders from any group it may have been a part of, including the global group. ++ *

++ * Note: this method is highly discouraged from being used, as mutation of the classloaders at runtime ++ * is not encouraged ++ * ++ * @param configuredPluginClassLoader the class loader to remove from this storage. ++ */ ++ void unregisterClassloader(ConfiguredPluginClassLoader configuredPluginClassLoader); ++ ++ /** ++ * Registers a configured plugin class loader directly into the global group without adding it to ++ * any existing groups. ++ *

++ * Note: this method unsafely injects the plugin classloader directly into the global group, which bypasses the ++ * group structure paper's plugin API introduced. This method should hence be used with caution. ++ * ++ * @param pluginLoader the configured plugin classloader instance that should be registered directly into the global ++ * group. ++ * @return a simple boolean flag, {@code true} if the classloader was registered or {@code false} if the classloader ++ * was already part of the global group. ++ */ ++ boolean registerUnsafePlugin(ConfiguredPluginClassLoader pluginLoader); ++ ++} +diff --git a/src/main/java/io/papermc/paper/plugin/provider/classloader/PaperClassLoaderStorageAccess.java b/src/main/java/io/papermc/paper/plugin/provider/classloader/PaperClassLoaderStorageAccess.java +new file mode 100644 +index 0000000000000000000000000000000000000000..2c0e5ba6f8eba7a632180491843071b8a8558e56 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/provider/classloader/PaperClassLoaderStorageAccess.java +@@ -0,0 +1,17 @@ ++package io.papermc.paper.plugin.provider.classloader; ++ ++import net.kyori.adventure.util.Services; ++ ++/** ++ * The paper classloader storage access acts as the holder for the server provided implementation of the ++ * {@link PaperClassLoaderStorage} interface. ++ */ ++class PaperClassLoaderStorageAccess { ++ ++ /** ++ * The shared instance of the {@link PaperClassLoaderStorage}, supplied through the {@link java.util.ServiceLoader} ++ * by the server. ++ */ ++ static final PaperClassLoaderStorage INSTANCE = Services.service(PaperClassLoaderStorage.class).orElseThrow(); ++ ++} +diff --git a/src/main/java/io/papermc/paper/plugin/provider/classloader/PluginClassLoaderGroup.java b/src/main/java/io/papermc/paper/plugin/provider/classloader/PluginClassLoaderGroup.java +new file mode 100644 +index 0000000000000000000000000000000000000000..885151cb932d9b8c09a7887edc879e154225f416 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/provider/classloader/PluginClassLoaderGroup.java +@@ -0,0 +1,65 @@ ++package io.papermc.paper.plugin.provider.classloader; ++ ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Contract; ++import org.jetbrains.annotations.Nullable; ++ ++/** ++ * A plugin classloader group represents a group of classloaders that a plugins classloader may access. ++ *

++ * An example of this would be a classloader group that holds all direct and transitive dependencies a plugin declared, ++ * allowing a plugins classloader to access classes included in these dependencies via this group. ++ */ ++@ApiStatus.Internal ++public interface PluginClassLoaderGroup { ++ ++ /** ++ * Attempts to find/load a class from this plugin class loader group using the passed fully qualified name ++ * in any of the classloaders that are part of this group. ++ *

++ * The lookup order across the contained loaders is not defined on the API level and depends purely on the ++ * implementation. ++ * ++ * @param name the fully qualified name of the class to load ++ * @param resolve whether the class should be resolved if needed or not ++ * @param requester plugin classloader that is requesting the class from this loader group ++ * @return the class found at the fully qualified class name passed. If the class could not be found, {@code null} ++ * will be returned. ++ * @see ConfiguredPluginClassLoader#loadClass(String, boolean, boolean, boolean) ++ */ ++ @Nullable ++ Class getClassByName(String name, boolean resolve, ConfiguredPluginClassLoader requester); ++ ++ /** ++ * Removes a configured plugin classloader from this class loader group. ++ * If the classloader is not currently in the list, this method will simply do nothing. ++ * ++ * @param configuredPluginClassLoader the plugin classloader to remove from the group ++ */ ++ @Contract(mutates = "this") ++ void remove(ConfiguredPluginClassLoader configuredPluginClassLoader); ++ ++ /** ++ * Adds the passed plugin classloader to this group, allowing this group to use it during ++ * {@link #getClassByName(String, boolean, ConfiguredPluginClassLoader)} lookups. ++ *

++ * This method does not query the {@link ClassLoaderAccess} (exposed via {@link #getAccess()}) to ensure ++ * if this group has access to the class loader passed. ++ * ++ * @param configuredPluginClassLoader the plugin classloader to add to this group. ++ */ ++ @Contract(mutates = "this") ++ void add(ConfiguredPluginClassLoader configuredPluginClassLoader); ++ ++ /** ++ * Provides the class loader access that guards and defines the content of this classloader group. ++ * While not guaranteed contractually (see {@link #add(ConfiguredPluginClassLoader)}), the access generally is ++ * responsible for defining which {@link ConfiguredPluginClassLoader}s should be part of this group and which ones ++ * should not. ++ * ++ * @return the classloader access governing which classloaders should be part of this group and which ones should ++ * not. ++ */ ++ ClassLoaderAccess getAccess(); ++ ++} +diff --git a/src/main/java/io/papermc/paper/plugin/provider/entrypoint/DependencyContext.java b/src/main/java/io/papermc/paper/plugin/provider/entrypoint/DependencyContext.java +new file mode 100644 +index 0000000000000000000000000000000000000000..44d630c3eb2670c36134b9907519dc986b3761b4 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/provider/entrypoint/DependencyContext.java +@@ -0,0 +1,48 @@ ++package io.papermc.paper.plugin.provider.entrypoint; ++ ++import io.papermc.paper.plugin.configuration.PluginMeta; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * A dependency context is a read-only abstraction of a type/concept that can resolve dependencies between plugins. ++ *

++ * This may for example be the server wide plugin manager itself, capable of validating if a dependency exists between ++ * two {@link PluginMeta} instances, however the implementation is not limited to such a concrete use-case. ++ */ ++@ApiStatus.Internal ++public interface DependencyContext { ++ ++ /** ++ * Computes if the passed {@link PluginMeta} defined the passed dependency as a transitive dependency. ++ * A transitive dependency, as implied by its name, may not have been configured directly by the passed plugin ++ * but could also simply be a dependency of a dependency. ++ *

++ * A simple example of this method would be ++ *

{@code
++     * dependencyContext.isTransitiveDependency(pluginMetaA, pluginMetaC);
++     * }
++ * which would return {@code true} if {@code pluginMetaA} directly or indirectly depends on {@code pluginMetaC}. ++ * ++ * @param plugin the plugin meta this computation should consider the requester of the dependency status for the ++ * passed potential dependency. ++ * @param depend the potential transitive dependency of the {@code plugin} parameter. ++ * @return a simple boolean flag indicating if {@code plugin} considers {@code depend} as a transitive dependency. ++ */ ++ boolean isTransitiveDependency(@NotNull PluginMeta plugin, @NotNull PluginMeta depend); ++ ++ /** ++ * Computes if this dependency context is aware of a dependency that provides/matches the passed identifier. ++ *

++ * A dependency in this methods context is any dependable artefact. It does not matter if anything actually depends ++ * on said artefact, its mere existence as a potential dependency is enough for this method to consider it a ++ * dependency. If this dependency context is hence aware of an artefact with the matching identifier, this ++ * method returns {@code true}. ++ * ++ * @param pluginIdentifier the unique identifier of the dependency with which to probe this dependency context. ++ * @return a plain boolean flag indicating if this dependency context is aware of a potential dependency with the ++ * passed identifier. ++ */ ++ boolean hasDependency(@NotNull String pluginIdentifier); ++ ++} +diff --git a/src/main/java/io/papermc/paper/plugin/provider/util/ProviderUtil.java b/src/main/java/io/papermc/paper/plugin/provider/util/ProviderUtil.java +new file mode 100644 +index 0000000000000000000000000000000000000000..6bf3d212a6156ad9ab0e82d1ca0a04f83f6e4b83 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/provider/util/ProviderUtil.java +@@ -0,0 +1,78 @@ ++package io.papermc.paper.plugin.provider.util; ++ ++import com.destroystokyo.paper.util.SneakyThrow; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; ++ ++/** ++ * An internal utility type that holds logic for loading a provider-like type from a classloaders. ++ * Provides, at least in the context of this utility, define themselves as implementations of a specific parent ++ * interface/type, e.g. {@link org.bukkit.plugin.java.JavaPlugin} and implement a no-args constructor. ++ */ ++@ApiStatus.Internal ++public class ProviderUtil { ++ ++ /** ++ * Loads the class found at the provided fully qualified class name from the passed classloader, creates a new ++ * instance of it using the no-args constructor, that should exist as per this method contract, and casts it to the ++ * provided parent type. ++ * ++ * @param clazz the fully qualified name of the class to load ++ * @param classType the parent type that the created object found at the {@code clazz} name should be cast to ++ * @param loader the loader from which the class should be loaded ++ * @param the generic type of the parent class the created object will be cast to ++ * @return the object instantiated from the class found at the provided FQN, cast to the parent type ++ */ ++ @NotNull ++ public static T loadClass(@NotNull String clazz, @NotNull Class classType, @NotNull ClassLoader loader) { ++ return loadClass(clazz, classType, loader, null); ++ } ++ ++ /** ++ * Loads the class found at the provided fully qualified class name from the passed classloader, creates a new ++ * instance of it using the no-args constructor, that should exist as per this method contract, and casts it to the ++ * provided parent type. ++ * ++ * @param clazz the fully qualified name of the class to load ++ * @param classType the parent type that the created object found at the {@code clazz} name should be cast to ++ * @param loader the loader from which the class should be loaded ++ * @param onError a runnable that is executed before any unknown exception is raised through a sneaky throw. ++ * @param the generic type of the parent class the created object will be cast to ++ * @return the object instantiated from the class found at the provided fully qualified class name, cast to the ++ * parent type ++ */ ++ @NotNull ++ public static T loadClass(@NotNull String clazz, @NotNull Class classType, @NotNull ClassLoader loader, @Nullable Runnable onError) { ++ try { ++ T clazzInstance; ++ ++ try { ++ Class jarClass = Class.forName(clazz, true, loader); ++ ++ Class pluginClass; ++ try { ++ pluginClass = jarClass.asSubclass(classType); ++ } catch (ClassCastException ex) { ++ throw new ClassCastException("class '%s' does not extend '%s'".formatted(clazz, classType)); ++ } ++ ++ clazzInstance = pluginClass.getDeclaredConstructor().newInstance(); ++ } catch (IllegalAccessException exception) { ++ throw new RuntimeException("No public constructor"); ++ } catch (InstantiationException exception) { ++ throw new RuntimeException("Abnormal class instantiation", exception); ++ } ++ ++ return clazzInstance; ++ } catch (Throwable e) { ++ if (onError != null) { ++ onError.run(); ++ } ++ SneakyThrow.sneaky(e); ++ } ++ ++ throw new AssertionError(); // Shouldn't happen ++ } ++ ++} +diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java +index 876072a6c91bd02c9c7de53556419b8e1ac48f27..dc9a4f12d9f05a3ae7c9f1c7648123e4b3dfd115 100644 +--- a/src/main/java/org/bukkit/UnsafeValues.java ++++ b/src/main/java/org/bukkit/UnsafeValues.java +@@ -96,4 +96,14 @@ public interface UnsafeValues { + String getTranslationKey(EntityType entityType); + + String getTranslationKey(ItemStack itemStack); ++ ++ // Paper start ++ @Deprecated(forRemoval = true) ++ boolean isSupportedApiVersion(String apiVersion); ++ ++ @Deprecated(forRemoval = true) ++ static boolean isLegacyPlugin(org.bukkit.plugin.Plugin plugin) { ++ return !Bukkit.getUnsafe().isSupportedApiVersion(plugin.getDescription().getAPIVersion()); ++ } ++ // Paper end + } +diff --git a/src/main/java/org/bukkit/command/PluginCommand.java b/src/main/java/org/bukkit/command/PluginCommand.java +index 1dbbc244309043b18c1d71707c4fb066c0d0e02d..551c5af6a7bfa2268cbc63be8e70d129bccaa912 100644 +--- a/src/main/java/org/bukkit/command/PluginCommand.java ++++ b/src/main/java/org/bukkit/command/PluginCommand.java +@@ -14,7 +14,7 @@ public final class PluginCommand extends Command implements PluginIdentifiableCo + private CommandExecutor executor; + private TabCompleter completer; + +- protected PluginCommand(@NotNull String name, @NotNull Plugin owner) { ++ PluginCommand(@NotNull String name, @NotNull Plugin owner) { + super(name); + this.executor = owner; + this.owningPlugin = owner; +diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java +index e195e74c48c69047aa825b75fad95419c505b41f..53f28c9e6843991486a576d41b6641c170589807 100644 +--- a/src/main/java/org/bukkit/command/SimpleCommandMap.java ++++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java +@@ -34,7 +34,7 @@ public class SimpleCommandMap implements CommandMap { + private void setDefaultCommands() { + register("bukkit", new VersionCommand("version")); + register("bukkit", new ReloadCommand("reload")); +- register("bukkit", new PluginsCommand("plugins")); ++ //register("bukkit", new PluginsCommand("plugins")); // Paper + register("bukkit", new TimingsCommand("timings")); + } + +diff --git a/src/main/java/org/bukkit/plugin/Plugin.java b/src/main/java/org/bukkit/plugin/Plugin.java +index b37938745f916b5f0111b07b1a1c97527f026e9d..8c76716249e44ed8bf6be94c1f5c7b6d9bb35be2 100644 +--- a/src/main/java/org/bukkit/plugin/Plugin.java ++++ b/src/main/java/org/bukkit/plugin/Plugin.java +@@ -30,10 +30,21 @@ public interface Plugin extends TabExecutor { + * Returns the plugin.yaml file containing the details for this plugin + * + * @return Contents of the plugin.yaml file ++ * @deprecated May be inaccurate due to different plugin implementations. ++ * @see Plugin#getPluginMeta() + */ ++ @Deprecated // Paper + @NotNull + public PluginDescriptionFile getDescription(); + ++ // Paper start ++ /** ++ * Gets the plugin meta for this plugin. ++ * @return configuration ++ */ ++ @NotNull ++ io.papermc.paper.plugin.configuration.PluginMeta getPluginMeta(); ++ // Paper end + /** + * Gets a {@link FileConfiguration} for this plugin, read through + * "config.yml" +@@ -94,6 +105,7 @@ public interface Plugin extends TabExecutor { + * + * @return PluginLoader that controls this plugin + */ ++ @Deprecated(forRemoval = true) // Paper - The PluginLoader system will not function in the near future + @NotNull + public PluginLoader getPluginLoader(); + +diff --git a/src/main/java/org/bukkit/plugin/PluginBase.java b/src/main/java/org/bukkit/plugin/PluginBase.java +index 94f8ceb965cecb5669a84a0ec61c0f706c2a2673..e773db6da357ad210eb24d4c389af2dc84ce450a 100644 +--- a/src/main/java/org/bukkit/plugin/PluginBase.java ++++ b/src/main/java/org/bukkit/plugin/PluginBase.java +@@ -31,6 +31,6 @@ public abstract class PluginBase implements Plugin { + @Override + @NotNull + public final String getName() { +- return getDescription().getName(); ++ return getPluginMeta().getName(); // Paper + } + } +diff --git a/src/main/java/org/bukkit/plugin/PluginDescriptionFile.java b/src/main/java/org/bukkit/plugin/PluginDescriptionFile.java +index 0c9f4d1e9104fa6951114c1f9ec954dfcc749196..f1ae66989afaa433bf2896e0bfe2cea472f774d8 100644 +--- a/src/main/java/org/bukkit/plugin/PluginDescriptionFile.java ++++ b/src/main/java/org/bukkit/plugin/PluginDescriptionFile.java +@@ -194,7 +194,7 @@ import org.yaml.snakeyaml.nodes.Tag; + * inferno.burningdeaths: true + * + */ +-public final class PluginDescriptionFile { ++public final class PluginDescriptionFile implements io.papermc.paper.plugin.configuration.PluginMeta { // Paper + private static final Pattern VALID_NAME = Pattern.compile("^[A-Za-z0-9 _.-]+$"); + private static final ThreadLocal YAML = new ThreadLocal() { + @Override +@@ -254,6 +254,70 @@ public final class PluginDescriptionFile { + private Set awareness = ImmutableSet.of(); + private String apiVersion = null; + private List libraries = ImmutableList.of(); ++ // Paper start - oh my goddddd ++ /** ++ * Don't use this. ++ */ ++ @org.jetbrains.annotations.ApiStatus.Internal ++ public PluginDescriptionFile(String rawName, String name, List provides, String main, String classLoaderOf, List depend, List softDepend, List loadBefore, String version, Map> commands, String description, List authors, List contributors, String website, String prefix, PluginLoadOrder order, List permissions, PermissionDefault defaultPerm, Set awareness, String apiVersion, List libraries) { ++ this.rawName = rawName; ++ this.name = name; ++ this.provides = provides; ++ this.main = main; ++ this.classLoaderOf = classLoaderOf; ++ this.depend = depend; ++ this.softDepend = softDepend; ++ this.loadBefore = loadBefore; ++ this.version = version; ++ this.commands = commands; ++ this.description = description; ++ this.authors = authors; ++ this.contributors = contributors; ++ this.website = website; ++ this.prefix = prefix; ++ this.order = order; ++ this.permissions = permissions; ++ this.defaultPerm = defaultPerm; ++ this.awareness = awareness; ++ this.apiVersion = apiVersion; ++ this.libraries = libraries; ++ } ++ ++ @Override ++ public @NotNull String getMainClass() { ++ return this.main; ++ } ++ ++ @Override ++ public @NotNull PluginLoadOrder getLoadOrder() { ++ return this.order; ++ } ++ ++ @Override ++ public @Nullable String getLoggerPrefix() { ++ return this.prefix; ++ } ++ ++ @Override ++ public @NotNull List getPluginDependencies() { ++ return this.depend; ++ } ++ ++ @Override ++ public @NotNull List getPluginSoftDependencies() { ++ return this.softDepend; ++ } ++ ++ @Override ++ public @NotNull List getLoadBeforePlugins() { ++ return this.loadBefore; ++ } ++ ++ @Override ++ public @NotNull List getProvidedPlugins() { ++ return this.provides; ++ } ++ // Paper end + + public PluginDescriptionFile(@NotNull final InputStream stream) throws InvalidDescriptionException { + loadMap(asMap(YAML.get().load(stream))); +diff --git a/src/main/java/org/bukkit/plugin/PluginLoader.java b/src/main/java/org/bukkit/plugin/PluginLoader.java +index a88733f1cd1ddb5d85ab1b0e6af4fd5b80bbc1c6..cb530369e667c426c842da356c31304bb5c3ecfa 100644 +--- a/src/main/java/org/bukkit/plugin/PluginLoader.java ++++ b/src/main/java/org/bukkit/plugin/PluginLoader.java +@@ -12,6 +12,7 @@ import org.jetbrains.annotations.NotNull; + * Represents a plugin loader, which handles direct access to specific types + * of plugins + */ ++@Deprecated(forRemoval = true) // Paper - The PluginLoader system will not function in the near future + public interface PluginLoader { + + /** +diff --git a/src/main/java/org/bukkit/plugin/PluginManager.java b/src/main/java/org/bukkit/plugin/PluginManager.java +index 41e26451fe12d8e6e0ef73c85731b24b4e3f200c..03213fde8315384ec56c16031cfc606ade2e8091 100644 +--- a/src/main/java/org/bukkit/plugin/PluginManager.java ++++ b/src/main/java/org/bukkit/plugin/PluginManager.java +@@ -14,7 +14,7 @@ import org.jetbrains.annotations.Nullable; + /** + * Handles all plugin management from the Server + */ +-public interface PluginManager { ++public interface PluginManager extends io.papermc.paper.plugin.PermissionManager { // Paper + + /** + * Registers the specified plugin loader +@@ -23,6 +23,7 @@ public interface PluginManager { + * @throws IllegalArgumentException Thrown when the given Class is not a + * valid PluginLoader + */ ++ @Deprecated(forRemoval = true) // Paper - The PluginLoader system will not function in the near future + public void registerInterface(@NotNull Class loader) throws IllegalArgumentException; + + /** +@@ -303,4 +304,17 @@ public interface PluginManager { + * @return True if event timings are to be used + */ + public boolean useTimings(); ++ ++ // Paper start ++ @org.jetbrains.annotations.ApiStatus.Internal ++ boolean isTransitiveDependency(io.papermc.paper.plugin.configuration.PluginMeta pluginMeta, io.papermc.paper.plugin.configuration.PluginMeta dependencyConfig); ++ ++ /** ++ * Sets the permission manager to be used for this server. ++ * ++ * @param permissionManager permission manager ++ */ ++ @org.jetbrains.annotations.ApiStatus.Experimental ++ void overridePermissionManager(@NotNull Plugin plugin, @Nullable io.papermc.paper.plugin.PermissionManager permissionManager); ++ // Paper end + } +diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java +index a69c5d5cad6168aeaae41e8adc319dc8c976b1e2..f64a90241ce7f73e111e6b5ac6ff87cd93583c0e 100644 +--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java ++++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java +@@ -43,6 +43,8 @@ import org.jetbrains.annotations.Nullable; + /** + * Handles all plugin management from the Server + */ ++@Deprecated(forRemoval = true) // Paper - This implementation may be replaced in a future version of Paper. ++// Plugins may still reflect into this class to modify permission logic for the time being. + public final class SimplePluginManager implements PluginManager { + private final Server server; + private final Map fileAssociations = new HashMap(); +@@ -51,10 +53,13 @@ public final class SimplePluginManager implements PluginManager { + private MutableGraph dependencyGraph = GraphBuilder.directed().build(); + private File updateDirectory; + private final SimpleCommandMap commandMap; +- private final Map permissions = new HashMap(); +- private final Map> defaultPerms = new LinkedHashMap>(); +- private final Map> permSubs = new HashMap>(); +- private final Map> defSubs = new HashMap>(); ++ // Paper start ++ public final Map permissions = new HashMap(); ++ public final Map> defaultPerms = new LinkedHashMap>(); ++ public final Map> permSubs = new HashMap>(); ++ public final Map> defSubs = new HashMap>(); ++ public PluginManager paperPluginManager; ++ // Paper end + private boolean useTimings = false; + + public SimplePluginManager(@NotNull Server instance, @NotNull SimpleCommandMap commandMap) { +@@ -111,6 +116,11 @@ public final class SimplePluginManager implements PluginManager { + @Override + @NotNull + public Plugin[] loadPlugins(@NotNull File directory) { ++ if (true) { ++ List pluginList = new ArrayList<>(); ++ java.util.Collections.addAll(pluginList, this.paperPluginManager.loadPlugins(directory)); ++ return pluginList.toArray(new Plugin[0]); ++ } + Preconditions.checkArgument(directory != null, "Directory cannot be null"); + Preconditions.checkArgument(directory.isDirectory(), "Directory must be a directory"); + +@@ -378,6 +388,15 @@ public final class SimplePluginManager implements PluginManager { + @Nullable + public synchronized Plugin loadPlugin(@NotNull File file) throws InvalidPluginException, UnknownDependencyException { + Preconditions.checkArgument(file != null, "File cannot be null"); ++ // Paper start ++ if (true) { ++ try { ++ return this.paperPluginManager.loadPlugin(file); ++ } catch (org.bukkit.plugin.InvalidDescriptionException ignored) { ++ return null; ++ } ++ } ++ // Paper end + + checkUpdate(file); + +@@ -428,12 +447,14 @@ public final class SimplePluginManager implements PluginManager { + @Override + @Nullable + public synchronized Plugin getPlugin(@NotNull String name) { ++ if (true) {return this.paperPluginManager.getPlugin(name);} // Paper + return lookupNames.get(name.replace(' ', '_')); + } + + @Override + @NotNull + public synchronized Plugin[] getPlugins() { ++ if (true) {return this.paperPluginManager.getPlugins();} // Paper + return plugins.toArray(new Plugin[plugins.size()]); + } + +@@ -447,6 +468,7 @@ public final class SimplePluginManager implements PluginManager { + */ + @Override + public boolean isPluginEnabled(@NotNull String name) { ++ if (true) {return this.paperPluginManager.isPluginEnabled(name);} // Paper + Plugin plugin = getPlugin(name); + + return isPluginEnabled(plugin); +@@ -460,6 +482,7 @@ public final class SimplePluginManager implements PluginManager { + */ + @Override + public boolean isPluginEnabled(@Nullable Plugin plugin) { ++ if (true) {return this.paperPluginManager.isPluginEnabled(plugin);} // Paper + if ((plugin != null) && (plugins.contains(plugin))) { + return plugin.isEnabled(); + } else { +@@ -469,6 +492,7 @@ public final class SimplePluginManager implements PluginManager { + + @Override + public void enablePlugin(@NotNull final Plugin plugin) { ++ if (true) {this.paperPluginManager.enablePlugin(plugin); return;} // Paper + if (!plugin.isEnabled()) { + List pluginCommands = PluginCommandYamlParser.parse(plugin); + +@@ -488,6 +512,7 @@ public final class SimplePluginManager implements PluginManager { + + @Override + public void disablePlugins() { ++ if (true) {this.paperPluginManager.disablePlugins(); return;} // Paper + Plugin[] plugins = getPlugins(); + for (int i = plugins.length - 1; i >= 0; i--) { + disablePlugin(plugins[i]); +@@ -496,6 +521,7 @@ public final class SimplePluginManager implements PluginManager { + + @Override + public void disablePlugin(@NotNull final Plugin plugin) { ++ if (true) {this.paperPluginManager.disablePlugin(plugin); return;} // Paper + if (plugin.isEnabled()) { + try { + plugin.getPluginLoader().disablePlugin(plugin); +@@ -540,6 +566,7 @@ public final class SimplePluginManager implements PluginManager { + + @Override + public void clearPlugins() { ++ if (true) {this.paperPluginManager.clearPlugins(); return;} // Paper + synchronized (this) { + disablePlugins(); + plugins.clear(); +@@ -560,6 +587,7 @@ public final class SimplePluginManager implements PluginManager { + */ + @Override + public void callEvent(@NotNull Event event) { ++ if (true) {this.paperPluginManager.callEvent(event); return;} // Paper + if (event.isAsynchronous()) { + if (Thread.holdsLock(this)) { + throw new IllegalStateException(event.getEventName() + " cannot be triggered asynchronously from inside synchronized code."); +@@ -608,6 +636,7 @@ public final class SimplePluginManager implements PluginManager { + + @Override + public void registerEvents(@NotNull Listener listener, @NotNull Plugin plugin) { ++ if (true) {this.paperPluginManager.registerEvents(listener, plugin); return;} // Paper + if (!plugin.isEnabled()) { + throw new IllegalPluginAccessException("Plugin attempted to register " + listener + " while not enabled"); + } +@@ -641,6 +670,7 @@ public final class SimplePluginManager implements PluginManager { + Preconditions.checkArgument(priority != null, "Priority cannot be null"); + Preconditions.checkArgument(executor != null, "Executor cannot be null"); + Preconditions.checkArgument(plugin != null, "Plugin cannot be null"); ++ if (true) {this.paperPluginManager.registerEvent(event, listener, priority, executor, plugin); return;} // Paper + + if (!plugin.isEnabled()) { + throw new IllegalPluginAccessException("Plugin attempted to register " + event + " while not enabled"); +@@ -688,16 +718,19 @@ public final class SimplePluginManager implements PluginManager { + @Override + @Nullable + public Permission getPermission(@NotNull String name) { ++ if (true) {return this.paperPluginManager.getPermission(name);} // Paper + return permissions.get(name.toLowerCase(java.util.Locale.ENGLISH)); + } + + @Override + public void addPermission(@NotNull Permission perm) { ++ if (true) {this.paperPluginManager.addPermission(perm); return;} // Paper + addPermission(perm, true); + } + + @Deprecated + public void addPermission(@NotNull Permission perm, boolean dirty) { ++ if (true) {this.paperPluginManager.addPermission(perm); return;} // Paper - This just has a performance implication, use the better api to avoid this. + String name = perm.getName().toLowerCase(java.util.Locale.ENGLISH); + + if (permissions.containsKey(name)) { +@@ -711,21 +744,25 @@ public final class SimplePluginManager implements PluginManager { + @Override + @NotNull + public Set getDefaultPermissions(boolean op) { ++ if (true) {return this.paperPluginManager.getDefaultPermissions(op);} // Paper + return ImmutableSet.copyOf(defaultPerms.get(op)); + } + + @Override + public void removePermission(@NotNull Permission perm) { ++ if (true) {this.paperPluginManager.removePermission(perm); return;} // Paper + removePermission(perm.getName()); + } + + @Override + public void removePermission(@NotNull String name) { ++ if (true) {this.paperPluginManager.removePermission(name); return;} // Paper + permissions.remove(name.toLowerCase(java.util.Locale.ENGLISH)); + } + + @Override + public void recalculatePermissionDefaults(@NotNull Permission perm) { ++ if (true) {this.paperPluginManager.recalculatePermissionDefaults(perm); return;} // Paper + if (perm != null && permissions.containsKey(perm.getName().toLowerCase(java.util.Locale.ENGLISH))) { + defaultPerms.get(true).remove(perm); + defaultPerms.get(false).remove(perm); +@@ -765,6 +802,7 @@ public final class SimplePluginManager implements PluginManager { + + @Override + public void subscribeToPermission(@NotNull String permission, @NotNull Permissible permissible) { ++ if (true) {this.paperPluginManager.subscribeToPermission(permission, permissible); return;} // Paper + String name = permission.toLowerCase(java.util.Locale.ENGLISH); + Map map = permSubs.get(name); + +@@ -778,6 +816,7 @@ public final class SimplePluginManager implements PluginManager { + + @Override + public void unsubscribeFromPermission(@NotNull String permission, @NotNull Permissible permissible) { ++ if (true) {this.paperPluginManager.unsubscribeFromPermission(permission, permissible); return;} // Paper + String name = permission.toLowerCase(java.util.Locale.ENGLISH); + Map map = permSubs.get(name); + +@@ -793,6 +832,7 @@ public final class SimplePluginManager implements PluginManager { + @Override + @NotNull + public Set getPermissionSubscriptions(@NotNull String permission) { ++ if (true) {return this.paperPluginManager.getPermissionSubscriptions(permission);} // Paper + String name = permission.toLowerCase(java.util.Locale.ENGLISH); + Map map = permSubs.get(name); + +@@ -805,6 +845,7 @@ public final class SimplePluginManager implements PluginManager { + + @Override + public void subscribeToDefaultPerms(boolean op, @NotNull Permissible permissible) { ++ if (true) {this.paperPluginManager.subscribeToDefaultPerms(op, permissible); return;} // Paper + Map map = defSubs.get(op); + + if (map == null) { +@@ -817,6 +858,7 @@ public final class SimplePluginManager implements PluginManager { + + @Override + public void unsubscribeFromDefaultPerms(boolean op, @NotNull Permissible permissible) { ++ if (true) {this.paperPluginManager.unsubscribeFromDefaultPerms(op, permissible); return;} // Paper + Map map = defSubs.get(op); + + if (map != null) { +@@ -831,6 +873,7 @@ public final class SimplePluginManager implements PluginManager { + @Override + @NotNull + public Set getDefaultPermSubscriptions(boolean op) { ++ if (true) {return this.paperPluginManager.getDefaultPermSubscriptions(op);} // Paper + Map map = defSubs.get(op); + + if (map == null) { +@@ -843,6 +886,7 @@ public final class SimplePluginManager implements PluginManager { + @Override + @NotNull + public Set getPermissions() { ++ if (true) {return this.paperPluginManager.getPermissions();} // Paper + return new HashSet(permissions.values()); + } + +@@ -866,6 +910,7 @@ public final class SimplePluginManager implements PluginManager { + + @Override + public boolean useTimings() { ++ if (true) {return this.paperPluginManager.useTimings();} // Paper + return useTimings; + } + +@@ -877,4 +922,28 @@ public final class SimplePluginManager implements PluginManager { + public void useTimings(boolean use) { + useTimings = use; + } ++ ++ // Paper start ++ public void clearPermissions() { ++ if (true) {this.paperPluginManager.clearPermissions(); return;} // Paper ++ permissions.clear(); ++ defaultPerms.get(true).clear(); ++ defaultPerms.get(false).clear(); ++ } ++ ++ @Override ++ public boolean isTransitiveDependency(io.papermc.paper.plugin.configuration.PluginMeta pluginMeta, io.papermc.paper.plugin.configuration.PluginMeta dependencyConfig) { ++ return this.paperPluginManager.isTransitiveDependency(pluginMeta, dependencyConfig); ++ } ++ ++ @Override ++ public void overridePermissionManager(@NotNull Plugin plugin, @Nullable io.papermc.paper.plugin.PermissionManager permissionManager) { ++ this.paperPluginManager.overridePermissionManager(plugin, permissionManager); ++ } ++ ++ @Override ++ public void addPermissions(@NotNull List perm) { ++ this.paperPluginManager.addPermissions(perm); ++ } ++ // Paper end + } +diff --git a/src/main/java/org/bukkit/plugin/UnknownDependencyException.java b/src/main/java/org/bukkit/plugin/UnknownDependencyException.java +index a80251eff75430863b37db1c131e22593f3fcd5e..310c4041963a3f1e0a26e39a6da12a9bfdb51edc 100644 +--- a/src/main/java/org/bukkit/plugin/UnknownDependencyException.java ++++ b/src/main/java/org/bukkit/plugin/UnknownDependencyException.java +@@ -43,4 +43,16 @@ public class UnknownDependencyException extends RuntimeException { + public UnknownDependencyException() { + + } ++ // Paper start ++ /** ++ * Create a new {@link UnknownDependencyException} with a message informing ++ * about which dependencies are missing for what plugin. ++ * ++ * @param missingDependencies missing dependencies ++ * @param pluginName plugin which is missing said dependencies ++ */ ++ public UnknownDependencyException(final @org.jetbrains.annotations.NotNull java.util.Collection missingDependencies, final @org.jetbrains.annotations.NotNull String pluginName) { ++ this("Unknown/missing dependency plugins: [" + String.join(", ", missingDependencies) + "]. Please download and install these plugins to run '" + pluginName + "'."); ++ } ++ // Paper end + } +diff --git a/src/main/java/org/bukkit/plugin/java/JavaPlugin.java b/src/main/java/org/bukkit/plugin/java/JavaPlugin.java +index 669a70faa95d0d6525a731d73499ed6fb0b48320..c9cf9d361a1289aba383718733a2098b5eafb38f 100644 +--- a/src/main/java/org/bukkit/plugin/java/JavaPlugin.java ++++ b/src/main/java/org/bukkit/plugin/java/JavaPlugin.java +@@ -38,6 +38,7 @@ public abstract class JavaPlugin extends PluginBase { + private Server server = null; + private File file = null; + private PluginDescriptionFile description = null; ++ private io.papermc.paper.plugin.configuration.PluginMeta pluginMeta = null; // Paper + private File dataFolder = null; + private ClassLoader classLoader = null; + private boolean naggable = true; +@@ -46,13 +47,16 @@ public abstract class JavaPlugin extends PluginBase { + private PluginLogger logger = null; + + public JavaPlugin() { +- final ClassLoader classLoader = this.getClass().getClassLoader(); +- if (!(classLoader instanceof PluginClassLoader)) { +- throw new IllegalStateException("JavaPlugin requires " + PluginClassLoader.class.getName()); ++ // Paper start ++ if (this.getClass().getClassLoader() instanceof io.papermc.paper.plugin.provider.classloader.ConfiguredPluginClassLoader configuredPluginClassLoader) { ++ configuredPluginClassLoader.init(this); ++ } else { ++ throw new IllegalStateException("JavaPlugin requires to be created by a valid classloader."); + } +- ((PluginClassLoader) classLoader).initialize(this); ++ // Paper end + } + ++ @Deprecated(forRemoval = true) // Paper + protected JavaPlugin(@NotNull final JavaPluginLoader loader, @NotNull final PluginDescriptionFile description, @NotNull final File dataFolder, @NotNull final File file) { + final ClassLoader classLoader = this.getClass().getClassLoader(); + if (classLoader instanceof PluginClassLoader) { +@@ -77,9 +81,12 @@ public abstract class JavaPlugin extends PluginBase { + * Gets the associated PluginLoader responsible for this plugin + * + * @return PluginLoader that controls this plugin ++ * @deprecated Plugin loading now occurs at a point which makes it impossible to expose this ++ * behavior. This instance will only throw unsupported operation exceptions. + */ + @NotNull + @Override ++ @Deprecated(forRemoval = true) // Paper + public final PluginLoader getPluginLoader() { + return loader; + } +@@ -120,13 +127,20 @@ public abstract class JavaPlugin extends PluginBase { + * Returns the plugin.yaml file containing the details for this plugin + * + * @return Contents of the plugin.yaml file ++ * @deprecated No longer applicable to all types of plugins + */ + @NotNull + @Override ++ @Deprecated + public final PluginDescriptionFile getDescription() { + return description; + } + ++ @Nullable ++ public final io.papermc.paper.plugin.configuration.PluginMeta getPluginMeta() { ++ return this.pluginMeta; ++ } ++ + @NotNull + @Override + public FileConfiguration getConfig() { +@@ -256,7 +270,8 @@ public abstract class JavaPlugin extends PluginBase { + * + * @param enabled true if enabled, otherwise false + */ +- protected final void setEnabled(final boolean enabled) { ++ @org.jetbrains.annotations.ApiStatus.Internal // Paper ++ public final void setEnabled(final boolean enabled) { // Paper + if (isEnabled != enabled) { + isEnabled = enabled; + +@@ -268,9 +283,18 @@ public abstract class JavaPlugin extends PluginBase { + } + } + +- +- final void init(@NotNull PluginLoader loader, @NotNull Server server, @NotNull PluginDescriptionFile description, @NotNull File dataFolder, @NotNull File file, @NotNull ClassLoader classLoader) { +- this.loader = loader; ++ // Paper start ++ private static class DummyPluginLoaderImplHolder { ++ private static final PluginLoader INSTANCE = net.kyori.adventure.util.Services.service(PluginLoader.class) ++ .orElseThrow(); ++ } ++ public final void init(@NotNull PluginLoader loader, @NotNull Server server, @NotNull PluginDescriptionFile description, @NotNull File dataFolder, @NotNull File file, @NotNull ClassLoader classLoader) { ++ init(server, description, dataFolder, file, classLoader, description); ++ this.pluginMeta = description; ++ } ++ public final void init(@NotNull Server server, @NotNull PluginDescriptionFile description, @NotNull File dataFolder, @NotNull File file, @NotNull ClassLoader classLoader, @Nullable io.papermc.paper.plugin.configuration.PluginMeta configuration) { ++ // Paper end ++ this.loader = DummyPluginLoaderImplHolder.INSTANCE; // Paper + this.server = server; + this.file = file; + this.description = description; +@@ -278,6 +302,7 @@ public abstract class JavaPlugin extends PluginBase { + this.classLoader = classLoader; + this.configFile = new File(dataFolder, "config.yml"); + this.logger = new PluginLogger(this); ++ this.pluginMeta = configuration; // Paper + } + + /** +@@ -394,10 +419,10 @@ public abstract class JavaPlugin extends PluginBase { + throw new IllegalArgumentException(clazz + " does not extend " + JavaPlugin.class); + } + final ClassLoader cl = clazz.getClassLoader(); +- if (!(cl instanceof PluginClassLoader)) { +- throw new IllegalArgumentException(clazz + " is not initialized by " + PluginClassLoader.class); ++ if (!(cl instanceof io.papermc.paper.plugin.provider.classloader.ConfiguredPluginClassLoader configuredPluginClassLoader)) { // Paper ++ throw new IllegalArgumentException(clazz + " is not initialized by a " + io.papermc.paper.plugin.provider.classloader.ConfiguredPluginClassLoader.class); // Paper + } +- JavaPlugin plugin = ((PluginClassLoader) cl).plugin; ++ JavaPlugin plugin = configuredPluginClassLoader.getPlugin(); // Paper + if (plugin == null) { + throw new IllegalStateException("Cannot get plugin for " + clazz + " from a static initializer"); + } +@@ -420,10 +445,10 @@ public abstract class JavaPlugin extends PluginBase { + public static JavaPlugin getProvidingPlugin(@NotNull Class clazz) { + Preconditions.checkArgument(clazz != null, "Null class cannot have a plugin"); + final ClassLoader cl = clazz.getClassLoader(); +- if (!(cl instanceof PluginClassLoader)) { +- throw new IllegalArgumentException(clazz + " is not provided by " + PluginClassLoader.class); ++ if (!(cl instanceof io.papermc.paper.plugin.provider.classloader.ConfiguredPluginClassLoader configuredPluginClassLoader)) { // Paper ++ throw new IllegalArgumentException(clazz + " is not provided by a " + io.papermc.paper.plugin.provider.classloader.ConfiguredPluginClassLoader.class); // Paper + } +- JavaPlugin plugin = ((PluginClassLoader) cl).plugin; ++ JavaPlugin plugin = configuredPluginClassLoader.getPlugin(); // Paper + if (plugin == null) { + throw new IllegalStateException("Cannot get plugin for " + clazz + " from a static initializer"); + } +diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +index 047c0304fd617cec990f80815b43916c6ef5a94c..fa39c93d76ebb9eecce1f4b5203cb361e4778b4f 100644 +--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java ++++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +@@ -49,6 +49,7 @@ import org.yaml.snakeyaml.error.YAMLException; + /** + * Represents a Java plugin loader, allowing plugins in the form of .jar + */ ++@Deprecated(forRemoval = true) // Paper - The PluginLoader system will not function in the near future. This implementation will be moved. + public final class JavaPluginLoader implements PluginLoader { + final Server server; + private final Pattern[] fileFilters = new Pattern[]{Pattern.compile("\\.jar$")}; +@@ -79,6 +80,7 @@ public final class JavaPluginLoader implements PluginLoader { + @Override + @NotNull + public Plugin loadPlugin(@NotNull final File file) throws InvalidPluginException { ++ if (true) throw new UnsupportedOperationException(); // Paper + Preconditions.checkArgument(file != null, "File cannot be null"); + + if (!file.exists()) { +@@ -142,7 +144,7 @@ public final class JavaPluginLoader implements PluginLoader { + + final PluginClassLoader loader; + try { +- loader = new PluginClassLoader(this, getClass().getClassLoader(), description, dataFolder, file, (libraryLoader != null) ? libraryLoader.createLoader(description) : null); ++ loader = new PluginClassLoader(getClass().getClassLoader(), description, dataFolder, file, (libraryLoader != null) ? libraryLoader.createLoader(description) : null); // Paper + } catch (InvalidPluginException ex) { + throw ex; + } catch (Throwable ex) { +diff --git a/src/main/java/org/bukkit/plugin/java/LibraryLoader.java b/src/main/java/org/bukkit/plugin/java/LibraryLoader.java +index 6d634b0ea813ccb19f1562a7d0e5a59cea4eab21..f9e67e20133d349e43d126dbb48b34d4d9aceb4c 100644 +--- a/src/main/java/org/bukkit/plugin/java/LibraryLoader.java ++++ b/src/main/java/org/bukkit/plugin/java/LibraryLoader.java +@@ -36,7 +36,10 @@ import org.eclipse.aether.transport.http.HttpTransporterFactory; + import org.jetbrains.annotations.NotNull; + import org.jetbrains.annotations.Nullable; + +-class LibraryLoader ++// Paper start ++@org.jetbrains.annotations.ApiStatus.Internal ++public class LibraryLoader ++// Paper end + { + + private final Logger logger; +diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java +index 2f74ec96ece706de23156ebabfe493211bc05391..dd569f2fc6098650d202e834b343b1bff2d42284 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; + /** + * A ClassLoader for plugins, to allow shared classes across multiple plugins + */ +-final class PluginClassLoader extends URLClassLoader { ++@org.jetbrains.annotations.ApiStatus.Internal // Paper ++public final class PluginClassLoader extends URLClassLoader implements io.papermc.paper.plugin.provider.classloader.ConfiguredPluginClassLoader { // Paper + private final JavaPluginLoader loader; + private final Map> classes = new ConcurrentHashMap>(); + private final PluginDescriptionFile description; +@@ -43,16 +44,18 @@ final class PluginClassLoader extends URLClassLoader { + private JavaPlugin pluginInit; + private IllegalStateException pluginState; + private final Set seenIllegalAccess = Collections.newSetFromMap(new ConcurrentHashMap<>()); ++ private java.util.logging.Logger logger; // Paper - add field ++ private io.papermc.paper.plugin.provider.classloader.PluginClassLoaderGroup classLoaderGroup; // Paper + + static { + ClassLoader.registerAsParallelCapable(); + } + +- PluginClassLoader(@NotNull final JavaPluginLoader loader, @Nullable final ClassLoader parent, @NotNull final PluginDescriptionFile description, @NotNull final File dataFolder, @NotNull final File file, @Nullable ClassLoader libraryLoader) throws IOException, InvalidPluginException, MalformedURLException { ++ @org.jetbrains.annotations.ApiStatus.Internal // Paper ++ public PluginClassLoader(@Nullable final ClassLoader parent, @NotNull final PluginDescriptionFile description, @NotNull final File dataFolder, @NotNull final File file, @Nullable ClassLoader libraryLoader) throws IOException, InvalidPluginException, MalformedURLException { // Paper + super(new URL[] {file.toURI().toURL()}, parent); +- Preconditions.checkArgument(loader != null, "Loader cannot be null"); ++ this.loader = null; // Paper - pass null into loader field + +- this.loader = loader; + this.description = description; + this.dataFolder = dataFolder; + this.file = file; +@@ -61,6 +64,10 @@ final class PluginClassLoader extends URLClassLoader { + this.url = file.toURI().toURL(); + this.libraryLoader = libraryLoader; + ++ ++ // Paper start ++ this.classLoaderGroup = io.papermc.paper.plugin.provider.classloader.PaperClassLoaderStorage.instance().registerSpigotGroup(this); // Paper ++ // Paper end + try { + Class jarClass; + try { +@@ -94,6 +101,27 @@ final class PluginClassLoader extends URLClassLoader { + return findResources(name); + } + ++ // Paper start ++ @Override ++ public Class loadClass(@NotNull String name, boolean resolve, boolean checkGlobal, boolean checkLibraries) throws ClassNotFoundException { ++ return this.loadClass0(name, resolve, checkGlobal, checkLibraries); ++ } ++ @Override ++ public io.papermc.paper.plugin.configuration.PluginMeta getConfiguration() { ++ return this.description; ++ } ++ ++ @Override ++ public void init(JavaPlugin plugin) { ++ this.initialize(plugin); ++ } ++ ++ @Override ++ public JavaPlugin getPlugin() { ++ return this.plugin; ++ } ++ // Paper end ++ + @Override + protected Class loadClass(String name, boolean resolve) throws ClassNotFoundException { + return loadClass0(name, resolve, true, true); +@@ -119,26 +147,11 @@ final class PluginClassLoader extends URLClassLoader { + + if (checkGlobal) { + // This ignores the libraries of other plugins, unless they are transitive dependencies. +- Class result = loader.getClassByName(name, resolve, description); ++ Class result = this.classLoaderGroup.getClassByName(name, resolve, this); // Paper + + if (result != null) { + // If the class was loaded from a library instead of a PluginClassLoader, we can assume that its associated plugin is a transitive dependency and can therefore skip this check. +- if (result.getClassLoader() instanceof PluginClassLoader) { +- PluginDescriptionFile provider = ((PluginClassLoader) result.getClassLoader()).description; +- +- if (provider != description +- && !seenIllegalAccess.contains(provider.getName()) +- && !((SimplePluginManager) loader.server.getPluginManager()).isTransitiveDepend(description, provider)) { +- +- seenIllegalAccess.add(provider.getName()); +- if (plugin != null) { +- plugin.getLogger().log(Level.WARNING, "Loaded class {0} from {1} which is not a depend or softdepend of this plugin.", new Object[]{name, provider.getFullName()}); +- } else { +- // In case the bad access occurs on construction +- loader.server.getLogger().log(Level.WARNING, "[{0}] Loaded class {1} from {2} which is not a depend or softdepend of this plugin.", new Object[]{description.getName(), name, provider.getFullName()}); +- } +- } +- } ++ // Paper - Totally delete the illegal access logic, we are never going to enforce it anyways here. + + return result; + } +@@ -167,7 +180,7 @@ final class PluginClassLoader extends URLClassLoader { + throw new ClassNotFoundException(name, ex); + } + +- classBytes = loader.server.getUnsafe().processClass(description, path, classBytes); ++ classBytes = org.bukkit.Bukkit.getServer().getUnsafe().processClass(description, path, classBytes); // Paper + + int dot = name.lastIndexOf('.'); + if (dot != -1) { +@@ -197,8 +210,8 @@ final class PluginClassLoader extends URLClassLoader { + result = super.findClass(name); + } + +- loader.setClass(name, result); + classes.put(name, result); ++ this.setClass(name, result); // Paper + } + + return result; +@@ -207,6 +220,12 @@ final class PluginClassLoader extends URLClassLoader { + @Override + public void close() throws IOException { + try { ++ // Paper start ++ Collection> classes = getClasses(); ++ for (Class clazz : classes) { ++ removeClass(clazz); ++ } ++ // Paper end + super.close(); + } finally { + jar.close(); +@@ -218,7 +237,7 @@ final class PluginClassLoader extends URLClassLoader { + return classes.values(); + } + +- synchronized void initialize(@NotNull JavaPlugin javaPlugin) { ++ public synchronized void initialize(@NotNull JavaPlugin javaPlugin) { // Paper + Preconditions.checkArgument(javaPlugin != null, "Initializing plugin cannot be null"); + Preconditions.checkArgument(javaPlugin.getClass().getClassLoader() == this, "Cannot initialize plugin outside of this class loader"); + if (this.plugin != null || this.pluginInit != null) { +@@ -228,6 +247,32 @@ final class PluginClassLoader extends URLClassLoader { + pluginState = new IllegalStateException("Initial initialization"); + this.pluginInit = javaPlugin; + +- javaPlugin.init(loader, loader.server, description, dataFolder, file, this); ++ javaPlugin.init(null, org.bukkit.Bukkit.getServer(), description, dataFolder, file, this); // Paper ++ } ++ ++ // Paper start ++ @Override ++ public String toString() { ++ JavaPlugin currPlugin = plugin != null ? plugin : pluginInit; ++ return "PluginClassLoader{" + ++ "plugin=" + currPlugin + ++ ", pluginEnabled=" + (currPlugin == null ? "uninitialized" : currPlugin.isEnabled()) + ++ ", url=" + file + ++ '}'; ++ } ++ ++ void setClass(@NotNull final String name, @NotNull final Class clazz) { ++ if (org.bukkit.configuration.serialization.ConfigurationSerializable.class.isAssignableFrom(clazz)) { ++ Class serializable = clazz.asSubclass(org.bukkit.configuration.serialization.ConfigurationSerializable.class); ++ org.bukkit.configuration.serialization.ConfigurationSerialization.registerClass(serializable); ++ } ++ } ++ ++ private void removeClass(@NotNull Class clazz) { ++ if (org.bukkit.configuration.serialization.ConfigurationSerializable.class.isAssignableFrom(clazz)) { ++ Class serializable = clazz.asSubclass(org.bukkit.configuration.serialization.ConfigurationSerializable.class); ++ org.bukkit.configuration.serialization.ConfigurationSerialization.unregisterClass(serializable); ++ } + } ++ // Paper end + } +diff --git a/src/test/java/io/papermc/paper/testing/TestServer.java b/src/test/java/io/papermc/paper/testing/TestServer.java +index 756acf231b1b076b08046d86992ba7ce7f62a94f..52d27d977b9df0bdf02b33ed0aaa3b4db0a04cb4 100644 +--- a/src/test/java/io/papermc/paper/testing/TestServer.java ++++ b/src/test/java/io/papermc/paper/testing/TestServer.java +@@ -36,9 +36,6 @@ public final class TestServer { + + when(dummyServer.getTag(anyString(), any(NamespacedKey.class), any())).thenAnswer(ignored -> new EmptyTag()); + +- final PluginManager pluginManager = new SimplePluginManager(dummyServer, new SimpleCommandMap(dummyServer)); +- when(dummyServer.getPluginManager()).thenReturn(pluginManager); +- + when(dummyServer.getRegistry(any())).thenAnswer(ignored -> new EmptyRegistry()); + when(dummyServer.getScoreboardCriteria(anyString())).thenReturn(null); + +diff --git a/src/test/java/org/bukkit/event/SyntheticEventTest.java b/src/test/java/org/bukkit/event/SyntheticEventTest.java +deleted file mode 100644 +index 09886568ae6167141b463b6262565fa212af3385..0000000000000000000000000000000000000000 +--- a/src/test/java/org/bukkit/event/SyntheticEventTest.java ++++ /dev/null +@@ -1,48 +0,0 @@ +-package org.bukkit.event; +- +-import org.bukkit.plugin.PluginLoader; +-import org.bukkit.plugin.SimplePluginManager; +-import org.bukkit.plugin.TestPlugin; +-import org.bukkit.plugin.java.JavaPluginLoader; +-import org.junit.Assert; +-import org.junit.Test; +- +-public class SyntheticEventTest { +- @SuppressWarnings("deprecation") +- @Test +- public void test() { +- io.papermc.paper.testing.TestServer.setup(); // Paper +- final JavaPluginLoader loader = new JavaPluginLoader(org.bukkit.Bukkit.getServer()); // Paper +- TestPlugin plugin = new TestPlugin(getClass().getName()) { +- @Override +- public PluginLoader getPluginLoader() { +- return loader; +- } +- }; +- SimplePluginManager pluginManager = new SimplePluginManager(org.bukkit.Bukkit.getServer(), null); // Paper +- +- TestEvent event = new TestEvent(false); +- Impl impl = new Impl(); +- +- pluginManager.registerEvents(impl, plugin); +- pluginManager.callEvent(event); +- +- Assert.assertEquals(1, impl.callCount); +- } +- +- public abstract static class Base implements Listener { +- int callCount = 0; +- +- public void accept(E evt) { +- callCount++; +- } +- } +- +- public static class Impl extends Base { +- @Override +- @EventHandler +- public void accept(TestEvent evt) { +- super.accept(evt); +- } +- } +-} +diff --git a/src/test/java/org/bukkit/plugin/PluginManagerTest.java b/src/test/java/org/bukkit/plugin/PluginManagerTest.java +deleted file mode 100644 +index c46ed2acb82db814d660459b705dd49e6d44240f..0000000000000000000000000000000000000000 +--- a/src/test/java/org/bukkit/plugin/PluginManagerTest.java ++++ /dev/null +@@ -1,183 +0,0 @@ +-package org.bukkit.plugin; +- +-import static org.hamcrest.Matchers.*; +-import static org.junit.Assert.*; +-import org.bukkit.event.Event; +-import org.bukkit.event.TestEvent; +-import org.bukkit.permissions.Permission; +-import org.junit.After; +-import org.junit.Test; +- +-public class PluginManagerTest { +- private class MutableObject { +- volatile Object value = null; +- } +- +- private static final PluginManager pm = org.bukkit.Bukkit.getServer().getPluginManager(); // Paper +- +- private final MutableObject store = new MutableObject(); +- +- @Test +- public void testAsyncSameThread() { +- final Event event = new TestEvent(true); +- try { +- pm.callEvent(event); +- } catch (IllegalStateException ex) { +- assertThat(event.getEventName() + " cannot be triggered asynchronously from primary server thread.", is(ex.getMessage())); +- return; +- } +- throw new IllegalStateException("No exception thrown"); +- } +- +- @Test +- public void testSyncSameThread() { +- final Event event = new TestEvent(false); +- pm.callEvent(event); +- } +- +- @Test +- public void testAsyncLocked() throws InterruptedException { +- final Event event = new TestEvent(true); +- Thread secondThread = new Thread( +- new Runnable() { +- @Override +- public void run() { +- try { +- synchronized (pm) { +- pm.callEvent(event); +- } +- } catch (Throwable ex) { +- store.value = ex; +- } +- } +- } +- ); +- secondThread.start(); +- secondThread.join(); +- assertThat(store.value, is(instanceOf(IllegalStateException.class))); +- assertThat(event.getEventName() + " cannot be triggered asynchronously from inside synchronized code.", is(((Throwable) store.value).getMessage())); +- } +- +- @Test +- public void testAsyncUnlocked() throws InterruptedException { +- final Event event = new TestEvent(true); +- Thread secondThread = new Thread( +- new Runnable() { +- @Override +- public void run() { +- try { +- pm.callEvent(event); +- } catch (Throwable ex) { +- store.value = ex; +- } +- } +- } +- ); +- secondThread.start(); +- secondThread.join(); +- if (store.value != null) { +- throw new RuntimeException((Throwable) store.value); +- } +- } +- +- @Test +- public void testSyncUnlocked() throws InterruptedException { +- final Event event = new TestEvent(false); +- Thread secondThread = new Thread( +- new Runnable() { +- @Override +- public void run() { +- try { +- pm.callEvent(event); +- } catch (Throwable ex) { +- store.value = ex; +- assertThat(event.getEventName() + " cannot be triggered asynchronously from another thread.", is(ex.getMessage())); +- return; +- } +- } +- } +- ); +- secondThread.start(); +- secondThread.join(); +- if (store.value == null) { +- throw new IllegalStateException("No exception thrown"); +- } +- } +- +- @Test +- public void testSyncLocked() throws InterruptedException { +- final Event event = new TestEvent(false); +- Thread secondThread = new Thread( +- new Runnable() { +- @Override +- public void run() { +- try { +- synchronized (pm) { +- pm.callEvent(event); +- } +- } catch (Throwable ex) { +- store.value = ex; +- assertThat(event.getEventName() + " cannot be triggered asynchronously from another thread.", is(ex.getMessage())); +- return; +- } +- } +- } +- ); +- secondThread.start(); +- secondThread.join(); +- if (store.value == null) { +- throw new IllegalStateException("No exception thrown"); +- } +- } +- +- @Test +- public void testRemovePermissionByNameLower() { +- this.testRemovePermissionByName("lower"); +- } +- +- @Test +- public void testRemovePermissionByNameUpper() { +- this.testRemovePermissionByName("UPPER"); +- } +- +- @Test +- public void testRemovePermissionByNameCamel() { +- this.testRemovePermissionByName("CaMeL"); +- } +- +- public void testRemovePermissionByPermissionLower() { +- this.testRemovePermissionByPermission("lower"); +- } +- +- @Test +- public void testRemovePermissionByPermissionUpper() { +- this.testRemovePermissionByPermission("UPPER"); +- } +- +- @Test +- public void testRemovePermissionByPermissionCamel() { +- this.testRemovePermissionByPermission("CaMeL"); +- } +- +- private void testRemovePermissionByName(final String name) { +- final Permission perm = new Permission(name); +- pm.addPermission(perm); +- assertThat("Permission \"" + name + "\" was not added", pm.getPermission(name), is(perm)); +- pm.removePermission(name); +- assertThat("Permission \"" + name + "\" was not removed", pm.getPermission(name), is(nullValue())); +- } +- +- private void testRemovePermissionByPermission(final String name) { +- final Permission perm = new Permission(name); +- pm.addPermission(perm); +- assertThat("Permission \"" + name + "\" was not added", pm.getPermission(name), is(perm)); +- pm.removePermission(perm); +- assertThat("Permission \"" + name + "\" was not removed", pm.getPermission(name), is(nullValue())); +- } +- +- @After +- public void tearDown() { +- pm.clearPlugins(); +- assertThat(pm.getPermissions(), is(empty())); +- } +-} +diff --git a/src/test/java/org/bukkit/plugin/TestPlugin.java b/src/test/java/org/bukkit/plugin/TestPlugin.java +index a8be3e23e3e280ad301d9530de50028515612966..43b58e920e739bb949ac0673e9ef73ba7b500dc9 100644 +--- a/src/test/java/org/bukkit/plugin/TestPlugin.java ++++ b/src/test/java/org/bukkit/plugin/TestPlugin.java +@@ -32,6 +32,12 @@ public class TestPlugin extends PluginBase { + public PluginDescriptionFile getDescription() { + return new PluginDescriptionFile(pluginName, "1.0", "test.test"); + } ++ // Paper start ++ @Override ++ public io.papermc.paper.plugin.configuration.PluginMeta getPluginMeta() { ++ return getDescription(); ++ } ++ // Paper end + + @Override + public FileConfiguration getConfig() { diff --git a/patches/api/0007-Add-Position.patch b/patches/api/0009-Add-Position.patch similarity index 100% rename from patches/api/0007-Add-Position.patch rename to patches/api/0009-Add-Position.patch diff --git a/patches/api/0009-Add-command-line-option-to-load-extra-plugin-jars-no.patch b/patches/api/0009-Add-command-line-option-to-load-extra-plugin-jars-no.patch deleted file mode 100644 index aab62144b6..0000000000 --- a/patches/api/0009-Add-command-line-option-to-load-extra-plugin-jars-no.patch +++ /dev/null @@ -1,181 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> -Date: Tue, 18 May 2021 14:42:26 -0700 -Subject: [PATCH] Add command line option to load extra plugin jars not in the - plugins folder - -ex: java -jar paperclip.jar nogui -add-plugin=/path/to/plugin.jar -add-plugin=/path/to/another/plugin_jar.jar - -diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index e24589a4cb42b0163e4a1455b8b11d7130b5cd41..71a09ed2b9863d2d339967f41ab6373ec27429d3 100644 ---- a/src/main/java/org/bukkit/Bukkit.java -+++ b/src/main/java/org/bukkit/Bukkit.java -@@ -76,6 +76,20 @@ public final class Bukkit { - return server; - } - -+ /** -+ * Returns the de facto plugins directory, generally used for storing plugin jars to be loaded, -+ * as well as their {@link org.bukkit.plugin.Plugin#getDataFolder() data folders}. -+ * -+ *

Plugins should use {@link org.bukkit.plugin.Plugin#getDataFolder()} rather than traversing this -+ * directory manually when determining the location in which to store their data and configuration files.

-+ * -+ * @return plugins directory -+ */ -+ @NotNull -+ public static File getPluginsFolder() { -+ return server.getPluginsFolder(); -+ } -+ - /** - * Attempts to set the {@link Server} singleton. - *

-diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index ac087402c90dad4b3c499fcf8507e50e9099cea5..a4f8035b40eebff8afe01788781128b04247f28c 100644 ---- a/src/main/java/org/bukkit/Server.java -+++ b/src/main/java/org/bukkit/Server.java -@@ -61,6 +61,18 @@ import org.jetbrains.annotations.Nullable; - */ - public interface Server extends PluginMessageRecipient, net.kyori.adventure.audience.ForwardingAudience { // Paper - -+ /** -+ * Returns the de facto plugins directory, generally used for storing plugin jars to be loaded, -+ * as well as their {@link org.bukkit.plugin.Plugin#getDataFolder() data folders}. -+ * -+ *

Plugins should use {@link org.bukkit.plugin.Plugin#getDataFolder()} rather than traversing this -+ * directory manually when determining the location in which to store their data and configuration files.

-+ * -+ * @return plugins directory -+ */ -+ @NotNull -+ File getPluginsFolder(); -+ - /** - * Used for all administrative messages, such as an operator using a - * command. -diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java -index 763b3e9ea24b14c54abf94048931f29228c76df5..1bfa9fcb1b803eecfe33156f81ee88d2922ca88a 100644 ---- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java -+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java -@@ -111,6 +111,12 @@ public final class SimplePluginManager implements PluginManager { - @Override - @NotNull - public Plugin[] loadPlugins(@NotNull File directory) { -+ // Paper start - extra jars -+ return this.loadPlugins(directory, java.util.Collections.emptyList()); -+ } -+ @NotNull -+ public Plugin[] loadPlugins(final @NotNull File directory, final @NotNull List extraPluginJars) { -+ // Paper end - Preconditions.checkArgument(directory != null, "Directory cannot be null"); - Preconditions.checkArgument(directory.isDirectory(), "Directory must be a directory"); - -@@ -128,7 +134,11 @@ public final class SimplePluginManager implements PluginManager { - Map> softDependencies = new HashMap>(); - - // This is where it figures out all possible plugins -- for (File file : directory.listFiles()) { -+ // Paper start - extra jars -+ final List pluginJars = new ArrayList<>(java.util.Arrays.asList(directory.listFiles())); -+ pluginJars.addAll(extraPluginJars); -+ for (File file : pluginJars) { -+ // Paper end - PluginLoader loader = null; - for (Pattern filter : filters) { - Matcher match = filter.matcher(file.getName()); -@@ -144,14 +154,14 @@ public final class SimplePluginManager implements PluginManager { - description = loader.getPluginDescription(file); - String name = description.getName(); - if (name.equalsIgnoreCase("bukkit") || name.equalsIgnoreCase("minecraft") || name.equalsIgnoreCase("mojang")) { -- server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "': Restricted Name"); -+ server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + file.getParentFile().getPath() + "': Restricted Name"); // Paper - continue; - } else if (description.rawName.indexOf(' ') != -1) { -- server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "': uses the space-character (0x20) in its name"); -+ server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + file.getParentFile().getPath() + "': uses the space-character (0x20) in its name"); // Paper - continue; - } - } catch (InvalidDescriptionException ex) { -- server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "'", ex); -+ server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + file.getParentFile().getPath() + "'", ex); // Paper - continue; - } - -@@ -162,7 +172,7 @@ public final class SimplePluginManager implements PluginManager { - description.getName(), - file.getPath(), - replacedFile.getPath(), -- directory.getPath() -+ file.getParentFile().getPath() // Paper - )); - } - -@@ -183,7 +193,7 @@ public final class SimplePluginManager implements PluginManager { - file.getPath(), - provided, - pluginFile.getPath(), -- directory.getPath() -+ file.getParentFile().getPath() // Paper - )); - } else { - String replacedPlugin = pluginsProvided.put(provided, description.getName()); -@@ -265,7 +275,7 @@ public final class SimplePluginManager implements PluginManager { - - server.getLogger().log( - Level.SEVERE, -- "Could not load '" + entry.getValue().getPath() + "' in folder '" + directory.getPath() + "'", -+ "Could not load '" + entry.getValue().getPath() + "' in folder '" + entry.getValue().getParentFile().getPath() + "'", // Paper - new UnknownDependencyException("Unknown dependency " + dependency + ". Please download and install " + dependency + " to run this plugin.")); - break; - } -@@ -304,11 +314,11 @@ public final class SimplePluginManager implements PluginManager { - loadedPlugins.add(loadedPlugin.getName()); - loadedPlugins.addAll(loadedPlugin.getDescription().getProvides()); - } else { -- server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "'"); -+ server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + file.getParentFile().getPath() + "'"); // Paper - } - continue; - } catch (InvalidPluginException ex) { -- server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "'", ex); -+ server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + file.getParentFile().getPath() + "'", ex); // Paper - } - } - } -@@ -335,11 +345,11 @@ public final class SimplePluginManager implements PluginManager { - loadedPlugins.add(loadedPlugin.getName()); - loadedPlugins.addAll(loadedPlugin.getDescription().getProvides()); - } else { -- server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "'"); -+ server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + file.getParentFile().getPath() + "'"); // Paper - } - break; - } catch (InvalidPluginException ex) { -- server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "'", ex); -+ server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + file.getParentFile().getPath() + "'", ex); // Paper - } - } - } -@@ -352,7 +362,7 @@ public final class SimplePluginManager implements PluginManager { - while (failedPluginIterator.hasNext()) { - File file = failedPluginIterator.next(); - failedPluginIterator.remove(); -- server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "': circular dependency detected"); -+ server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + file.getParentFile().getPath() + "': circular dependency detected"); // Paper - } - } - } -diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -index 5c1b8b05d8a5408bb4830942c74ebfe400ab5a32..333c47a1f7e9d7ddf91aad5ec15163427f7b8039 100644 ---- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -@@ -91,7 +91,7 @@ public final class JavaPluginLoader implements PluginLoader { - throw new InvalidPluginException(ex); - } - -- final File parentFile = file.getParentFile(); -+ final File parentFile = this.server.getPluginsFolder(); // Paper - final File dataFolder = new File(parentFile, description.getName()); - @SuppressWarnings("deprecation") - final File oldDataFolder = new File(parentFile, description.getRawName()); diff --git a/patches/api/0008-Timings-v2.patch b/patches/api/0010-Timings-v2.patch similarity index 98% rename from patches/api/0008-Timings-v2.patch rename to patches/api/0010-Timings-v2.patch index 9303d3c156..7e728cc868 100644 --- a/patches/api/0008-Timings-v2.patch +++ b/patches/api/0010-Timings-v2.patch @@ -2834,10 +2834,10 @@ index 892e03189957b0072827be4fd485dd98352334e8..ac087402c90dad4b3c499fcf8507e50e * Sends the component to the player * diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index 4f339debf113d103ffe0b5fdb03dfc82eafd1bd5..d45cc92ca30e79173f30aae10724beeec6d22398 100644 +index dc9a4f12d9f05a3ae7c9f1c7648123e4b3dfd115..daf3ac72cae4d19c0273058dc6a1e1afe9a47f77 100644 --- a/src/main/java/org/bukkit/UnsafeValues.java +++ b/src/main/java/org/bukkit/UnsafeValues.java -@@ -32,6 +32,7 @@ public interface UnsafeValues { +@@ -33,6 +33,7 @@ public interface UnsafeValues { net.kyori.adventure.text.Component resolveWithContext(net.kyori.adventure.text.Component component, org.bukkit.command.CommandSender context, org.bukkit.entity.Entity scoreboardSubject, boolean bypassPermissions) throws java.io.IOException; // Paper end @@ -2845,10 +2845,10 @@ index 4f339debf113d103ffe0b5fdb03dfc82eafd1bd5..d45cc92ca30e79173f30aae10724beee Material toLegacy(Material material); Material fromLegacy(Material material); -@@ -87,4 +88,12 @@ public interface UnsafeValues { - Multimap getDefaultAttributeModifiers(Material material, EquipmentSlot slot); - - CreativeCategory getCreativeCategory(Material material); +@@ -106,4 +107,12 @@ public interface UnsafeValues { + return !Bukkit.getUnsafe().isSupportedApiVersion(plugin.getDescription().getAPIVersion()); + } + // Paper end + + // Paper start + /** @@ -2886,19 +2886,20 @@ index 0000000000000000000000000000000000000000..f9a00aecca5ec41b460bf41dfe1c6969 + } +} diff --git a/src/main/java/org/bukkit/command/Command.java b/src/main/java/org/bukkit/command/Command.java -index 57ade3963faae3724d9a01eeeb6d02168acb567e..6fd341482d5250ad814e870360e40b52427f799a 100644 +index caa29be46e8541b69ec47c181eb3320d6515b544..6fd341482d5250ad814e870360e40b52427f799a 100644 --- a/src/main/java/org/bukkit/command/Command.java +++ b/src/main/java/org/bukkit/command/Command.java -@@ -33,6 +33,8 @@ public abstract class Command { +@@ -33,7 +33,8 @@ public abstract class Command { protected String usageMessage; private String permission; private net.kyori.adventure.text.Component permissionMessage; // Paper +- public org.spigotmc.CustomTimingsHandler timings; // Spigot + public co.aikar.timings.Timing timings; // Paper + @NotNull public String getTimingName() {return getName();} // Paper protected Command(@NotNull String name) { this(name, "", "/" + name, new ArrayList()); -@@ -46,7 +48,6 @@ public abstract class Command { +@@ -47,7 +48,6 @@ public abstract class Command { this.usageMessage = (usageMessage == null) ? "/" + name : usageMessage; this.aliases = aliases; this.activeAliases = new ArrayList(aliases); @@ -2906,7 +2907,7 @@ index 57ade3963faae3724d9a01eeeb6d02168acb567e..6fd341482d5250ad814e870360e40b52 } /** -@@ -244,7 +245,6 @@ public abstract class Command { +@@ -245,7 +245,6 @@ public abstract class Command { } this.nextLabel = name; if (!isRegistered()) { @@ -3079,7 +3080,7 @@ index 0000000000000000000000000000000000000000..9d263ab3afb938c215c0b64d9171345f + +} diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java -index e195e74c48c69047aa825b75fad95419c505b41f..f99d71301ceaa3af07ff0525f7d657ac6253d0e6 100644 +index 53f28c9e6843991486a576d41b6641c170589807..4205649948a9e2a72f64c3f007112245abac6d50 100644 --- a/src/main/java/org/bukkit/command/SimpleCommandMap.java +++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java @@ -15,7 +15,6 @@ import org.bukkit.command.defaults.BukkitCommand; @@ -3093,7 +3094,7 @@ index e195e74c48c69047aa825b75fad95419c505b41f..f99d71301ceaa3af07ff0525f7d657ac @@ -35,7 +34,7 @@ public class SimpleCommandMap implements CommandMap { register("bukkit", new VersionCommand("version")); register("bukkit", new ReloadCommand("reload")); - register("bukkit", new PluginsCommand("plugins")); + //register("bukkit", new PluginsCommand("plugins")); // Paper - register("bukkit", new TimingsCommand("timings")); + register("bukkit", new co.aikar.timings.TimingsCommand("timings")); // Paper } @@ -3391,10 +3392,10 @@ index 516d7fc7812aac343782861d0d567f54aa578c2a..00000000000000000000000000000000 - // Spigot end -} diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 5a2c072c95cad8485e281e080e5e606194b05b30..3f9236ce97adb4b724e18a5f05497681bed5d4d5 100644 +index 4053c086a9ef9aa071402818672643bd800851d6..705644a2e0d209ef717470da07d34fafc88a0640 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java -@@ -2011,7 +2011,14 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -2036,7 +2036,14 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM @Deprecated // Paper public void sendMessage(@NotNull net.md_5.bungee.api.ChatMessageType position, @Nullable UUID sender, @NotNull net.md_5.bungee.api.chat.BaseComponent... components) { throw new UnsupportedOperationException("Not supported yet."); @@ -3410,10 +3411,10 @@ index 5a2c072c95cad8485e281e080e5e606194b05b30..3f9236ce97adb4b724e18a5f05497681 @NotNull diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java -index a69c5d5cad6168aeaae41e8adc319dc8c976b1e2..763b3e9ea24b14c54abf94048931f29228c76df5 100644 +index f64a90241ce7f73e111e6b5ac6ff87cd93583c0e..f13dcbe448111b24b36105d25527ba87ccc9334e 100644 --- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java +++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java -@@ -358,7 +358,6 @@ public final class SimplePluginManager implements PluginManager { +@@ -368,7 +368,6 @@ public final class SimplePluginManager implements PluginManager { } } @@ -3421,7 +3422,7 @@ index a69c5d5cad6168aeaae41e8adc319dc8c976b1e2..763b3e9ea24b14c54abf94048931f292 return result.toArray(new Plugin[result.size()]); } -@@ -397,9 +396,9 @@ public final class SimplePluginManager implements PluginManager { +@@ -416,9 +415,9 @@ public final class SimplePluginManager implements PluginManager { if (result != null) { plugins.add(result); @@ -3433,16 +3434,16 @@ index a69c5d5cad6168aeaae41e8adc319dc8c976b1e2..763b3e9ea24b14c54abf94048931f292 } } -@@ -428,7 +427,7 @@ public final class SimplePluginManager implements PluginManager { - @Override +@@ -448,7 +447,7 @@ public final class SimplePluginManager implements PluginManager { @Nullable public synchronized Plugin getPlugin(@NotNull String name) { + if (true) {return this.paperPluginManager.getPlugin(name);} // Paper - return lookupNames.get(name.replace(' ', '_')); + return lookupNames.get(name.replace(' ', '_').toLowerCase(java.util.Locale.ENGLISH)); // Paper } @Override -@@ -646,7 +645,8 @@ public final class SimplePluginManager implements PluginManager { +@@ -676,7 +675,8 @@ public final class SimplePluginManager implements PluginManager { throw new IllegalPluginAccessException("Plugin attempted to register " + event + " while not enabled"); } @@ -3452,28 +3453,29 @@ index a69c5d5cad6168aeaae41e8adc319dc8c976b1e2..763b3e9ea24b14c54abf94048931f292 getEventListeners(event).register(new TimedRegisteredListener(listener, executor, priority, plugin, ignoreCancelled)); } else { getEventListeners(event).register(new RegisteredListener(listener, executor, priority, plugin, ignoreCancelled)); -@@ -866,7 +866,7 @@ public final class SimplePluginManager implements PluginManager { - +@@ -911,7 +911,7 @@ public final class SimplePluginManager implements PluginManager { @Override public boolean useTimings() { + if (true) {return this.paperPluginManager.useTimings();} // Paper - return useTimings; + return co.aikar.timings.Timings.isTimingsEnabled(); // Spigot } /** -@@ -875,6 +875,6 @@ public final class SimplePluginManager implements PluginManager { +@@ -920,7 +920,7 @@ public final class SimplePluginManager implements PluginManager { * @param use True if per event timing code should be used */ public void useTimings(boolean use) { - useTimings = use; + co.aikar.timings.Timings.setTimingsEnabled(use); // Paper } - } + + // Paper start diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -index 047c0304fd617cec990f80815b43916c6ef5a94c..5c1b8b05d8a5408bb4830942c74ebfe400ab5a32 100644 +index fa39c93d76ebb9eecce1f4b5203cb361e4778b4f..aa6ce50ff2d0318bfcc328daa4fd9f2e50d34d01 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 { +@@ -55,7 +55,6 @@ public final class JavaPluginLoader implements PluginLoader { private final Pattern[] fileFilters = new Pattern[]{Pattern.compile("\\.jar$")}; private final List loaders = new CopyOnWriteArrayList(); private final LibraryLoader libraryLoader; @@ -3481,7 +3483,7 @@ index 047c0304fd617cec990f80815b43916c6ef5a94c..5c1b8b05d8a5408bb4830942c74ebfe4 /** * This class was not meant to be constructed explicitly -@@ -292,27 +291,21 @@ public final class JavaPluginLoader implements PluginLoader { +@@ -294,27 +293,21 @@ public final class JavaPluginLoader implements PluginLoader { } } @@ -3512,20 +3514,6 @@ index 047c0304fd617cec990f80815b43916c6ef5a94c..5c1b8b05d8a5408bb4830942c74ebfe4 if (false) { // Spigot - RL handles useTimings check now 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 2f74ec96ece706de23156ebabfe493211bc05391..6148b69af39344f758b05a28c7c572befa9b8f3f 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; - /** - * A ClassLoader for plugins, to allow shared classes across multiple plugins - */ --final class PluginClassLoader extends URLClassLoader { -+public final class PluginClassLoader extends URLClassLoader { // Spigot -+ public JavaPlugin getPlugin() { return plugin; } // Spigot - private final JavaPluginLoader loader; - private final Map> classes = new ConcurrentHashMap>(); - private final PluginDescriptionFile description; diff --git a/src/main/java/org/bukkit/util/CachedServerIcon.java b/src/main/java/org/bukkit/util/CachedServerIcon.java index 5ca863b3692b2e1b58e7fb4d82f554a92cc4f01e..612958a331575d1da2715531ebdf6b1168f2e860 100644 --- a/src/main/java/org/bukkit/util/CachedServerIcon.java diff --git a/patches/api/0011-Add-command-line-option-to-load-extra-plugin-jars-no.patch b/patches/api/0011-Add-command-line-option-to-load-extra-plugin-jars-no.patch new file mode 100644 index 0000000000..c3bb33b35f --- /dev/null +++ b/patches/api/0011-Add-command-line-option-to-load-extra-plugin-jars-no.patch @@ -0,0 +1,96 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> +Date: Tue, 18 May 2021 14:42:26 -0700 +Subject: [PATCH] Add command line option to load extra plugin jars not in the + plugins folder + +ex: java -jar paperclip.jar nogui -add-plugin=/path/to/plugin.jar -add-plugin=/path/to/another/plugin_jar.jar + +diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java +index e24589a4cb42b0163e4a1455b8b11d7130b5cd41..71a09ed2b9863d2d339967f41ab6373ec27429d3 100644 +--- a/src/main/java/org/bukkit/Bukkit.java ++++ b/src/main/java/org/bukkit/Bukkit.java +@@ -76,6 +76,20 @@ public final class Bukkit { + return server; + } + ++ /** ++ * Returns the de facto plugins directory, generally used for storing plugin jars to be loaded, ++ * as well as their {@link org.bukkit.plugin.Plugin#getDataFolder() data folders}. ++ * ++ *

Plugins should use {@link org.bukkit.plugin.Plugin#getDataFolder()} rather than traversing this ++ * directory manually when determining the location in which to store their data and configuration files.

++ * ++ * @return plugins directory ++ */ ++ @NotNull ++ public static File getPluginsFolder() { ++ return server.getPluginsFolder(); ++ } ++ + /** + * Attempts to set the {@link Server} singleton. + *

+diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java +index ac087402c90dad4b3c499fcf8507e50e9099cea5..a4f8035b40eebff8afe01788781128b04247f28c 100644 +--- a/src/main/java/org/bukkit/Server.java ++++ b/src/main/java/org/bukkit/Server.java +@@ -61,6 +61,18 @@ import org.jetbrains.annotations.Nullable; + */ + public interface Server extends PluginMessageRecipient, net.kyori.adventure.audience.ForwardingAudience { // Paper + ++ /** ++ * Returns the de facto plugins directory, generally used for storing plugin jars to be loaded, ++ * as well as their {@link org.bukkit.plugin.Plugin#getDataFolder() data folders}. ++ * ++ *

Plugins should use {@link org.bukkit.plugin.Plugin#getDataFolder()} rather than traversing this ++ * directory manually when determining the location in which to store their data and configuration files.

++ * ++ * @return plugins directory ++ */ ++ @NotNull ++ File getPluginsFolder(); ++ + /** + * Used for all administrative messages, such as an operator using a + * command. +diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java +index f13dcbe448111b24b36105d25527ba87ccc9334e..3fcb73a0fc2daaeb76dd4c6757afce52c5b3118b 100644 +--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java ++++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java +@@ -116,9 +116,22 @@ public final class SimplePluginManager implements PluginManager { + @Override + @NotNull + public Plugin[] loadPlugins(@NotNull File directory) { ++ // Paper start - extra jars ++ return this.loadPlugins(directory, java.util.Collections.emptyList()); ++ } ++ @NotNull ++ public Plugin[] loadPlugins(final @NotNull File directory, final @NotNull List extraPluginJars) { ++ // Paper end + if (true) { + List pluginList = new ArrayList<>(); + java.util.Collections.addAll(pluginList, this.paperPluginManager.loadPlugins(directory)); ++ for (File file : extraPluginJars) { ++ try { ++ pluginList.add(this.paperPluginManager.loadPlugin(file)); ++ } catch (Exception e) { ++ this.server.getLogger().log(Level.SEVERE, "Plugin loading error!", e); ++ } ++ } + return pluginList.toArray(new Plugin[0]); + } + Preconditions.checkArgument(directory != null, "Directory cannot be null"); +diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +index 02062284dbc1a6c923ceffa5e4d6a3be8c7429d3..88d852c1a729ffd5951da803da424b31591c9f9a 100644 +--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java ++++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +@@ -93,7 +93,7 @@ public final class JavaPluginLoader implements PluginLoader { + throw new InvalidPluginException(ex); + } + +- final File parentFile = file.getParentFile(); ++ final File parentFile = this.server.getPluginsFolder(); // Paper + final File dataFolder = new File(parentFile, description.getName()); + @SuppressWarnings("deprecation") + final File oldDataFolder = new File(parentFile, description.getRawName()); diff --git a/patches/api/0010-Player-affects-spawning-API.patch b/patches/api/0012-Player-affects-spawning-API.patch similarity index 86% rename from patches/api/0010-Player-affects-spawning-API.patch rename to patches/api/0012-Player-affects-spawning-API.patch index 59f6484c72..231bbfca9b 100644 --- a/patches/api/0010-Player-affects-spawning-API.patch +++ b/patches/api/0012-Player-affects-spawning-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Player affects spawning API diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 3f9236ce97adb4b724e18a5f05497681bed5d4d5..7c13de51561df662691a36ca1cc91ca7997d773a 100644 +index 705644a2e0d209ef717470da07d34fafc88a0640..1c3d9ac922c189adc139c2646b4bdc97dbfadb43 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java -@@ -1850,6 +1850,22 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -1875,6 +1875,22 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM @Deprecated // Paper public String getLocale(); diff --git a/patches/api/0011-Add-getTPS-method.patch b/patches/api/0013-Add-getTPS-method.patch similarity index 100% rename from patches/api/0011-Add-getTPS-method.patch rename to patches/api/0013-Add-getTPS-method.patch diff --git a/patches/api/0012-Version-Command-2.0.patch b/patches/api/0014-Version-Command-2.0.patch similarity index 98% rename from patches/api/0012-Version-Command-2.0.patch rename to patches/api/0014-Version-Command-2.0.patch index e1dd11c10e..9a83efca80 100644 --- a/patches/api/0012-Version-Command-2.0.patch +++ b/patches/api/0014-Version-Command-2.0.patch @@ -56,10 +56,10 @@ index 0000000000000000000000000000000000000000..a736d7bcdc5861a01b66ba36158db1c7 + } +} diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index d45cc92ca30e79173f30aae10724beeec6d22398..c67d2e96e30261e480f1df96464befac03d78a69 100644 +index daf3ac72cae4d19c0273058dc6a1e1afe9a47f77..24fad8e59a3a5a174d24505cedda2a3fd52115b1 100644 --- a/src/main/java/org/bukkit/UnsafeValues.java +++ b/src/main/java/org/bukkit/UnsafeValues.java -@@ -95,5 +95,12 @@ public interface UnsafeValues { +@@ -114,5 +114,12 @@ public interface UnsafeValues { * @return name */ String getTimingsServerName(); diff --git a/patches/api/0013-Entity-Origin-API.patch b/patches/api/0015-Entity-Origin-API.patch similarity index 100% rename from patches/api/0013-Entity-Origin-API.patch rename to patches/api/0015-Entity-Origin-API.patch diff --git a/patches/api/0014-Add-PlayerLocaleChangeEvent.patch b/patches/api/0016-Add-PlayerLocaleChangeEvent.patch similarity index 100% rename from patches/api/0014-Add-PlayerLocaleChangeEvent.patch rename to patches/api/0016-Add-PlayerLocaleChangeEvent.patch diff --git a/patches/api/0015-Add-view-distance-API.patch b/patches/api/0017-Add-view-distance-API.patch similarity index 94% rename from patches/api/0015-Add-view-distance-API.patch rename to patches/api/0017-Add-view-distance-API.patch index f1d1622670..9c146dfd15 100644 --- a/patches/api/0015-Add-view-distance-API.patch +++ b/patches/api/0017-Add-view-distance-API.patch @@ -8,10 +8,10 @@ Add per player no-tick, tick, and send view distances. Also add send/no-tick view distance to World. diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 425cad3b6c365560f6614767d763ad61a92e6722..75a87b221cc0f6334c5283130a7b2bfdf4eedd03 100644 +index ed57cd69d88504b78782271c9a3d423a29471674..8a6a548314eef8d486be908e38e3a4562f26bdb4 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java -@@ -2673,6 +2673,62 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient +@@ -2698,6 +2698,62 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient int getSimulationDistance(); // Spigot end @@ -75,10 +75,10 @@ index 425cad3b6c365560f6614767d763ad61a92e6722..75a87b221cc0f6334c5283130a7b2bfd public class Spigot { diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 7c13de51561df662691a36ca1cc91ca7997d773a..292f7827df666c10d7b82aa9b1688bf3f0da5c7b 100644 +index 1c3d9ac922c189adc139c2646b4bdc97dbfadb43..7efbc8540d3a42ae8ec9b4e4343e1352e0cfa993 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java -@@ -1864,6 +1864,78 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -1889,6 +1889,78 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM * @param affects Whether the player can affect mob spawning */ public void setAffectsSpawning(boolean affects); diff --git a/patches/api/0016-Add-BeaconEffectEvent.patch b/patches/api/0018-Add-BeaconEffectEvent.patch similarity index 100% rename from patches/api/0016-Add-BeaconEffectEvent.patch rename to patches/api/0018-Add-BeaconEffectEvent.patch diff --git a/patches/api/0017-Add-PlayerInitialSpawnEvent.patch b/patches/api/0019-Add-PlayerInitialSpawnEvent.patch similarity index 100% rename from patches/api/0017-Add-PlayerInitialSpawnEvent.patch rename to patches/api/0019-Add-PlayerInitialSpawnEvent.patch diff --git a/patches/api/0019-Expose-server-CommandMap.patch b/patches/api/0020-Expose-server-CommandMap.patch similarity index 100% rename from patches/api/0019-Expose-server-CommandMap.patch rename to patches/api/0020-Expose-server-CommandMap.patch diff --git a/patches/api/0020-Graduate-bungeecord-chat-API-from-spigot-subclasses.patch b/patches/api/0021-Graduate-bungeecord-chat-API-from-spigot-subclasses.patch similarity index 96% rename from patches/api/0020-Graduate-bungeecord-chat-API-from-spigot-subclasses.patch rename to patches/api/0021-Graduate-bungeecord-chat-API-from-spigot-subclasses.patch index 99ec6d6bc6..ba52e08d1b 100644 --- a/patches/api/0020-Graduate-bungeecord-chat-API-from-spigot-subclasses.patch +++ b/patches/api/0021-Graduate-bungeecord-chat-API-from-spigot-subclasses.patch @@ -76,10 +76,10 @@ index 6a7b91af3e738613cf79c13e2844efe9a2efd254..bef555b3de44fed312b45a5d5cd811b1 * Gets the name of the update folder. The update folder is used to safely * update plugins at the right moment on a plugin load. diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 292f7827df666c10d7b82aa9b1688bf3f0da5c7b..b91c12089ba0723356ef2d3d1b8b0c66ca8850bf 100644 +index 7efbc8540d3a42ae8ec9b4e4343e1352e0cfa993..6120eeefb8ffcb39bac81ba60ff3a5d9a3687dd5 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java -@@ -778,6 +778,42 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -803,6 +803,42 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM */ public void sendMap(@NotNull MapView map); diff --git a/patches/api/0021-Add-exception-reporting-event.patch b/patches/api/0022-Add-exception-reporting-event.patch similarity index 97% rename from patches/api/0021-Add-exception-reporting-event.patch rename to patches/api/0022-Add-exception-reporting-event.patch index fb5e83667b..bed957377c 100644 --- a/patches/api/0021-Add-exception-reporting-event.patch +++ b/patches/api/0022-Add-exception-reporting-event.patch @@ -462,7 +462,7 @@ index 0000000000000000000000000000000000000000..5582999fe94c7a3dac655044ccc6d078 + } +} diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java -index f99d71301ceaa3af07ff0525f7d657ac6253d0e6..2e23c124311b38aaea64dd274c33afcd52edcf43 100644 +index 4205649948a9e2a72f64c3f007112245abac6d50..b3b32ce429edbf1ed040354dbe28ab86f0d24201 100644 --- a/src/main/java/org/bukkit/command/SimpleCommandMap.java +++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java @@ -155,11 +155,14 @@ public class SimpleCommandMap implements CommandMap { @@ -493,10 +493,10 @@ index f99d71301ceaa3af07ff0525f7d657ac6253d0e6..2e23c124311b38aaea64dd274c33afcd } diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java -index 1bfa9fcb1b803eecfe33156f81ee88d2922ca88a..b535ab89b5a04371bac41720d28b4af8b18f1c20 100644 +index 5a25e44c6ddeec5ad5fdd8c4a1f30dba5546cbe6..d1d5bf23529434730df7be8ae463d2e32c9fcf5f 100644 --- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java +++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java -@@ -488,7 +488,8 @@ public final class SimplePluginManager implements PluginManager { +@@ -515,7 +515,8 @@ public final class SimplePluginManager implements PluginManager { try { plugin.getPluginLoader().enablePlugin(plugin); } catch (Throwable ex) { @@ -506,7 +506,7 @@ index 1bfa9fcb1b803eecfe33156f81ee88d2922ca88a..b535ab89b5a04371bac41720d28b4af8 } HandlerList.bakeAll(); -@@ -509,32 +510,37 @@ public final class SimplePluginManager implements PluginManager { +@@ -538,32 +539,37 @@ public final class SimplePluginManager implements PluginManager { try { plugin.getPluginLoader().disablePlugin(plugin); } catch (Throwable ex) { @@ -549,7 +549,7 @@ index 1bfa9fcb1b803eecfe33156f81ee88d2922ca88a..b535ab89b5a04371bac41720d28b4af8 } try { -@@ -547,6 +553,13 @@ public final class SimplePluginManager implements PluginManager { +@@ -576,6 +582,13 @@ public final class SimplePluginManager implements PluginManager { } } @@ -562,8 +562,8 @@ index 1bfa9fcb1b803eecfe33156f81ee88d2922ca88a..b535ab89b5a04371bac41720d28b4af8 + @Override public void clearPlugins() { - synchronized (this) { -@@ -610,7 +623,13 @@ public final class SimplePluginManager implements PluginManager { + if (true) {this.paperPluginManager.clearPlugins(); return;} // Paper +@@ -641,7 +654,13 @@ public final class SimplePluginManager implements PluginManager { )); } } catch (Throwable ex) { diff --git a/patches/api/0022-Add-BaseComponent-sendMessage-methods-to-CommandSend.patch b/patches/api/0023-Add-BaseComponent-sendMessage-methods-to-CommandSend.patch similarity index 100% rename from patches/api/0022-Add-BaseComponent-sendMessage-methods-to-CommandSend.patch rename to patches/api/0023-Add-BaseComponent-sendMessage-methods-to-CommandSend.patch diff --git a/patches/api/0023-Fix-ServerListPingEvent-flagging-as-Async.patch b/patches/api/0024-Fix-ServerListPingEvent-flagging-as-Async.patch similarity index 100% rename from patches/api/0023-Fix-ServerListPingEvent-flagging-as-Async.patch rename to patches/api/0024-Fix-ServerListPingEvent-flagging-as-Async.patch diff --git a/patches/api/0025-Add-methods-for-working-with-arrows-stuck-in-living-.patch b/patches/api/0025-Add-methods-for-working-with-arrows-stuck-in-living-.patch deleted file mode 100644 index e8a86018cb..0000000000 --- a/patches/api/0025-Add-methods-for-working-with-arrows-stuck-in-living-.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: mrapple -Date: Sun, 25 Nov 2012 13:47:27 -0600 -Subject: [PATCH] Add methods for working with arrows stuck in living entities - - -diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index 2b816f0e6bdb912ceeff82c0043272b3970fe243..f00502b59f15c3a92ce18e7d1aa4e546fd45b16a 100644 ---- a/src/main/java/org/bukkit/entity/LivingEntity.java -+++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -689,4 +689,19 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource - * @return Whether the entity is invisible - */ - public boolean isInvisible(); -+ -+ // Paper start -+ /** -+ * Get the number of arrows stuck in this entity -+ * @return Number of arrows stuck -+ */ -+ int getArrowsStuck(); -+ -+ /** -+ * Set the number of arrows stuck in this entity -+ * -+ * @param arrows Number of arrows to stick in this entity -+ */ -+ void setArrowsStuck(int arrows); -+ // Paper end - } diff --git a/patches/api/0024-Player-Tab-List-and-Title-APIs.patch b/patches/api/0025-Player-Tab-List-and-Title-APIs.patch similarity index 99% rename from patches/api/0024-Player-Tab-List-and-Title-APIs.patch rename to patches/api/0025-Player-Tab-List-and-Title-APIs.patch index c3924585b7..06d9807549 100644 --- a/patches/api/0024-Player-Tab-List-and-Title-APIs.patch +++ b/patches/api/0025-Player-Tab-List-and-Title-APIs.patch @@ -432,7 +432,7 @@ index 0000000000000000000000000000000000000000..9e90c3df567a65b48a0b9341f784eb90 + } +} diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index b91c12089ba0723356ef2d3d1b8b0c66ca8850bf..74a3abef2ff1be11427558293e81f3b7fe9fff16 100644 +index 6120eeefb8ffcb39bac81ba60ff3a5d9a3687dd5..5de2fbb69c8950a5f85476b60993b3d6b2164162 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java @@ -3,6 +3,7 @@ package org.bukkit.entity; @@ -443,7 +443,7 @@ index b91c12089ba0723356ef2d3d1b8b0c66ca8850bf..74a3abef2ff1be11427558293e81f3b7 import org.bukkit.DyeColor; import org.bukkit.Effect; import org.bukkit.GameMode; -@@ -812,6 +813,131 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -837,6 +838,131 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM public default void sendMessage(net.md_5.bungee.api.ChatMessageType position, net.md_5.bungee.api.chat.BaseComponent... components) { spigot().sendMessage(position, components); } diff --git a/patches/api/0026-Add-methods-for-working-with-arrows-stuck-in-living-.patch b/patches/api/0026-Add-methods-for-working-with-arrows-stuck-in-living-.patch new file mode 100644 index 0000000000..a1913f44d8 --- /dev/null +++ b/patches/api/0026-Add-methods-for-working-with-arrows-stuck-in-living-.patch @@ -0,0 +1,65 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: mrapple +Date: Sun, 25 Nov 2012 13:47:27 -0600 +Subject: [PATCH] Add methods for working with arrows stuck in living entities + +Upstream added methods for this so the original methods +are now deprecated + +diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java +index 2b816f0e6bdb912ceeff82c0043272b3970fe243..9977bb3cb5a66c84db816f8e4597db1c053f77c8 100644 +--- a/src/main/java/org/bukkit/entity/LivingEntity.java ++++ b/src/main/java/org/bukkit/entity/LivingEntity.java +@@ -215,12 +215,26 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource + */ + public int getArrowsInBody(); + ++ // Paper start ++ /** ++ * Set the amount of arrows in the entity's body. ++ *

++ * Does not fire the {@link org.bukkit.event.entity.ArrowBodyCountChangeEvent}. ++ * ++ * @param count amount of arrows in entity's body ++ */ ++ default void setArrowsInBody(final int count) { ++ this.setArrowsInBody(count, false); ++ } ++ // Paper end ++ + /** + * Set the amount of arrows in the entity's body. + * + * @param count amount of arrows in entity's body ++ * @param fireEvent whether to fire the {@link org.bukkit.event.entity.ArrowBodyCountChangeEvent} event + */ +- public void setArrowsInBody(int count); ++ void setArrowsInBody(int count, boolean fireEvent); // Paper + + /** + * Returns the living entity's current maximum no damage ticks. +@@ -689,4 +703,24 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource + * @return Whether the entity is invisible + */ + public boolean isInvisible(); ++ ++ // Paper start ++ /** ++ * Get the number of arrows stuck in this entity ++ * @return Number of arrows stuck ++ * @deprecated use {@link #getArrowsInBody()} ++ */ ++ @Deprecated ++ int getArrowsStuck(); ++ ++ /** ++ * Set the number of arrows stuck in this entity ++ * ++ * @param arrows Number of arrows to stick in this entity ++ * @deprecated use {@link #setArrowsInBody(int, boolean)}. This method previously fired {@link org.bukkit.event.entity.ArrowBodyCountChangeEvent} so if ++ * you want to retain exact functionality, pass {@code true} for {@code fireEvent}. ++ */ ++ @Deprecated ++ void setArrowsStuck(int arrows); ++ // Paper end + } diff --git a/patches/api/0026-Complete-resource-pack-API.patch b/patches/api/0027-Complete-resource-pack-API.patch similarity index 97% rename from patches/api/0026-Complete-resource-pack-API.patch rename to patches/api/0027-Complete-resource-pack-API.patch index d7714d68dd..87a1f02236 100644 --- a/patches/api/0026-Complete-resource-pack-API.patch +++ b/patches/api/0027-Complete-resource-pack-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Complete resource pack API diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 74a3abef2ff1be11427558293e81f3b7fe9fff16..bc3fc130b38bb9e102ab6a95e6ca75d815ba4902 100644 +index 5de2fbb69c8950a5f85476b60993b3d6b2164162..60bfbf979899df20e0f7ab5f1dcf79ff3cb483a9 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java -@@ -1329,7 +1329,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -1354,7 +1354,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM * @throws IllegalArgumentException Thrown if the URL is null. * @throws IllegalArgumentException Thrown if the URL is too long. The * length restriction is an implementation specific arbitrary value. @@ -18,7 +18,7 @@ index 74a3abef2ff1be11427558293e81f3b7fe9fff16..bc3fc130b38bb9e102ab6a95e6ca75d8 public void setResourcePack(@NotNull String url); /** -@@ -2145,6 +2147,124 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -2170,6 +2172,124 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM default net.kyori.adventure.text.event.HoverEvent asHoverEvent(final @NotNull java.util.function.UnaryOperator op) { return net.kyori.adventure.text.event.HoverEvent.showEntity(op.apply(net.kyori.adventure.text.event.HoverEvent.ShowEntity.of(this.getType().getKey(), this.getUniqueId(), this.displayName()))); } diff --git a/patches/api/0030-Add-command-to-reload-permissions.yml-and-require-co.patch b/patches/api/0030-Add-command-to-reload-permissions.yml-and-require-co.patch index 9f6ec05cf3..595ab58607 100644 --- a/patches/api/0030-Add-command-to-reload-permissions.yml-and-require-co.patch +++ b/patches/api/0030-Add-command-to-reload-permissions.yml-and-require-co.patch @@ -84,21 +84,3 @@ index 50cc311be7904cc8fc6070a21c8e4de3a489fd20..5fa9d648bc780e874f658597f1a24715 + return java.util.Collections.singletonList("permissions"); // Paper } } -diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java -index b535ab89b5a04371bac41720d28b4af8b18f1c20..77caec9f974077ed6580d3cbbc20feb1199feb11 100644 ---- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java -+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java -@@ -906,4 +906,13 @@ public final class SimplePluginManager implements PluginManager { - public void useTimings(boolean use) { - co.aikar.timings.Timings.setTimingsEnabled(use); // Paper - } -+ -+ // Paper start -+ public void clearPermissions() { -+ permissions.clear(); -+ defaultPerms.get(true).clear(); -+ defaultPerms.get(false).clear(); -+ } -+ // Paper end -+ - } diff --git a/patches/api/0043-Allow-Reloading-of-Command-Aliases.patch b/patches/api/0043-Allow-Reloading-of-Command-Aliases.patch index 5be01c94c3..66c1e8846b 100644 --- a/patches/api/0043-Allow-Reloading-of-Command-Aliases.patch +++ b/patches/api/0043-Allow-Reloading-of-Command-Aliases.patch @@ -56,7 +56,7 @@ index bd2c7a6964722412148fae39e1b4951fc0002b9b..864c263bbd4dd6dd7c37a74b39b1a40a + // Paper end } diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java -index 2e23c124311b38aaea64dd274c33afcd52edcf43..950a2d0b3b583c6b9a703190874bbc4df2783ab7 100644 +index b3b32ce429edbf1ed040354dbe28ab86f0d24201..1424060c0a162020d4a680e0a592224561067b16 100644 --- a/src/main/java/org/bukkit/command/SimpleCommandMap.java +++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java @@ -293,4 +293,11 @@ public class SimpleCommandMap implements CommandMap { diff --git a/patches/api/0046-Add-String-based-Action-Bar-API.patch b/patches/api/0046-Add-String-based-Action-Bar-API.patch index 343e0ac46b..d2e11a89db 100644 --- a/patches/api/0046-Add-String-based-Action-Bar-API.patch +++ b/patches/api/0046-Add-String-based-Action-Bar-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add String based Action Bar API diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index bc3fc130b38bb9e102ab6a95e6ca75d815ba4902..80910fcc46b62ee4974a659713a1a72b5b4c135b 100644 +index 60bfbf979899df20e0f7ab5f1dcf79ff3cb483a9..92d1f84e3fdd2c0d69239e1ddc77ff799a2897c1 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java @@ -4,6 +4,7 @@ import java.net.InetSocketAddress; @@ -16,7 +16,7 @@ index bc3fc130b38bb9e102ab6a95e6ca75d815ba4902..80910fcc46b62ee4974a659713a1a72b import org.bukkit.DyeColor; import org.bukkit.Effect; import org.bukkit.GameMode; -@@ -780,6 +781,39 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -805,6 +806,39 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM public void sendMap(@NotNull MapView map); // Paper start @@ -56,7 +56,7 @@ index bc3fc130b38bb9e102ab6a95e6ca75d815ba4902..80910fcc46b62ee4974a659713a1a72b /** * Sends the component to the player * -@@ -807,9 +841,11 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -832,9 +866,11 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM /** * Sends an array of components as a single message to the specified screen position of this player * @@ -68,7 +68,7 @@ index bc3fc130b38bb9e102ab6a95e6ca75d815ba4902..80910fcc46b62ee4974a659713a1a72b public default void sendMessage(net.md_5.bungee.api.ChatMessageType position, net.md_5.bungee.api.chat.BaseComponent... components) { spigot().sendMessage(position, components); } -@@ -2336,6 +2372,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -2361,6 +2397,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM /** * Sends the component to the specified screen position of this player * @@ -76,7 +76,7 @@ index bc3fc130b38bb9e102ab6a95e6ca75d815ba4902..80910fcc46b62ee4974a659713a1a72b * @param position the screen position * @param component the components to send * @deprecated use {@code sendMessage} methods that accept {@link net.kyori.adventure.text.Component} -@@ -2348,6 +2385,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -2373,6 +2410,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM /** * Sends an array of components as a single message to the specified screen position of this player * diff --git a/patches/api/0051-Provide-E-TE-Chunk-count-stat-methods.patch b/patches/api/0051-Provide-E-TE-Chunk-count-stat-methods.patch index d90b03ed52..cfa57eedb2 100644 --- a/patches/api/0051-Provide-E-TE-Chunk-count-stat-methods.patch +++ b/patches/api/0051-Provide-E-TE-Chunk-count-stat-methods.patch @@ -7,7 +7,7 @@ Provides counts without the ineffeciency of using .getEntities().size() which creates copy of the collections. diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 75a87b221cc0f6334c5283130a7b2bfdf4eedd03..e6c9942f7820f2b8750c1bb0825c8bdbc6f4b99e 100644 +index 8a6a548314eef8d486be908e38e3a4562f26bdb4..749d3de7dad480965be536938733d72bdfc2995b 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -45,6 +45,33 @@ import org.jetbrains.annotations.Nullable; diff --git a/patches/api/0055-Fix-upstream-javadocs.patch b/patches/api/0055-Fix-upstream-javadocs.patch index 3ef4db44fc..33f96dea90 100644 --- a/patches/api/0055-Fix-upstream-javadocs.patch +++ b/patches/api/0055-Fix-upstream-javadocs.patch @@ -19,7 +19,7 @@ index d3d8c5ac59cee2ec24e91223e0c994016a4f9752..82757d3013e01a6bfbb685929955d3e7 * @return an array containing all previous players */ diff --git a/src/main/java/org/bukkit/ChunkSnapshot.java b/src/main/java/org/bukkit/ChunkSnapshot.java -index fb3e166ec48b8c0ebb7d541eaa1761b03a140610..cab63d678e56df0a090ee793d56def88b8c68079 100644 +index 0cf808356a1a5c6fc4bcf97a694ed9beb80a776a..dc765dea47a9a1c1520fb16ddb24f81413ed0dd1 100644 --- a/src/main/java/org/bukkit/ChunkSnapshot.java +++ b/src/main/java/org/bukkit/ChunkSnapshot.java @@ -136,7 +136,7 @@ public interface ChunkSnapshot { @@ -103,7 +103,7 @@ index 91fc11dda99de506be83d40df8929bf7cd8e8d85..7dc631ebd009f5f5c3ac1699c3f3515c // Paper end } diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java -index 652238659e0a6e0df11f2798773aea4fe7712360..9c57eda3b7af7026639afda9959bc5e5a720861a 100644 +index 09936f3a2376a46721bbc8365c989581c2a789ef..3845a726adbd0e75d7bf2aeeb6da8cb571d51a8f 100644 --- a/src/main/java/org/bukkit/entity/HumanEntity.java +++ b/src/main/java/org/bukkit/entity/HumanEntity.java @@ -22,6 +22,11 @@ import org.jetbrains.annotations.Nullable; @@ -134,7 +134,7 @@ index 2926fa6071bc7640cc10280b5c3962b0ce7686f1..4f63988848443aff55619bc12ef12c92 * Instructs this Mob to set the specified LivingEntity as its target. *

diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 80910fcc46b62ee4974a659713a1a72b5b4c135b..50faa513411cdb611ae228f0c07a7dfe15807b85 100644 +index 92d1f84e3fdd2c0d69239e1ddc77ff799a2897c1..e15a9525b989abee62ca2d8ec924ee492118abb2 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java @@ -312,15 +312,15 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM @@ -157,7 +157,7 @@ index 80910fcc46b62ee4974a659713a1a72b5b4c135b..50faa513411cdb611ae228f0c07a7dfe *

* Note: This will overwrite the players current inventory, health, * motion, etc, with the state from the saved dat file. -@@ -798,7 +798,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -823,7 +823,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM * * Use supplied alternative character to the section symbol to represent legacy color codes. * diff --git a/patches/api/0058-Add-UnknownCommandEvent.patch b/patches/api/0058-Add-UnknownCommandEvent.patch index 64312ce49a..df31d3cf28 100644 --- a/patches/api/0058-Add-UnknownCommandEvent.patch +++ b/patches/api/0058-Add-UnknownCommandEvent.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Add UnknownCommandEvent diff --git a/src/main/java/org/bukkit/event/command/UnknownCommandEvent.java b/src/main/java/org/bukkit/event/command/UnknownCommandEvent.java new file mode 100644 -index 0000000000000000000000000000000000000000..57128c780bc73e39d2733cceeb21dc06c2422c3c +index 0000000000000000000000000000000000000000..e4f8a0d14ae66468bbb0a5d6bf9c1ee417dc866c --- /dev/null +++ b/src/main/java/org/bukkit/event/command/UnknownCommandEvent.java -@@ -0,0 +1,113 @@ +@@ -0,0 +1,110 @@ +package org.bukkit.event.command; + +import net.kyori.adventure.text.Component; @@ -17,6 +17,7 @@ index 0000000000000000000000000000000000000000..57128c780bc73e39d2733cceeb21dc06 +import org.bukkit.command.CommandSender; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; ++import org.jetbrains.annotations.Contract; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + @@ -29,11 +30,6 @@ index 0000000000000000000000000000000000000000..57128c780bc73e39d2733cceeb21dc06 + @NotNull private String commandLine; + @Nullable private Component message; + -+ @Deprecated -+ public UnknownCommandEvent(@NotNull final CommandSender sender, @NotNull final String commandLine, @Nullable final String message) { -+ this(sender, commandLine, message == null ? null : LegacyComponentSerializer.legacySection().deserialize(message)); -+ } -+ + public UnknownCommandEvent(@NotNull final CommandSender sender, @NotNull final String commandLine, @Nullable final Component message) { + super(false); + this.sender = sender; @@ -96,6 +92,7 @@ index 0000000000000000000000000000000000000000..57128c780bc73e39d2733cceeb21dc06 + * @return Unknown command message + */ + @Nullable ++ @Contract(pure = true) + public Component message() { + return this.message; + } diff --git a/patches/api/0061-Shoulder-Entities-Release-API.patch b/patches/api/0061-Shoulder-Entities-Release-API.patch index a7f5fc1a48..5dbabdff87 100644 --- a/patches/api/0061-Shoulder-Entities-Release-API.patch +++ b/patches/api/0061-Shoulder-Entities-Release-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Shoulder Entities Release API diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java -index 9c57eda3b7af7026639afda9959bc5e5a720861a..be3eaadbc768a306da68a15abcaa7a5d3ec760c7 100644 +index 3845a726adbd0e75d7bf2aeeb6da8cb571d51a8f..abdca9fe5acc90f167219eb769ece66c35682bb1 100644 --- a/src/main/java/org/bukkit/entity/HumanEntity.java +++ b/src/main/java/org/bukkit/entity/HumanEntity.java -@@ -319,6 +319,26 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder +@@ -339,6 +339,26 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder */ public int getExpToLevel(); diff --git a/patches/api/0065-Add-getI18NDisplayName-API.patch b/patches/api/0065-Add-getI18NDisplayName-API.patch index ea4187110a..529bea034e 100644 --- a/patches/api/0065-Add-getI18NDisplayName-API.patch +++ b/patches/api/0065-Add-getI18NDisplayName-API.patch @@ -32,10 +32,10 @@ index af4a7ce37eb10bab06eadb6583c7894b3ec55ae6..159e5a908b35b84b7fabc36581e093d9 // Paper end } diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index d168a836d655b369f67200d7afe101b56ff815b1..edf5cd3734011de9130139e542ebc44bcc67f396 100644 +index 9da047582e9648d84875b6d3c136960bbb97b70e..87f7942082ad943a97058f58c09ea2fe9caf5bfe 100644 --- a/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -611,5 +611,20 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor +@@ -618,5 +618,20 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat public @NotNull net.kyori.adventure.text.Component displayName() { return Bukkit.getServer().getItemFactory().displayName(this); } diff --git a/patches/api/0066-ensureServerConversions-API.patch b/patches/api/0066-ensureServerConversions-API.patch index 95f1933756..0f74f77359 100644 --- a/patches/api/0066-ensureServerConversions-API.patch +++ b/patches/api/0066-ensureServerConversions-API.patch @@ -29,10 +29,10 @@ index 159e5a908b35b84b7fabc36581e093d9aa4c4b67..66ffc658dba85942f179760dc6c50258 // Paper end } diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index edf5cd3734011de9130139e542ebc44bcc67f396..8b76d7ca596ea261c0ca3b9fe2fbf5507c3883e3 100644 +index 87f7942082ad943a97058f58c09ea2fe9caf5bfe..9d32283ee612a50b8a2bfe5151f42c9f181ede4c 100644 --- a/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -536,7 +536,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor +@@ -537,7 +537,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat } } @@ -41,7 +41,7 @@ index edf5cd3734011de9130139e542ebc44bcc67f396..8b76d7ca596ea261c0ca3b9fe2fbf550 } /** -@@ -612,6 +612,19 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor +@@ -619,6 +619,19 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat return Bukkit.getServer().getItemFactory().displayName(this); } diff --git a/patches/api/0068-LivingEntity-setKiller.patch b/patches/api/0067-LivingEntity-setKiller.patch similarity index 83% rename from patches/api/0068-LivingEntity-setKiller.patch rename to patches/api/0067-LivingEntity-setKiller.patch index 706e674ebd..e117b6ac51 100644 --- a/patches/api/0068-LivingEntity-setKiller.patch +++ b/patches/api/0067-LivingEntity-setKiller.patch @@ -5,10 +5,10 @@ Subject: [PATCH] LivingEntity#setKiller diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index f00502b59f15c3a92ce18e7d1aa4e546fd45b16a..036936671d816fc553ad2fdf8324609ab610b7f5 100644 +index 9977bb3cb5a66c84db816f8e4597db1c053f77c8..ccd8f36c8450bab9f609bb220b5270394960580e 100644 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -281,6 +281,15 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource +@@ -295,6 +295,15 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource @Nullable public Player getKiller(); diff --git a/patches/api/0069-ProfileWhitelistVerifyEvent.patch b/patches/api/0068-ProfileWhitelistVerifyEvent.patch similarity index 100% rename from patches/api/0069-ProfileWhitelistVerifyEvent.patch rename to patches/api/0068-ProfileWhitelistVerifyEvent.patch diff --git a/patches/api/0070-Allow-plugins-to-use-SLF4J-for-logging.patch b/patches/api/0069-Allow-plugins-to-use-SLF4J-for-logging.patch similarity index 88% rename from patches/api/0070-Allow-plugins-to-use-SLF4J-for-logging.patch rename to patches/api/0069-Allow-plugins-to-use-SLF4J-for-logging.patch index 2fbad5cbc1..4254e0f90a 100644 --- a/patches/api/0070-Allow-plugins-to-use-SLF4J-for-logging.patch +++ b/patches/api/0069-Allow-plugins-to-use-SLF4J-for-logging.patch @@ -14,7 +14,7 @@ it without having to shade it in the plugin and going through several layers of logging abstraction. diff --git a/build.gradle.kts b/build.gradle.kts -index 9d650b937610d83748b30d724cee97afd715167f..3c4dd6ebc2289c44c2f5723e7920aadffdc51884 100644 +index f5f217a3a786bf4c95bea74c135289d12205cf7b..56333098150995cd36793de75a998b628e82881d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -39,6 +39,8 @@ dependencies { @@ -27,10 +27,10 @@ index 9d650b937610d83748b30d724cee97afd715167f..3c4dd6ebc2289c44c2f5723e7920aadf implementation("org.ow2.asm:asm:9.2") implementation("org.ow2.asm:asm-commons:9.2") diff --git a/src/main/java/org/bukkit/plugin/Plugin.java b/src/main/java/org/bukkit/plugin/Plugin.java -index b37938745f916b5f0111b07b1a1c97527f026e9d..08aef59d8443038771704d9587e31f299e587307 100644 +index 8c76716249e44ed8bf6be94c1f5c7b6d9bb35be2..4eb639fbb46a0848be207149ea433455550fae1c 100644 --- a/src/main/java/org/bukkit/plugin/Plugin.java +++ b/src/main/java/org/bukkit/plugin/Plugin.java -@@ -186,6 +186,22 @@ public interface Plugin extends TabExecutor { +@@ -198,6 +198,22 @@ public interface Plugin extends TabExecutor { } // Paper end diff --git a/patches/api/0071-Handle-plugin-prefixes-in-implementation-logging-con.patch b/patches/api/0070-Handle-plugin-prefixes-in-implementation-logging-con.patch similarity index 79% rename from patches/api/0071-Handle-plugin-prefixes-in-implementation-logging-con.patch rename to patches/api/0070-Handle-plugin-prefixes-in-implementation-logging-con.patch index e8b752d9a7..bdc3a0e82f 100644 --- a/patches/api/0071-Handle-plugin-prefixes-in-implementation-logging-con.patch +++ b/patches/api/0070-Handle-plugin-prefixes-in-implementation-logging-con.patch @@ -17,10 +17,10 @@ The implementation should handle plugin prefixes by displaying logger names when appropriate. diff --git a/src/main/java/org/bukkit/plugin/java/JavaPlugin.java b/src/main/java/org/bukkit/plugin/java/JavaPlugin.java -index 669a70faa95d0d6525a731d73499ed6fb0b48320..1ff0e0ef1aebec5bbb0a8a09af11d07b2a3220e8 100644 +index 6175b04327b12e74140a0885f7326546dfaf269a..79df67daf2fe8193fd83dd6a7bfc78b3f6e524c2 100644 --- a/src/main/java/org/bukkit/plugin/java/JavaPlugin.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPlugin.java -@@ -43,7 +43,7 @@ public abstract class JavaPlugin extends PluginBase { +@@ -44,7 +44,7 @@ public abstract class JavaPlugin extends PluginBase { private boolean naggable = true; private FileConfiguration newConfig = null; private File configFile = null; @@ -28,14 +28,14 @@ index 669a70faa95d0d6525a731d73499ed6fb0b48320..1ff0e0ef1aebec5bbb0a8a09af11d07b + private Logger logger = null; // Paper - PluginLogger -> Logger public JavaPlugin() { - final ClassLoader classLoader = this.getClass().getClassLoader(); -@@ -277,7 +277,8 @@ public abstract class JavaPlugin extends PluginBase { + // Paper start +@@ -301,8 +301,8 @@ public abstract class JavaPlugin extends PluginBase { this.dataFolder = dataFolder; this.classLoader = classLoader; this.configFile = new File(dataFolder, "config.yml"); - this.logger = new PluginLogger(this); -+ // Paper - Handle plugin prefix in implementation -+ this.logger = Logger.getLogger(description.getPrefix() != null ? description.getPrefix() : description.getName()); + this.pluginMeta = configuration; // Paper ++ this.logger = Logger.getLogger(description.getPrefix() != null ? description.getPrefix() : description.getName()); // Paper - Handle plugin prefix in implementation } /** diff --git a/patches/api/0072-Add-PlayerJumpEvent.patch b/patches/api/0071-Add-PlayerJumpEvent.patch similarity index 100% rename from patches/api/0072-Add-PlayerJumpEvent.patch rename to patches/api/0071-Add-PlayerJumpEvent.patch diff --git a/patches/api/0073-Add-workaround-for-plugins-modifying-the-parent-of-t.patch b/patches/api/0072-Add-workaround-for-plugins-modifying-the-parent-of-t.patch similarity index 65% rename from patches/api/0073-Add-workaround-for-plugins-modifying-the-parent-of-t.patch rename to patches/api/0072-Add-workaround-for-plugins-modifying-the-parent-of-t.patch index 4b8543b4f9..338400e4d6 100644 --- a/patches/api/0073-Add-workaround-for-plugins-modifying-the-parent-of-t.patch +++ b/patches/api/0072-Add-workaround-for-plugins-modifying-the-parent-of-t.patch @@ -14,12 +14,13 @@ parent of the plugin logger to avoid this. diff --git a/src/main/java/com/destroystokyo/paper/utils/PaperPluginLogger.java b/src/main/java/com/destroystokyo/paper/utils/PaperPluginLogger.java new file mode 100644 -index 0000000000000000000000000000000000000000..76f2cb9cd99cad2a9484eab2becd8c36f1dd91b3 +index 0000000000000000000000000000000000000000..087ee57fe5485bc760fadd45a176d4d90a18f9f8 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/utils/PaperPluginLogger.java -@@ -0,0 +1,41 @@ +@@ -0,0 +1,48 @@ +package com.destroystokyo.paper.utils; + ++import io.papermc.paper.plugin.configuration.PluginMeta; +import org.bukkit.plugin.PluginDescriptionFile; + +import java.util.logging.Level; @@ -32,20 +33,26 @@ index 0000000000000000000000000000000000000000..76f2cb9cd99cad2a9484eab2becd8c36 + */ +public class PaperPluginLogger extends Logger { + ++ @Deprecated(forRemoval = true) + @NotNull + public static Logger getLogger(@NotNull PluginDescriptionFile description) { -+ Logger logger = new PaperPluginLogger(description); ++ return getLogger((PluginMeta) description); ++ } ++ ++ @NotNull ++ public static Logger getLogger(@NotNull PluginMeta meta) { ++ Logger logger = new PaperPluginLogger(meta); + if (!LogManager.getLogManager().addLogger(logger)) { + // Disable this if it's going to happen across reloads anyways... + //logger.log(Level.WARNING, "Could not insert plugin logger - one was already found: {}", LogManager.getLogManager().getLogger(this.getName())); -+ logger = LogManager.getLogManager().getLogger(description.getPrefix() != null ? description.getPrefix() : description.getName()); ++ logger = LogManager.getLogManager().getLogger(meta.getLoggerPrefix() != null ? meta.getLoggerPrefix() : meta.getName()); + } + + return logger; + } + -+ private PaperPluginLogger(@NotNull PluginDescriptionFile description) { -+ super(description.getPrefix() != null ? description.getPrefix() : description.getName(), null); ++ private PaperPluginLogger(@NotNull PluginMeta meta) { ++ super(meta.getLoggerPrefix() != null ? meta.getLoggerPrefix() : meta.getName(), null); + } + + @Override @@ -60,24 +67,23 @@ index 0000000000000000000000000000000000000000..76f2cb9cd99cad2a9484eab2becd8c36 + +} diff --git a/src/main/java/org/bukkit/plugin/java/JavaPlugin.java b/src/main/java/org/bukkit/plugin/java/JavaPlugin.java -index 1ff0e0ef1aebec5bbb0a8a09af11d07b2a3220e8..3bea5dd67ad0393160ccede4ac99a3c7baa1803b 100644 +index 71c8d2345eef6895edb8d210553ec3cddd9c76d0..6d31f3a2569ae9c522a5e6cddd38ac8f252f1bfe 100644 --- a/src/main/java/org/bukkit/plugin/java/JavaPlugin.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPlugin.java -@@ -43,7 +43,7 @@ public abstract class JavaPlugin extends PluginBase { +@@ -44,7 +44,7 @@ public abstract class JavaPlugin extends PluginBase { private boolean naggable = true; private FileConfiguration newConfig = null; private File configFile = null; - private Logger logger = null; // Paper - PluginLogger -> Logger -+ Logger logger = null; // Paper - PluginLogger -> Logger, package-private ++ public Logger logger = null; // Paper - PluginLogger -> Logger, public public JavaPlugin() { - final ClassLoader classLoader = this.getClass().getClassLoader(); -@@ -277,8 +277,11 @@ public abstract class JavaPlugin extends PluginBase { - this.dataFolder = dataFolder; + // Paper start +@@ -302,7 +302,11 @@ public abstract class JavaPlugin extends PluginBase { this.classLoader = classLoader; this.configFile = new File(dataFolder, "config.yml"); -- // Paper - Handle plugin prefix in implementation -- this.logger = Logger.getLogger(description.getPrefix() != null ? description.getPrefix() : description.getName()); + this.pluginMeta = configuration; // Paper +- this.logger = Logger.getLogger(description.getPrefix() != null ? description.getPrefix() : description.getName()); // Paper - Handle plugin prefix in implementation + // Paper start + if (this.logger == null) { + this.logger = com.destroystokyo.paper.utils.PaperPluginLogger.getLogger(this.description); @@ -87,31 +93,23 @@ index 1ff0e0ef1aebec5bbb0a8a09af11d07b2a3220e8..3bea5dd67ad0393160ccede4ac99a3c7 /** diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java -index 6148b69af39344f758b05a28c7c572befa9b8f3f..0db641f5d5e1293b236ad0d2e3a156802ffed839 100644 +index dd569f2fc6098650d202e834b343b1bff2d42284..fade45ef475ae20922f5abea49a0f035d19b7819 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 - private JavaPlugin pluginInit; - private IllegalStateException pluginState; - private final Set seenIllegalAccess = Collections.newSetFromMap(new ConcurrentHashMap<>()); -+ private java.util.logging.Logger logger; // Paper - add field - - static { - ClassLoader.registerAsParallelCapable(); -@@ -62,6 +63,8 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot +@@ -64,7 +64,7 @@ public final class PluginClassLoader extends URLClassLoader implements io.paperm 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 { -@@ -229,6 +232,7 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot + // Paper start + this.classLoaderGroup = io.papermc.paper.plugin.provider.classloader.PaperClassLoaderStorage.instance().registerSpigotGroup(this); // Paper + // Paper end +@@ -247,6 +247,7 @@ public final class PluginClassLoader extends URLClassLoader implements io.paperm pluginState = new IllegalStateException("Initial initialization"); this.pluginInit = javaPlugin; + javaPlugin.logger = this.logger; // Paper - set logger - javaPlugin.init(loader, loader.server, description, dataFolder, file, this); + javaPlugin.init(null, org.bukkit.Bukkit.getServer(), description, dataFolder, file, this); // Paper } - } + diff --git a/patches/api/0074-Add-PlayerArmorChangeEvent.patch b/patches/api/0073-Add-PlayerArmorChangeEvent.patch similarity index 100% rename from patches/api/0074-Add-PlayerArmorChangeEvent.patch rename to patches/api/0073-Add-PlayerArmorChangeEvent.patch diff --git a/patches/api/0075-API-to-get-a-BlockState-without-a-snapshot.patch b/patches/api/0074-API-to-get-a-BlockState-without-a-snapshot.patch similarity index 91% rename from patches/api/0075-API-to-get-a-BlockState-without-a-snapshot.patch rename to patches/api/0074-API-to-get-a-BlockState-without-a-snapshot.patch index 41c8e70b83..8f748c0ed1 100644 --- a/patches/api/0075-API-to-get-a-BlockState-without-a-snapshot.patch +++ b/patches/api/0074-API-to-get-a-BlockState-without-a-snapshot.patch @@ -9,10 +9,10 @@ on the real tile entity. This is useful for where performance is needed diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java -index b4094e042c1619cfcdd68c27f82979a7562ddf55..d29bdc125dba0128d93d57e8d9393b970e6c00a9 100644 +index f8e12868f2e629cdf4784f0157fdb2f8e7b01f99..61ce341daec63392f040b70cd12662379b2f1ebd 100644 --- a/src/main/java/org/bukkit/block/Block.java +++ b/src/main/java/org/bukkit/block/Block.java -@@ -271,6 +271,16 @@ public interface Block extends Metadatable { +@@ -272,6 +272,16 @@ public interface Block extends Metadatable, Translatable { @NotNull BlockState getState(); diff --git a/patches/api/0076-AsyncTabCompleteEvent.patch b/patches/api/0075-AsyncTabCompleteEvent.patch similarity index 99% rename from patches/api/0076-AsyncTabCompleteEvent.patch rename to patches/api/0075-AsyncTabCompleteEvent.patch index 205825a521..ebb7553005 100644 --- a/patches/api/0076-AsyncTabCompleteEvent.patch +++ b/patches/api/0075-AsyncTabCompleteEvent.patch @@ -578,7 +578,7 @@ index 270e6d8ad4358baa256cee5f16cff281f063ce3b..4a3451af454295ac3e1b688e6665cad9 @Override diff --git a/src/test/java/org/bukkit/AnnotationTest.java b/src/test/java/org/bukkit/AnnotationTest.java -index 8275a5d7e1de39a5171e254f449a42c6defd3445..4bca64b2a44ae032730575ecba39f9737a5a1ec7 100644 +index 9825db30d42701aad5d9970bbb989fbff0142fb1..2cb81e6d253d70388da15c9d07b630277d486c70 100644 --- a/src/test/java/org/bukkit/AnnotationTest.java +++ b/src/test/java/org/bukkit/AnnotationTest.java @@ -48,6 +48,8 @@ public class AnnotationTest { diff --git a/patches/api/0077-Expose-client-protocol-version-and-virtual-host.patch b/patches/api/0076-Expose-client-protocol-version-and-virtual-host.patch similarity index 96% rename from patches/api/0077-Expose-client-protocol-version-and-virtual-host.patch rename to patches/api/0076-Expose-client-protocol-version-and-virtual-host.patch index 1acdee557a..b8c4f58271 100644 --- a/patches/api/0077-Expose-client-protocol-version-and-virtual-host.patch +++ b/patches/api/0076-Expose-client-protocol-version-and-virtual-host.patch @@ -57,7 +57,7 @@ index 0000000000000000000000000000000000000000..7b2af1bd72dfbcf4e962a982940fc49b + +} diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 50faa513411cdb611ae228f0c07a7dfe15807b85..1f29ed50c981fa262790a070722bbe9fecac5b02 100644 +index e15a9525b989abee62ca2d8ec924ee492118abb2..7efa33336a6f6309cf11677185fd11a7c0757bb3 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java @@ -41,7 +41,7 @@ import org.jetbrains.annotations.Nullable; diff --git a/patches/api/0078-Display-warning-on-deprecated-recipe-API.patch b/patches/api/0077-Display-warning-on-deprecated-recipe-API.patch similarity index 100% rename from patches/api/0078-Display-warning-on-deprecated-recipe-API.patch rename to patches/api/0077-Display-warning-on-deprecated-recipe-API.patch diff --git a/patches/api/0079-PlayerPickupExperienceEvent.patch b/patches/api/0078-PlayerPickupExperienceEvent.patch similarity index 100% rename from patches/api/0079-PlayerPickupExperienceEvent.patch rename to patches/api/0078-PlayerPickupExperienceEvent.patch diff --git a/patches/api/0080-ExperienceOrbMergeEvent.patch b/patches/api/0079-ExperienceOrbMergeEvent.patch similarity index 100% rename from patches/api/0080-ExperienceOrbMergeEvent.patch rename to patches/api/0079-ExperienceOrbMergeEvent.patch diff --git a/patches/api/0081-Ability-to-apply-mending-to-XP-API.patch b/patches/api/0080-Ability-to-apply-mending-to-XP-API.patch similarity index 91% rename from patches/api/0081-Ability-to-apply-mending-to-XP-API.patch rename to patches/api/0080-Ability-to-apply-mending-to-XP-API.patch index 2115648f1d..757c0b1d45 100644 --- a/patches/api/0081-Ability-to-apply-mending-to-XP-API.patch +++ b/patches/api/0080-Ability-to-apply-mending-to-XP-API.patch @@ -10,10 +10,10 @@ of giving the player experience points. Both an API To standalone mend, and apply mending logic to .giveExp has been added. diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 1f29ed50c981fa262790a070722bbe9fecac5b02..f42ef55662b8cecd7383ae10424364da97c54453 100644 +index 7efa33336a6f6309cf11677185fd11a7c0757bb3..a2a207ea9aa7e6a09af75cf8975153b9abc10ec2 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java -@@ -1064,12 +1064,33 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -1089,12 +1089,33 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM */ public void resetPlayerWeather(); diff --git a/patches/api/0082-PreCreatureSpawnEvent.patch b/patches/api/0081-PreCreatureSpawnEvent.patch similarity index 98% rename from patches/api/0082-PreCreatureSpawnEvent.patch rename to patches/api/0081-PreCreatureSpawnEvent.patch index abc126ec41..f00514bf0f 100644 --- a/patches/api/0082-PreCreatureSpawnEvent.patch +++ b/patches/api/0081-PreCreatureSpawnEvent.patch @@ -16,7 +16,7 @@ See: https://github.com/PaperMC/Paper/issues/917 diff --git a/src/main/java/com/destroystokyo/paper/event/entity/PreCreatureSpawnEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/PreCreatureSpawnEvent.java new file mode 100644 -index 0000000000000000000000000000000000000000..3ad231aa3206c8cfd5ec995249584cebab5d11f3 +index 0000000000000000000000000000000000000000..02e421b0bb4ce3529ef1c4d34ec8a0c0345cce57 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/event/entity/PreCreatureSpawnEvent.java @@ -0,0 +1,105 @@ diff --git a/patches/api/0083-PlayerNaturallySpawnCreaturesEvent.patch b/patches/api/0082-PlayerNaturallySpawnCreaturesEvent.patch similarity index 100% rename from patches/api/0083-PlayerNaturallySpawnCreaturesEvent.patch rename to patches/api/0082-PlayerNaturallySpawnCreaturesEvent.patch diff --git a/patches/api/0084-Add-setPlayerProfile-API-for-Skulls.patch b/patches/api/0083-Add-setPlayerProfile-API-for-Skulls.patch similarity index 100% rename from patches/api/0084-Add-setPlayerProfile-API-for-Skulls.patch rename to patches/api/0083-Add-setPlayerProfile-API-for-Skulls.patch diff --git a/patches/api/0085-Fill-Profile-Property-Events.patch b/patches/api/0084-Fill-Profile-Property-Events.patch similarity index 100% rename from patches/api/0085-Fill-Profile-Property-Events.patch rename to patches/api/0084-Fill-Profile-Property-Events.patch diff --git a/patches/api/0086-PlayerAdvancementCriterionGrantEvent.patch b/patches/api/0085-PlayerAdvancementCriterionGrantEvent.patch similarity index 100% rename from patches/api/0086-PlayerAdvancementCriterionGrantEvent.patch rename to patches/api/0085-PlayerAdvancementCriterionGrantEvent.patch diff --git a/patches/api/0087-Add-ArmorStand-Item-Meta.patch b/patches/api/0086-Add-ArmorStand-Item-Meta.patch similarity index 100% rename from patches/api/0087-Add-ArmorStand-Item-Meta.patch rename to patches/api/0086-Add-ArmorStand-Item-Meta.patch diff --git a/patches/api/0088-Optimize-Hoppers.patch b/patches/api/0087-Optimize-Hoppers.patch similarity index 100% rename from patches/api/0088-Optimize-Hoppers.patch rename to patches/api/0087-Optimize-Hoppers.patch diff --git a/patches/api/0089-Tameable-getOwnerUniqueId-API.patch b/patches/api/0088-Tameable-getOwnerUniqueId-API.patch similarity index 100% rename from patches/api/0089-Tameable-getOwnerUniqueId-API.patch rename to patches/api/0088-Tameable-getOwnerUniqueId-API.patch diff --git a/patches/api/0090-Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch b/patches/api/0089-Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch similarity index 100% rename from patches/api/0090-Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch rename to patches/api/0089-Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch diff --git a/patches/api/0091-Add-extended-PaperServerListPingEvent.patch b/patches/api/0090-Add-extended-PaperServerListPingEvent.patch similarity index 100% rename from patches/api/0091-Add-extended-PaperServerListPingEvent.patch rename to patches/api/0090-Add-extended-PaperServerListPingEvent.patch diff --git a/patches/api/0092-Player.setPlayerProfile-API.patch b/patches/api/0091-Player.setPlayerProfile-API.patch similarity index 97% rename from patches/api/0092-Player.setPlayerProfile-API.patch rename to patches/api/0091-Player.setPlayerProfile-API.patch index f217438f07..2e0e0ff318 100644 --- a/patches/api/0092-Player.setPlayerProfile-API.patch +++ b/patches/api/0091-Player.setPlayerProfile-API.patch @@ -93,10 +93,10 @@ index bf1102b4481b8c9b9c4f5ba0c561556b75fea077..8539bac19bf9ba1a66689a9af90e088a /** diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index f42ef55662b8cecd7383ae10424364da97c54453..d55104146a7a4668aa73ee0bf6f084471e8b85c2 100644 +index a2a207ea9aa7e6a09af75cf8975153b9abc10ec2..c2723b0e34f5d63b4b26ddb3b7c7e8b349a5521e 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java -@@ -2322,6 +2322,20 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -2347,6 +2347,20 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM * was {@link org.bukkit.event.player.PlayerResourcePackStatusEvent.Status#SUCCESSFULLY_LOADED} */ boolean hasResourcePack(); diff --git a/patches/api/0093-getPlayerUniqueId-API.patch b/patches/api/0092-getPlayerUniqueId-API.patch similarity index 100% rename from patches/api/0093-getPlayerUniqueId-API.patch rename to patches/api/0092-getPlayerUniqueId-API.patch diff --git a/patches/api/0094-Add-legacy-ping-support-to-PaperServerListPingEvent.patch b/patches/api/0093-Add-legacy-ping-support-to-PaperServerListPingEvent.patch similarity index 100% rename from patches/api/0094-Add-legacy-ping-support-to-PaperServerListPingEvent.patch rename to patches/api/0093-Add-legacy-ping-support-to-PaperServerListPingEvent.patch diff --git a/patches/api/0095-Add-openSign-method-to-HumanEntity.patch b/patches/api/0094-Add-openSign-method-to-HumanEntity.patch similarity index 80% rename from patches/api/0095-Add-openSign-method-to-HumanEntity.patch rename to patches/api/0094-Add-openSign-method-to-HumanEntity.patch index 2b6b38993f..b0e1448977 100644 --- a/patches/api/0095-Add-openSign-method-to-HumanEntity.patch +++ b/patches/api/0094-Add-openSign-method-to-HumanEntity.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add openSign method to HumanEntity diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java -index be3eaadbc768a306da68a15abcaa7a5d3ec760c7..13b74e942012169611f2791f8b4493d04710e4c0 100644 +index abdca9fe5acc90f167219eb769ece66c35682bb1..9715a9d36187e2eecfeab1a05087d27c28b8690e 100644 --- a/src/main/java/org/bukkit/entity/HumanEntity.java +++ b/src/main/java/org/bukkit/entity/HumanEntity.java -@@ -480,6 +480,14 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder +@@ -500,6 +500,14 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder */ @Deprecated public void setShoulderEntityRight(@Nullable Entity entity); @@ -24,10 +24,10 @@ index be3eaadbc768a306da68a15abcaa7a5d3ec760c7..13b74e942012169611f2791f8b4493d0 /** * Make the entity drop the item in their hand. diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index d55104146a7a4668aa73ee0bf6f084471e8b85c2..104171d7a75abf5c3ba5903c1fba4ca7a85369ae 100644 +index c2723b0e34f5d63b4b26ddb3b7c7e8b349a5521e..6a33b5d7fc34a78a131a0ef280cddd1b9718e125 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java -@@ -2177,7 +2177,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -2202,7 +2202,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM /** * Open a Sign for editing by the Player. * diff --git a/patches/api/0096-Add-Ban-Methods-to-Player-Objects.patch b/patches/api/0095-Add-Ban-Methods-to-Player-Objects.patch similarity index 97% rename from patches/api/0096-Add-Ban-Methods-to-Player-Objects.patch rename to patches/api/0095-Add-Ban-Methods-to-Player-Objects.patch index d5fa90406f..4c2078ecb1 100644 --- a/patches/api/0096-Add-Ban-Methods-to-Player-Objects.patch +++ b/patches/api/0095-Add-Ban-Methods-to-Player-Objects.patch @@ -8,7 +8,7 @@ Allows a more logical API for banning players. player.banPlayer("Breaking the rules"); diff --git a/src/main/java/org/bukkit/OfflinePlayer.java b/src/main/java/org/bukkit/OfflinePlayer.java -index c5eed3234a8c04bfa9d707685746fc2b40ec8bfc..93f86bb30725dff5dbfcccf15012ffd1cee237bf 100644 +index 3ba8ff1a41ac9fd96fd4dec5cbe0f714fef93022..b39ed4eb2e7d9e40805e201d77973877481db8fd 100644 --- a/src/main/java/org/bukkit/OfflinePlayer.java +++ b/src/main/java/org/bukkit/OfflinePlayer.java @@ -58,6 +58,61 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio @@ -74,10 +74,10 @@ index c5eed3234a8c04bfa9d707685746fc2b40ec8bfc..93f86bb30725dff5dbfcccf15012ffd1 /** * Checks if this player is whitelisted or not diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 104171d7a75abf5c3ba5903c1fba4ca7a85369ae..d3c3347fd08fd6e05d5b269aa50fa083c555a7e3 100644 +index 6a33b5d7fc34a78a131a0ef280cddd1b9718e125..41188fb005807f3adfcdd81e72da122309850383 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java -@@ -781,6 +781,162 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -806,6 +806,162 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM public void sendMap(@NotNull MapView map); // Paper start diff --git a/patches/api/0097-EndermanEscapeEvent.patch b/patches/api/0096-EndermanEscapeEvent.patch similarity index 100% rename from patches/api/0097-EndermanEscapeEvent.patch rename to patches/api/0096-EndermanEscapeEvent.patch diff --git a/patches/api/0098-Enderman.teleportRandomly.patch b/patches/api/0097-Enderman.teleportRandomly.patch similarity index 100% rename from patches/api/0098-Enderman.teleportRandomly.patch rename to patches/api/0097-Enderman.teleportRandomly.patch diff --git a/patches/api/0099-Additional-world.getNearbyEntities-API-s.patch b/patches/api/0098-Additional-world.getNearbyEntities-API-s.patch similarity index 99% rename from patches/api/0099-Additional-world.getNearbyEntities-API-s.patch rename to patches/api/0098-Additional-world.getNearbyEntities-API-s.patch index 3659b5a65e..750f260d01 100644 --- a/patches/api/0099-Additional-world.getNearbyEntities-API-s.patch +++ b/patches/api/0098-Additional-world.getNearbyEntities-API-s.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Additional world.getNearbyEntities API's Provides more methods to get nearby entities, and filter by types and predicates diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index e6c9942f7820f2b8750c1bb0825c8bdbc6f4b99e..3539e63993cc21f9eecda9046b759cebdfec80ff 100644 +index 749d3de7dad480965be536938733d72bdfc2995b..dad7de7246741d6f3f2a444cf0b88f396302a8af 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -1,6 +1,9 @@ diff --git a/patches/api/0100-Location.isChunkLoaded-API.patch b/patches/api/0099-Location.isChunkLoaded-API.patch similarity index 100% rename from patches/api/0100-Location.isChunkLoaded-API.patch rename to patches/api/0099-Location.isChunkLoaded-API.patch diff --git a/patches/api/0101-Expand-World.spawnParticle-API-and-add-Builder.patch b/patches/api/0100-Expand-World.spawnParticle-API-and-add-Builder.patch similarity index 99% rename from patches/api/0101-Expand-World.spawnParticle-API-and-add-Builder.patch rename to patches/api/0100-Expand-World.spawnParticle-API-and-add-Builder.patch index c8a0f69c4b..2b43acd659 100644 --- a/patches/api/0101-Expand-World.spawnParticle-API-and-add-Builder.patch +++ b/patches/api/0100-Expand-World.spawnParticle-API-and-add-Builder.patch @@ -522,10 +522,10 @@ index 9f646171b3ac617fb5217d5ab9c106c3100a8c8d..2315fffc4a1a5bebc50a703e9df59df8 * Options which can be applied to redstone dust particles - a particle * color and size. diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 3539e63993cc21f9eecda9046b759cebdfec80ff..8b48ce606523528f4322296b61a64bd12067387c 100644 +index dad7de7246741d6f3f2a444cf0b88f396302a8af..ae102dddda30ff0e15f70bdb17385c8d9d4b9a08 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java -@@ -2787,7 +2787,57 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient +@@ -2812,7 +2812,57 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient * @param data the data to use for the particle or null, * the type of this depends on {@link Particle#getDataType()} */ diff --git a/patches/api/0102-EndermanAttackPlayerEvent.patch b/patches/api/0101-EndermanAttackPlayerEvent.patch similarity index 100% rename from patches/api/0102-EndermanAttackPlayerEvent.patch rename to patches/api/0101-EndermanAttackPlayerEvent.patch diff --git a/patches/api/0104-WitchConsumePotionEvent.patch b/patches/api/0102-WitchConsumePotionEvent.patch similarity index 100% rename from patches/api/0104-WitchConsumePotionEvent.patch rename to patches/api/0102-WitchConsumePotionEvent.patch diff --git a/patches/api/0105-WitchThrowPotionEvent.patch b/patches/api/0103-WitchThrowPotionEvent.patch similarity index 100% rename from patches/api/0105-WitchThrowPotionEvent.patch rename to patches/api/0103-WitchThrowPotionEvent.patch diff --git a/patches/api/0106-Location.toBlockLocation-toCenterLocation.patch b/patches/api/0104-Location.toBlockLocation-toCenterLocation.patch similarity index 100% rename from patches/api/0106-Location.toBlockLocation-toCenterLocation.patch rename to patches/api/0104-Location.toBlockLocation-toCenterLocation.patch diff --git a/patches/api/0107-PotionEffect-clone-methods.patch b/patches/api/0105-PotionEffect-clone-methods.patch similarity index 100% rename from patches/api/0107-PotionEffect-clone-methods.patch rename to patches/api/0105-PotionEffect-clone-methods.patch diff --git a/patches/api/0108-WitchReadyPotionEvent.patch b/patches/api/0106-WitchReadyPotionEvent.patch similarity index 100% rename from patches/api/0108-WitchReadyPotionEvent.patch rename to patches/api/0106-WitchReadyPotionEvent.patch diff --git a/patches/api/0109-ItemStack-getMaxItemUseDuration.patch b/patches/api/0107-ItemStack-getMaxItemUseDuration.patch similarity index 81% rename from patches/api/0109-ItemStack-getMaxItemUseDuration.patch rename to patches/api/0107-ItemStack-getMaxItemUseDuration.patch index 2335189f45..13fc1407e6 100644 --- a/patches/api/0109-ItemStack-getMaxItemUseDuration.patch +++ b/patches/api/0107-ItemStack-getMaxItemUseDuration.patch @@ -6,10 +6,10 @@ Subject: [PATCH] ItemStack#getMaxItemUseDuration Allows you to determine how long it takes to use a usable/consumable item diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index 8b76d7ca596ea261c0ca3b9fe2fbf5507c3883e3..54d7c4b78f7fb01d8c11c19f038642b155334770 100644 +index 9d32283ee612a50b8a2bfe5151f42c9f181ede4c..53d99d214652ae1636f28a179a5b66edc0f8f229 100644 --- a/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -639,5 +639,13 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor +@@ -646,5 +646,13 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat public String getI18NDisplayName() { return Bukkit.getServer().getItemFactory().getI18NDisplayName(this); } diff --git a/patches/api/0110-Add-EntityTeleportEndGatewayEvent.patch b/patches/api/0108-Add-EntityTeleportEndGatewayEvent.patch similarity index 100% rename from patches/api/0110-Add-EntityTeleportEndGatewayEvent.patch rename to patches/api/0108-Add-EntityTeleportEndGatewayEvent.patch diff --git a/patches/api/0111-Make-shield-blocking-delay-configurable.patch b/patches/api/0109-Make-shield-blocking-delay-configurable.patch similarity index 80% rename from patches/api/0111-Make-shield-blocking-delay-configurable.patch rename to patches/api/0109-Make-shield-blocking-delay-configurable.patch index a6061071b5..42c5c4e0cb 100644 --- a/patches/api/0111-Make-shield-blocking-delay-configurable.patch +++ b/patches/api/0109-Make-shield-blocking-delay-configurable.patch @@ -5,12 +5,12 @@ Subject: [PATCH] Make shield blocking delay configurable diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index 036936671d816fc553ad2fdf8324609ab610b7f5..75629874849e4cdcf0465b653f27baaca5247fea 100644 +index ccd8f36c8450bab9f609bb220b5270394960580e..2bfeebe26f32d2e931dc483714d30430deeb9b04 100644 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -712,5 +712,19 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource - * @param arrows Number of arrows to stick in this entity +@@ -731,5 +731,19 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource */ + @Deprecated void setArrowsStuck(int arrows); + + /** diff --git a/patches/api/0112-EntityShootBowEvent-consumeArrow-and-getArrowItem-AP.patch b/patches/api/0110-EntityShootBowEvent-consumeArrow-and-getArrowItem-AP.patch similarity index 100% rename from patches/api/0112-EntityShootBowEvent-consumeArrow-and-getArrowItem-AP.patch rename to patches/api/0110-EntityShootBowEvent-consumeArrow-and-getArrowItem-AP.patch diff --git a/patches/api/0113-Add-getNearbyXXX-methods-to-Location.patch b/patches/api/0111-Add-getNearbyXXX-methods-to-Location.patch similarity index 100% rename from patches/api/0113-Add-getNearbyXXX-methods-to-Location.patch rename to patches/api/0111-Add-getNearbyXXX-methods-to-Location.patch diff --git a/patches/api/0114-PlayerReadyArrowEvent.patch b/patches/api/0112-PlayerReadyArrowEvent.patch similarity index 100% rename from patches/api/0114-PlayerReadyArrowEvent.patch rename to patches/api/0112-PlayerReadyArrowEvent.patch diff --git a/patches/api/0115-Add-EntityKnockbackByEntityEvent-and-EntityPushedByE.patch b/patches/api/0113-Add-EntityKnockbackByEntityEvent-and-EntityPushedByE.patch similarity index 100% rename from patches/api/0115-Add-EntityKnockbackByEntityEvent-and-EntityPushedByE.patch rename to patches/api/0113-Add-EntityKnockbackByEntityEvent-and-EntityPushedByE.patch diff --git a/patches/api/0116-Expand-Explosions-API.patch b/patches/api/0114-Expand-Explosions-API.patch similarity index 98% rename from patches/api/0116-Expand-Explosions-API.patch rename to patches/api/0114-Expand-Explosions-API.patch index eefb112a52..f578a00aa5 100644 --- a/patches/api/0116-Expand-Explosions-API.patch +++ b/patches/api/0114-Expand-Explosions-API.patch @@ -106,7 +106,7 @@ index 6693e3d8dc2519facb12db981a6b6325faa095bf..5a6b33c6d9a68affdbd02c13fdb0854e * Returns a list of entities within a bounding box centered around a Location. * diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 8b48ce606523528f4322296b61a64bd12067387c..fd50f3a12863d1bc65d1880c939389f7b5d2c53c 100644 +index ae102dddda30ff0e15f70bdb17385c8d9d4b9a08..adf743334f4e69ebca8045df70800f67bcd7d98f 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -1424,6 +1424,88 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient diff --git a/patches/api/0117-ItemStack-API-additions-for-quantity-flags-lore.patch b/patches/api/0115-ItemStack-API-additions-for-quantity-flags-lore.patch similarity index 96% rename from patches/api/0117-ItemStack-API-additions-for-quantity-flags-lore.patch rename to patches/api/0115-ItemStack-API-additions-for-quantity-flags-lore.patch index d8bba965f1..21bfeaac9b 100644 --- a/patches/api/0117-ItemStack-API-additions-for-quantity-flags-lore.patch +++ b/patches/api/0115-ItemStack-API-additions-for-quantity-flags-lore.patch @@ -5,7 +5,7 @@ Subject: [PATCH] ItemStack API additions for quantity/flags/lore diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index 54d7c4b78f7fb01d8c11c19f038642b155334770..7559f75dcc6665fa3d19d6e53a141a214407d1c5 100644 +index 53d99d214652ae1636f28a179a5b66edc0f8f229..a70de962712c14cb895708e89ad3811041728935 100644 --- a/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java @@ -3,6 +3,7 @@ package org.bukkit.inventory; @@ -16,7 +16,7 @@ index 54d7c4b78f7fb01d8c11c19f038642b155334770..7559f75dcc6665fa3d19d6e53a141a21 import java.util.Map; import org.bukkit.Bukkit; import org.bukkit.Material; -@@ -647,5 +648,185 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor +@@ -654,5 +655,185 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat // Requires access to NMS return ensureServerConversions().getMaxItemUseDuration(); } diff --git a/patches/api/0118-LivingEntity-Hand-Raised-Item-Use-API.patch b/patches/api/0116-LivingEntity-Hand-Raised-Item-Use-API.patch similarity index 88% rename from patches/api/0118-LivingEntity-Hand-Raised-Item-Use-API.patch rename to patches/api/0116-LivingEntity-Hand-Raised-Item-Use-API.patch index 12e017a64e..719617eb8e 100644 --- a/patches/api/0118-LivingEntity-Hand-Raised-Item-Use-API.patch +++ b/patches/api/0116-LivingEntity-Hand-Raised-Item-Use-API.patch @@ -6,10 +6,10 @@ Subject: [PATCH] LivingEntity Hand Raised/Item Use API How long an entity has raised hands to charge an attack or use an item diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java -index 13b74e942012169611f2791f8b4493d04710e4c0..9c711d0b2c2f7b0c0603847590e8a1a94f091ff0 100644 +index 9715a9d36187e2eecfeab1a05087d27c28b8690e..12068d14af5731494a839b87b67ed3cc26bf8f36 100644 --- a/src/main/java/org/bukkit/entity/HumanEntity.java +++ b/src/main/java/org/bukkit/entity/HumanEntity.java -@@ -308,7 +308,9 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder +@@ -328,7 +328,9 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder * * @return the item being used by the player, or null if they are not using * an item @@ -20,10 +20,10 @@ index 13b74e942012169611f2791f8b4493d04710e4c0..9c711d0b2c2f7b0c0603847590e8a1a9 public ItemStack getItemInUse(); diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index 75629874849e4cdcf0465b653f27baaca5247fea..c80e75b72ac863db19e3d234e349876dd8797924 100644 +index 2bfeebe26f32d2e931dc483714d30430deeb9b04..17e5d2e2acdae23d8ea3b3b1a89f62e8be7b81a8 100644 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -726,5 +726,42 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource +@@ -745,5 +745,42 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource * @param delay Delay in ticks */ void setShieldBlockingDelay(int delay); diff --git a/patches/api/0119-RangedEntity-API.patch b/patches/api/0117-RangedEntity-API.patch similarity index 100% rename from patches/api/0119-RangedEntity-API.patch rename to patches/api/0117-RangedEntity-API.patch diff --git a/patches/api/0120-Add-World.getEntity-UUID-API.patch b/patches/api/0118-Add-World.getEntity-UUID-API.patch similarity index 91% rename from patches/api/0120-Add-World.getEntity-UUID-API.patch rename to patches/api/0118-Add-World.getEntity-UUID-API.patch index 7a8b323bb4..759dc7c245 100644 --- a/patches/api/0120-Add-World.getEntity-UUID-API.patch +++ b/patches/api/0118-Add-World.getEntity-UUID-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add World.getEntity(UUID) API diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index fd50f3a12863d1bc65d1880c939389f7b5d2c53c..c58c9c7791eff28ba8f847f5bc60e0db757ababd 100644 +index adf743334f4e69ebca8045df70800f67bcd7d98f..e0caac06b7f5459faefbbd5a6a3486dbb6bfa9ba 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -944,6 +944,17 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient diff --git a/patches/api/0121-InventoryCloseEvent-Reason-API.patch b/patches/api/0119-InventoryCloseEvent-Reason-API.patch similarity index 94% rename from patches/api/0121-InventoryCloseEvent-Reason-API.patch rename to patches/api/0119-InventoryCloseEvent-Reason-API.patch index 45e9ab3f1f..3bda77d2a9 100644 --- a/patches/api/0121-InventoryCloseEvent-Reason-API.patch +++ b/patches/api/0119-InventoryCloseEvent-Reason-API.patch @@ -7,10 +7,10 @@ Allows you to determine why an inventory was closed, enabling plugin developers to "confirm" things based on if it was player triggered close or not. diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java -index 9c711d0b2c2f7b0c0603847590e8a1a94f091ff0..8f489abbb7e80d869ca0f6e8626cecbd453b625a 100644 +index 12068d14af5731494a839b87b67ed3cc26bf8f36..3b184a66d1aebe4501fbdfd78ddf7a4ef5378f9f 100644 --- a/src/main/java/org/bukkit/entity/HumanEntity.java +++ b/src/main/java/org/bukkit/entity/HumanEntity.java -@@ -159,6 +159,15 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder +@@ -179,6 +179,15 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder */ public void closeInventory(); diff --git a/patches/api/0122-Allow-setting-the-vex-s-summoner.patch b/patches/api/0120-Allow-setting-the-vex-s-summoner.patch similarity index 100% rename from patches/api/0122-Allow-setting-the-vex-s-summoner.patch rename to patches/api/0120-Allow-setting-the-vex-s-summoner.patch diff --git a/patches/api/0123-Entity-getChunk-API.patch b/patches/api/0121-Entity-getChunk-API.patch similarity index 100% rename from patches/api/0123-Entity-getChunk-API.patch rename to patches/api/0121-Entity-getChunk-API.patch diff --git a/patches/api/0125-EnderDragon-Events.patch b/patches/api/0122-EnderDragon-Events.patch similarity index 100% rename from patches/api/0125-EnderDragon-Events.patch rename to patches/api/0122-EnderDragon-Events.patch diff --git a/patches/api/0126-PlayerElytraBoostEvent.patch b/patches/api/0123-PlayerElytraBoostEvent.patch similarity index 100% rename from patches/api/0126-PlayerElytraBoostEvent.patch rename to patches/api/0123-PlayerElytraBoostEvent.patch diff --git a/patches/api/0127-PlayerLaunchProjectileEvent.patch b/patches/api/0124-PlayerLaunchProjectileEvent.patch similarity index 100% rename from patches/api/0127-PlayerLaunchProjectileEvent.patch rename to patches/api/0124-PlayerLaunchProjectileEvent.patch diff --git a/patches/api/0128-EntityTransformedEvent.patch b/patches/api/0125-EntityTransformedEvent.patch similarity index 100% rename from patches/api/0128-EntityTransformedEvent.patch rename to patches/api/0125-EntityTransformedEvent.patch diff --git a/patches/api/0129-Allow-disabling-armour-stand-ticking.patch b/patches/api/0126-Allow-disabling-armour-stand-ticking.patch similarity index 100% rename from patches/api/0129-Allow-disabling-armour-stand-ticking.patch rename to patches/api/0126-Allow-disabling-armour-stand-ticking.patch diff --git a/patches/api/0130-SkeletonHorse-Additions.patch b/patches/api/0127-SkeletonHorse-Additions.patch similarity index 100% rename from patches/api/0130-SkeletonHorse-Additions.patch rename to patches/api/0127-SkeletonHorse-Additions.patch diff --git a/patches/api/0131-Expand-Location-Manipulation-API.patch b/patches/api/0128-Expand-Location-Manipulation-API.patch similarity index 100% rename from patches/api/0131-Expand-Location-Manipulation-API.patch rename to patches/api/0128-Expand-Location-Manipulation-API.patch diff --git a/patches/api/0132-Expand-ArmorStand-API.patch b/patches/api/0129-Expand-ArmorStand-API.patch similarity index 100% rename from patches/api/0132-Expand-ArmorStand-API.patch rename to patches/api/0129-Expand-ArmorStand-API.patch diff --git a/patches/api/0133-AnvilDamageEvent.patch b/patches/api/0130-AnvilDamageEvent.patch similarity index 100% rename from patches/api/0133-AnvilDamageEvent.patch rename to patches/api/0130-AnvilDamageEvent.patch diff --git a/patches/api/0135-Add-TNTPrimeEvent.patch b/patches/api/0131-Add-TNTPrimeEvent.patch similarity index 100% rename from patches/api/0135-Add-TNTPrimeEvent.patch rename to patches/api/0131-Add-TNTPrimeEvent.patch diff --git a/patches/api/0136-Provide-Chunk-Coordinates-as-a-Long-API.patch b/patches/api/0132-Provide-Chunk-Coordinates-as-a-Long-API.patch similarity index 90% rename from patches/api/0136-Provide-Chunk-Coordinates-as-a-Long-API.patch rename to patches/api/0132-Provide-Chunk-Coordinates-as-a-Long-API.patch index 401c96f1fa..286027b8ed 100644 --- a/patches/api/0136-Provide-Chunk-Coordinates-as-a-Long-API.patch +++ b/patches/api/0132-Provide-Chunk-Coordinates-as-a-Long-API.patch @@ -7,10 +7,10 @@ Allows you to easily access the chunks X/z as a long, and a method to look up by the long key too. diff --git a/src/main/java/org/bukkit/Chunk.java b/src/main/java/org/bukkit/Chunk.java -index 15478355e0a4f7d247f1a051cbbf841c98a7688b..e596e5d372dba6ee1e44486659332b5a747e96d5 100644 +index a33379e6df0577ea149be473a647258a3bda99f1..fa14c276309fc113d5fda38dfdda1d6ee25b8787 100644 --- a/src/main/java/org/bukkit/Chunk.java +++ b/src/main/java/org/bukkit/Chunk.java -@@ -28,6 +28,32 @@ public interface Chunk extends PersistentDataHolder { +@@ -29,6 +29,32 @@ public interface Chunk extends PersistentDataHolder { */ int getZ(); @@ -44,7 +44,7 @@ index 15478355e0a4f7d247f1a051cbbf841c98a7688b..e596e5d372dba6ee1e44486659332b5a * Gets the world containing this chunk * diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index c58c9c7791eff28ba8f847f5bc60e0db757ababd..8c71be9c39ec6aae07b088a63e71cc2ae44b0412 100644 +index e0caac06b7f5459faefbbd5a6a3486dbb6bfa9ba..7d6c923ea603a3193865e6a34b41617ac7016d19 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -212,6 +212,22 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient diff --git a/patches/api/0137-Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch b/patches/api/0133-Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch similarity index 66% rename from patches/api/0137-Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch rename to patches/api/0133-Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch index 5f7cd8a636..615d6cb623 100644 --- a/patches/api/0137-Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch +++ b/patches/api/0133-Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch @@ -5,30 +5,15 @@ Subject: [PATCH] Ability to get Tile Entities from a chunk without snapshots diff --git a/src/main/java/org/bukkit/Chunk.java b/src/main/java/org/bukkit/Chunk.java -index e596e5d372dba6ee1e44486659332b5a747e96d5..e1e1bc868019f715370490719ef887e0eee3ddec 100644 +index fa14c276309fc113d5fda38dfdda1d6ee25b8787..eccc357cabd8317afc5666c3347936d50eb34015 100644 --- a/src/main/java/org/bukkit/Chunk.java +++ b/src/main/java/org/bukkit/Chunk.java -@@ -1,6 +1,8 @@ - package org.bukkit; - - import java.util.Collection; -+import java.util.function.Predicate; -+ - import org.bukkit.block.Block; - import org.bukkit.block.BlockState; - import org.bukkit.block.data.BlockData; -@@ -111,13 +113,36 @@ public interface Chunk extends PersistentDataHolder { - @NotNull - Entity[] getEntities(); - -+ // Paper start - /** - * Get a list of all tile entities in the chunk. - * +@@ -118,7 +118,30 @@ public interface Chunk extends PersistentDataHolder { * @return The tile entities. */ @NotNull - BlockState[] getTileEntities(); ++ // Paper start + default BlockState[] getTileEntities() { + return getTileEntities(true); + } @@ -50,7 +35,7 @@ index e596e5d372dba6ee1e44486659332b5a747e96d5..e1e1bc868019f715370490719ef887e0 + * @return The tile entities. + */ + @NotNull -+ Collection getTileEntities(@NotNull Predicate blockPredicate, boolean useSnapshot); ++ Collection getTileEntities(java.util.function.@NotNull Predicate blockPredicate, boolean useSnapshot); + // Paper end /** diff --git a/patches/api/0138-Don-t-use-snapshots-for-Timings-Tile-Entity-reports.patch b/patches/api/0134-Don-t-use-snapshots-for-Timings-Tile-Entity-reports.patch similarity index 100% rename from patches/api/0138-Don-t-use-snapshots-for-Timings-Tile-Entity-reports.patch rename to patches/api/0134-Don-t-use-snapshots-for-Timings-Tile-Entity-reports.patch diff --git a/patches/api/0139-Allow-Blocks-to-be-accessed-via-a-long-key.patch b/patches/api/0135-Allow-Blocks-to-be-accessed-via-a-long-key.patch similarity index 95% rename from patches/api/0139-Allow-Blocks-to-be-accessed-via-a-long-key.patch rename to patches/api/0135-Allow-Blocks-to-be-accessed-via-a-long-key.patch index 1a41281590..e0eadf4d4b 100644 --- a/patches/api/0139-Allow-Blocks-to-be-accessed-via-a-long-key.patch +++ b/patches/api/0135-Allow-Blocks-to-be-accessed-via-a-long-key.patch @@ -50,7 +50,7 @@ index 943c3364f6b931fe11f9a6099504590b2da34657..16a604b6315daff228c827fe02b1234c * @return A new location where X/Y/Z are the center of the block */ diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 8c71be9c39ec6aae07b088a63e71cc2ae44b0412..25e38f0f4fe36193dcc968ef7619bc8c0e705fb2 100644 +index 7d6c923ea603a3193865e6a34b41617ac7016d19..00651d5486f1de886df7a4a01aaf272ceb0fa82a 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -95,6 +95,40 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient @@ -95,10 +95,10 @@ index 8c71be9c39ec6aae07b088a63e71cc2ae44b0412..25e38f0f4fe36193dcc968ef7619bc8c * Gets the highest non-empty (impassable) coordinate at the given * coordinates. diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java -index d29bdc125dba0128d93d57e8d9393b970e6c00a9..b101f5264bdde8bd14913d5161c1047020830f8d 100644 +index 61ce341daec63392f040b70cd12662379b2f1ebd..0be73b2f45c9aab6e73bcb7a76136ec6e2428163 100644 --- a/src/main/java/org/bukkit/block/Block.java +++ b/src/main/java/org/bukkit/block/Block.java -@@ -155,6 +155,82 @@ public interface Block extends Metadatable { +@@ -156,6 +156,82 @@ public interface Block extends Metadatable, Translatable { */ int getZ(); diff --git a/patches/api/0140-Slime-Pathfinder-Events.patch b/patches/api/0136-Slime-Pathfinder-Events.patch similarity index 100% rename from patches/api/0140-Slime-Pathfinder-Events.patch rename to patches/api/0136-Slime-Pathfinder-Events.patch diff --git a/patches/api/0141-Add-PhantomPreSpawnEvent.patch b/patches/api/0137-Add-PhantomPreSpawnEvent.patch similarity index 100% rename from patches/api/0141-Add-PhantomPreSpawnEvent.patch rename to patches/api/0137-Add-PhantomPreSpawnEvent.patch diff --git a/patches/api/0142-Add-More-Creeper-API.patch b/patches/api/0138-Add-More-Creeper-API.patch similarity index 100% rename from patches/api/0142-Add-More-Creeper-API.patch rename to patches/api/0138-Add-More-Creeper-API.patch diff --git a/patches/api/0143-Inventory-removeItemAnySlot.patch b/patches/api/0139-Inventory-removeItemAnySlot.patch similarity index 100% rename from patches/api/0143-Inventory-removeItemAnySlot.patch rename to patches/api/0139-Inventory-removeItemAnySlot.patch diff --git a/patches/api/0144-isChunkGenerated-API.patch b/patches/api/0140-isChunkGenerated-API.patch similarity index 96% rename from patches/api/0144-isChunkGenerated-API.patch rename to patches/api/0140-isChunkGenerated-API.patch index 0704b7f0db..510a040e7e 100644 --- a/patches/api/0144-isChunkGenerated-API.patch +++ b/patches/api/0140-isChunkGenerated-API.patch @@ -34,7 +34,7 @@ index 16a604b6315daff228c827fe02b1234cca3e884d..20978b269a7757a561d6b872cc77898b /** * Sets the position of this Location and returns itself diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 25e38f0f4fe36193dcc968ef7619bc8c0e705fb2..44b758d70b96a0ba857e1090af91893313945096 100644 +index 00651d5486f1de886df7a4a01aaf272ceb0fa82a..8075ff77eddb971a0a73dad3c9b809131b5db343 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -260,6 +260,17 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient diff --git a/patches/api/0145-Add-source-block-constructor-and-getChangedBlockData.patch b/patches/api/0141-Add-source-block-constructor-and-getChangedBlockData.patch similarity index 100% rename from patches/api/0145-Add-source-block-constructor-and-getChangedBlockData.patch rename to patches/api/0141-Add-source-block-constructor-and-getChangedBlockData.patch diff --git a/patches/api/0146-Async-Chunks-API.patch b/patches/api/0142-Async-Chunks-API.patch similarity index 99% rename from patches/api/0146-Async-Chunks-API.patch rename to patches/api/0142-Async-Chunks-API.patch index f42bce4b89..e81a733023 100644 --- a/patches/api/0146-Async-Chunks-API.patch +++ b/patches/api/0142-Async-Chunks-API.patch @@ -8,7 +8,7 @@ Adds API's to load or generate chunks asynchronously. Also adds utility methods to Entity to teleport asynchronously. diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 44b758d70b96a0ba857e1090af91893313945096..d7f0117a8776a5bd0c6ec6c05d2c56c3b8e08de8 100644 +index 8075ff77eddb971a0a73dad3c9b809131b5db343..12c1731cd3e7138b30a509bf1c6de937b70cf27d 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -969,6 +969,482 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient diff --git a/patches/api/0147-Add-ray-tracing-methods-to-LivingEntity.patch b/patches/api/0143-Add-ray-tracing-methods-to-LivingEntity.patch similarity index 98% rename from patches/api/0147-Add-ray-tracing-methods-to-LivingEntity.patch rename to patches/api/0143-Add-ray-tracing-methods-to-LivingEntity.patch index e1aaccea32..b2299ab712 100644 --- a/patches/api/0147-Add-ray-tracing-methods-to-LivingEntity.patch +++ b/patches/api/0143-Add-ray-tracing-methods-to-LivingEntity.patch @@ -78,7 +78,7 @@ index 0000000000000000000000000000000000000000..c896d172519a8552a132031cb956378d + } +} diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index c80e75b72ac863db19e3d234e349876dd8797924..c29846df0469535870e1743eee25325a4f092a6d 100644 +index 17e5d2e2acdae23d8ea3b3b1a89f62e8be7b81a8..8cccec99cdb028e86b71b3984f4f94201fd9a390 100644 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java @@ -83,6 +83,98 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource diff --git a/patches/api/0148-Expose-attack-cooldown-methods-for-Player.patch b/patches/api/0144-Expose-attack-cooldown-methods-for-Player.patch similarity index 88% rename from patches/api/0148-Expose-attack-cooldown-methods-for-Player.patch rename to patches/api/0144-Expose-attack-cooldown-methods-for-Player.patch index c7c1cb413e..fe319a1efb 100644 --- a/patches/api/0148-Expose-attack-cooldown-methods-for-Player.patch +++ b/patches/api/0144-Expose-attack-cooldown-methods-for-Player.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Expose attack cooldown methods for Player diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index d3c3347fd08fd6e05d5b269aa50fa083c555a7e3..90982225ad78d8005961895102800b6a20bb42a0 100644 +index 41188fb005807f3adfcdd81e72da122309850383..01c530297bfdb7a0279be7af7eecef3eb95cd369 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java -@@ -2492,6 +2492,26 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -2517,6 +2517,26 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM * @param profile The new profile to use */ void setPlayerProfile(@NotNull com.destroystokyo.paper.profile.PlayerProfile profile); diff --git a/patches/api/0149-Improve-death-events.patch b/patches/api/0145-Improve-death-events.patch similarity index 98% rename from patches/api/0149-Improve-death-events.patch rename to patches/api/0145-Improve-death-events.patch index 7cad311ede..4c756a68c6 100644 --- a/patches/api/0149-Improve-death-events.patch +++ b/patches/api/0145-Improve-death-events.patch @@ -180,7 +180,7 @@ index a5984ab06cce95d30e70511e125f69339b574c04..e19a3df9aa2204b44c0b029bda141ae6 + // Paper end } diff --git a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java -index 7941c60b0e1840785ba2b250071591bd75bc6e35..a871eddf73f918c0e3d2554ef8d9cfd0f830fcaa 100644 +index 1f1df82c9bcf18bad1187e3f24ede1901d91c06f..3b43954b428f2e5e9a718bf6d34116f25c90269f 100644 --- a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java +++ b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java @@ -63,6 +63,17 @@ public class PlayerDeathEvent extends EntityDeathEvent { diff --git a/patches/api/0150-Add-Git-information-to-version-command-on-startup.patch b/patches/api/0146-Add-Git-information-to-version-command-on-startup.patch similarity index 100% rename from patches/api/0150-Add-Git-information-to-version-command-on-startup.patch rename to patches/api/0146-Add-Git-information-to-version-command-on-startup.patch diff --git a/patches/api/0151-Mob-Pathfinding-API.patch b/patches/api/0147-Mob-Pathfinding-API.patch similarity index 100% rename from patches/api/0151-Mob-Pathfinding-API.patch rename to patches/api/0147-Mob-Pathfinding-API.patch diff --git a/patches/api/0152-Add-an-API-for-CanPlaceOn-and-CanDestroy-NBT-values.patch b/patches/api/0148-Add-an-API-for-CanPlaceOn-and-CanDestroy-NBT-values.patch similarity index 97% rename from patches/api/0152-Add-an-API-for-CanPlaceOn-and-CanDestroy-NBT-values.patch rename to patches/api/0148-Add-an-API-for-CanPlaceOn-and-CanDestroy-NBT-values.patch index 0e894e6763..d2844e4b57 100644 --- a/patches/api/0152-Add-an-API-for-CanPlaceOn-and-CanDestroy-NBT-values.patch +++ b/patches/api/0148-Add-an-API-for-CanPlaceOn-and-CanDestroy-NBT-values.patch @@ -199,10 +199,10 @@ index 0000000000000000000000000000000000000000..28f3fda950999a9c964a3608042ca605 + } +} diff --git a/src/main/java/org/bukkit/NamespacedKey.java b/src/main/java/org/bukkit/NamespacedKey.java -index c65f0d6569c130b4920a9e71ad24af6427f1f030..01bcb3a1bdb5accdf844d0178cec3d25746b3eaa 100644 +index f4540ceee4937a496a10a08429093adf8ae2cfc0..81acf8bb6f8c2f5b67aca6f2ea78fff5d55c4763 100644 --- a/src/main/java/org/bukkit/NamespacedKey.java +++ b/src/main/java/org/bukkit/NamespacedKey.java -@@ -19,7 +19,7 @@ import org.jetbrains.annotations.Nullable; +@@ -18,7 +18,7 @@ import org.jetbrains.annotations.Nullable; * underscores, hyphens, and forward slashes. * */ @@ -211,7 +211,7 @@ index c65f0d6569c130b4920a9e71ad24af6427f1f030..01bcb3a1bdb5accdf844d0178cec3d25 /** * The namespace representing all inbuilt keys. -@@ -84,11 +84,13 @@ public final class NamespacedKey implements net.kyori.adventure.key.Key { // Pap +@@ -118,11 +118,13 @@ public final class NamespacedKey implements net.kyori.adventure.key.Key { // Pap } @NotNull diff --git a/patches/api/0153-Performance-Concurrency-Improvements-to-Permissions.patch b/patches/api/0149-Performance-Concurrency-Improvements-to-Permissions.patch similarity index 100% rename from patches/api/0153-Performance-Concurrency-Improvements-to-Permissions.patch rename to patches/api/0149-Performance-Concurrency-Improvements-to-Permissions.patch diff --git a/patches/api/0154-Add-ItemStackRecipeChoice-Draft-API.patch b/patches/api/0150-Add-ItemStackRecipeChoice-Draft-API.patch similarity index 100% rename from patches/api/0154-Add-ItemStackRecipeChoice-Draft-API.patch rename to patches/api/0150-Add-ItemStackRecipeChoice-Draft-API.patch diff --git a/patches/api/0155-Implement-furnace-cook-speed-multiplier-API.patch b/patches/api/0151-Implement-furnace-cook-speed-multiplier-API.patch similarity index 84% rename from patches/api/0155-Implement-furnace-cook-speed-multiplier-API.patch rename to patches/api/0151-Implement-furnace-cook-speed-multiplier-API.patch index 709ba414da..dd6ed2012a 100644 --- a/patches/api/0155-Implement-furnace-cook-speed-multiplier-API.patch +++ b/patches/api/0151-Implement-furnace-cook-speed-multiplier-API.patch @@ -37,23 +37,22 @@ index ac3b24c5c99eeb1435d785efade728dd40947da5..dbdf3dbe9517b09a7965cf9d65cae1ed @Override public FurnaceInventory getInventory(); diff --git a/src/main/java/org/bukkit/event/inventory/FurnaceStartSmeltEvent.java b/src/main/java/org/bukkit/event/inventory/FurnaceStartSmeltEvent.java -index 533a33dbd4c4c3c07fe759206dc288efec5cd531..f13f1b4daa99fb86b60acc94d0406dcd8cb4d98b 100644 +index 1440c6115520d692faf75455df35b92aa8734491..1e55f50f04de78ae0b8832a8021ffc7327676e8e 100644 --- a/src/main/java/org/bukkit/event/inventory/FurnaceStartSmeltEvent.java +++ b/src/main/java/org/bukkit/event/inventory/FurnaceStartSmeltEvent.java -@@ -13,11 +13,18 @@ public class FurnaceStartSmeltEvent extends BlockEvent { +@@ -15,10 +15,17 @@ public class FurnaceStartSmeltEvent extends InventoryBlockStartEvent { private final CookingRecipe recipe; private int totalCookTime; + @Deprecated // Paper - furnace cook speed multiplier public FurnaceStartSmeltEvent(@NotNull final Block furnace, @NotNull ItemStack source, @NotNull final CookingRecipe recipe) { -+ // Paper start - furnace cook speed multiplier ++ // Paper start + this(furnace, source, recipe, recipe.getCookingTime()); + } + -+ public FurnaceStartSmeltEvent(@NotNull final Block furnace, @NotNull ItemStack source, @NotNull CookingRecipe recipe, int cookingTime) { ++ public FurnaceStartSmeltEvent(final @NotNull Block furnace, final @NotNull ItemStack source, final @NotNull CookingRecipe recipe, final int cookingTime) { + // Paper end - super(furnace); - this.source = source; + super(furnace, source); this.recipe = recipe; - this.totalCookTime = recipe.getCookingTime(); + this.totalCookTime = cookingTime; // Paper - furnace cook speed multiplier diff --git a/patches/api/0156-Material-API-additions.patch b/patches/api/0152-Material-API-additions.patch similarity index 82% rename from patches/api/0156-Material-API-additions.patch rename to patches/api/0152-Material-API-additions.patch index bbda411f80..92dc2c0e98 100644 --- a/patches/api/0156-Material-API-additions.patch +++ b/patches/api/0152-Material-API-additions.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Material API additions diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java -index bcf746a611fbfa66b12b31a12710c423ba39d42c..cd09fa22e6322770bcb582ba00a384c5ca0fd8d8 100644 +index d1cb98a43e1135c53fd4ae544272ff6225f387f6..a4a85c62e87c18e38ba16e3966a41e6631ec8add 100644 --- a/src/main/java/org/bukkit/Material.java +++ b/src/main/java/org/bukkit/Material.java @@ -112,6 +112,7 @@ import org.jetbrains.annotations.Nullable; @@ -13,10 +13,10 @@ index bcf746a611fbfa66b12b31a12710c423ba39d42c..cd09fa22e6322770bcb582ba00a384c5 * An enum of all material IDs accepted by the official server and client */ +@SuppressWarnings({"DeprecatedIsStillUsed", "deprecation"}) // Paper - public enum Material implements Keyed { + public enum Material implements Keyed, Translatable { // AIR(9648, 0), -@@ -4273,6 +4274,22 @@ public enum Material implements Keyed { +@@ -4273,6 +4274,22 @@ public enum Material implements Keyed, Translatable { } } diff --git a/patches/api/0157-Add-Material-Tags.patch b/patches/api/0153-Add-Material-Tags.patch similarity index 97% rename from patches/api/0157-Add-Material-Tags.patch rename to patches/api/0153-Add-Material-Tags.patch index e0cbc1d95c..a9f31f66b3 100644 --- a/patches/api/0157-Add-Material-Tags.patch +++ b/patches/api/0153-Add-Material-Tags.patch @@ -1134,7 +1134,7 @@ index bceaa1a97b2c5cc15c8f54ae8f6f18029708627a..15699ee58e06880a508689f761ecfdb7 public interface Tag extends Keyed { diff --git a/src/test/java/com/destroystokyo/paper/MaterialTagsTest.java b/src/test/java/com/destroystokyo/paper/MaterialTagsTest.java new file mode 100644 -index 0000000000000000000000000000000000000000..f849d8b12a7e3d1606698408ab4bb140a3b370e4 +index 0000000000000000000000000000000000000000..e541f29e983d8dcaca91de9ee1459d587226b4c3 --- /dev/null +++ b/src/test/java/com/destroystokyo/paper/MaterialTagsTest.java @@ -0,0 +1,65 @@ @@ -1146,8 +1146,8 @@ index 0000000000000000000000000000000000000000..f849d8b12a7e3d1606698408ab4bb140 + +import io.papermc.paper.tag.BaseTag; +import io.papermc.paper.tag.EntityTags; ++import io.papermc.paper.testing.TestServer; +import org.bukkit.Bukkit; -+import org.bukkit.TestServer; +import org.junit.Before; +import org.junit.Test; + @@ -1163,7 +1163,7 @@ index 0000000000000000000000000000000000000000..f849d8b12a7e3d1606698408ab4bb140 + + @Before + public void before() { -+ TestServer.getInstance(); ++ TestServer.setup(); + } + + @Test @@ -1205,26 +1205,24 @@ index 0000000000000000000000000000000000000000..f849d8b12a7e3d1606698408ab4bb140 +} diff --git a/src/test/java/io/papermc/paper/EntityTagsTest.java b/src/test/java/io/papermc/paper/EntityTagsTest.java new file mode 100644 -index 0000000000000000000000000000000000000000..06bb9d1180361d3d00c699796bbacbce5bef2177 +index 0000000000000000000000000000000000000000..3caf03d8e50cd2180e9aac2dddeaa3afd0bf7438 --- /dev/null +++ b/src/test/java/io/papermc/paper/EntityTagsTest.java -@@ -0,0 +1,24 @@ +@@ -0,0 +1,22 @@ +package io.papermc.paper; + -+import com.destroystokyo.paper.MaterialTags; +import io.papermc.paper.tag.EntityTags; -+import org.bukkit.Bukkit; -+import org.bukkit.TestServer; -+import org.junit.Test; -+ ++import io.papermc.paper.testing.TestServer; +import java.util.logging.Level; ++import org.bukkit.Bukkit; ++import org.junit.Test; + +public class EntityTagsTest { + + @Test + public void testInitialize() { + try { -+ TestServer.getInstance(); ++ TestServer.setup(); + EntityTags.HORSES.getValues(); + assert true; + } catch (Throwable e) { @@ -1233,24 +1231,3 @@ index 0000000000000000000000000000000000000000..06bb9d1180361d3d00c699796bbacbce + } + } +} -diff --git a/src/test/java/org/bukkit/TestServer.java b/src/test/java/org/bukkit/TestServer.java -index 701a17c10f31cd345238a3c568264178ce372faa..bfb39f48bea14ad616c53e2a8a6901e93f728768 100644 ---- a/src/test/java/org/bukkit/TestServer.java -+++ b/src/test/java/org/bukkit/TestServer.java -@@ -32,6 +32,16 @@ public final class TestServer implements InvocationHandler { - } - } - ); -+ // Paper start -+ methodMap.put( -+ Server.class.getMethod("getTag", String.class, NamespacedKey.class, Class.class), -+ new MethodHandler() { -+ public Object handle(TestServer server, Object[] args) { -+ return new com.destroystokyo.paper.MaterialSetTag(); -+ } -+ } -+ ); -+ // Paper end - methodMap.put( - Server.class.getMethod("getPluginManager"), - new MethodHandler() { diff --git a/patches/api/0158-PreSpawnerSpawnEvent.patch b/patches/api/0154-PreSpawnerSpawnEvent.patch similarity index 100% rename from patches/api/0158-PreSpawnerSpawnEvent.patch rename to patches/api/0154-PreSpawnerSpawnEvent.patch diff --git a/patches/api/0159-Add-LivingEntity-getTargetEntity.patch b/patches/api/0155-Add-LivingEntity-getTargetEntity.patch similarity index 98% rename from patches/api/0159-Add-LivingEntity-getTargetEntity.patch rename to patches/api/0155-Add-LivingEntity-getTargetEntity.patch index 9d07ef98d1..323e4aa5ca 100644 --- a/patches/api/0159-Add-LivingEntity-getTargetEntity.patch +++ b/patches/api/0155-Add-LivingEntity-getTargetEntity.patch @@ -51,7 +51,7 @@ index 0000000000000000000000000000000000000000..af8765b213390cf75fe02a6eb68aecf7 + } +} diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index 70c0512a5875533c9b8ce7a1b21cc799772c5ef4..98484c748db12dbdcdbe456befa30ad87864420b 100644 +index 8cccec99cdb028e86b71b3984f4f94201fd9a390..94fad96f8fd57314c571b6396f44cd9d91254cfc 100644 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java @@ -173,6 +173,77 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource diff --git a/patches/api/0160-Add-sun-related-API.patch b/patches/api/0156-Add-sun-related-API.patch similarity index 94% rename from patches/api/0160-Add-sun-related-API.patch rename to patches/api/0156-Add-sun-related-API.patch index 714a4b24ea..0efa61418f 100644 --- a/patches/api/0160-Add-sun-related-API.patch +++ b/patches/api/0156-Add-sun-related-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add sun related API diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index d7f0117a8776a5bd0c6ec6c05d2c56c3b8e08de8..24a14005cb9c2fe7e97ba0fbd948c0c1110c52ce 100644 +index 12c1731cd3e7138b30a509bf1c6de937b70cf27d..0ece998826c8e5d5a02a4a348172274b82bb2086 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -1796,6 +1796,16 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient diff --git a/patches/api/0161-Turtle-API.patch b/patches/api/0157-Turtle-API.patch similarity index 100% rename from patches/api/0161-Turtle-API.patch rename to patches/api/0157-Turtle-API.patch diff --git a/patches/api/0162-Add-spectator-target-events.patch b/patches/api/0158-Add-spectator-target-events.patch similarity index 100% rename from patches/api/0162-Add-spectator-target-events.patch rename to patches/api/0158-Add-spectator-target-events.patch diff --git a/patches/api/0163-Add-more-Witch-API.patch b/patches/api/0159-Add-more-Witch-API.patch similarity index 100% rename from patches/api/0163-Add-more-Witch-API.patch rename to patches/api/0159-Add-more-Witch-API.patch diff --git a/patches/api/0164-Make-the-default-permission-message-configurable.patch b/patches/api/0160-Make-the-default-permission-message-configurable.patch similarity index 100% rename from patches/api/0164-Make-the-default-permission-message-configurable.patch rename to patches/api/0160-Make-the-default-permission-message-configurable.patch diff --git a/patches/api/0165-Support-cancellation-supression-of-EntityDismount-Ve.patch b/patches/api/0161-Support-cancellation-supression-of-EntityDismount-Ve.patch similarity index 100% rename from patches/api/0165-Support-cancellation-supression-of-EntityDismount-Ve.patch rename to patches/api/0161-Support-cancellation-supression-of-EntityDismount-Ve.patch diff --git a/patches/api/0166-Add-more-Zombie-API.patch b/patches/api/0162-Add-more-Zombie-API.patch similarity index 100% rename from patches/api/0166-Add-more-Zombie-API.patch rename to patches/api/0162-Add-more-Zombie-API.patch diff --git a/patches/api/0167-Change-the-reserved-channel-check-to-be-sensible.patch b/patches/api/0163-Change-the-reserved-channel-check-to-be-sensible.patch similarity index 100% rename from patches/api/0167-Change-the-reserved-channel-check-to-be-sensible.patch rename to patches/api/0163-Change-the-reserved-channel-check-to-be-sensible.patch diff --git a/patches/api/0168-Add-PlayerConnectionCloseEvent.patch b/patches/api/0164-Add-PlayerConnectionCloseEvent.patch similarity index 100% rename from patches/api/0168-Add-PlayerConnectionCloseEvent.patch rename to patches/api/0164-Add-PlayerConnectionCloseEvent.patch diff --git a/patches/api/0169-Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch b/patches/api/0165-Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch similarity index 96% rename from patches/api/0169-Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch rename to patches/api/0165-Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch index ad97b59cd4..79029fc972 100644 --- a/patches/api/0169-Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch +++ b/patches/api/0165-Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch @@ -16,7 +16,7 @@ intent to remove) and replace it with two new methods, clearly named and documented as to their purpose. diff --git a/src/main/java/org/bukkit/OfflinePlayer.java b/src/main/java/org/bukkit/OfflinePlayer.java -index 93f86bb30725dff5dbfcccf15012ffd1cee237bf..a7d1f1e701f23e851f735584a30bedadb0d8b9bd 100644 +index b39ed4eb2e7d9e40805e201d77973877481db8fd..69b50eee42e8c52063033705bd23a5ef5231ed83 100644 --- a/src/main/java/org/bukkit/OfflinePlayer.java +++ b/src/main/java/org/bukkit/OfflinePlayer.java @@ -160,7 +160,9 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio diff --git a/patches/api/0170-Add-ItemStack-Recipe-API-helper-methods.patch b/patches/api/0166-Add-ItemStack-Recipe-API-helper-methods.patch similarity index 100% rename from patches/api/0170-Add-ItemStack-Recipe-API-helper-methods.patch rename to patches/api/0166-Add-ItemStack-Recipe-API-helper-methods.patch diff --git a/patches/api/0171-BlockDestroyEvent.patch b/patches/api/0167-BlockDestroyEvent.patch similarity index 100% rename from patches/api/0171-BlockDestroyEvent.patch rename to patches/api/0167-BlockDestroyEvent.patch diff --git a/patches/api/0172-Add-WhitelistToggleEvent.patch b/patches/api/0168-Add-WhitelistToggleEvent.patch similarity index 100% rename from patches/api/0172-Add-WhitelistToggleEvent.patch rename to patches/api/0168-Add-WhitelistToggleEvent.patch diff --git a/patches/api/0173-Add-GS4-Query-event.patch b/patches/api/0169-Add-GS4-Query-event.patch similarity index 100% rename from patches/api/0173-Add-GS4-Query-event.patch rename to patches/api/0169-Add-GS4-Query-event.patch diff --git a/patches/api/0174-Add-PlayerPostRespawnEvent.patch b/patches/api/0170-Add-PlayerPostRespawnEvent.patch similarity index 100% rename from patches/api/0174-Add-PlayerPostRespawnEvent.patch rename to patches/api/0170-Add-PlayerPostRespawnEvent.patch diff --git a/patches/api/0175-Entity-getEntitySpawnReason.patch b/patches/api/0171-Entity-getEntitySpawnReason.patch similarity index 100% rename from patches/api/0175-Entity-getEntitySpawnReason.patch rename to patches/api/0171-Entity-getEntitySpawnReason.patch diff --git a/patches/api/0176-Fix-Spigot-annotation-mistakes.patch b/patches/api/0172-Fix-Spigot-annotation-mistakes.patch similarity index 94% rename from patches/api/0176-Fix-Spigot-annotation-mistakes.patch rename to patches/api/0172-Fix-Spigot-annotation-mistakes.patch index 4135cb4d0d..a4ef2fafcd 100644 --- a/patches/api/0176-Fix-Spigot-annotation-mistakes.patch +++ b/patches/api/0172-Fix-Spigot-annotation-mistakes.patch @@ -79,10 +79,10 @@ index 20978b269a7757a561d6b872cc77898b44bbd272..2b9a117804a8ca54b47e51e23359bd6e if (this.world == null) { return null; diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java -index cd09fa22e6322770bcb582ba00a384c5ca0fd8d8..a7d36ef22724f0ce3add61ab314e09e6465077d4 100644 +index a4a85c62e87c18e38ba16e3966a41e6631ec8add..e883bb46461eb40b018ebe8c07caff96046fd11d 100644 --- a/src/main/java/org/bukkit/Material.java +++ b/src/main/java/org/bukkit/Material.java -@@ -4303,11 +4303,11 @@ public enum Material implements Keyed { +@@ -4303,11 +4303,11 @@ public enum Material implements Keyed, Translatable { } /** @@ -96,7 +96,7 @@ index cd09fa22e6322770bcb582ba00a384c5ca0fd8d8..a7d36ef22724f0ce3add61ab314e09e6 public boolean isLegacy() { return legacy; } -@@ -4378,8 +4378,10 @@ public enum Material implements Keyed { +@@ -4378,8 +4378,10 @@ public enum Material implements Keyed, Translatable { * Gets the MaterialData class associated with this Material * * @return MaterialData associated with this Material @@ -108,10 +108,10 @@ index cd09fa22e6322770bcb582ba00a384c5ca0fd8d8..a7d36ef22724f0ce3add61ab314e09e6 Preconditions.checkArgument(legacy, "Cannot get data class of Modern Material"); return ctor.getDeclaringClass(); diff --git a/src/main/java/org/bukkit/NamespacedKey.java b/src/main/java/org/bukkit/NamespacedKey.java -index 01bcb3a1bdb5accdf844d0178cec3d25746b3eaa..236c9aea9ffc36269e5c32eacc9f1fd6bd039c88 100644 +index 81acf8bb6f8c2f5b67aca6f2ea78fff5d55c4763..32479109d90571368fd66da7dcb45ddf54eb404e 100644 --- a/src/main/java/org/bukkit/NamespacedKey.java +++ b/src/main/java/org/bukkit/NamespacedKey.java -@@ -39,12 +39,14 @@ public final class NamespacedKey implements net.kyori.adventure.key.Key, com.des +@@ -73,12 +73,14 @@ public final class NamespacedKey implements net.kyori.adventure.key.Key, com.des /** * Create a key in a specific namespace. @@ -126,8 +126,8 @@ index 01bcb3a1bdb5accdf844d0178cec3d25746b3eaa..236c9aea9ffc36269e5c32eacc9f1fd6 */ - @Deprecated public NamespacedKey(@NotNull String namespace, @NotNull String key) { - Preconditions.checkArgument(namespace != null && VALID_NAMESPACE.matcher(namespace).matches(), "Invalid namespace. Must be [a-z0-9._-]: %s", namespace); - Preconditions.checkArgument(key != null && VALID_KEY.matcher(key).matches(), "Invalid key. Must be [a-z0-9/._-]: %s", key); + Preconditions.checkArgument(namespace != null && isValidNamespace(namespace), "Invalid namespace. Must be [a-z0-9._-]: %s", namespace); + Preconditions.checkArgument(key != null && isValidKey(key), "Invalid key. Must be [a-z0-9/._-]: %s", key); diff --git a/src/main/java/org/bukkit/NetherWartsState.java b/src/main/java/org/bukkit/NetherWartsState.java index f43209cf7b752c26718c303ca8c3e1c7d9912ad3..f0094e6fb05e526736629ad3181c8d2c16ba6ca4 100644 --- a/src/main/java/org/bukkit/NetherWartsState.java @@ -144,6 +144,22 @@ index f43209cf7b752c26718c303ca8c3e1c7d9912ad3..f0094e6fb05e526736629ad3181c8d2c public enum NetherWartsState { /** +diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java +index ea80520c19cd3dd6aa25665c748d96fd4a3f6e40..ff1fcdaccbca81602278a0b52670f7b895ba22b7 100644 +--- a/src/main/java/org/bukkit/Registry.java ++++ b/src/main/java/org/bukkit/Registry.java +@@ -229,8 +229,11 @@ public interface Registry extends Iterable { + * + * @param input non-null input + * @return registered object or null if does not exist ++ * @deprecated this method's behavior is broken and not useful. If you want to get an object ++ * based on its vanilla name, or a key, wrap it in a {@link NamespacedKey} object and use {@link #get(NamespacedKey)} + */ + @Nullable ++ @Deprecated(forRemoval = true) // Paper + default T match(@NotNull String input) { + Preconditions.checkArgument(input != null, "input must not be null"); + diff --git a/src/main/java/org/bukkit/SandstoneType.java b/src/main/java/org/bukkit/SandstoneType.java index 6277451c3c6c551078c237cd767b6d70c4f585ea..10f5cfb1885833a1d2c1027c03974da45ab28e2f 100644 --- a/src/main/java/org/bukkit/SandstoneType.java @@ -227,7 +243,7 @@ index e455eb21abf121dc6ff10ff8a13dd06f67096a8f..bbc01e7c192ae6689c301670047ff114 return origin; } diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 24a14005cb9c2fe7e97ba0fbd948c0c1110c52ce..891b25c84f6cc86ac3ccf61eca1d4398f31ba6b5 100644 +index 0ece998826c8e5d5a02a4a348172274b82bb2086..f57e59dd5db687fb4feb13e8283e4ff327c3e8c4 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -430,9 +430,8 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient @@ -341,10 +357,10 @@ index 95c79c5fa0c4e30201f887da6467ce5f81c8a255..7f9c4d4b430a3f0276461346ff2621ba /** diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 90982225ad78d8005961895102800b6a20bb42a0..fc8dd3af9fcb083b483da19a80234d668c2fcffc 100644 +index 01c530297bfdb7a0279be7af7eecef3eb95cd369..0dd3fcd86099e5a032b09b46309894d5c3e6f39d 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java -@@ -1399,9 +1399,8 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -1424,9 +1424,8 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM * * @param plugin Plugin that wants to hide the entity * @param entity Entity to hide @@ -355,7 +371,7 @@ index 90982225ad78d8005961895102800b6a20bb42a0..fc8dd3af9fcb083b483da19a80234d66 public void hideEntity(@NotNull Plugin plugin, @NotNull Entity entity); /** -@@ -1411,9 +1410,8 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -1436,9 +1435,8 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM * * @param plugin Plugin that wants to show the entity * @param entity Entity to show @@ -366,7 +382,7 @@ index 90982225ad78d8005961895102800b6a20bb42a0..fc8dd3af9fcb083b483da19a80234d66 public void showEntity(@NotNull Plugin plugin, @NotNull Entity entity); /** -@@ -1422,9 +1420,8 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -1447,9 +1445,8 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM * @param entity Entity to check * @return True if the provided entity is not being hidden from this * player @@ -671,18 +687,18 @@ index 66ffc658dba85942f179760dc6c50258e24ab903..50fe28b48d885c782278bdb53a0bbae3 /** diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index 7559f75dcc6665fa3d19d6e53a141a214407d1c5..515f623b3b6e76dbf24ec1d204f7983adb100858 100644 +index a70de962712c14cb895708e89ad3811041728935..b15645cd56c245214bb5b87b36395fbc8e86e3d3 100644 --- a/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -7,6 +7,7 @@ import java.util.List; // Paper - import java.util.Map; +@@ -8,6 +8,7 @@ import java.util.Map; import org.bukkit.Bukkit; import org.bukkit.Material; + import org.bukkit.Translatable; +import org.bukkit.UndefinedNullability; import org.bukkit.Utility; import org.bukkit.configuration.serialization.ConfigurationSerializable; import org.bukkit.enchantments.Enchantment; -@@ -67,6 +68,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor +@@ -68,6 +69,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat * @param damage durability / damage * @deprecated see {@link #setDurability(short)} */ @@ -690,7 +706,7 @@ index 7559f75dcc6665fa3d19d6e53a141a214407d1c5..515f623b3b6e76dbf24ec1d204f7983a public ItemStack(@NotNull final Material type, final int amount, final short damage) { this(type, amount, damage, null); } -@@ -168,8 +170,10 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor +@@ -169,8 +171,10 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat * Gets the MaterialData for this stack of items * * @return MaterialData for this item @@ -701,7 +717,7 @@ index 7559f75dcc6665fa3d19d6e53a141a214407d1c5..515f623b3b6e76dbf24ec1d204f7983a public MaterialData getData() { Material mat = Bukkit.getUnsafe().toLegacy(getType()); if (data == null && mat != null && mat.getData() != null) { -@@ -183,7 +187,9 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor +@@ -184,7 +188,9 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat * Sets the MaterialData for this stack of items * * @param data New MaterialData for this item @@ -711,7 +727,7 @@ index 7559f75dcc6665fa3d19d6e53a141a214407d1c5..515f623b3b6e76dbf24ec1d204f7983a public void setData(@Nullable MaterialData data) { if (data == null) { this.data = data; -@@ -545,7 +551,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor +@@ -546,7 +552,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat * * @return a copy of the current ItemStack's ItemData */ diff --git a/patches/api/0177-Server-Tick-Events.patch b/patches/api/0173-Server-Tick-Events.patch similarity index 100% rename from patches/api/0177-Server-Tick-Events.patch rename to patches/api/0173-Server-Tick-Events.patch diff --git a/patches/api/0178-PlayerDeathEvent-getItemsToKeep.patch b/patches/api/0174-PlayerDeathEvent-getItemsToKeep.patch similarity index 100% rename from patches/api/0178-PlayerDeathEvent-getItemsToKeep.patch rename to patches/api/0174-PlayerDeathEvent-getItemsToKeep.patch diff --git a/patches/api/0179-Add-Heightmap-API.patch b/patches/api/0175-Add-Heightmap-API.patch similarity index 99% rename from patches/api/0179-Add-Heightmap-API.patch rename to patches/api/0175-Add-Heightmap-API.patch index ff70e17363..4c029e4fc2 100644 --- a/patches/api/0179-Add-Heightmap-API.patch +++ b/patches/api/0175-Add-Heightmap-API.patch @@ -103,7 +103,7 @@ index 2b9a117804a8ca54b47e51e23359bd6e01087641..6bbf8468bc47e82b0aeb164e49cdb73d * Creates explosion at this location with given power * diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 891b25c84f6cc86ac3ccf61eca1d4398f31ba6b5..79b1015c56aab88ee8bf70cef0a2ab05c910d991 100644 +index f57e59dd5db687fb4feb13e8283e4ff327c3e8c4..30d5ed45df901a4931a35cc62aec08818307ec99 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -167,6 +167,87 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient diff --git a/patches/api/0180-Mob-Spawner-API-Enhancements.patch b/patches/api/0176-Mob-Spawner-API-Enhancements.patch similarity index 100% rename from patches/api/0180-Mob-Spawner-API-Enhancements.patch rename to patches/api/0176-Mob-Spawner-API-Enhancements.patch diff --git a/patches/api/0181-Add-BlockSoundGroup-interface.patch b/patches/api/0177-Add-BlockSoundGroup-interface.patch similarity index 95% rename from patches/api/0181-Add-BlockSoundGroup-interface.patch rename to patches/api/0177-Add-BlockSoundGroup-interface.patch index 1d34e11a3b..d7e1a7c6c0 100644 --- a/patches/api/0181-Add-BlockSoundGroup-interface.patch +++ b/patches/api/0177-Add-BlockSoundGroup-interface.patch @@ -76,10 +76,10 @@ index 0000000000000000000000000000000000000000..ec36942128cbacae171584c89480b4aa + Sound getFallSound(); +} diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java -index b101f5264bdde8bd14913d5161c1047020830f8d..db441e463b02ee734f85c855f5538cd41041dbae 100644 +index 0be73b2f45c9aab6e73bcb7a76136ec6e2428163..3107abe94bb94b03b2e285c75ab0b7fdc7c0bc87 100644 --- a/src/main/java/org/bukkit/block/Block.java +++ b/src/main/java/org/bukkit/block/Block.java -@@ -606,4 +606,25 @@ public interface Block extends Metadatable { +@@ -607,4 +607,25 @@ public interface Block extends Metadatable, Translatable { * @return true if the block data can be placed here */ boolean canPlace(@NotNull BlockData data); diff --git a/patches/api/0182-Amend-PlayerInteractAtEntityEvent-javadoc-for-ArmorS.patch b/patches/api/0178-Amend-PlayerInteractAtEntityEvent-javadoc-for-ArmorS.patch similarity index 100% rename from patches/api/0182-Amend-PlayerInteractAtEntityEvent-javadoc-for-ArmorS.patch rename to patches/api/0178-Amend-PlayerInteractAtEntityEvent-javadoc-for-ArmorS.patch diff --git a/patches/api/0183-Increase-custom-payload-channel-message-size.patch b/patches/api/0179-Increase-custom-payload-channel-message-size.patch similarity index 100% rename from patches/api/0183-Increase-custom-payload-channel-message-size.patch rename to patches/api/0179-Increase-custom-payload-channel-message-size.patch diff --git a/patches/api/0184-Expose-the-internal-current-tick.patch b/patches/api/0180-Expose-the-internal-current-tick.patch similarity index 100% rename from patches/api/0184-Expose-the-internal-current-tick.patch rename to patches/api/0180-Expose-the-internal-current-tick.patch diff --git a/patches/api/0185-Improve-Block-breakNaturally-API.patch b/patches/api/0181-Improve-Block-breakNaturally-API.patch similarity index 93% rename from patches/api/0185-Improve-Block-breakNaturally-API.patch rename to patches/api/0181-Improve-Block-breakNaturally-API.patch index 8bf4a34007..01e9249c42 100644 --- a/patches/api/0185-Improve-Block-breakNaturally-API.patch +++ b/patches/api/0181-Improve-Block-breakNaturally-API.patch @@ -10,10 +10,10 @@ Adds bool param to trigger exp drops for blocks Co-authored-by: William Blake Galbreath diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java -index db441e463b02ee734f85c855f5538cd41041dbae..af705e45204975a342e1454156ba143ed52cecdc 100644 +index 3107abe94bb94b03b2e285c75ab0b7fdc7c0bc87..06ef9e133125d80127e1dbd6ae0eda89fa08a1d7 100644 --- a/src/main/java/org/bukkit/block/Block.java +++ b/src/main/java/org/bukkit/block/Block.java -@@ -480,6 +480,52 @@ public interface Block extends Metadatable { +@@ -481,6 +481,52 @@ public interface Block extends Metadatable, Translatable { */ boolean breakNaturally(@Nullable ItemStack tool); diff --git a/patches/api/0186-PlayerDeathEvent-shouldDropExperience.patch b/patches/api/0182-PlayerDeathEvent-shouldDropExperience.patch similarity index 100% rename from patches/api/0186-PlayerDeathEvent-shouldDropExperience.patch rename to patches/api/0182-PlayerDeathEvent-shouldDropExperience.patch diff --git a/patches/api/0187-Add-ThrownEggHatchEvent.patch b/patches/api/0183-Add-ThrownEggHatchEvent.patch similarity index 100% rename from patches/api/0187-Add-ThrownEggHatchEvent.patch rename to patches/api/0183-Add-ThrownEggHatchEvent.patch diff --git a/patches/api/0188-Entity-Jump-API.patch b/patches/api/0184-Entity-Jump-API.patch similarity index 94% rename from patches/api/0188-Entity-Jump-API.patch rename to patches/api/0184-Entity-Jump-API.patch index 07af96d48a..56fdb9b0f4 100644 --- a/patches/api/0188-Entity-Jump-API.patch +++ b/patches/api/0184-Entity-Jump-API.patch @@ -57,10 +57,10 @@ index 0000000000000000000000000000000000000000..f0067c2e953d18e1a33536980071ba3f + } +} diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index 98484c748db12dbdcdbe456befa30ad87864420b..3618a138a602fde4d3f045e9982dd95c0376b30d 100644 +index 94fad96f8fd57314c571b6396f44cd9d91254cfc..f76090f1f7ae7e3c026896b82e6379e5c2fd26fe 100644 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -926,5 +926,25 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource +@@ -945,5 +945,25 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource */ @NotNull org.bukkit.inventory.EquipmentSlot getHandRaised(); diff --git a/patches/api/0189-add-hand-to-BlockMultiPlaceEvent.patch b/patches/api/0185-add-hand-to-BlockMultiPlaceEvent.patch similarity index 100% rename from patches/api/0189-add-hand-to-BlockMultiPlaceEvent.patch rename to patches/api/0185-add-hand-to-BlockMultiPlaceEvent.patch diff --git a/patches/api/0190-Add-tick-times-API.patch b/patches/api/0186-Add-tick-times-API.patch similarity index 100% rename from patches/api/0190-Add-tick-times-API.patch rename to patches/api/0186-Add-tick-times-API.patch diff --git a/patches/api/0191-Expose-MinecraftServer-isRunning.patch b/patches/api/0187-Expose-MinecraftServer-isRunning.patch similarity index 100% rename from patches/api/0191-Expose-MinecraftServer-isRunning.patch rename to patches/api/0187-Expose-MinecraftServer-isRunning.patch diff --git a/patches/api/0192-Add-Raw-Byte-ItemStack-Serialization.patch b/patches/api/0188-Add-Raw-Byte-ItemStack-Serialization.patch similarity index 80% rename from patches/api/0192-Add-Raw-Byte-ItemStack-Serialization.patch rename to patches/api/0188-Add-Raw-Byte-ItemStack-Serialization.patch index 923dca3f3f..a97f91708d 100644 --- a/patches/api/0192-Add-Raw-Byte-ItemStack-Serialization.patch +++ b/patches/api/0188-Add-Raw-Byte-ItemStack-Serialization.patch @@ -6,12 +6,12 @@ Subject: [PATCH] Add Raw Byte ItemStack Serialization Serializes using NBT which is safer for server data migrations than bukkits format. diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index 81da1def96d18704303cadd72261a1b2fcbb9fc5..5453b2ae459b2d5171ef7129c29891b721ee8e0b 100644 +index 24fad8e59a3a5a174d24505cedda2a3fd52115b1..ee9ed5f0e2936c740903784b01b9e2fff75b92f8 100644 --- a/src/main/java/org/bukkit/UnsafeValues.java +++ b/src/main/java/org/bukkit/UnsafeValues.java -@@ -108,5 +108,9 @@ public interface UnsafeValues { - static boolean isLegacyPlugin(org.bukkit.plugin.Plugin plugin) { - return !Bukkit.getUnsafe().isSupportedApiVersion(plugin.getDescription().getAPIVersion()); +@@ -121,5 +121,9 @@ public interface UnsafeValues { + default com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() { + return new com.destroystokyo.paper.util.VersionFetcher.DummyVersionFetcher(); } + + byte[] serializeItem(ItemStack item); @@ -20,10 +20,10 @@ index 81da1def96d18704303cadd72261a1b2fcbb9fc5..5453b2ae459b2d5171ef7129c29891b7 // Paper end } diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index 515f623b3b6e76dbf24ec1d204f7983adb100858..d3334c62bf39abf17ee7f3e68e106fd637ffdf00 100644 +index b15645cd56c245214bb5b87b36395fbc8e86e3d3..7c280d7beeb42dca52e36e77bbd41742b2572710 100644 --- a/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -632,6 +632,30 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor +@@ -639,6 +639,30 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat return Bukkit.getServer().getItemFactory().ensureServerConversions(this); } diff --git a/patches/api/0195-Add-Player-Client-Options-API.patch b/patches/api/0189-Add-Player-Client-Options-API.patch similarity index 98% rename from patches/api/0195-Add-Player-Client-Options-API.patch rename to patches/api/0189-Add-Player-Client-Options-API.patch index b67161dbb9..c04d29472e 100644 --- a/patches/api/0195-Add-Player-Client-Options-API.patch +++ b/patches/api/0189-Add-Player-Client-Options-API.patch @@ -229,7 +229,7 @@ index 0000000000000000000000000000000000000000..cf67dc7d465223710adbf2b798109f52 + } +} diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index fc8dd3af9fcb083b483da19a80234d668c2fcffc..5a84c4c5644f5d82896c693939ddc7d30a69cc97 100644 +index 0dd3fcd86099e5a032b09b46309894d5c3e6f39d..e277cf56c8c2c005efdbe1dd450c158debf46569 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java @@ -3,6 +3,7 @@ package org.bukkit.entity; @@ -240,7 +240,7 @@ index fc8dd3af9fcb083b483da19a80234d668c2fcffc..5a84c4c5644f5d82896c693939ddc7d3 import com.destroystokyo.paper.Title; // Paper import net.kyori.adventure.text.Component; import org.bukkit.DyeColor; -@@ -2509,6 +2510,12 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -2534,6 +2535,12 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM * Reset the cooldown counter to 0, effectively starting the cooldown period. */ void resetCooldown(); diff --git a/patches/api/0196-Add-PlayerAttackEntityCooldownResetEvent.patch b/patches/api/0190-Add-PlayerAttackEntityCooldownResetEvent.patch similarity index 100% rename from patches/api/0196-Add-PlayerAttackEntityCooldownResetEvent.patch rename to patches/api/0190-Add-PlayerAttackEntityCooldownResetEvent.patch diff --git a/patches/api/0197-Fix-Potion-toItemStack-swapping-the-extended-and-upg.patch b/patches/api/0191-Fix-Potion-toItemStack-swapping-the-extended-and-upg.patch similarity index 100% rename from patches/api/0197-Fix-Potion-toItemStack-swapping-the-extended-and-upg.patch rename to patches/api/0191-Fix-Potion-toItemStack-swapping-the-extended-and-upg.patch diff --git a/patches/api/0198-Add-item-slot-convenience-methods.patch b/patches/api/0192-Add-item-slot-convenience-methods.patch similarity index 100% rename from patches/api/0198-Add-item-slot-convenience-methods.patch rename to patches/api/0192-Add-item-slot-convenience-methods.patch diff --git a/patches/api/0199-Villager-Restocks-API.patch b/patches/api/0193-Villager-Restocks-API.patch similarity index 100% rename from patches/api/0199-Villager-Restocks-API.patch rename to patches/api/0193-Villager-Restocks-API.patch diff --git a/patches/api/0200-Expose-game-version.patch b/patches/api/0194-Expose-game-version.patch similarity index 100% rename from patches/api/0200-Expose-game-version.patch rename to patches/api/0194-Expose-game-version.patch diff --git a/patches/api/0201-Add-Mob-Goal-API.patch b/patches/api/0195-Add-Mob-Goal-API.patch similarity index 100% rename from patches/api/0201-Add-Mob-Goal-API.patch rename to patches/api/0195-Add-Mob-Goal-API.patch diff --git a/patches/api/0202-Add-villager-reputation-API.patch b/patches/api/0196-Add-villager-reputation-API.patch similarity index 100% rename from patches/api/0202-Add-villager-reputation-API.patch rename to patches/api/0196-Add-villager-reputation-API.patch diff --git a/patches/api/0203-Spawn-Reason-API.patch b/patches/api/0197-Spawn-Reason-API.patch similarity index 100% rename from patches/api/0203-Spawn-Reason-API.patch rename to patches/api/0197-Spawn-Reason-API.patch diff --git a/patches/api/0204-Potential-bed-API.patch b/patches/api/0198-Potential-bed-API.patch similarity index 88% rename from patches/api/0204-Potential-bed-API.patch rename to patches/api/0198-Potential-bed-API.patch index 102eb79e40..7fda003ff2 100644 --- a/patches/api/0204-Potential-bed-API.patch +++ b/patches/api/0198-Potential-bed-API.patch @@ -8,10 +8,10 @@ Adds a new method to fetch the location of a player's bed without generating any getPotentialBedLocation - Gets the last known location of a player's bed. This does not preform any check if the bed is still valid and does not load any chunks. diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java -index 8f489abbb7e80d869ca0f6e8626cecbd453b625a..0775c1061a72af66344ec45248b50072c394da38 100644 +index 3b184a66d1aebe4501fbdfd78ddf7a4ef5378f9f..5e4d1fdb18cc9df9a6ef558cfba5bc3ec4bd2315 100644 --- a/src/main/java/org/bukkit/entity/HumanEntity.java +++ b/src/main/java/org/bukkit/entity/HumanEntity.java -@@ -249,6 +249,19 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder +@@ -269,6 +269,19 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder */ public int getSleepTicks(); diff --git a/patches/api/0207-Inventory-getHolder-method-without-block-snapshot.patch b/patches/api/0199-Inventory-getHolder-method-without-block-snapshot.patch similarity index 100% rename from patches/api/0207-Inventory-getHolder-method-without-block-snapshot.patch rename to patches/api/0199-Inventory-getHolder-method-without-block-snapshot.patch diff --git a/patches/api/0208-Improve-Arrow-API.patch b/patches/api/0200-Improve-Arrow-API.patch similarity index 100% rename from patches/api/0208-Improve-Arrow-API.patch rename to patches/api/0200-Improve-Arrow-API.patch diff --git a/patches/api/0209-Add-and-implement-PlayerRecipeBookClickEvent.patch b/patches/api/0201-Add-and-implement-PlayerRecipeBookClickEvent.patch similarity index 100% rename from patches/api/0209-Add-and-implement-PlayerRecipeBookClickEvent.patch rename to patches/api/0201-Add-and-implement-PlayerRecipeBookClickEvent.patch diff --git a/patches/api/0210-Support-components-in-ItemMeta.patch b/patches/api/0202-Support-components-in-ItemMeta.patch similarity index 100% rename from patches/api/0210-Support-components-in-ItemMeta.patch rename to patches/api/0202-Support-components-in-ItemMeta.patch diff --git a/patches/api/0211-added-2-new-TargetReasons-for-1.16-mob-behavior.patch b/patches/api/0203-added-2-new-TargetReasons-for-1.16-mob-behavior.patch similarity index 100% rename from patches/api/0211-added-2-new-TargetReasons-for-1.16-mob-behavior.patch rename to patches/api/0203-added-2-new-TargetReasons-for-1.16-mob-behavior.patch diff --git a/patches/api/0212-Add-entity-liquid-API.patch b/patches/api/0204-Add-entity-liquid-API.patch similarity index 100% rename from patches/api/0212-Add-entity-liquid-API.patch rename to patches/api/0204-Add-entity-liquid-API.patch diff --git a/patches/api/0213-Add-PrepareResultEvent-PrepareGrindstoneEvent.patch b/patches/api/0205-Add-PrepareResultEvent-PrepareGrindstoneEvent.patch similarity index 100% rename from patches/api/0213-Add-PrepareResultEvent-PrepareGrindstoneEvent.patch rename to patches/api/0205-Add-PrepareResultEvent-PrepareGrindstoneEvent.patch diff --git a/patches/api/0214-Brand-support.patch b/patches/api/0206-Brand-support.patch similarity index 85% rename from patches/api/0214-Brand-support.patch rename to patches/api/0206-Brand-support.patch index ce8d4fade7..fb38631c64 100644 --- a/patches/api/0214-Brand-support.patch +++ b/patches/api/0206-Brand-support.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Brand support diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 5a84c4c5644f5d82896c693939ddc7d30a69cc97..8f7667562187a141ec037eaafa2e3e8d1abd6bff 100644 +index e277cf56c8c2c005efdbe1dd450c158debf46569..91a5ddaee8b5e4581e3cdef7aecf21788d21bbba 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java -@@ -2644,6 +2644,16 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -2669,6 +2669,16 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM // Paper end } diff --git a/patches/api/0215-Support-hex-colors-in-getLastColors.patch b/patches/api/0207-Support-hex-colors-in-getLastColors.patch similarity index 100% rename from patches/api/0215-Support-hex-colors-in-getLastColors.patch rename to patches/api/0207-Support-hex-colors-in-getLastColors.patch diff --git a/patches/api/0216-Add-setMaxPlayers-API.patch b/patches/api/0208-Add-setMaxPlayers-API.patch similarity index 100% rename from patches/api/0216-Add-setMaxPlayers-API.patch rename to patches/api/0208-Add-setMaxPlayers-API.patch diff --git a/patches/api/0217-Add-BellRingEvent.patch b/patches/api/0209-Add-BellRingEvent.patch similarity index 100% rename from patches/api/0217-Add-BellRingEvent.patch rename to patches/api/0209-Add-BellRingEvent.patch diff --git a/patches/api/0218-Add-moon-phase-API.patch b/patches/api/0210-Add-moon-phase-API.patch similarity index 100% rename from patches/api/0218-Add-moon-phase-API.patch rename to patches/api/0210-Add-moon-phase-API.patch diff --git a/patches/api/0219-Add-playPickupItemAnimation-to-LivingEntity.patch b/patches/api/0211-Add-playPickupItemAnimation-to-LivingEntity.patch similarity index 89% rename from patches/api/0219-Add-playPickupItemAnimation-to-LivingEntity.patch rename to patches/api/0211-Add-playPickupItemAnimation-to-LivingEntity.patch index 40f98e2964..92490d42d5 100644 --- a/patches/api/0219-Add-playPickupItemAnimation-to-LivingEntity.patch +++ b/patches/api/0211-Add-playPickupItemAnimation-to-LivingEntity.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add playPickupItemAnimation to LivingEntity diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index 3618a138a602fde4d3f045e9982dd95c0376b30d..4b2bbeebe724682a53850f92872169d7cfbeb552 100644 +index f76090f1f7ae7e3c026896b82e6379e5c2fd26fe..76fdfa7b00cb905163567a204a727cf047d9261a 100644 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -946,5 +946,28 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource +@@ -965,5 +965,28 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource * @param jumping entity jump state */ void setJumping(boolean jumping); diff --git a/patches/api/0220-Add-more-Evoker-API.patch b/patches/api/0212-Add-more-Evoker-API.patch similarity index 100% rename from patches/api/0220-Add-more-Evoker-API.patch rename to patches/api/0212-Add-more-Evoker-API.patch diff --git a/patches/api/0221-Add-methods-to-get-translation-keys.patch b/patches/api/0213-Add-methods-to-get-translation-keys.patch similarity index 76% rename from patches/api/0221-Add-methods-to-get-translation-keys.patch rename to patches/api/0213-Add-methods-to-get-translation-keys.patch index bfeb3be141..0f9e2fd1aa 100644 --- a/patches/api/0221-Add-methods-to-get-translation-keys.patch +++ b/patches/api/0213-Add-methods-to-get-translation-keys.patch @@ -144,80 +144,68 @@ index 0a66077d152a3c89fa7a277663969767798eb100..b02490737409eb80a2d2fb275c9a60b6 + // Paper end } diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java -index a7d36ef22724f0ce3add61ab314e09e6465077d4..4d496c7c088a75b79a25e7397b47600a8c104cf4 100644 +index e883bb46461eb40b018ebe8c07caff96046fd11d..89af89e5fb49e202e80ea7688c62f8e119f4ddfe 100644 --- a/src/main/java/org/bukkit/Material.java +++ b/src/main/java/org/bukkit/Material.java @@ -113,7 +113,7 @@ import org.jetbrains.annotations.Nullable; * An enum of all material IDs accepted by the official server and client */ @SuppressWarnings({"DeprecatedIsStillUsed", "deprecation"}) // Paper --public enum Material implements Keyed { -+public enum Material implements Keyed, net.kyori.adventure.translation.Translatable { // Paper +-public enum Material implements Keyed, Translatable { ++public enum Material implements Keyed, Translatable, net.kyori.adventure.translation.Translatable { // Paper // AIR(9648, 0), STONE(22948), -@@ -4288,6 +4288,23 @@ public enum Material implements Keyed { +@@ -4288,6 +4288,15 @@ public enum Material implements Keyed, Translatable { } return false; } + -+ /** -+ * Return the translation key for the Material, so the client can translate it into the active -+ * locale when using a TranslatableComponent. -+ * @return the translation key -+ * @deprecated use {@link #translationKey()} -+ */ -+ @NotNull -+ @Deprecated -+ public String getTranslationKey() { -+ return this.translationKey(); -+ } -+ + @Override + public @NotNull String translationKey() { -+ return Bukkit.getUnsafe().getTranslationKey(this); ++ if (this.isItem()) { ++ return Bukkit.getUnsafe().getItemTranslationKey(this); ++ } else { ++ return Bukkit.getUnsafe().getBlockTranslationKey(this); ++ } + } // Paper end /** -diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index 5453b2ae459b2d5171ef7129c29891b721ee8e0b..b518720355d8a8dcd55cb755e4e1fa9fc3dfc52b 100644 ---- a/src/main/java/org/bukkit/UnsafeValues.java -+++ b/src/main/java/org/bukkit/UnsafeValues.java -@@ -112,5 +112,34 @@ public interface UnsafeValues { - byte[] serializeItem(ItemStack item); +@@ -10596,9 +10605,11 @@ public enum Material implements Keyed, Translatable { + * material + * @see #getBlockTranslationKey() + * @see #getItemTranslationKey() ++ * @deprecated use {@link #translationKey()} + */ + @Override + @NotNull ++ @Deprecated(forRemoval = true) // Paper + public String getTranslationKey() { + if (this.isItem()) { + return Bukkit.getUnsafe().getItemTranslationKey(this); +diff --git a/src/main/java/org/bukkit/Translatable.java b/src/main/java/org/bukkit/Translatable.java +index e3faa2c675c85a9cbdbbb1debec0ff81c58a1bbd..fd1629c2d2028a88fb3d56b0aeb833d17235080a 100644 +--- a/src/main/java/org/bukkit/Translatable.java ++++ b/src/main/java/org/bukkit/Translatable.java +@@ -5,14 +5,18 @@ import org.jetbrains.annotations.NotNull; + /** + * Represents an object with a text representation that can be translated by the + * Minecraft client. ++ * @deprecated use {@link net.kyori.adventure.translation.Translatable} + */ ++@Deprecated(forRemoval = true) // Paper + public interface Translatable { - ItemStack deserializeItem(byte[] data); -+ -+ /** -+ * Return the translation key for the Material, so the client can translate it into the active -+ * locale when using a {@link net.kyori.adventure.text.TranslatableComponent}. -+ * @return the translation key -+ */ -+ String getTranslationKey(Material mat); -+ -+ /** -+ * Return the translation key for the Block, so the client can translate it into the active -+ * locale when using a {@link net.kyori.adventure.text.TranslatableComponent}. -+ * @return the translation key -+ */ -+ String getTranslationKey(org.bukkit.block.Block block); -+ -+ /** -+ * Return the translation key for the EntityType, so the client can translate it into the active -+ * locale when using a {@link net.kyori.adventure.text.TranslatableComponent}.
-+ * This is null, when the EntityType isn't known to NMS (custom entities) -+ * @return the translation key -+ */ -+ String getTranslationKey(org.bukkit.entity.EntityType type); -+ -+ /** -+ * Return the translation key for the ItemStack, so the client can translate it into the active -+ * locale when using a {@link net.kyori.adventure.text.TranslatableComponent}.
-+ * @return the translation key -+ */ -+ String getTranslationKey(ItemStack itemStack); - // Paper end + /** + * Get the translation key, suitable for use in a translation component. + * + * @return the translation key ++ * @deprecated look for a {@code translationKey()} method instead + */ + @NotNull ++ @Deprecated(forRemoval = true) // Paper + String getTranslationKey(); } diff --git a/src/main/java/org/bukkit/attribute/Attribute.java b/src/main/java/org/bukkit/attribute/Attribute.java index 13eac9ad2c1672051635d1c35cc49239252e7a61..107e36ef02a9481954bd770ce9a55a0b1e84be7a 100644 @@ -269,31 +257,28 @@ index 02c5fcbc76b2db6bf4eb7580456b5658c08272b4..d56e1b50dd7da18f40278cec4bfdc941 + // Paper end } diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java -index af705e45204975a342e1454156ba143ed52cecdc..ce3b81c5d83c9747ea0e3410c932460d11bf5c55 100644 +index 06ef9e133125d80127e1dbd6ae0eda89fa08a1d7..35ed58bce2589bb097dd0f6bf2a6ebd76dc31fcd 100644 --- a/src/main/java/org/bukkit/block/Block.java +++ b/src/main/java/org/bukkit/block/Block.java -@@ -31,7 +31,7 @@ import org.jetbrains.annotations.Nullable; +@@ -32,7 +32,7 @@ import org.jetbrains.annotations.Nullable; * (i.e. lighting and power) may not be able to be safely accessed during world * generation when used in cases like BlockPhysicsEvent!!!! */ --public interface Block extends Metadatable { -+public interface Block extends Metadatable, net.kyori.adventure.translation.Translatable { // Paper - translatable +-public interface Block extends Metadatable, Translatable { ++public interface Block extends Metadatable, Translatable, net.kyori.adventure.translation.Translatable { // Paper - translatable /** * Gets the metadata for this block -@@ -672,5 +672,15 @@ public interface Block extends Metadatable { +@@ -673,5 +673,12 @@ public interface Block extends Metadatable, Translatable { * @return the sound group for this block */ @NotNull org.bukkit.SoundGroup getBlockSoundGroup(); + + /** -+ * Return the translation key for the Block, so the client can translate it into the active -+ * locale when using a TranslatableComponent. -+ * @return the translation key + * @deprecated use {@link #translationKey()} + */ + @NotNull -+ @Deprecated ++ @Deprecated(forRemoval = true) + String getTranslationKey(); // Paper end } @@ -326,36 +311,28 @@ index 4d5f0837bd0e02a30c943d8969fb6b13452322e0..a39f9c078f42451bd122f3e3729d10ca // Paper end } diff --git a/src/main/java/org/bukkit/entity/EntityType.java b/src/main/java/org/bukkit/entity/EntityType.java -index df9d315cfaf968527fc8bc26dadd88f64a408cde..50d9442ffafdfabd4904dafae7daaeadcedee75b 100644 +index 2caa5f82e206b231fd9e9f5508c3713816e5a0e4..80897ed8641a2bdc4e3557e20f3a8ae4b8c5da69 100644 --- a/src/main/java/org/bukkit/entity/EntityType.java +++ b/src/main/java/org/bukkit/entity/EntityType.java -@@ -20,7 +20,7 @@ import org.jetbrains.annotations.Contract; +@@ -22,7 +22,7 @@ import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; --public enum EntityType implements Keyed { -+public enum EntityType implements Keyed, net.kyori.adventure.translation.Translatable { // Paper - translatable +-public enum EntityType implements Keyed, Translatable { ++public enum EntityType implements Keyed, Translatable, net.kyori.adventure.translation.Translatable { // Paper - translatable // These strings MUST match the strings in nms.EntityTypes and are case sensitive. /** -@@ -425,4 +425,27 @@ public enum EntityType implements Keyed { - public boolean isAlive() { - return living; +@@ -430,7 +430,19 @@ public enum EntityType implements Keyed, Translatable { + + @Override + @NotNull ++ @Deprecated(forRemoval = true) // Paper + public String getTranslationKey() { + return Bukkit.getUnsafe().getTranslationKey(this); } -+ // Paper start -+ /** -+ * Return the translation key for the EntityType, so the client can translate it into the active -+ * locale when using a TranslatableComponent.
-+ * This is null, when the EntityType isn't known to NMS (custom entities) -+ * @return the translation key -+ * @deprecated use {@link #translationKey()} -+ */ -+ @Deprecated -+ @Nullable -+ public String getTranslationKey() { -+ return org.bukkit.Bukkit.getUnsafe().getTranslationKey(this); -+ } + ++ // Paper start + /** + * @throws IllegalArgumentException if the entity does not have a translation key (is probably a custom entity) + */ @@ -473,38 +450,32 @@ index 5bd252c0ae3b09fe141d131360c67bb9bfbf5422..78587d9fabe6371a23a7963917b054db + } diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index d3334c62bf39abf17ee7f3e68e106fd637ffdf00..d6eafaa58b19ab44dfdef1baa58fa89c5b761b65 100644 +index 7c280d7beeb42dca52e36e77bbd41742b2572710..03a15727c85a08c0c79965be249373a11f31ce6e 100644 --- a/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -24,7 +24,7 @@ import org.jetbrains.annotations.Nullable; +@@ -25,7 +25,7 @@ import org.jetbrains.annotations.Nullable; * use this class to encapsulate Materials for which {@link Material#isItem()} * returns false. */ --public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyori.adventure.text.event.HoverEventSource { // Paper -+public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyori.adventure.text.event.HoverEventSource, net.kyori.adventure.translation.Translatable { // Paper +-public class ItemStack implements Cloneable, ConfigurationSerializable, Translatable, net.kyori.adventure.text.event.HoverEventSource { // Paper ++public class ItemStack implements Cloneable, ConfigurationSerializable, Translatable, net.kyori.adventure.text.event.HoverEventSource, net.kyori.adventure.translation.Translatable { // Paper private Material type = Material.AIR; private int amount = 0; private MaterialData data = null; -@@ -858,5 +858,30 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor +@@ -606,6 +606,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat + + @Override + @NotNull ++ @Deprecated(forRemoval = true) // Paper + public String getTranslationKey() { + return Bukkit.getUnsafe().getTranslationKey(this); + } +@@ -865,5 +866,16 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat ItemMeta itemMeta = getItemMeta(); return itemMeta != null && itemMeta.hasItemFlag(flag); } + + /** -+ * Gets the translation key for this itemstack. -+ * This is not the same as getting the translation key -+ * for the material of this itemstack. -+ * -+ * @return the translation key -+ * @deprecated use {@link #translationKey()} -+ */ -+ @NotNull -+ @Deprecated -+ public String getTranslationKey() { -+ return this.translationKey(); -+ } -+ -+ /** + * {@inheritDoc} + *

+ * This is not the same as getting the translation key diff --git a/patches/api/0222-Create-HoverEvent-from-ItemStack-Entity.patch b/patches/api/0214-Create-HoverEvent-from-ItemStack-Entity.patch similarity index 100% rename from patches/api/0222-Create-HoverEvent-from-ItemStack-Entity.patch rename to patches/api/0214-Create-HoverEvent-from-ItemStack-Entity.patch diff --git a/patches/api/0223-Add-additional-open-container-api-to-HumanEntity.patch b/patches/api/0215-Add-additional-open-container-api-to-HumanEntity.patch similarity index 96% rename from patches/api/0223-Add-additional-open-container-api-to-HumanEntity.patch rename to patches/api/0215-Add-additional-open-container-api-to-HumanEntity.patch index 2d427236be..aa221f2256 100644 --- a/patches/api/0223-Add-additional-open-container-api-to-HumanEntity.patch +++ b/patches/api/0215-Add-additional-open-container-api-to-HumanEntity.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add additional open container api to HumanEntity diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java -index 0775c1061a72af66344ec45248b50072c394da38..7e23e157eb70e6bf94d0ac4a0196cc5c943dcac4 100644 +index 5e4d1fdb18cc9df9a6ef558cfba5bc3ec4bd2315..b0de996c7cbfc36a3f749091068a70885b009832 100644 --- a/src/main/java/org/bukkit/entity/HumanEntity.java +++ b/src/main/java/org/bukkit/entity/HumanEntity.java -@@ -154,6 +154,92 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder +@@ -174,6 +174,92 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder @Nullable public InventoryView openMerchant(@NotNull Merchant merchant, boolean force); diff --git a/patches/api/0224-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch b/patches/api/0216-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch similarity index 74% rename from patches/api/0224-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch rename to patches/api/0216-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch index 0d12123896..cc17c319f5 100644 --- a/patches/api/0224-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch +++ b/patches/api/0216-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch @@ -6,13 +6,13 @@ Subject: [PATCH] Expose the Entity Counter to allow plugins to use valid and diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index b518720355d8a8dcd55cb755e4e1fa9fc3dfc52b..824833a04df15551c8dd9ddfa8d4c1c9cf6d49c0 100644 +index ee9ed5f0e2936c740903784b01b9e2fff75b92f8..1f89a3c1c3b73a939c2653102fc1dc8b630672a8 100644 --- a/src/main/java/org/bukkit/UnsafeValues.java +++ b/src/main/java/org/bukkit/UnsafeValues.java -@@ -141,5 +141,12 @@ public interface UnsafeValues { - * @return the translation key - */ - String getTranslationKey(ItemStack itemStack); +@@ -125,5 +125,12 @@ public interface UnsafeValues { + byte[] serializeItem(ItemStack item); + + ItemStack deserializeItem(byte[] data); + + /** + * Creates and returns the next EntityId available. diff --git a/patches/api/0225-Entity-isTicking.patch b/patches/api/0217-Entity-isTicking.patch similarity index 100% rename from patches/api/0225-Entity-isTicking.patch rename to patches/api/0217-Entity-isTicking.patch diff --git a/patches/api/0226-Clarify-the-Javadocs-for-Entity.getEntitySpawnReason.patch b/patches/api/0218-Clarify-the-Javadocs-for-Entity.getEntitySpawnReason.patch similarity index 100% rename from patches/api/0226-Clarify-the-Javadocs-for-Entity.getEntitySpawnReason.patch rename to patches/api/0218-Clarify-the-Javadocs-for-Entity.getEntitySpawnReason.patch diff --git a/patches/api/0227-Villager-resetOffers.patch b/patches/api/0219-Villager-resetOffers.patch similarity index 100% rename from patches/api/0227-Villager-resetOffers.patch rename to patches/api/0219-Villager-resetOffers.patch diff --git a/patches/api/0228-Player-elytra-boost-API.patch b/patches/api/0220-Player-elytra-boost-API.patch similarity index 88% rename from patches/api/0228-Player-elytra-boost-API.patch rename to patches/api/0220-Player-elytra-boost-API.patch index 40d4cad6f1..8ab8153eac 100644 --- a/patches/api/0228-Player-elytra-boost-API.patch +++ b/patches/api/0220-Player-elytra-boost-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Player elytra boost API diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 8f7667562187a141ec037eaafa2e3e8d1abd6bff..8d4a010d826fb84feb3d6b927275c49d8eec9f71 100644 +index 91a5ddaee8b5e4581e3cdef7aecf21788d21bbba..ea824a19e3e75bbfd7382c977a5409c9d6ed03ab 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java -@@ -2516,6 +2516,19 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -2541,6 +2541,19 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM */ @NotNull T getClientOption(@NotNull ClientOption option); diff --git a/patches/api/0229-Add-getOfflinePlayerIfCached-String.patch b/patches/api/0221-Add-getOfflinePlayerIfCached-String.patch similarity index 100% rename from patches/api/0229-Add-getOfflinePlayerIfCached-String.patch rename to patches/api/0221-Add-getOfflinePlayerIfCached-String.patch diff --git a/patches/api/0230-Add-ignore-discounts-API.patch b/patches/api/0222-Add-ignore-discounts-API.patch similarity index 100% rename from patches/api/0230-Add-ignore-discounts-API.patch rename to patches/api/0222-Add-ignore-discounts-API.patch diff --git a/patches/api/0231-Item-no-age-no-player-pickup.patch b/patches/api/0223-Item-no-age-no-player-pickup.patch similarity index 100% rename from patches/api/0231-Item-no-age-no-player-pickup.patch rename to patches/api/0223-Item-no-age-no-player-pickup.patch diff --git a/patches/api/0232-Beacon-API-custom-effect-ranges.patch b/patches/api/0224-Beacon-API-custom-effect-ranges.patch similarity index 100% rename from patches/api/0232-Beacon-API-custom-effect-ranges.patch rename to patches/api/0224-Beacon-API-custom-effect-ranges.patch diff --git a/patches/api/0233-Add-API-for-quit-reason.patch b/patches/api/0225-Add-API-for-quit-reason.patch similarity index 100% rename from patches/api/0233-Add-API-for-quit-reason.patch rename to patches/api/0225-Add-API-for-quit-reason.patch diff --git a/patches/api/0234-Add-Destroy-Speed-API.patch b/patches/api/0226-Add-Destroy-Speed-API.patch similarity index 86% rename from patches/api/0234-Add-Destroy-Speed-API.patch rename to patches/api/0226-Add-Destroy-Speed-API.patch index a7835cadaa..bdf9933289 100644 --- a/patches/api/0234-Add-Destroy-Speed-API.patch +++ b/patches/api/0226-Add-Destroy-Speed-API.patch @@ -6,12 +6,12 @@ Subject: [PATCH] Add Destroy Speed API Co-authored-by: Jake Potrebic diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java -index 2c837ea822f3b0c4ec312f0c956fe1b778cbd5e9..4a408361ac86b8c490942686c2709817338f4f59 100644 +index 35ed58bce2589bb097dd0f6bf2a6ebd76dc31fcd..ded1daaef53882a80e618f4ed97b50fd0ee4786c 100644 --- a/src/main/java/org/bukkit/block/Block.java +++ b/src/main/java/org/bukkit/block/Block.java -@@ -682,5 +682,29 @@ public interface Block extends Metadatable, net.kyori.adventure.translation.Tran +@@ -680,5 +680,29 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr @NotNull - @Deprecated + @Deprecated(forRemoval = true) String getTranslationKey(); + + /** diff --git a/patches/api/0235-Add-LivingEntity-clearActiveItem.patch b/patches/api/0227-Add-LivingEntity-clearActiveItem.patch similarity index 84% rename from patches/api/0235-Add-LivingEntity-clearActiveItem.patch rename to patches/api/0227-Add-LivingEntity-clearActiveItem.patch index 3ebf45e6ab..cb7332dea2 100644 --- a/patches/api/0235-Add-LivingEntity-clearActiveItem.patch +++ b/patches/api/0227-Add-LivingEntity-clearActiveItem.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add LivingEntity#clearActiveItem diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index 4b2bbeebe724682a53850f92872169d7cfbeb552..f52c7d2ac653dde284de8d83ebe034afa2cde90a 100644 +index 76fdfa7b00cb905163567a204a727cf047d9261a..b09c9eb92c069f76e0fba4a08ed0a5c66ced3a40 100644 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -897,6 +897,13 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource +@@ -916,6 +916,13 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource @NotNull org.bukkit.inventory.ItemStack getActiveItem(); diff --git a/patches/api/0236-Add-PlayerItemCooldownEvent.patch b/patches/api/0228-Add-PlayerItemCooldownEvent.patch similarity index 100% rename from patches/api/0236-Add-PlayerItemCooldownEvent.patch rename to patches/api/0228-Add-PlayerItemCooldownEvent.patch diff --git a/patches/api/0237-More-lightning-API.patch b/patches/api/0229-More-lightning-API.patch similarity index 100% rename from patches/api/0237-More-lightning-API.patch rename to patches/api/0229-More-lightning-API.patch diff --git a/patches/api/0238-Add-PlayerShearBlockEvent.patch b/patches/api/0230-Add-PlayerShearBlockEvent.patch similarity index 100% rename from patches/api/0238-Add-PlayerShearBlockEvent.patch rename to patches/api/0230-Add-PlayerShearBlockEvent.patch diff --git a/patches/api/0239-Enable-multi-release-plugin-jars.patch b/patches/api/0231-Enable-multi-release-plugin-jars.patch similarity index 82% rename from patches/api/0239-Enable-multi-release-plugin-jars.patch rename to patches/api/0231-Enable-multi-release-plugin-jars.patch index 40eb489f1d..a9d77d233b 100644 --- a/patches/api/0239-Enable-multi-release-plugin-jars.patch +++ b/patches/api/0231-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 fc5dc3b2f73e76976748eb013b39cae931072143..e39492e2544c39c5457f079a6baadf0b4074dd7e 100644 +index fade45ef475ae20922f5abea49a0f035d19b7819..264d712d3399d24cb01b85fc2d055d9fbf11b23a 100644 --- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java +++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java -@@ -58,7 +58,7 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot +@@ -59,7 +59,7 @@ public final class PluginClassLoader extends URLClassLoader implements io.paperm this.description = description; this.dataFolder = dataFolder; this.file = file; diff --git a/patches/api/0240-Player-Chunk-Load-Unload-Events.patch b/patches/api/0232-Player-Chunk-Load-Unload-Events.patch similarity index 100% rename from patches/api/0240-Player-Chunk-Load-Unload-Events.patch rename to patches/api/0232-Player-Chunk-Load-Unload-Events.patch diff --git a/patches/api/0241-Expose-LivingEntity-hurt-direction.patch b/patches/api/0233-Expose-LivingEntity-hurt-direction.patch similarity index 84% rename from patches/api/0241-Expose-LivingEntity-hurt-direction.patch rename to patches/api/0233-Expose-LivingEntity-hurt-direction.patch index 3c417244c7..92baefbb10 100644 --- a/patches/api/0241-Expose-LivingEntity-hurt-direction.patch +++ b/patches/api/0233-Expose-LivingEntity-hurt-direction.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Expose LivingEntity hurt direction diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index f52c7d2ac653dde284de8d83ebe034afa2cde90a..f44f510b3194c9716ec59caa195f83dde2b2773a 100644 +index b09c9eb92c069f76e0fba4a08ed0a5c66ced3a40..cc61e030f1bdb4d1ef52a0a1ae4983f95d2460fd 100644 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -976,5 +976,19 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource +@@ -995,5 +995,19 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource * @param quantity quantity of item */ void playPickupItemAnimation(@NotNull Item item, int quantity); diff --git a/patches/api/0242-Add-OBSTRUCTED-reason-to-BedEnterResult.patch b/patches/api/0234-Add-OBSTRUCTED-reason-to-BedEnterResult.patch similarity index 100% rename from patches/api/0242-Add-OBSTRUCTED-reason-to-BedEnterResult.patch rename to patches/api/0234-Add-OBSTRUCTED-reason-to-BedEnterResult.patch diff --git a/patches/api/0243-Added-PlayerTradeEvent.patch b/patches/api/0235-Added-PlayerTradeEvent.patch similarity index 100% rename from patches/api/0243-Added-PlayerTradeEvent.patch rename to patches/api/0235-Added-PlayerTradeEvent.patch diff --git a/patches/api/0244-Add-TargetHitEvent-API.patch b/patches/api/0236-Add-TargetHitEvent-API.patch similarity index 100% rename from patches/api/0244-Add-TargetHitEvent-API.patch rename to patches/api/0236-Add-TargetHitEvent-API.patch diff --git a/patches/api/0245-Additional-Block-Material-API-s.patch b/patches/api/0237-Additional-Block-Material-API-s.patch similarity index 90% rename from patches/api/0245-Additional-Block-Material-API-s.patch rename to patches/api/0237-Additional-Block-Material-API-s.patch index fe8d819d32..5d7efccc1f 100644 --- a/patches/api/0245-Additional-Block-Material-API-s.patch +++ b/patches/api/0237-Additional-Block-Material-API-s.patch @@ -9,10 +9,10 @@ process to do this in the Bukkit API Adds API for buildable, replaceable, burnable too. diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java -index 4a408361ac86b8c490942686c2709817338f4f59..43a0e57a6db702b2a40e151f151bfaa63b9d95d5 100644 +index ded1daaef53882a80e618f4ed97b50fd0ee4786c..4abd16a4e99ae0380b67c86b9744d71423053b5e 100644 --- a/src/main/java/org/bukkit/block/Block.java +++ b/src/main/java/org/bukkit/block/Block.java -@@ -438,6 +438,42 @@ public interface Block extends Metadatable, net.kyori.adventure.translation.Tran +@@ -439,6 +439,42 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr */ boolean isLiquid(); diff --git a/patches/api/0246-Add-API-to-get-Material-from-Boats-and-Minecarts.patch b/patches/api/0238-Add-API-to-get-Material-from-Boats-and-Minecarts.patch similarity index 100% rename from patches/api/0246-Add-API-to-get-Material-from-Boats-and-Minecarts.patch rename to patches/api/0238-Add-API-to-get-Material-from-Boats-and-Minecarts.patch diff --git a/patches/api/0247-Add-PlayerFlowerPotManipulateEvent.patch b/patches/api/0239-Add-PlayerFlowerPotManipulateEvent.patch similarity index 100% rename from patches/api/0247-Add-PlayerFlowerPotManipulateEvent.patch rename to patches/api/0239-Add-PlayerFlowerPotManipulateEvent.patch diff --git a/patches/api/0248-Zombie-API-breaking-doors.patch b/patches/api/0240-Zombie-API-breaking-doors.patch similarity index 100% rename from patches/api/0248-Zombie-API-breaking-doors.patch rename to patches/api/0240-Zombie-API-breaking-doors.patch diff --git a/patches/api/0249-Add-EntityLoadCrossbowEvent.patch b/patches/api/0241-Add-EntityLoadCrossbowEvent.patch similarity index 100% rename from patches/api/0249-Add-EntityLoadCrossbowEvent.patch rename to patches/api/0241-Add-EntityLoadCrossbowEvent.patch diff --git a/patches/api/0250-Added-WorldGameRuleChangeEvent.patch b/patches/api/0242-Added-WorldGameRuleChangeEvent.patch similarity index 100% rename from patches/api/0250-Added-WorldGameRuleChangeEvent.patch rename to patches/api/0242-Added-WorldGameRuleChangeEvent.patch diff --git a/patches/api/0251-Added-ServerResourcesReloadedEvent.patch b/patches/api/0243-Added-ServerResourcesReloadedEvent.patch similarity index 100% rename from patches/api/0251-Added-ServerResourcesReloadedEvent.patch rename to patches/api/0243-Added-ServerResourcesReloadedEvent.patch diff --git a/patches/api/0252-Add-BlockFailedDispenseEvent.patch b/patches/api/0244-Add-BlockFailedDispenseEvent.patch similarity index 100% rename from patches/api/0252-Add-BlockFailedDispenseEvent.patch rename to patches/api/0244-Add-BlockFailedDispenseEvent.patch diff --git a/patches/api/0253-Added-PlayerLecternPageChangeEvent.patch b/patches/api/0245-Added-PlayerLecternPageChangeEvent.patch similarity index 100% rename from patches/api/0253-Added-PlayerLecternPageChangeEvent.patch rename to patches/api/0245-Added-PlayerLecternPageChangeEvent.patch diff --git a/patches/api/0254-Added-PlayerLoomPatternSelectEvent.patch b/patches/api/0246-Added-PlayerLoomPatternSelectEvent.patch similarity index 100% rename from patches/api/0254-Added-PlayerLoomPatternSelectEvent.patch rename to patches/api/0246-Added-PlayerLoomPatternSelectEvent.patch diff --git a/patches/api/0255-Add-API-to-get-exact-interaction-point-in-PlayerInte.patch b/patches/api/0247-Add-API-to-get-exact-interaction-point-in-PlayerInte.patch similarity index 100% rename from patches/api/0255-Add-API-to-get-exact-interaction-point-in-PlayerInte.patch rename to patches/api/0247-Add-API-to-get-exact-interaction-point-in-PlayerInte.patch diff --git a/patches/api/0256-Add-sendOpLevel-API.patch b/patches/api/0248-Add-sendOpLevel-API.patch similarity index 87% rename from patches/api/0256-Add-sendOpLevel-API.patch rename to patches/api/0248-Add-sendOpLevel-API.patch index b3bdaac090..30329ebd74 100644 --- a/patches/api/0256-Add-sendOpLevel-API.patch +++ b/patches/api/0248-Add-sendOpLevel-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add sendOpLevel API diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 8d4a010d826fb84feb3d6b927275c49d8eec9f71..9bae45ea3097e328594dcaefac87c55d2c27498d 100644 +index ea824a19e3e75bbfd7382c977a5409c9d6ed03ab..c3db4783a05020cf91e2fd314dddf22d1ccfc02b 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java -@@ -2529,6 +2529,17 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -2554,6 +2554,17 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM */ @Nullable Firework boostElytra(@NotNull ItemStack firework); diff --git a/patches/api/0257-Add-PaperRegistry.patch b/patches/api/0249-Add-PaperRegistry.patch similarity index 96% rename from patches/api/0257-Add-PaperRegistry.patch rename to patches/api/0249-Add-PaperRegistry.patch index c5486a380d..c4c2b84949 100644 --- a/patches/api/0257-Add-PaperRegistry.patch +++ b/patches/api/0249-Add-PaperRegistry.patch @@ -91,10 +91,10 @@ index 0000000000000000000000000000000000000000..f29e76a6b66ddfec12ddf8db6dcb2df6 + } +} diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index 824833a04df15551c8dd9ddfa8d4c1c9cf6d49c0..3d5185a1a3a5e5e1b1428ddbedec38f908f5870a 100644 +index 1f89a3c1c3b73a939c2653102fc1dc8b630672a8..e5e91f4b4492fa1e709d81f313aac80761ab9e07 100644 --- a/src/main/java/org/bukkit/UnsafeValues.java +++ b/src/main/java/org/bukkit/UnsafeValues.java -@@ -148,5 +148,15 @@ public interface UnsafeValues { +@@ -132,5 +132,15 @@ public interface UnsafeValues { * Use this when sending custom packets, so that there are no collisions on the client or server. */ public int nextEntityId(); diff --git a/patches/api/0258-Add-StructuresLocateEvent.patch b/patches/api/0250-Add-StructuresLocateEvent.patch similarity index 99% rename from patches/api/0258-Add-StructuresLocateEvent.patch rename to patches/api/0250-Add-StructuresLocateEvent.patch index 267a1b8045..9f5a511014 100644 --- a/patches/api/0258-Add-StructuresLocateEvent.patch +++ b/patches/api/0250-Add-StructuresLocateEvent.patch @@ -443,10 +443,10 @@ index 0000000000000000000000000000000000000000..5a43e40b7311ed2acb51f6ba8b12d1f3 + } +} diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java -index a77320257b691c3a380f7c59c350382c0c0fe863..ec59aa76488a1500ab3df46c98ba7b1d4179df4e 100644 +index ff1fcdaccbca81602278a0b52670f7b895ba22b7..9e39c028b3d7bea4f2998d6ed8d53d88361ccfcd 100644 --- a/src/main/java/org/bukkit/Registry.java +++ b/src/main/java/org/bukkit/Registry.java -@@ -210,6 +210,13 @@ public interface Registry extends Iterable { +@@ -211,6 +211,13 @@ public interface Registry extends Iterable { return GameEvent.getByKey(key); } }; diff --git a/patches/api/0259-Return-chat-component-with-empty-text-instead-of-thr.patch b/patches/api/0251-Return-chat-component-with-empty-text-instead-of-thr.patch similarity index 100% rename from patches/api/0259-Return-chat-component-with-empty-text-instead-of-thr.patch rename to patches/api/0251-Return-chat-component-with-empty-text-instead-of-thr.patch diff --git a/patches/api/0260-Add-BlockPreDispenseEvent.patch b/patches/api/0252-Add-BlockPreDispenseEvent.patch similarity index 100% rename from patches/api/0260-Add-BlockPreDispenseEvent.patch rename to patches/api/0252-Add-BlockPreDispenseEvent.patch diff --git a/patches/api/0261-Added-missing-vanilla-tags.patch b/patches/api/0253-Added-missing-vanilla-tags.patch similarity index 100% rename from patches/api/0261-Added-missing-vanilla-tags.patch rename to patches/api/0253-Added-missing-vanilla-tags.patch diff --git a/patches/api/0262-Added-PlayerChangeBeaconEffectEvent.patch b/patches/api/0254-Added-PlayerChangeBeaconEffectEvent.patch similarity index 100% rename from patches/api/0262-Added-PlayerChangeBeaconEffectEvent.patch rename to patches/api/0254-Added-PlayerChangeBeaconEffectEvent.patch diff --git a/patches/api/0263-Added-PlayerStonecutterRecipeSelectEvent.patch b/patches/api/0255-Added-PlayerStonecutterRecipeSelectEvent.patch similarity index 100% rename from patches/api/0263-Added-PlayerStonecutterRecipeSelectEvent.patch rename to patches/api/0255-Added-PlayerStonecutterRecipeSelectEvent.patch diff --git a/patches/api/0264-Add-dropLeash-variable-to-EntityUnleashEvent.patch b/patches/api/0256-Add-dropLeash-variable-to-EntityUnleashEvent.patch similarity index 100% rename from patches/api/0264-Add-dropLeash-variable-to-EntityUnleashEvent.patch rename to patches/api/0256-Add-dropLeash-variable-to-EntityUnleashEvent.patch diff --git a/patches/api/0265-add-DragonEggFormEvent.patch b/patches/api/0257-add-DragonEggFormEvent.patch similarity index 100% rename from patches/api/0265-add-DragonEggFormEvent.patch rename to patches/api/0257-add-DragonEggFormEvent.patch diff --git a/patches/api/0266-EntityMoveEvent.patch b/patches/api/0258-EntityMoveEvent.patch similarity index 100% rename from patches/api/0266-EntityMoveEvent.patch rename to patches/api/0258-EntityMoveEvent.patch diff --git a/patches/api/0267-Allow-adding-items-to-BlockDropItemEvent.patch b/patches/api/0259-Allow-adding-items-to-BlockDropItemEvent.patch similarity index 100% rename from patches/api/0267-Allow-adding-items-to-BlockDropItemEvent.patch rename to patches/api/0259-Allow-adding-items-to-BlockDropItemEvent.patch diff --git a/patches/api/0268-Add-getMainThreadExecutor-to-BukkitScheduler.patch b/patches/api/0260-Add-getMainThreadExecutor-to-BukkitScheduler.patch similarity index 100% rename from patches/api/0268-Add-getMainThreadExecutor-to-BukkitScheduler.patch rename to patches/api/0260-Add-getMainThreadExecutor-to-BukkitScheduler.patch diff --git a/patches/api/0269-living-entity-allow-attribute-registration.patch b/patches/api/0261-living-entity-allow-attribute-registration.patch similarity index 100% rename from patches/api/0269-living-entity-allow-attribute-registration.patch rename to patches/api/0261-living-entity-allow-attribute-registration.patch diff --git a/patches/api/0270-Add-missing-effects.patch b/patches/api/0262-Add-missing-effects.patch similarity index 100% rename from patches/api/0270-Add-missing-effects.patch rename to patches/api/0262-Add-missing-effects.patch diff --git a/patches/api/0271-Expose-Tracked-Players.patch b/patches/api/0263-Expose-Tracked-Players.patch similarity index 100% rename from patches/api/0271-Expose-Tracked-Players.patch rename to patches/api/0263-Expose-Tracked-Players.patch diff --git a/patches/api/0272-Cache-the-result-of-Material-isBlock.patch b/patches/api/0264-Cache-the-result-of-Material-isBlock.patch similarity index 74% rename from patches/api/0272-Cache-the-result-of-Material-isBlock.patch rename to patches/api/0264-Cache-the-result-of-Material-isBlock.patch index 62e0c5fb00..4ba6e74321 100644 --- a/patches/api/0272-Cache-the-result-of-Material-isBlock.patch +++ b/patches/api/0264-Cache-the-result-of-Material-isBlock.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Cache the result of Material#isBlock diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java -index 4d496c7c088a75b79a25e7397b47600a8c104cf4..b1214775680099c8255b45ed0285568572f12895 100644 +index 89af89e5fb49e202e80ea7688c62f8e119f4ddfe..7e447f8be7dc9768df487e1f7f4b9aafedb33e2d 100644 --- a/src/main/java/org/bukkit/Material.java +++ b/src/main/java/org/bukkit/Material.java -@@ -4232,6 +4232,7 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -4232,6 +4232,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla public final Class data; private final boolean legacy; private final NamespacedKey key; @@ -16,7 +16,7 @@ index 4d496c7c088a75b79a25e7397b47600a8c104cf4..b1214775680099c8255b45ed02855685 private Material(final int id) { this(id, 64); -@@ -4438,6 +4439,11 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -4430,6 +4431,11 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla * @return true if this material is a block */ public boolean isBlock() { @@ -28,7 +28,7 @@ index 4d496c7c088a75b79a25e7397b47600a8c104cf4..b1214775680099c8255b45ed02855685 switch (this) { // case ACACIA_BUTTON: -@@ -5593,6 +5599,7 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -5585,6 +5591,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla static { for (Material material : values()) { BY_NAME.put(material.name(), material); diff --git a/patches/api/0273-Add-worldborder-events.patch b/patches/api/0265-Add-worldborder-events.patch similarity index 100% rename from patches/api/0273-Add-worldborder-events.patch rename to patches/api/0265-Add-worldborder-events.patch diff --git a/patches/api/0274-added-PlayerNameEntityEvent.patch b/patches/api/0266-added-PlayerNameEntityEvent.patch similarity index 100% rename from patches/api/0274-added-PlayerNameEntityEvent.patch rename to patches/api/0266-added-PlayerNameEntityEvent.patch diff --git a/patches/api/0275-Add-recipe-to-cook-events.patch b/patches/api/0267-Add-recipe-to-cook-events.patch similarity index 100% rename from patches/api/0275-Add-recipe-to-cook-events.patch rename to patches/api/0267-Add-recipe-to-cook-events.patch diff --git a/patches/api/0276-Add-Block-isValidTool.patch b/patches/api/0268-Add-Block-isValidTool.patch similarity index 79% rename from patches/api/0276-Add-Block-isValidTool.patch rename to patches/api/0268-Add-Block-isValidTool.patch index 1ba9ed8d9a..84a641142e 100644 --- a/patches/api/0276-Add-Block-isValidTool.patch +++ b/patches/api/0268-Add-Block-isValidTool.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add Block#isValidTool diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java -index 43a0e57a6db702b2a40e151f151bfaa63b9d95d5..c847bc83c0911007d226f1a8c6f1d0cefa9a1689 100644 +index 4abd16a4e99ae0380b67c86b9744d71423053b5e..96a3466181a6829e1868b5f5249349e8fd2cdd09 100644 --- a/src/main/java/org/bukkit/block/Block.java +++ b/src/main/java/org/bukkit/block/Block.java -@@ -229,6 +229,15 @@ public interface Block extends Metadatable, net.kyori.adventure.translation.Tran +@@ -230,6 +230,15 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr public static int getBlockKeyZ(long packed) { return (int) ((packed << 10) >> 37); } diff --git a/patches/api/0277-Expand-world-key-API.patch b/patches/api/0269-Expand-world-key-API.patch similarity index 97% rename from patches/api/0277-Expand-world-key-API.patch rename to patches/api/0269-Expand-world-key-API.patch index c9288c202d..e78eb2a0e5 100644 --- a/patches/api/0277-Expand-world-key-API.patch +++ b/patches/api/0269-Expand-world-key-API.patch @@ -78,10 +78,10 @@ index 02b898d441c42771903d5839c3cde544b1a25778..1a3b4f20c7126caf8a34040028f73508 * Create a new virtual {@link WorldBorder}. *

diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index 3d5185a1a3a5e5e1b1428ddbedec38f908f5870a..b359a7bff658c4b3ff569e78e0751dc07437bb48 100644 +index e5e91f4b4492fa1e709d81f313aac80761ab9e07..3545313f1c592e29d0bb5d055fc4e5c71c8a6fca 100644 --- a/src/main/java/org/bukkit/UnsafeValues.java +++ b/src/main/java/org/bukkit/UnsafeValues.java -@@ -158,5 +158,10 @@ public interface UnsafeValues { +@@ -142,5 +142,10 @@ public interface UnsafeValues { * @throws IllegalArgumentException if there isn't a registry for that type */ @org.jetbrains.annotations.NotNull Registry registryFor(Class classOfT); diff --git a/patches/api/0278-Item-Rarity-API.patch b/patches/api/0270-Item-Rarity-API.patch similarity index 83% rename from patches/api/0278-Item-Rarity-API.patch rename to patches/api/0270-Item-Rarity-API.patch index 3e3fcac796..2558d2aed0 100644 --- a/patches/api/0278-Item-Rarity-API.patch +++ b/patches/api/0270-Item-Rarity-API.patch @@ -39,12 +39,12 @@ index 0000000000000000000000000000000000000000..74ef8395cc040ce488c2acaa416db202 + } +} diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java -index b1214775680099c8255b45ed0285568572f12895..6fbbc3525574abd5189c9032f7d64dc55c0dfa80 100644 +index 7e447f8be7dc9768df487e1f7f4b9aafedb33e2d..eb8aa093148eea3b2fcafe06e8f1277ebbe2f275 100644 --- a/src/main/java/org/bukkit/Material.java +++ b/src/main/java/org/bukkit/Material.java -@@ -4306,6 +4306,17 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata - public @NotNull String translationKey() { - return Bukkit.getUnsafe().getTranslationKey(this); +@@ -4298,6 +4298,17 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla + return Bukkit.getUnsafe().getBlockTranslationKey(this); + } } + + /** @@ -61,10 +61,10 @@ index b1214775680099c8255b45ed0285568572f12895..6fbbc3525574abd5189c9032f7d64dc5 /** diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index b359a7bff658c4b3ff569e78e0751dc07437bb48..bc8e86f83423a0abdfe3516076636b02192e7501 100644 +index 3545313f1c592e29d0bb5d055fc4e5c71c8a6fca..aa6d4e0ea2a1e2b96cc94d5a1d2223caecfea7a4 100644 --- a/src/main/java/org/bukkit/UnsafeValues.java +++ b/src/main/java/org/bukkit/UnsafeValues.java -@@ -163,5 +163,22 @@ public interface UnsafeValues { +@@ -147,5 +147,22 @@ public interface UnsafeValues { * Just don't use it. */ @org.jetbrains.annotations.NotNull String getMainLevelName(); @@ -88,10 +88,10 @@ index b359a7bff658c4b3ff569e78e0751dc07437bb48..bc8e86f83423a0abdfe3516076636b02 // Paper end } diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index d6eafaa58b19ab44dfdef1baa58fa89c5b761b65..75bd1f7a5a30d21ae61836072ec057a95b7c288b 100644 +index 03a15727c85a08c0c79965be249373a11f31ce6e..c6378a880eac9f444c66f640260e8d410efd015b 100644 --- a/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -883,5 +883,15 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor +@@ -877,5 +877,15 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat public @NotNull String translationKey() { return Bukkit.getUnsafe().getTranslationKey(this); } diff --git a/patches/api/0279-Expose-protocol-version.patch b/patches/api/0271-Expose-protocol-version.patch similarity index 82% rename from patches/api/0279-Expose-protocol-version.patch rename to patches/api/0271-Expose-protocol-version.patch index ec1f242ac2..fc59754077 100644 --- a/patches/api/0279-Expose-protocol-version.patch +++ b/patches/api/0271-Expose-protocol-version.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Expose protocol version diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index bc8e86f83423a0abdfe3516076636b02192e7501..8650d5b9bd322f0b67382fcd7900f922c5134a97 100644 +index aa6d4e0ea2a1e2b96cc94d5a1d2223caecfea7a4..c876f95989d5bb64e745f8f62b4874422156d49c 100644 --- a/src/main/java/org/bukkit/UnsafeValues.java +++ b/src/main/java/org/bukkit/UnsafeValues.java -@@ -180,5 +180,12 @@ public interface UnsafeValues { +@@ -164,5 +164,12 @@ public interface UnsafeValues { * @return the itemstack rarity */ public io.papermc.paper.inventory.ItemRarity getItemStackRarity(ItemStack itemStack); diff --git a/patches/api/0280-add-isDeeplySleeping-to-HumanEntity.patch b/patches/api/0272-add-isDeeplySleeping-to-HumanEntity.patch similarity index 84% rename from patches/api/0280-add-isDeeplySleeping-to-HumanEntity.patch rename to patches/api/0272-add-isDeeplySleeping-to-HumanEntity.patch index 85ca92bd05..6519681c65 100644 --- a/patches/api/0280-add-isDeeplySleeping-to-HumanEntity.patch +++ b/patches/api/0272-add-isDeeplySleeping-to-HumanEntity.patch @@ -5,10 +5,10 @@ Subject: [PATCH] add isDeeplySleeping to HumanEntity diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java -index 7e23e157eb70e6bf94d0ac4a0196cc5c943dcac4..29885c7184dbec82a6de69c39878276392779d71 100644 +index b0de996c7cbfc36a3f749091068a70885b009832..a82eee24439989bb0180e3d0b1cc33f277d5305b 100644 --- a/src/main/java/org/bukkit/entity/HumanEntity.java +++ b/src/main/java/org/bukkit/entity/HumanEntity.java -@@ -328,6 +328,15 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder +@@ -348,6 +348,15 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder */ public void setCooldown(@NotNull Material material, int ticks); diff --git a/patches/api/0281-add-consumeFuel-to-FurnaceBurnEvent.patch b/patches/api/0273-add-consumeFuel-to-FurnaceBurnEvent.patch similarity index 100% rename from patches/api/0281-add-consumeFuel-to-FurnaceBurnEvent.patch rename to patches/api/0273-add-consumeFuel-to-FurnaceBurnEvent.patch diff --git a/patches/api/0282-add-get-set-drop-chance-to-EntityEquipment.patch b/patches/api/0274-add-get-set-drop-chance-to-EntityEquipment.patch similarity index 100% rename from patches/api/0282-add-get-set-drop-chance-to-EntityEquipment.patch rename to patches/api/0274-add-get-set-drop-chance-to-EntityEquipment.patch diff --git a/patches/api/0283-Added-PlayerDeepSleepEvent.patch b/patches/api/0275-Added-PlayerDeepSleepEvent.patch similarity index 100% rename from patches/api/0283-Added-PlayerDeepSleepEvent.patch rename to patches/api/0275-Added-PlayerDeepSleepEvent.patch diff --git a/patches/api/0284-More-World-API.patch b/patches/api/0276-More-World-API.patch similarity index 95% rename from patches/api/0284-More-World-API.patch rename to patches/api/0276-More-World-API.patch index 11fd4e80e2..cb5bd8b1d2 100644 --- a/patches/api/0284-More-World-API.patch +++ b/patches/api/0276-More-World-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] More World API diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 79b1015c56aab88ee8bf70cef0a2ab05c910d991..82eb04abe67e05f1bb6fd2a0350d5b2574a01d4b 100644 +index 30d5ed45df901a4931a35cc62aec08818307ec99..6da379edbf35321f7265606228695f40a9ea6977 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java -@@ -3709,6 +3709,114 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient +@@ -3734,6 +3734,114 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient @Nullable StructureSearchResult locateNearestStructure(@NotNull Location origin, @NotNull Structure structure, int radius, boolean findUnexplored); diff --git a/patches/api/0285-Added-PlayerBedFailEnterEvent.patch b/patches/api/0277-Added-PlayerBedFailEnterEvent.patch similarity index 100% rename from patches/api/0285-Added-PlayerBedFailEnterEvent.patch rename to patches/api/0277-Added-PlayerBedFailEnterEvent.patch diff --git a/patches/api/0286-Introduce-beacon-activation-deactivation-events.patch b/patches/api/0278-Introduce-beacon-activation-deactivation-events.patch similarity index 100% rename from patches/api/0286-Introduce-beacon-activation-deactivation-events.patch rename to patches/api/0278-Introduce-beacon-activation-deactivation-events.patch diff --git a/patches/api/0287-PlayerMoveEvent-Improvements.patch b/patches/api/0279-PlayerMoveEvent-Improvements.patch similarity index 100% rename from patches/api/0287-PlayerMoveEvent-Improvements.patch rename to patches/api/0279-PlayerMoveEvent-Improvements.patch diff --git a/patches/api/0288-add-RespawnFlags-to-PlayerRespawnEvent.patch b/patches/api/0280-add-RespawnFlags-to-PlayerRespawnEvent.patch similarity index 100% rename from patches/api/0288-add-RespawnFlags-to-PlayerRespawnEvent.patch rename to patches/api/0280-add-RespawnFlags-to-PlayerRespawnEvent.patch diff --git a/patches/api/0289-Add-more-WanderingTrader-API.patch b/patches/api/0281-Add-more-WanderingTrader-API.patch similarity index 100% rename from patches/api/0289-Add-more-WanderingTrader-API.patch rename to patches/api/0281-Add-more-WanderingTrader-API.patch diff --git a/patches/api/0290-Add-EntityBlockStorage-clearEntities.patch b/patches/api/0282-Add-EntityBlockStorage-clearEntities.patch similarity index 100% rename from patches/api/0290-Add-EntityBlockStorage-clearEntities.patch rename to patches/api/0282-Add-EntityBlockStorage-clearEntities.patch diff --git a/patches/api/0291-Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch b/patches/api/0283-Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch similarity index 100% rename from patches/api/0291-Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch rename to patches/api/0283-Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch diff --git a/patches/api/0292-Add-raw-address-to-AsyncPlayerPreLoginEvent.patch b/patches/api/0284-Add-raw-address-to-AsyncPlayerPreLoginEvent.patch similarity index 100% rename from patches/api/0292-Add-raw-address-to-AsyncPlayerPreLoginEvent.patch rename to patches/api/0284-Add-raw-address-to-AsyncPlayerPreLoginEvent.patch diff --git a/patches/api/0293-Inventory-close.patch b/patches/api/0285-Inventory-close.patch similarity index 100% rename from patches/api/0293-Inventory-close.patch rename to patches/api/0285-Inventory-close.patch diff --git a/patches/api/0294-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch b/patches/api/0286-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch similarity index 100% rename from patches/api/0294-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch rename to patches/api/0286-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch diff --git a/patches/api/0295-Add-basic-Datapack-API.patch b/patches/api/0287-Add-basic-Datapack-API.patch similarity index 100% rename from patches/api/0295-Add-basic-Datapack-API.patch rename to patches/api/0287-Add-basic-Datapack-API.patch diff --git a/patches/api/0296-additions-to-PlayerGameModeChangeEvent.patch b/patches/api/0288-additions-to-PlayerGameModeChangeEvent.patch similarity index 100% rename from patches/api/0296-additions-to-PlayerGameModeChangeEvent.patch rename to patches/api/0288-additions-to-PlayerGameModeChangeEvent.patch diff --git a/patches/api/0297-ItemStack-repair-check-API.patch b/patches/api/0289-ItemStack-repair-check-API.patch similarity index 87% rename from patches/api/0297-ItemStack-repair-check-API.patch rename to patches/api/0289-ItemStack-repair-check-API.patch index ad6d09f01e..6e16f41651 100644 --- a/patches/api/0297-ItemStack-repair-check-API.patch +++ b/patches/api/0289-ItemStack-repair-check-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] ItemStack repair check API diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index 8650d5b9bd322f0b67382fcd7900f922c5134a97..6f4e02065bcb4130f5a30de01f3adbe3513c1d70 100644 +index c876f95989d5bb64e745f8f62b4874422156d49c..52e0bee77f10965932c67333e7d22cbbcdc08048 100644 --- a/src/main/java/org/bukkit/UnsafeValues.java +++ b/src/main/java/org/bukkit/UnsafeValues.java -@@ -181,6 +181,16 @@ public interface UnsafeValues { +@@ -165,6 +165,16 @@ public interface UnsafeValues { */ public io.papermc.paper.inventory.ItemRarity getItemStackRarity(ItemStack itemStack); @@ -26,10 +26,10 @@ index 8650d5b9bd322f0b67382fcd7900f922c5134a97..6f4e02065bcb4130f5a30de01f3adbe3 * Returns the server's protocol version. * diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index 75bd1f7a5a30d21ae61836072ec057a95b7c288b..0d0d7bda2d4fafffd3e80a359019626ab44031d0 100644 +index c6378a880eac9f444c66f640260e8d410efd015b..b731ac4f6cd82d8476e4040a2204f58b0f63a0d3 100644 --- a/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -893,5 +893,27 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor +@@ -887,5 +887,27 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat public io.papermc.paper.inventory.ItemRarity getRarity() { return Bukkit.getUnsafe().getItemStackRarity(this); } diff --git a/patches/api/0298-More-Enchantment-API.patch b/patches/api/0290-More-Enchantment-API.patch similarity index 100% rename from patches/api/0298-More-Enchantment-API.patch rename to patches/api/0290-More-Enchantment-API.patch diff --git a/patches/api/0300-Add-Mob-lookAt-API.patch b/patches/api/0291-Add-Mob-lookAt-API.patch similarity index 100% rename from patches/api/0300-Add-Mob-lookAt-API.patch rename to patches/api/0291-Add-Mob-lookAt-API.patch diff --git a/patches/api/0301-ItemStack-editMeta.patch b/patches/api/0292-ItemStack-editMeta.patch similarity index 92% rename from patches/api/0301-ItemStack-editMeta.patch rename to patches/api/0292-ItemStack-editMeta.patch index a6b2d88a10..b3170677e6 100644 --- a/patches/api/0301-ItemStack-editMeta.patch +++ b/patches/api/0292-ItemStack-editMeta.patch @@ -5,10 +5,10 @@ Subject: [PATCH] ItemStack#editMeta diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index 0d0d7bda2d4fafffd3e80a359019626ab44031d0..77ef41527a05e2d7899633ef7fa813774dd15bd9 100644 +index b731ac4f6cd82d8476e4040a2204f58b0f63a0d3..84ea952cdee1eaec5572641e09fdd85930ddeb47 100644 --- a/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -546,6 +546,50 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor +@@ -547,6 +547,50 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat return result.ensureServerConversions(); // Paper } diff --git a/patches/api/0302-Add-EntityInsideBlockEvent.patch b/patches/api/0293-Add-EntityInsideBlockEvent.patch similarity index 100% rename from patches/api/0302-Add-EntityInsideBlockEvent.patch rename to patches/api/0293-Add-EntityInsideBlockEvent.patch diff --git a/patches/api/0303-Attributes-API-for-item-defaults.patch b/patches/api/0294-Attributes-API-for-item-defaults.patch similarity index 86% rename from patches/api/0303-Attributes-API-for-item-defaults.patch rename to patches/api/0294-Attributes-API-for-item-defaults.patch index fb2164214c..804d636cec 100644 --- a/patches/api/0303-Attributes-API-for-item-defaults.patch +++ b/patches/api/0294-Attributes-API-for-item-defaults.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Attributes API for item defaults diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java -index 6fbbc3525574abd5189c9032f7d64dc55c0dfa80..bdc51797e3e3c8ffb1db842e29ddb86beeec48ec 100644 +index eb8aa093148eea3b2fcafe06e8f1277ebbe2f275..9c6291531d3081bf601364815fdd0a9b801eee50 100644 --- a/src/main/java/org/bukkit/Material.java +++ b/src/main/java/org/bukkit/Material.java -@@ -4317,6 +4317,21 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -4309,6 +4309,21 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla public io.papermc.paper.inventory.ItemRarity getItemRarity() { return Bukkit.getUnsafe().getItemRarity(this); } @@ -31,10 +31,10 @@ index 6fbbc3525574abd5189c9032f7d64dc55c0dfa80..bdc51797e3e3c8ffb1db842e29ddb86b /** diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index 6f4e02065bcb4130f5a30de01f3adbe3513c1d70..4e3eac5f06a6ded0f152f1744fcebfeef6b48814 100644 +index 52e0bee77f10965932c67333e7d22cbbcdc08048..3388f31c2f287c8dcf4bfd157a04d9383cbe41e3 100644 --- a/src/main/java/org/bukkit/UnsafeValues.java +++ b/src/main/java/org/bukkit/UnsafeValues.java -@@ -191,6 +191,18 @@ public interface UnsafeValues { +@@ -175,6 +175,18 @@ public interface UnsafeValues { */ public boolean isValidRepairItemStack(@org.jetbrains.annotations.NotNull ItemStack itemToBeRepaired, @org.jetbrains.annotations.NotNull ItemStack repairMaterial); diff --git a/patches/api/0304-Add-cause-to-Weather-ThunderChangeEvents.patch b/patches/api/0295-Add-cause-to-Weather-ThunderChangeEvents.patch similarity index 100% rename from patches/api/0304-Add-cause-to-Weather-ThunderChangeEvents.patch rename to patches/api/0295-Add-cause-to-Weather-ThunderChangeEvents.patch diff --git a/patches/api/0305-More-Lidded-Block-API.patch b/patches/api/0296-More-Lidded-Block-API.patch similarity index 100% rename from patches/api/0305-More-Lidded-Block-API.patch rename to patches/api/0296-More-Lidded-Block-API.patch diff --git a/patches/api/0306-Add-PlayerKickEvent-causes.patch b/patches/api/0297-Add-PlayerKickEvent-causes.patch similarity index 97% rename from patches/api/0306-Add-PlayerKickEvent-causes.patch rename to patches/api/0297-Add-PlayerKickEvent-causes.patch index 8c11c37695..a216a1fe7d 100644 --- a/patches/api/0306-Add-PlayerKickEvent-causes.patch +++ b/patches/api/0297-Add-PlayerKickEvent-causes.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerKickEvent causes diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 9bae45ea3097e328594dcaefac87c55d2c27498d..19d23f2995322e1710741b58e5c7bc2f3880fc0d 100644 +index c3db4783a05020cf91e2fd314dddf22d1ccfc02b..ba45de407168f34511af34bcd1a0e209ddfe2374 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java @@ -252,6 +252,14 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM diff --git a/patches/api/0307-Add-PufferFishStateChangeEvent.patch b/patches/api/0298-Add-PufferFishStateChangeEvent.patch similarity index 100% rename from patches/api/0307-Add-PufferFishStateChangeEvent.patch rename to patches/api/0298-Add-PufferFishStateChangeEvent.patch diff --git a/patches/api/0308-Add-BellRevealRaiderEvent.patch b/patches/api/0299-Add-BellRevealRaiderEvent.patch similarity index 100% rename from patches/api/0308-Add-BellRevealRaiderEvent.patch rename to patches/api/0299-Add-BellRevealRaiderEvent.patch diff --git a/patches/api/0309-Add-ElderGuardianAppearanceEvent.patch b/patches/api/0300-Add-ElderGuardianAppearanceEvent.patch similarity index 100% rename from patches/api/0309-Add-ElderGuardianAppearanceEvent.patch rename to patches/api/0300-Add-ElderGuardianAppearanceEvent.patch diff --git a/patches/api/0310-Add-more-line-of-sight-methods.patch b/patches/api/0301-Add-more-line-of-sight-methods.patch similarity index 92% rename from patches/api/0310-Add-more-line-of-sight-methods.patch rename to patches/api/0301-Add-more-line-of-sight-methods.patch index 898d444572..6c81b3e7cf 100644 --- a/patches/api/0310-Add-more-line-of-sight-methods.patch +++ b/patches/api/0301-Add-more-line-of-sight-methods.patch @@ -23,10 +23,10 @@ index aa534b1a9a1fb84a2fbd4b372f313bb4b63325fa..43b53c21af01e0f496c8aaacff82dfdf // Paper end } diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index f44f510b3194c9716ec59caa195f83dde2b2773a..21ca1df6b484390a644d1f0894ebcac0080ff570 100644 +index cc61e030f1bdb4d1ef52a0a1ae4983f95d2460fd..9ab91154c74b5a3001cf4d5df1b4ae1e26508b60 100644 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -532,6 +532,19 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource +@@ -546,6 +546,19 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource */ public boolean hasLineOfSight(@NotNull Entity other); diff --git a/patches/api/0311-Add-WaterBottleSplashEvent.patch b/patches/api/0302-Add-WaterBottleSplashEvent.patch similarity index 100% rename from patches/api/0311-Add-WaterBottleSplashEvent.patch rename to patches/api/0302-Add-WaterBottleSplashEvent.patch diff --git a/patches/api/0312-Add-more-LimitedRegion-API.patch b/patches/api/0303-Add-more-LimitedRegion-API.patch similarity index 100% rename from patches/api/0312-Add-more-LimitedRegion-API.patch rename to patches/api/0303-Add-more-LimitedRegion-API.patch diff --git a/patches/api/0313-Missing-Entity-Behavior-API.patch b/patches/api/0304-Missing-Entity-Behavior-API.patch similarity index 100% rename from patches/api/0313-Missing-Entity-Behavior-API.patch rename to patches/api/0304-Missing-Entity-Behavior-API.patch diff --git a/patches/api/0314-Adds-PlayerArmSwingEvent.patch b/patches/api/0305-Adds-PlayerArmSwingEvent.patch similarity index 100% rename from patches/api/0314-Adds-PlayerArmSwingEvent.patch rename to patches/api/0305-Adds-PlayerArmSwingEvent.patch diff --git a/patches/api/0315-Add-PlayerSignCommandPreprocessEvent.patch b/patches/api/0306-Add-PlayerSignCommandPreprocessEvent.patch similarity index 100% rename from patches/api/0315-Add-PlayerSignCommandPreprocessEvent.patch rename to patches/api/0306-Add-PlayerSignCommandPreprocessEvent.patch diff --git a/patches/api/0316-fix-empty-array-elements-in-command-arguments.patch b/patches/api/0307-fix-empty-array-elements-in-command-arguments.patch similarity index 93% rename from patches/api/0316-fix-empty-array-elements-in-command-arguments.patch rename to patches/api/0307-fix-empty-array-elements-in-command-arguments.patch index b6512f8f29..4b66990211 100644 --- a/patches/api/0316-fix-empty-array-elements-in-command-arguments.patch +++ b/patches/api/0307-fix-empty-array-elements-in-command-arguments.patch @@ -9,7 +9,7 @@ Adjacent spaces sent by players are removed in PlayerConnection, so this change But it does affect the console, command blocks, Bukkit.dispatchCommand, etc. diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java -index 950a2d0b3b583c6b9a703190874bbc4df2783ab7..b8623575b1c1b565560c2dd6438190716845a652 100644 +index 1424060c0a162020d4a680e0a592224561067b16..ac9a28922f8a556944a4c3649d74c32c622f0cb0 100644 --- a/src/main/java/org/bukkit/command/SimpleCommandMap.java +++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java @@ -130,7 +130,7 @@ public class SimpleCommandMap implements CommandMap { diff --git a/patches/api/0317-Stinger-API.patch b/patches/api/0308-Stinger-API.patch similarity index 86% rename from patches/api/0317-Stinger-API.patch rename to patches/api/0308-Stinger-API.patch index 9cd431ef56..a07877f35f 100644 --- a/patches/api/0317-Stinger-API.patch +++ b/patches/api/0308-Stinger-API.patch @@ -5,12 +5,12 @@ Subject: [PATCH] Stinger API diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index 21ca1df6b484390a644d1f0894ebcac0080ff570..6f7483a86b713b7b85e595f55b167e1547bc4b8e 100644 +index 9ab91154c74b5a3001cf4d5df1b4ae1e26508b60..27187efdbcf1cf20a53175f1177c16dc40acab3c 100644 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -385,6 +385,36 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource +@@ -399,6 +399,36 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource */ - public void setArrowsInBody(int count); + void setArrowsInBody(int count, boolean fireEvent); // Paper + // Paper Start - Bee Stinger API + /** diff --git a/patches/api/0309-Rewrite-LogEvents-to-contain-the-source-jars-in-stac.patch b/patches/api/0309-Rewrite-LogEvents-to-contain-the-source-jars-in-stac.patch new file mode 100644 index 0000000000..ae0d6b5289 --- /dev/null +++ b/patches/api/0309-Rewrite-LogEvents-to-contain-the-source-jars-in-stac.patch @@ -0,0 +1,19 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: SirYwell +Date: Sat, 10 Jul 2021 11:11:43 +0200 +Subject: [PATCH] Rewrite LogEvents to contain the source jars in stack traces + + +diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java +index 264d712d3399d24cb01b85fc2d055d9fbf11b23a..327ff03fa1978881fa6f6ba20e33e3c049c2e3cd 100644 +--- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java ++++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java +@@ -53,7 +53,7 @@ public final class PluginClassLoader extends URLClassLoader implements io.paperm + + @org.jetbrains.annotations.ApiStatus.Internal // Paper + public PluginClassLoader(@Nullable final ClassLoader parent, @NotNull final PluginDescriptionFile description, @NotNull final File dataFolder, @NotNull final File file, @Nullable ClassLoader libraryLoader) throws IOException, InvalidPluginException, MalformedURLException { // Paper +- super(new URL[] {file.toURI().toURL()}, parent); ++ super(file.getName(), new URL[] {file.toURI().toURL()}, parent); + this.loader = null; // Paper - pass null into loader field + + this.description = description; diff --git a/patches/api/0319-Add-PlayerSetSpawnEvent.patch b/patches/api/0310-Add-PlayerSetSpawnEvent.patch similarity index 100% rename from patches/api/0319-Add-PlayerSetSpawnEvent.patch rename to patches/api/0310-Add-PlayerSetSpawnEvent.patch diff --git a/patches/api/0320-Added-EntityDamageItemEvent.patch b/patches/api/0311-Added-EntityDamageItemEvent.patch similarity index 100% rename from patches/api/0320-Added-EntityDamageItemEvent.patch rename to patches/api/0311-Added-EntityDamageItemEvent.patch diff --git a/patches/api/0321-Make-EntityUnleashEvent-cancellable.patch b/patches/api/0312-Make-EntityUnleashEvent-cancellable.patch similarity index 100% rename from patches/api/0321-Make-EntityUnleashEvent-cancellable.patch rename to patches/api/0312-Make-EntityUnleashEvent-cancellable.patch diff --git a/patches/api/0322-Change-EnderEye-target-without-changing-other-things.patch b/patches/api/0313-Change-EnderEye-target-without-changing-other-things.patch similarity index 100% rename from patches/api/0322-Change-EnderEye-target-without-changing-other-things.patch rename to patches/api/0313-Change-EnderEye-target-without-changing-other-things.patch diff --git a/patches/api/0323-Add-BlockBreakBlockEvent.patch b/patches/api/0314-Add-BlockBreakBlockEvent.patch similarity index 100% rename from patches/api/0323-Add-BlockBreakBlockEvent.patch rename to patches/api/0314-Add-BlockBreakBlockEvent.patch diff --git a/patches/api/0324-Add-helpers-for-left-right-click-to-Action.patch b/patches/api/0315-Add-helpers-for-left-right-click-to-Action.patch similarity index 100% rename from patches/api/0324-Add-helpers-for-left-right-click-to-Action.patch rename to patches/api/0315-Add-helpers-for-left-right-click-to-Action.patch diff --git a/patches/api/0325-Option-to-prevent-NBT-copy-in-smithing-recipes.patch b/patches/api/0316-Option-to-prevent-NBT-copy-in-smithing-recipes.patch similarity index 100% rename from patches/api/0325-Option-to-prevent-NBT-copy-in-smithing-recipes.patch rename to patches/api/0316-Option-to-prevent-NBT-copy-in-smithing-recipes.patch diff --git a/patches/api/0326-More-CommandBlock-API.patch b/patches/api/0317-More-CommandBlock-API.patch similarity index 100% rename from patches/api/0326-More-CommandBlock-API.patch rename to patches/api/0317-More-CommandBlock-API.patch diff --git a/patches/api/0328-Add-missing-team-sidebar-display-slots.patch b/patches/api/0318-Add-missing-team-sidebar-display-slots.patch similarity index 100% rename from patches/api/0328-Add-missing-team-sidebar-display-slots.patch rename to patches/api/0318-Add-missing-team-sidebar-display-slots.patch diff --git a/patches/api/0318-Rewrite-LogEvents-to-contain-the-source-jars-in-stac.patch b/patches/api/0318-Rewrite-LogEvents-to-contain-the-source-jars-in-stac.patch deleted file mode 100644 index a9319418e4..0000000000 --- a/patches/api/0318-Rewrite-LogEvents-to-contain-the-source-jars-in-stac.patch +++ /dev/null @@ -1,19 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: SirYwell -Date: Sat, 10 Jul 2021 11:11:43 +0200 -Subject: [PATCH] Rewrite LogEvents to contain the source jars in stack traces - - -diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java -index e39492e2544c39c5457f079a6baadf0b4074dd7e..345394132df70593800127d34a38f8f8a4dafe00 100644 ---- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java -+++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java -@@ -51,7 +51,7 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot - } - - PluginClassLoader(@NotNull final JavaPluginLoader loader, @Nullable final ClassLoader parent, @NotNull final PluginDescriptionFile description, @NotNull final File dataFolder, @NotNull final File file, @Nullable ClassLoader libraryLoader) throws IOException, InvalidPluginException, MalformedURLException { -- super(new URL[] {file.toURI().toURL()}, parent); -+ super(file.getName(), new URL[] {file.toURI().toURL()}, parent); // Paper - rewrite LogEvents to contain source jar info - Preconditions.checkArgument(loader != null, "Loader cannot be null"); - - this.loader = loader; diff --git a/patches/api/0329-add-back-EntityPortalExitEvent.patch b/patches/api/0319-add-back-EntityPortalExitEvent.patch similarity index 100% rename from patches/api/0329-add-back-EntityPortalExitEvent.patch rename to patches/api/0319-add-back-EntityPortalExitEvent.patch diff --git a/patches/api/0330-Add-methods-to-find-targets-for-lightning-strikes.patch b/patches/api/0320-Add-methods-to-find-targets-for-lightning-strikes.patch similarity index 95% rename from patches/api/0330-Add-methods-to-find-targets-for-lightning-strikes.patch rename to patches/api/0320-Add-methods-to-find-targets-for-lightning-strikes.patch index bce5db5143..d0652f734d 100644 --- a/patches/api/0330-Add-methods-to-find-targets-for-lightning-strikes.patch +++ b/patches/api/0320-Add-methods-to-find-targets-for-lightning-strikes.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add methods to find targets for lightning strikes diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 82eb04abe67e05f1bb6fd2a0350d5b2574a01d4b..43d12399e807abd4c95ffec8c025373b6d344a36 100644 +index 6da379edbf35321f7265606228695f40a9ea6977..2955302b08b30570e4a561e3b076d10d80f2f2b3 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -749,6 +749,37 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient diff --git a/patches/api/0331-Get-entity-default-attributes.patch b/patches/api/0321-Get-entity-default-attributes.patch similarity index 88% rename from patches/api/0331-Get-entity-default-attributes.patch rename to patches/api/0321-Get-entity-default-attributes.patch index b4b4a952ea..0d8ae058a8 100644 --- a/patches/api/0331-Get-entity-default-attributes.patch +++ b/patches/api/0321-Get-entity-default-attributes.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Get entity default attributes diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index 4e3eac5f06a6ded0f152f1744fcebfeef6b48814..68b560af277d4913306fb1b9c88c2fadcd2f446a 100644 +index 3388f31c2f287c8dcf4bfd157a04d9383cbe41e3..393e0e9bacb30cdae4154ec2573e000a82cc89e7 100644 --- a/src/main/java/org/bukkit/UnsafeValues.java +++ b/src/main/java/org/bukkit/UnsafeValues.java -@@ -209,5 +209,22 @@ public interface UnsafeValues { +@@ -193,5 +193,22 @@ public interface UnsafeValues { * @return the server's protocol version */ int getProtocolVersion(); @@ -32,10 +32,10 @@ index 4e3eac5f06a6ded0f152f1744fcebfeef6b48814..68b560af277d4913306fb1b9c88c2fad // Paper end } diff --git a/src/main/java/org/bukkit/entity/EntityType.java b/src/main/java/org/bukkit/entity/EntityType.java -index 50d9442ffafdfabd4904dafae7daaeadcedee75b..5a0c96875d9c3bd32b4649a3fccd43af1ccb195b 100644 +index 80897ed8641a2bdc4e3557e20f3a8ae4b8c5da69..4915c1064a9b6bf1d485f9e6e42b9f6e4e12f236 100644 --- a/src/main/java/org/bukkit/entity/EntityType.java +++ b/src/main/java/org/bukkit/entity/EntityType.java -@@ -447,5 +447,24 @@ public enum EntityType implements Keyed, net.kyori.adventure.translation.Transla +@@ -444,5 +444,24 @@ public enum EntityType implements Keyed, Translatable, net.kyori.adventure.trans Preconditions.checkArgument(this != UNKNOWN, "UNKNOWN entities do not have translation keys"); return org.bukkit.Bukkit.getUnsafe().getTranslationKey(this); } diff --git a/patches/api/0332-Left-handed-API.patch b/patches/api/0322-Left-handed-API.patch similarity index 100% rename from patches/api/0332-Left-handed-API.patch rename to patches/api/0322-Left-handed-API.patch diff --git a/patches/api/0333-Add-more-advancement-API.patch b/patches/api/0323-Add-more-advancement-API.patch similarity index 98% rename from patches/api/0333-Add-more-advancement-API.patch rename to patches/api/0323-Add-more-advancement-API.patch index 1dcfad9c82..2fd6d7a372 100644 --- a/patches/api/0333-Add-more-advancement-API.patch +++ b/patches/api/0323-Add-more-advancement-API.patch @@ -256,7 +256,7 @@ index 0ff86a39025a94ca128364a45bf171728cb81027..aec6be7e121da3eb8a464b6934da29ab /** diff --git a/src/main/java/org/bukkit/advancement/AdvancementDisplayType.java b/src/main/java/org/bukkit/advancement/AdvancementDisplayType.java -index d6640a9ebb30195abf4570dfd30a320fa4636995..f6e1a6c1bb7b99a391dec73c9707840214988fc6 100644 +index de767efb9f55448df061e166c66a2cf3439d57ec..06d8b72dd54becc13f40bd6e505115405462cd73 100644 --- a/src/main/java/org/bukkit/advancement/AdvancementDisplayType.java +++ b/src/main/java/org/bukkit/advancement/AdvancementDisplayType.java @@ -8,7 +8,9 @@ import org.jetbrains.annotations.NotNull; diff --git a/patches/api/0334-Add-ItemFactory-getSpawnEgg-API.patch b/patches/api/0324-Add-ItemFactory-getSpawnEgg-API.patch similarity index 100% rename from patches/api/0334-Add-ItemFactory-getSpawnEgg-API.patch rename to patches/api/0324-Add-ItemFactory-getSpawnEgg-API.patch diff --git a/patches/api/0335-Add-critical-damage-API.patch b/patches/api/0325-Add-critical-damage-API.patch similarity index 100% rename from patches/api/0335-Add-critical-damage-API.patch rename to patches/api/0325-Add-critical-damage-API.patch diff --git a/patches/api/0336-Fix-issues-with-mob-conversion.patch b/patches/api/0326-Fix-issues-with-mob-conversion.patch similarity index 100% rename from patches/api/0336-Fix-issues-with-mob-conversion.patch rename to patches/api/0326-Fix-issues-with-mob-conversion.patch diff --git a/patches/api/0337-Add-isCollidable-methods-to-various-places.patch b/patches/api/0327-Add-isCollidable-methods-to-various-places.patch similarity index 83% rename from patches/api/0337-Add-isCollidable-methods-to-various-places.patch rename to patches/api/0327-Add-isCollidable-methods-to-various-places.patch index 4607f0597e..5923e618bf 100644 --- a/patches/api/0337-Add-isCollidable-methods-to-various-places.patch +++ b/patches/api/0327-Add-isCollidable-methods-to-various-places.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add isCollidable methods to various places diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java -index bdc51797e3e3c8ffb1db842e29ddb86beeec48ec..56459876a7736bd3a015e0aba511313997f9ec65 100644 +index 9c6291531d3081bf601364815fdd0a9b801eee50..33371518fc8c5d97625f3d528ba8fee25d8c9c00 100644 --- a/src/main/java/org/bukkit/Material.java +++ b/src/main/java/org/bukkit/Material.java -@@ -4332,6 +4332,16 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -4324,6 +4324,16 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla public Multimap getItemAttributes(@NotNull EquipmentSlot equipmentSlot) { return Bukkit.getUnsafe().getItemAttributes(this, equipmentSlot); } @@ -26,10 +26,10 @@ index bdc51797e3e3c8ffb1db842e29ddb86beeec48ec..56459876a7736bd3a015e0aba5113139 /** diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index 68b560af277d4913306fb1b9c88c2fadcd2f446a..9fd64aa7f2487b07fe0a6873bd57a0ed483499a3 100644 +index 393e0e9bacb30cdae4154ec2573e000a82cc89e7..aa5fff8704fa002af0cffb09049311edaef19339 100644 --- a/src/main/java/org/bukkit/UnsafeValues.java +++ b/src/main/java/org/bukkit/UnsafeValues.java -@@ -226,5 +226,14 @@ public interface UnsafeValues { +@@ -210,5 +210,14 @@ public interface UnsafeValues { * @throws IllegalArgumentException if the entity does not exist of have default attributes (use {@link #hasDefaultEntityAttributes(NamespacedKey)} first) */ @org.jetbrains.annotations.NotNull org.bukkit.attribute.Attributable getDefaultEntityAttributes(@org.jetbrains.annotations.NotNull NamespacedKey entityKey); @@ -45,10 +45,10 @@ index 68b560af277d4913306fb1b9c88c2fadcd2f446a..9fd64aa7f2487b07fe0a6873bd57a0ed // Paper end } diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java -index c847bc83c0911007d226f1a8c6f1d0cefa9a1689..cff39708e66208921da15d12d94407d6b6950298 100644 +index 96a3466181a6829e1868b5f5249349e8fd2cdd09..cda6e7d8e032b3edc919995141dc260b1ea82810 100644 --- a/src/main/java/org/bukkit/block/Block.java +++ b/src/main/java/org/bukkit/block/Block.java -@@ -481,6 +481,13 @@ public interface Block extends Metadatable, net.kyori.adventure.translation.Tran +@@ -482,6 +482,13 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr * @return true if block is solid */ boolean isSolid(); diff --git a/patches/api/0338-Goat-ram-API.patch b/patches/api/0328-Goat-ram-API.patch similarity index 100% rename from patches/api/0338-Goat-ram-API.patch rename to patches/api/0328-Goat-ram-API.patch diff --git a/patches/api/0339-Add-API-for-resetting-a-single-score.patch b/patches/api/0329-Add-API-for-resetting-a-single-score.patch similarity index 100% rename from patches/api/0339-Add-API-for-resetting-a-single-score.patch rename to patches/api/0329-Add-API-for-resetting-a-single-score.patch diff --git a/patches/api/0340-Add-Raw-Byte-Entity-Serialization.patch b/patches/api/0330-Add-Raw-Byte-Entity-Serialization.patch similarity index 88% rename from patches/api/0340-Add-Raw-Byte-Entity-Serialization.patch rename to patches/api/0330-Add-Raw-Byte-Entity-Serialization.patch index 27fcb0fc86..5afcb9c166 100644 --- a/patches/api/0340-Add-Raw-Byte-Entity-Serialization.patch +++ b/patches/api/0330-Add-Raw-Byte-Entity-Serialization.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add Raw Byte Entity Serialization diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index 9fd64aa7f2487b07fe0a6873bd57a0ed483499a3..aa252abe42c184914d6b50ad1f94ba7ada22d7df 100644 +index aa5fff8704fa002af0cffb09049311edaef19339..80314e6dabadcd290841c792f3a5fafecd6ea036 100644 --- a/src/main/java/org/bukkit/UnsafeValues.java +++ b/src/main/java/org/bukkit/UnsafeValues.java -@@ -113,6 +113,14 @@ public interface UnsafeValues { +@@ -126,6 +126,14 @@ public interface UnsafeValues { ItemStack deserializeItem(byte[] data); @@ -21,8 +21,8 @@ index 9fd64aa7f2487b07fe0a6873bd57a0ed483499a3..aa252abe42c184914d6b50ad1f94ba7a + org.bukkit.entity.Entity deserializeEntity(byte[] data, World world, boolean preserveUUID); + /** - * Return the translation key for the Material, so the client can translate it into the active - * locale when using a {@link net.kyori.adventure.text.TranslatableComponent}. + * Creates and returns the next EntityId available. + *

diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java index e3218b5c170e1916a991aa1fae6a4f4e26dc034d..570d446869022008d01ba382e85ec69fcb25f99d 100644 --- a/src/main/java/org/bukkit/entity/Entity.java diff --git a/patches/api/0341-Add-PlayerItemFrameChangeEvent.patch b/patches/api/0331-Add-PlayerItemFrameChangeEvent.patch similarity index 100% rename from patches/api/0341-Add-PlayerItemFrameChangeEvent.patch rename to patches/api/0331-Add-PlayerItemFrameChangeEvent.patch diff --git a/patches/api/0342-Add-player-health-update-API.patch b/patches/api/0332-Add-player-health-update-API.patch similarity index 91% rename from patches/api/0342-Add-player-health-update-API.patch rename to patches/api/0332-Add-player-health-update-API.patch index 83a3545f84..49930e7153 100644 --- a/patches/api/0342-Add-player-health-update-API.patch +++ b/patches/api/0332-Add-player-health-update-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add player health update API diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 19d23f2995322e1710741b58e5c7bc2f3880fc0d..b5519cf329485a2ec72586e66a8a88617c09312e 100644 +index ba45de407168f34511af34bcd1a0e209ddfe2374..0c3a4a3ebd6f16c1c45c2b82620d5ca6cdace8a1 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java -@@ -1917,6 +1917,31 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -1942,6 +1942,31 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM */ public double getHealthScale(); diff --git a/patches/api/0343-Allow-delegation-to-vanilla-chunk-gen.patch b/patches/api/0333-Allow-delegation-to-vanilla-chunk-gen.patch similarity index 100% rename from patches/api/0343-Allow-delegation-to-vanilla-chunk-gen.patch rename to patches/api/0333-Allow-delegation-to-vanilla-chunk-gen.patch diff --git a/patches/api/0344-Add-more-Campfire-API.patch b/patches/api/0334-Add-more-Campfire-API.patch similarity index 100% rename from patches/api/0344-Add-more-Campfire-API.patch rename to patches/api/0334-Add-more-Campfire-API.patch diff --git a/patches/api/0345-Move-VehicleCollisionEvent-HandlerList-up.patch b/patches/api/0335-Move-VehicleCollisionEvent-HandlerList-up.patch similarity index 100% rename from patches/api/0345-Move-VehicleCollisionEvent-HandlerList-up.patch rename to patches/api/0335-Move-VehicleCollisionEvent-HandlerList-up.patch diff --git a/patches/api/0346-Improve-scoreboard-entries.patch b/patches/api/0336-Improve-scoreboard-entries.patch similarity index 100% rename from patches/api/0346-Improve-scoreboard-entries.patch rename to patches/api/0336-Improve-scoreboard-entries.patch diff --git a/patches/api/0347-Entity-powdered-snow-API.patch b/patches/api/0337-Entity-powdered-snow-API.patch similarity index 100% rename from patches/api/0347-Entity-powdered-snow-API.patch rename to patches/api/0337-Entity-powdered-snow-API.patch diff --git a/patches/api/0348-Add-API-for-item-entity-health.patch b/patches/api/0338-Add-API-for-item-entity-health.patch similarity index 100% rename from patches/api/0348-Add-API-for-item-entity-health.patch rename to patches/api/0338-Add-API-for-item-entity-health.patch diff --git a/patches/api/0349-Expose-isFuel-and-canSmelt-methods-to-FurnaceInvento.patch b/patches/api/0339-Expose-isFuel-and-canSmelt-methods-to-FurnaceInvento.patch similarity index 100% rename from patches/api/0349-Expose-isFuel-and-canSmelt-methods-to-FurnaceInvento.patch rename to patches/api/0339-Expose-isFuel-and-canSmelt-methods-to-FurnaceInvento.patch diff --git a/patches/api/0350-Bucketable-API.patch b/patches/api/0340-Bucketable-API.patch similarity index 100% rename from patches/api/0350-Bucketable-API.patch rename to patches/api/0340-Bucketable-API.patch diff --git a/patches/api/0351-System-prop-for-default-config-comment-parsing.patch b/patches/api/0341-System-prop-for-default-config-comment-parsing.patch similarity index 100% rename from patches/api/0351-System-prop-for-default-config-comment-parsing.patch rename to patches/api/0341-System-prop-for-default-config-comment-parsing.patch diff --git a/patches/api/0352-Expose-vanilla-BiomeProvider-from-WorldInfo.patch b/patches/api/0342-Expose-vanilla-BiomeProvider-from-WorldInfo.patch similarity index 100% rename from patches/api/0352-Expose-vanilla-BiomeProvider-from-WorldInfo.patch rename to patches/api/0342-Expose-vanilla-BiomeProvider-from-WorldInfo.patch diff --git a/patches/api/0353-Add-new-overload-to-PersistentDataContainer-has.patch b/patches/api/0343-Add-new-overload-to-PersistentDataContainer-has.patch similarity index 100% rename from patches/api/0353-Add-new-overload-to-PersistentDataContainer-has.patch rename to patches/api/0343-Add-new-overload-to-PersistentDataContainer-has.patch diff --git a/patches/api/0354-Multiple-Entries-with-Scoreboards.patch b/patches/api/0344-Multiple-Entries-with-Scoreboards.patch similarity index 100% rename from patches/api/0354-Multiple-Entries-with-Scoreboards.patch rename to patches/api/0344-Multiple-Entries-with-Scoreboards.patch diff --git a/patches/api/0355-Added-getHostname-to-AsyncPlayerPreLoginEvent.patch b/patches/api/0345-Added-getHostname-to-AsyncPlayerPreLoginEvent.patch similarity index 100% rename from patches/api/0355-Added-getHostname-to-AsyncPlayerPreLoginEvent.patch rename to patches/api/0345-Added-getHostname-to-AsyncPlayerPreLoginEvent.patch diff --git a/patches/api/0356-Warn-on-strange-EventHandler-return-types.patch b/patches/api/0346-Warn-on-strange-EventHandler-return-types.patch similarity index 100% rename from patches/api/0356-Warn-on-strange-EventHandler-return-types.patch rename to patches/api/0346-Warn-on-strange-EventHandler-return-types.patch diff --git a/patches/api/0357-Multi-Block-Change-API.patch b/patches/api/0347-Multi-Block-Change-API.patch similarity index 91% rename from patches/api/0357-Multi-Block-Change-API.patch rename to patches/api/0347-Multi-Block-Change-API.patch index 1d9a1f89d4..09612ae46c 100644 --- a/patches/api/0357-Multi-Block-Change-API.patch +++ b/patches/api/0347-Multi-Block-Change-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Multi Block Change API diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index b5519cf329485a2ec72586e66a8a88617c09312e..82d9cfadb00da9b7c2034938780354a573801728 100644 +index 0c3a4a3ebd6f16c1c45c2b82620d5ca6cdace8a1..17ad43c24dc2e18f5cde0ac0bfae1de9fe415964 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java -@@ -624,6 +624,27 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -649,6 +649,27 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM */ public void sendBlockDamage(@NotNull Location loc, float progress); diff --git a/patches/api/0358-Fix-NotePlayEvent.patch b/patches/api/0348-Fix-NotePlayEvent.patch similarity index 100% rename from patches/api/0358-Fix-NotePlayEvent.patch rename to patches/api/0348-Fix-NotePlayEvent.patch diff --git a/patches/api/0359-Freeze-Tick-Lock-API.patch b/patches/api/0349-Freeze-Tick-Lock-API.patch similarity index 100% rename from patches/api/0359-Freeze-Tick-Lock-API.patch rename to patches/api/0349-Freeze-Tick-Lock-API.patch diff --git a/patches/api/0360-Dolphin-API.patch b/patches/api/0350-Dolphin-API.patch similarity index 100% rename from patches/api/0360-Dolphin-API.patch rename to patches/api/0350-Dolphin-API.patch diff --git a/patches/api/0361-More-PotionEffectType-API.patch b/patches/api/0351-More-PotionEffectType-API.patch similarity index 97% rename from patches/api/0361-More-PotionEffectType-API.patch rename to patches/api/0351-More-PotionEffectType-API.patch index aa6840470d..81fe72fe80 100644 --- a/patches/api/0361-More-PotionEffectType-API.patch +++ b/patches/api/0351-More-PotionEffectType-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] More PotionEffectType API diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java -index ec59aa76488a1500ab3df46c98ba7b1d4179df4e..56a90dbf1a61dce615ee0f712851bf01de06b28c 100644 +index 9e39c028b3d7bea4f2998d6ed8d53d88361ccfcd..3dc747080b7bfea4b04b5a47cc7ae4698c758802 100644 --- a/src/main/java/org/bukkit/Registry.java +++ b/src/main/java/org/bukkit/Registry.java -@@ -216,6 +216,25 @@ public interface Registry extends Iterable { +@@ -217,6 +217,25 @@ public interface Registry extends Iterable { * @see io.papermc.paper.world.structure.ConfiguredStructure */ Registry CONFIGURED_STRUCTURE = Bukkit.getRegistry(io.papermc.paper.world.structure.ConfiguredStructure.class); diff --git a/patches/api/0362-API-for-creating-command-sender-which-forwards-feedb.patch b/patches/api/0352-API-for-creating-command-sender-which-forwards-feedb.patch similarity index 100% rename from patches/api/0362-API-for-creating-command-sender-which-forwards-feedb.patch rename to patches/api/0352-API-for-creating-command-sender-which-forwards-feedb.patch diff --git a/patches/api/0363-Implement-regenerateChunk.patch b/patches/api/0353-Implement-regenerateChunk.patch similarity index 91% rename from patches/api/0363-Implement-regenerateChunk.patch rename to patches/api/0353-Implement-regenerateChunk.patch index 4cc4dda624..fc4adbf415 100644 --- a/patches/api/0363-Implement-regenerateChunk.patch +++ b/patches/api/0353-Implement-regenerateChunk.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Implement regenerateChunk diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 43d12399e807abd4c95ffec8c025373b6d344a36..9e71e519cda72a1e2a01474f238b97015ec5115e 100644 +index 2955302b08b30570e4a561e3b076d10d80f2f2b3..aa04d7df70d99402c91e920fd693d7d4fb655786 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -498,8 +498,8 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient diff --git a/patches/api/0365-Add-GameEvent-tags.patch b/patches/api/0354-Add-GameEvent-tags.patch similarity index 100% rename from patches/api/0365-Add-GameEvent-tags.patch rename to patches/api/0354-Add-GameEvent-tags.patch diff --git a/patches/api/0366-Furnace-RecipesUsed-API.patch b/patches/api/0355-Furnace-RecipesUsed-API.patch similarity index 100% rename from patches/api/0366-Furnace-RecipesUsed-API.patch rename to patches/api/0355-Furnace-RecipesUsed-API.patch diff --git a/patches/api/0367-Configurable-sculk-sensor-listener-range.patch b/patches/api/0356-Configurable-sculk-sensor-listener-range.patch similarity index 100% rename from patches/api/0367-Configurable-sculk-sensor-listener-range.patch rename to patches/api/0356-Configurable-sculk-sensor-listener-range.patch diff --git a/patches/api/0368-Add-missing-block-data-mins-and-maxes.patch b/patches/api/0357-Add-missing-block-data-mins-and-maxes.patch similarity index 100% rename from patches/api/0368-Add-missing-block-data-mins-and-maxes.patch rename to patches/api/0357-Add-missing-block-data-mins-and-maxes.patch diff --git a/patches/api/0369-Custom-Potion-Mixes.patch b/patches/api/0358-Custom-Potion-Mixes.patch similarity index 100% rename from patches/api/0369-Custom-Potion-Mixes.patch rename to patches/api/0358-Custom-Potion-Mixes.patch diff --git a/patches/api/0370-Expose-furnace-minecart-push-values.patch b/patches/api/0359-Expose-furnace-minecart-push-values.patch similarity index 100% rename from patches/api/0370-Expose-furnace-minecart-push-values.patch rename to patches/api/0359-Expose-furnace-minecart-push-values.patch diff --git a/patches/api/0371-More-Projectile-API.patch b/patches/api/0360-More-Projectile-API.patch similarity index 87% rename from patches/api/0371-More-Projectile-API.patch rename to patches/api/0360-More-Projectile-API.patch index f3b615b3c2..74619e0a48 100644 --- a/patches/api/0371-More-Projectile-API.patch +++ b/patches/api/0360-More-Projectile-API.patch @@ -178,10 +178,10 @@ index d1b37530319f6d37ee37f62080289c1e45848bc8..e94c7e279356c510f60508b26277d489 + // Paper end } diff --git a/src/main/java/org/bukkit/entity/Projectile.java b/src/main/java/org/bukkit/entity/Projectile.java -index a523fca4baab447181ef91df67fa69b24e010149..6935f8806ca1ed87fa761e73bc0f6c41ab60453e 100644 +index a523fca4baab447181ef91df67fa69b24e010149..d97904540ff5cf103604862a5a1a3a41f56dfe33 100644 --- a/src/main/java/org/bukkit/entity/Projectile.java +++ b/src/main/java/org/bukkit/entity/Projectile.java -@@ -43,4 +43,45 @@ public interface Projectile extends Entity { +@@ -43,4 +43,80 @@ public interface Projectile extends Entity { */ @Deprecated(forRemoval = true) // Paper public void setBounce(boolean doesBounce); @@ -225,6 +225,41 @@ index a523fca4baab447181ef91df67fa69b24e010149..6935f8806ca1ed87fa761e73bc0f6c41 + * @param beenShot has been in shot into the world + */ + void setHasBeenShot(boolean beenShot); ++ ++ /** ++ * Gets whether this projectile can hit an entity. ++ *

++ * This method returns true under the following conditions: ++ *

++ * - The shooter can see the entity ({@link Player#canSee(Entity)})

++ * - The entity is alive and not a spectator

++ * - The projectile has left the hitbox of the shooter ({@link #hasLeftShooter()})

++ * - If this is an arrow with piercing, it has not pierced the entity already ++ * ++ * @param entity the entity to check if this projectile can hit ++ * @return true if this projectile can damage the entity, false otherwise ++ */ ++ boolean canHitEntity(@org.jetbrains.annotations.NotNull Entity entity); ++ ++ /** ++ * Makes this projectile hit a specific entity. ++ * This uses the current position of the projectile for the hit point. ++ * Using this method will result in {@link org.bukkit.event.entity.ProjectileHitEvent} being called. ++ * @param entity the entity to hit ++ * @see #hitEntity(Entity, org.bukkit.util.Vector) ++ * @see #canHitEntity(Entity) ++ */ ++ void hitEntity(@org.jetbrains.annotations.NotNull Entity entity); ++ ++ /** ++ * Makes this projectile hit a specific entity from a specific point. ++ * Using this method will result in {@link org.bukkit.event.entity.ProjectileHitEvent} being called. ++ * @param entity the entity to hit ++ * @param vector the direction to hit from ++ * @see #hitEntity(Entity) ++ * @see #canHitEntity(Entity) ++ */ ++ void hitEntity(@org.jetbrains.annotations.NotNull Entity entity, @org.jetbrains.annotations.NotNull org.bukkit.util.Vector vector); + // Paper end } diff --git a/src/main/java/org/bukkit/entity/ShulkerBullet.java b/src/main/java/org/bukkit/entity/ShulkerBullet.java diff --git a/patches/api/0372-Add-getComputedBiome-API.patch b/patches/api/0361-Add-getComputedBiome-API.patch similarity index 93% rename from patches/api/0372-Add-getComputedBiome-API.patch rename to patches/api/0361-Add-getComputedBiome-API.patch index b192af7101..98dc77cad2 100644 --- a/patches/api/0372-Add-getComputedBiome-API.patch +++ b/patches/api/0361-Add-getComputedBiome-API.patch @@ -51,10 +51,10 @@ index 43b53c21af01e0f496c8aaacff82dfdfadaf40f6..3f7e860de4e28745fcdf8d2f41f4a8c2 * Sets the {@link Biome} at the given {@link Location}. * diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java -index cff39708e66208921da15d12d94407d6b6950298..e405c279f6135c94c775a856ab88fd3cace6bd5c 100644 +index cda6e7d8e032b3edc919995141dc260b1ea82810..13485933b8b897b5a9b35f337b43eab5c968f13a 100644 --- a/src/main/java/org/bukkit/block/Block.java +++ b/src/main/java/org/bukkit/block/Block.java -@@ -370,10 +370,22 @@ public interface Block extends Metadatable, net.kyori.adventure.translation.Tran +@@ -371,10 +371,22 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr * Returns the biome that this block resides in * * @return Biome type containing this block diff --git a/patches/api/0373-Add-enchantWithLevels-API.patch b/patches/api/0362-Add-enchantWithLevels-API.patch similarity index 94% rename from patches/api/0373-Add-enchantWithLevels-API.patch rename to patches/api/0362-Add-enchantWithLevels-API.patch index 394fcb62bf..42506ea030 100644 --- a/patches/api/0373-Add-enchantWithLevels-API.patch +++ b/patches/api/0362-Add-enchantWithLevels-API.patch @@ -32,10 +32,10 @@ index 2acafae468fcbb7213d6b6c30803a3924a3bbc30..40edff7c93b6bf75de81102326667135 * Creates a hover event for the given item. * diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index 77ef41527a05e2d7899633ef7fa813774dd15bd9..b8a344fd900dcbd4b28085a54b85b16c742e9c6f 100644 +index 84ea952cdee1eaec5572641e09fdd85930ddeb47..6f33145f1ccc7645616f310a68676207318c2a58 100644 --- a/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -648,6 +648,24 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor +@@ -656,6 +656,24 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat } // Paper start diff --git a/patches/api/0374-Add-TameableDeathMessageEvent.patch b/patches/api/0363-Add-TameableDeathMessageEvent.patch similarity index 100% rename from patches/api/0374-Add-TameableDeathMessageEvent.patch rename to patches/api/0363-Add-TameableDeathMessageEvent.patch diff --git a/patches/api/0375-Allow-to-change-the-podium-of-the-EnderDragon.patch b/patches/api/0364-Allow-to-change-the-podium-of-the-EnderDragon.patch similarity index 100% rename from patches/api/0375-Allow-to-change-the-podium-of-the-EnderDragon.patch rename to patches/api/0364-Allow-to-change-the-podium-of-the-EnderDragon.patch diff --git a/patches/api/0376-Add-pre-unbreaking-amount-to-PlayerItemDamageEvent.patch b/patches/api/0365-Add-pre-unbreaking-amount-to-PlayerItemDamageEvent.patch similarity index 100% rename from patches/api/0376-Add-pre-unbreaking-amount-to-PlayerItemDamageEvent.patch rename to patches/api/0365-Add-pre-unbreaking-amount-to-PlayerItemDamageEvent.patch diff --git a/patches/api/0378-WorldCreator-keepSpawnLoaded.patch b/patches/api/0366-WorldCreator-keepSpawnLoaded.patch similarity index 100% rename from patches/api/0378-WorldCreator-keepSpawnLoaded.patch rename to patches/api/0366-WorldCreator-keepSpawnLoaded.patch diff --git a/patches/api/0379-Add-EntityDyeEvent-and-CollarColorable-interface.patch b/patches/api/0367-Add-EntityDyeEvent-and-CollarColorable-interface.patch similarity index 100% rename from patches/api/0379-Add-EntityDyeEvent-and-CollarColorable-interface.patch rename to patches/api/0367-Add-EntityDyeEvent-and-CollarColorable-interface.patch diff --git a/patches/api/0380-Add-PlayerStopUsingItemEvent.patch b/patches/api/0368-Add-PlayerStopUsingItemEvent.patch similarity index 100% rename from patches/api/0380-Add-PlayerStopUsingItemEvent.patch rename to patches/api/0368-Add-PlayerStopUsingItemEvent.patch diff --git a/patches/api/0381-FallingBlock-auto-expire-setting.patch b/patches/api/0369-FallingBlock-auto-expire-setting.patch similarity index 100% rename from patches/api/0381-FallingBlock-auto-expire-setting.patch rename to patches/api/0369-FallingBlock-auto-expire-setting.patch diff --git a/patches/api/0382-Keyed-Cat-Type.patch b/patches/api/0370-Keyed-Cat-Type.patch similarity index 100% rename from patches/api/0382-Keyed-Cat-Type.patch rename to patches/api/0370-Keyed-Cat-Type.patch diff --git a/patches/api/0383-Add-method-isTickingWorlds-to-Bukkit.patch b/patches/api/0371-Add-method-isTickingWorlds-to-Bukkit.patch similarity index 100% rename from patches/api/0383-Add-method-isTickingWorlds-to-Bukkit.patch rename to patches/api/0371-Add-method-isTickingWorlds-to-Bukkit.patch diff --git a/patches/api/0384-Add-WardenAngerChangeEvent.patch b/patches/api/0372-Add-WardenAngerChangeEvent.patch similarity index 100% rename from patches/api/0384-Add-WardenAngerChangeEvent.patch rename to patches/api/0372-Add-WardenAngerChangeEvent.patch diff --git a/patches/api/0385-Nameable-Banner-API.patch b/patches/api/0373-Nameable-Banner-API.patch similarity index 100% rename from patches/api/0385-Nameable-Banner-API.patch rename to patches/api/0373-Nameable-Banner-API.patch diff --git a/patches/api/0386-Add-Player-getFishHook.patch b/patches/api/0374-Add-Player-getFishHook.patch similarity index 82% rename from patches/api/0386-Add-Player-getFishHook.patch rename to patches/api/0374-Add-Player-getFishHook.patch index 9c96c813ae..e1bc389488 100644 --- a/patches/api/0386-Add-Player-getFishHook.patch +++ b/patches/api/0374-Add-Player-getFishHook.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add Player#getFishHook diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java -index 29885c7184dbec82a6de69c39878276392779d71..3b204144e2d245098b3dc23b8779f9ed817bb6d1 100644 +index a82eee24439989bb0180e3d0b1cc33f277d5305b..127c82c36bd37ef61385a758785bffc6ec1f4b5c 100644 --- a/src/main/java/org/bukkit/entity/HumanEntity.java +++ b/src/main/java/org/bukkit/entity/HumanEntity.java -@@ -356,6 +356,13 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder +@@ -376,6 +376,13 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder @Nullable public Location getPotentialBedLocation(); // Paper end diff --git a/patches/api/0387-More-Teleport-API.patch b/patches/api/0375-More-Teleport-API.patch similarity index 98% rename from patches/api/0387-More-Teleport-API.patch rename to patches/api/0375-More-Teleport-API.patch index e4eb33f55e..5dad416fa4 100644 --- a/patches/api/0387-More-Teleport-API.patch +++ b/patches/api/0375-More-Teleport-API.patch @@ -159,10 +159,10 @@ index b878509ff536f2d728c800a0ae6cd36802570b31..9bfe62185acb2a208268a2db3aa81dad * Teleports this entity to the given location. If this entity is riding a * vehicle, it will be dismounted prior to teleportation. diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 82d9cfadb00da9b7c2034938780354a573801728..8bac7b0b762a75a6535b50351850192a9568b578 100644 +index 17ad43c24dc2e18f5cde0ac0bfae1de9fe415964..6fbdcf6e5df2e613db022d38fc1e170578ef5e8a 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java -@@ -2732,6 +2732,71 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -2757,6 +2757,71 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM String getClientBrandName(); // Paper end diff --git a/patches/api/0388-Add-EntityPortalReadyEvent.patch b/patches/api/0376-Add-EntityPortalReadyEvent.patch similarity index 100% rename from patches/api/0388-Add-EntityPortalReadyEvent.patch rename to patches/api/0376-Add-EntityPortalReadyEvent.patch diff --git a/patches/api/0389-Custom-Chat-Completion-Suggestions-API.patch b/patches/api/0377-Custom-Chat-Completion-Suggestions-API.patch similarity index 89% rename from patches/api/0389-Custom-Chat-Completion-Suggestions-API.patch rename to patches/api/0377-Custom-Chat-Completion-Suggestions-API.patch index 0afdd4aa9a..61ef59a573 100644 --- a/patches/api/0389-Custom-Chat-Completion-Suggestions-API.patch +++ b/patches/api/0377-Custom-Chat-Completion-Suggestions-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Custom Chat Completion Suggestions API diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 8bac7b0b762a75a6535b50351850192a9568b578..cde9dfaba913e18d2efc6003d5209ba3cfb02945 100644 +index 6fbdcf6e5df2e613db022d38fc1e170578ef5e8a..30e8f60762235e87db0445c041e47969223ce570 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java -@@ -2594,6 +2594,25 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -2619,6 +2619,25 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM * @throws IllegalArgumentException If the level is negative or greater than {@code 4} (i.e. not within {@code [0, 4]}). */ void sendOpLevel(byte level); diff --git a/patches/api/0390-Collision-API.patch b/patches/api/0378-Collision-API.patch similarity index 100% rename from patches/api/0390-Collision-API.patch rename to patches/api/0378-Collision-API.patch diff --git a/patches/api/0391-Block-Ticking-API.patch b/patches/api/0379-Block-Ticking-API.patch similarity index 83% rename from patches/api/0391-Block-Ticking-API.patch rename to patches/api/0379-Block-Ticking-API.patch index 01e89b8a66..b6f73760b2 100644 --- a/patches/api/0391-Block-Ticking-API.patch +++ b/patches/api/0379-Block-Ticking-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Block Ticking API diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java -index 0b02bfce9ee01c6beb14348129ab86c751c01e54..aba40431c5a1ae43106a678445483e0653e130d1 100644 +index 13485933b8b897b5a9b35f337b43eab5c968f13a..390a2a2611df35a9ea6f1eb996b47e2aa4597ff0 100644 --- a/src/main/java/org/bukkit/block/Block.java +++ b/src/main/java/org/bukkit/block/Block.java -@@ -588,6 +588,21 @@ public interface Block extends Metadatable, net.kyori.adventure.translation.Tran +@@ -589,6 +589,21 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr * @return true if the block was destroyed */ boolean breakNaturally(@NotNull ItemStack tool, boolean triggerEffect, boolean dropExperience); @@ -31,10 +31,10 @@ index 0b02bfce9ee01c6beb14348129ab86c751c01e54..aba40431c5a1ae43106a678445483e06 /** diff --git a/src/main/java/org/bukkit/block/data/BlockData.java b/src/main/java/org/bukkit/block/data/BlockData.java -index 62273e32e87b0dbc568747a67156366d4d4972bd..bd987bd0a29618dfe07de50b194fd6fa694628ec 100644 +index e7ea3f9a60968f257c631bbefcc31653e6ae3728..dcfd515af841cbb957a9a651b6350c88840c041e 100644 --- a/src/main/java/org/bukkit/block/data/BlockData.java +++ b/src/main/java/org/bukkit/block/data/BlockData.java -@@ -151,4 +151,14 @@ public interface BlockData extends Cloneable { +@@ -199,4 +199,14 @@ public interface BlockData extends Cloneable { * @return true if the face is sturdy and can support a block, false otherwise */ boolean isFaceSturdy(@NotNull BlockFace face, @NotNull BlockSupport support); diff --git a/patches/api/0392-Add-NamespacedKey-biome-methods.patch b/patches/api/0380-Add-NamespacedKey-biome-methods.patch similarity index 92% rename from patches/api/0392-Add-NamespacedKey-biome-methods.patch rename to patches/api/0380-Add-NamespacedKey-biome-methods.patch index 89d36528f2..72e349941b 100644 --- a/patches/api/0392-Add-NamespacedKey-biome-methods.patch +++ b/patches/api/0380-Add-NamespacedKey-biome-methods.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Add NamespacedKey biome methods Co-authored-by: Thonk <30448663+ExcessiveAmountsOfZombies@users.noreply.github.com> diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index aa252abe42c184914d6b50ad1f94ba7ada22d7df..854be548e5a645e7312e6e9390d5255f8b1d61e6 100644 +index 80314e6dabadcd290841c792f3a5fafecd6ea036..7cf5223d3f66783e05767e16000bf51925064d66 100644 --- a/src/main/java/org/bukkit/UnsafeValues.java +++ b/src/main/java/org/bukkit/UnsafeValues.java -@@ -243,5 +243,32 @@ public interface UnsafeValues { +@@ -227,5 +227,32 @@ public interface UnsafeValues { * @throws IllegalArgumentException if {@link Material#isBlock()} is false */ boolean isCollidable(@org.jetbrains.annotations.NotNull Material material); diff --git a/patches/api/0393-Add-custom-destroyerIdentity-to-sendBlockDamage.patch b/patches/api/0381-Add-custom-destroyerIdentity-to-sendBlockDamage.patch similarity index 88% rename from patches/api/0393-Add-custom-destroyerIdentity-to-sendBlockDamage.patch rename to patches/api/0381-Add-custom-destroyerIdentity-to-sendBlockDamage.patch index 31fa2bff14..04accb0303 100644 --- a/patches/api/0393-Add-custom-destroyerIdentity-to-sendBlockDamage.patch +++ b/patches/api/0381-Add-custom-destroyerIdentity-to-sendBlockDamage.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add custom destroyerIdentity to sendBlockDamage diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index cde9dfaba913e18d2efc6003d5209ba3cfb02945..1d98abff1ad0116f7a2599f078aa730cb84843c1 100644 +index 30e8f60762235e87db0445c041e47969223ce570..478c175d1fcb9a6d1211c50618eec4b9b14bc0ba 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java -@@ -616,7 +616,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -641,7 +641,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM /** * Send block damage. This fakes block break progress for a user at a * certain location. This will not actually change the block's break @@ -17,7 +17,7 @@ index cde9dfaba913e18d2efc6003d5209ba3cfb02945..1d98abff1ad0116f7a2599f078aa730c * * @param loc the location of the damaged block * @param progress the progress from 0.0 - 1.0 where 0 is no damage and -@@ -625,6 +625,18 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -650,6 +650,18 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM public void sendBlockDamage(@NotNull Location loc, float progress); // Paper start diff --git a/patches/api/0394-Also-load-resources-from-LibraryLoader.patch b/patches/api/0382-Also-load-resources-from-LibraryLoader.patch similarity index 81% rename from patches/api/0394-Also-load-resources-from-LibraryLoader.patch rename to patches/api/0382-Also-load-resources-from-LibraryLoader.patch index 9843c45af2..189e43e0bc 100644 --- a/patches/api/0394-Also-load-resources-from-LibraryLoader.patch +++ b/patches/api/0382-Also-load-resources-from-LibraryLoader.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Also load resources from LibraryLoader diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java -index 345394132df70593800127d34a38f8f8a4dafe00..f7cfe6c0d9d52ed72d0d45baaaf856c15769c668 100644 +index 327ff03fa1978881fa6f6ba20e33e3c049c2e3cd..7d300a539ac2ef1c773cfa90cecc8655490a8686 100644 --- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java +++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java -@@ -90,14 +90,35 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot +@@ -93,14 +93,35 @@ public final class PluginClassLoader extends URLClassLoader implements io.paperm @Override public URL getResource(String name) { @@ -43,6 +43,6 @@ index 345394132df70593800127d34a38f8f8a4dafe00..f7cfe6c0d9d52ed72d0d45baaaf856c1 + } + // Paper end + + // Paper start @Override - protected Class loadClass(String name, boolean resolve) throws ClassNotFoundException { - return loadClass0(name, resolve, true, true); + public Class loadClass(@NotNull String name, boolean resolve, boolean checkGlobal, boolean checkLibraries) throws ClassNotFoundException { diff --git a/patches/api/0395-Added-byte-array-serialization-deserialization-for-P.patch b/patches/api/0383-Added-byte-array-serialization-deserialization-for-P.patch similarity index 100% rename from patches/api/0395-Added-byte-array-serialization-deserialization-for-P.patch rename to patches/api/0383-Added-byte-array-serialization-deserialization-for-P.patch diff --git a/patches/api/0396-Add-a-consumer-parameter-to-ProjectileSource-launchP.patch b/patches/api/0384-Add-a-consumer-parameter-to-ProjectileSource-launchP.patch similarity index 100% rename from patches/api/0396-Add-a-consumer-parameter-to-ProjectileSource-launchP.patch rename to patches/api/0384-Add-a-consumer-parameter-to-ProjectileSource-launchP.patch diff --git a/patches/api/0397-Expose-codepoint-limit-in-YamlConfigOptions-and-incr.patch b/patches/api/0385-Expose-codepoint-limit-in-YamlConfigOptions-and-incr.patch similarity index 100% rename from patches/api/0397-Expose-codepoint-limit-in-YamlConfigOptions-and-incr.patch rename to patches/api/0385-Expose-codepoint-limit-in-YamlConfigOptions-and-incr.patch diff --git a/patches/api/0399-Add-getDrops-to-BlockState-and-isPreferredTool-to-Bl.patch b/patches/api/0386-Add-getDrops-to-BlockState.patch similarity index 66% rename from patches/api/0399-Add-getDrops-to-BlockState-and-isPreferredTool-to-Bl.patch rename to patches/api/0386-Add-getDrops-to-BlockState.patch index c23b7577e0..48f3a99f04 100644 --- a/patches/api/0399-Add-getDrops-to-BlockState-and-isPreferredTool-to-Bl.patch +++ b/patches/api/0386-Add-getDrops-to-BlockState.patch @@ -1,8 +1,10 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: MelnCat Date: Fri, 12 Aug 2022 23:24:53 -0700 -Subject: [PATCH] Add getDrops to BlockState and isPreferredTool to BlockData +Subject: [PATCH] Add getDrops to BlockState +Originally added isPreferredTool to BlockData but +upstream added that. diff --git a/src/main/java/org/bukkit/block/BlockState.java b/src/main/java/org/bukkit/block/BlockState.java index 10cbe71917bc32cca61748bcb0aa3395c554dbf8..37ca7b6b0fcee8bec12026ec3715dcc47400cc11 100644 @@ -43,24 +45,3 @@ index 10cbe71917bc32cca61748bcb0aa3395c554dbf8..37ca7b6b0fcee8bec12026ec3715dcc4 + java.util.@org.jetbrains.annotations.Unmodifiable Collection getDrops(@NotNull org.bukkit.inventory.ItemStack tool, @Nullable org.bukkit.entity.Entity entity); // Paper end } -diff --git a/src/main/java/org/bukkit/block/data/BlockData.java b/src/main/java/org/bukkit/block/data/BlockData.java -index bd987bd0a29618dfe07de50b194fd6fa694628ec..b166d053b3c44f06cb1f5b643e7f7e117eb21d17 100644 ---- a/src/main/java/org/bukkit/block/data/BlockData.java -+++ b/src/main/java/org/bukkit/block/data/BlockData.java -@@ -160,5 +160,16 @@ public interface BlockData extends Cloneable { - * @return is ticked randomly - */ - boolean isRandomlyTicked(); -+ -+ /** -+ * Returns if the given item is a preferred choice to break this block. -+ * -+ * In some cases this determines if a block will drop anything or extra -+ * loot. -+ * -+ * @param tool The tool or item used for breaking this block -+ * @return true if the tool is preferred for breaking this block -+ */ -+ boolean isPreferredTool(@NotNull org.bukkit.inventory.ItemStack tool); - // Paper end - } diff --git a/patches/api/0400-Add-PlayerInventorySlotChangeEvent.patch b/patches/api/0387-Add-PlayerInventorySlotChangeEvent.patch similarity index 100% rename from patches/api/0400-Add-PlayerInventorySlotChangeEvent.patch rename to patches/api/0387-Add-PlayerInventorySlotChangeEvent.patch diff --git a/patches/api/0401-Elder-Guardian-appearance-API.patch b/patches/api/0388-Elder-Guardian-appearance-API.patch similarity index 87% rename from patches/api/0401-Elder-Guardian-appearance-API.patch rename to patches/api/0388-Elder-Guardian-appearance-API.patch index ca33de41db..026b673fa5 100644 --- a/patches/api/0401-Elder-Guardian-appearance-API.patch +++ b/patches/api/0388-Elder-Guardian-appearance-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Elder Guardian appearance API diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 1d98abff1ad0116f7a2599f078aa730cb84843c1..ecb8b4cf48c7d6151ffec92bc6855d1fc57a2b51 100644 +index 478c175d1fcb9a6d1211c50618eec4b9b14bc0ba..9ac0f78d1bf434e501c32382ad2e517a1e19fbfa 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java -@@ -2828,6 +2828,24 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -2853,6 +2853,24 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM void lookAt(@NotNull org.bukkit.entity.Entity entity, @NotNull io.papermc.paper.entity.LookAnchor playerAnchor, @NotNull io.papermc.paper.entity.LookAnchor entityAnchor); // Paper end - Teleport API diff --git a/patches/api/0402-Allow-changing-bed-s-occupied-property.patch b/patches/api/0389-Allow-changing-bed-s-occupied-property.patch similarity index 100% rename from patches/api/0402-Allow-changing-bed-s-occupied-property.patch rename to patches/api/0389-Allow-changing-bed-s-occupied-property.patch diff --git a/patches/api/0403-Add-EquipmentSlot-convenience-methods.patch b/patches/api/0390-Add-EquipmentSlot-convenience-methods.patch similarity index 100% rename from patches/api/0403-Add-EquipmentSlot-convenience-methods.patch rename to patches/api/0390-Add-EquipmentSlot-convenience-methods.patch diff --git a/patches/api/0404-Add-LivingEntity-swingHand-EquipmentSlot-convenience.patch b/patches/api/0391-Add-LivingEntity-swingHand-EquipmentSlot-convenience.patch similarity index 89% rename from patches/api/0404-Add-LivingEntity-swingHand-EquipmentSlot-convenience.patch rename to patches/api/0391-Add-LivingEntity-swingHand-EquipmentSlot-convenience.patch index 8d24e5009f..cb116f6d63 100644 --- a/patches/api/0404-Add-LivingEntity-swingHand-EquipmentSlot-convenience.patch +++ b/patches/api/0391-Add-LivingEntity-swingHand-EquipmentSlot-convenience.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add LivingEntity#swingHand(EquipmentSlot) convenience method diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index 6f7483a86b713b7b85e595f55b167e1547bc4b8e..475fdef28596cf8454da58d04d4c4153719a4a68 100644 +index 27187efdbcf1cf20a53175f1177c16dc40acab3c..aa2c3c4648844908b2699f6f220393f98836ed5d 100644 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -1033,5 +1033,23 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource +@@ -1052,5 +1052,23 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource * @param hurtDirection hurt direction */ void setHurtDirection(float hurtDirection); diff --git a/patches/api/0405-Add-entity-knockback-API.patch b/patches/api/0392-Add-entity-knockback-API.patch similarity index 88% rename from patches/api/0405-Add-entity-knockback-API.patch rename to patches/api/0392-Add-entity-knockback-API.patch index a11c0251f8..4f7f54130d 100644 --- a/patches/api/0405-Add-entity-knockback-API.patch +++ b/patches/api/0392-Add-entity-knockback-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add entity knockback API diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index 475fdef28596cf8454da58d04d4c4153719a4a68..1999cd1b1aaa23589da4e11cf80139b8e7a2a539 100644 +index aa2c3c4648844908b2699f6f220393f98836ed5d..f5a4160afb75549dd56a237cf99ec733efef9b4c 100644 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -1051,5 +1051,17 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource +@@ -1070,5 +1070,17 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource this.swingOffHand(); } } diff --git a/patches/api/0406-Added-EntityToggleSitEvent.patch b/patches/api/0393-Added-EntityToggleSitEvent.patch similarity index 100% rename from patches/api/0406-Added-EntityToggleSitEvent.patch rename to patches/api/0393-Added-EntityToggleSitEvent.patch diff --git a/patches/api/0407-Add-Moving-Piston-API.patch b/patches/api/0394-Add-Moving-Piston-API.patch similarity index 100% rename from patches/api/0407-Add-Moving-Piston-API.patch rename to patches/api/0394-Add-Moving-Piston-API.patch diff --git a/patches/api/0408-Add-PrePlayerAttackEntityEvent.patch b/patches/api/0395-Add-PrePlayerAttackEntityEvent.patch similarity index 100% rename from patches/api/0408-Add-PrePlayerAttackEntityEvent.patch rename to patches/api/0395-Add-PrePlayerAttackEntityEvent.patch diff --git a/patches/api/0409-Add-Player-Warden-Warning-API.patch b/patches/api/0396-Add-Player-Warden-Warning-API.patch similarity index 93% rename from patches/api/0409-Add-Player-Warden-Warning-API.patch rename to patches/api/0396-Add-Player-Warden-Warning-API.patch index 5360645a3a..634b1dc4ab 100644 --- a/patches/api/0409-Add-Player-Warden-Warning-API.patch +++ b/patches/api/0396-Add-Player-Warden-Warning-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add Player Warden Warning API diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index ecb8b4cf48c7d6151ffec92bc6855d1fc57a2b51..1e27b9de47f111b9c000243214e22890e323f7fc 100644 +index 9ac0f78d1bf434e501c32382ad2e517a1e19fbfa..3a450af12df6c71e91eab34237dcbf870708f3c6 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java -@@ -2844,6 +2844,59 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -2869,6 +2869,59 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM * @param silent whether sound should be silenced */ void showElderGuardian(boolean silent); diff --git a/patches/api/0410-More-vanilla-friendly-methods-to-update-trades.patch b/patches/api/0397-More-vanilla-friendly-methods-to-update-trades.patch similarity index 100% rename from patches/api/0410-More-vanilla-friendly-methods-to-update-trades.patch rename to patches/api/0397-More-vanilla-friendly-methods-to-update-trades.patch diff --git a/patches/api/0411-Add-paper-dumplisteners-command.patch b/patches/api/0398-Add-paper-dumplisteners-command.patch similarity index 100% rename from patches/api/0411-Add-paper-dumplisteners-command.patch rename to patches/api/0398-Add-paper-dumplisteners-command.patch diff --git a/patches/api/0398-Add-system-property-to-print-stacktrace-on-bad-plugi.patch b/patches/api/0398-Add-system-property-to-print-stacktrace-on-bad-plugi.patch deleted file mode 100644 index 48e74889cc..0000000000 --- a/patches/api/0398-Add-system-property-to-print-stacktrace-on-bad-plugi.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Nassim Jahnke -Date: Sat, 1 Oct 2022 09:44:26 +0200 -Subject: [PATCH] Add system property to print stacktrace on bad plugin class - access - - -diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java -index f7cfe6c0d9d52ed72d0d45baaaf856c15769c668..cb3c25ef46b279ffdde87f47f729eb8aa7549c1c 100644 ---- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java -+++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java -@@ -162,6 +162,11 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot - // In case the bad access occurs on construction - loader.server.getLogger().log(Level.WARNING, "[{0}] Loaded class {1} from {2} which is not a depend or softdepend of this plugin.", new Object[]{description.getName(), name, provider.getFullName()}); - } -+ // Paper start -+ if (Boolean.getBoolean("Paper.printStacktraceOnBadPluginClassAccess")) { -+ (plugin != null ? plugin.getLogger() : loader.server.getLogger()).log(Level.WARNING, "Stacktrace", new Exception()); -+ } -+ // Paper end - } - } - diff --git a/patches/api/0412-ItemStack-damage-API.patch b/patches/api/0399-ItemStack-damage-API.patch similarity index 79% rename from patches/api/0412-ItemStack-damage-API.patch rename to patches/api/0399-ItemStack-damage-API.patch index 55f924ce2f..27cedcf655 100644 --- a/patches/api/0412-ItemStack-damage-API.patch +++ b/patches/api/0399-ItemStack-damage-API.patch @@ -8,10 +8,10 @@ to simulate damage done to an itemstack and all the logic associated with damaging them diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index 1999cd1b1aaa23589da4e11cf80139b8e7a2a539..c27aaec51ae4de593da4443e1e8a773e1b59aafa 100644 +index f5a4160afb75549dd56a237cf99ec733efef9b4c..efcf093bc908a3a5711a06e579503100514f57aa 100644 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -1063,5 +1063,48 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource +@@ -1082,5 +1082,52 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource * @param directionZ The relative z position of the knockback source direction */ void knockback(double strength, double directionX, double directionZ); @@ -38,21 +38,25 @@ index 1999cd1b1aaa23589da4e11cf80139b8e7a2a539..c27aaec51ae4de593da4443e1e8a773e + void broadcastSlotBreak(org.bukkit.inventory.@NotNull EquipmentSlot slot, @NotNull Collection players); + + /** -+ * Damages this itemstack by the specified amount. This -+ * runs all logic associated with damaging an itemstack like -+ * events and stat changes. ++ * Damages the itemstack in this slot by the specified amount. ++ *

++ * This runs all logic associated with damaging an itemstack like ++ * gamemode and enchantment checks, events, stat changes, and advancement ++ * triggers. + * + * @param stack the itemstack to damage + * @param amount the amount of damage to do -+ * @return the damaged itemstack, or an empty stack if it broke. It may be the same instance as the stack passed it, but it may not. ++ * @return the damaged itemstack, or an empty stack if it broke. There are no ++ * guarantees the returned itemstack is the same instance + */ + @NotNull ItemStack damageItemStack(@NotNull ItemStack stack, int amount); + + /** + * Damages the itemstack in this slot by the specified amount. ++ *

+ * This runs all logic associated with damaging an itemstack like -+ * events, stat changes, and notifying clients to play -+ * break animations. ++ * gamemode and enchantment checks, events, stat changes, advancement ++ * triggers, and notifying clients to play break animations. + * + * @param slot the slot of the stack to damage + * @param amount the amount of damage to do @@ -61,10 +65,10 @@ index 1999cd1b1aaa23589da4e11cf80139b8e7a2a539..c27aaec51ae4de593da4443e1e8a773e // Paper end } diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index b8a344fd900dcbd4b28085a54b85b16c742e9c6f..870c0ddd101094a3bce1ebf5ec4d42c51053db84 100644 +index 6f33145f1ccc7645616f310a68676207318c2a58..449d6e1995eedbfaeffdc5d1f1c2295378006aa8 100644 --- a/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -977,5 +977,19 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor +@@ -971,5 +971,19 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat public boolean canRepair(@NotNull ItemStack toBeRepaired) { return Bukkit.getUnsafe().isValidRepairItemStack(toBeRepaired, this); } diff --git a/patches/api/0413-Add-Tick-TemporalUnit.patch b/patches/api/0400-Add-Tick-TemporalUnit.patch similarity index 75% rename from patches/api/0413-Add-Tick-TemporalUnit.patch rename to patches/api/0400-Add-Tick-TemporalUnit.patch index 4b8cbf258f..96c1dddab8 100644 --- a/patches/api/0413-Add-Tick-TemporalUnit.patch +++ b/patches/api/0400-Add-Tick-TemporalUnit.patch @@ -6,16 +6,17 @@ Subject: [PATCH] Add Tick TemporalUnit diff --git a/src/main/java/io/papermc/paper/util/Tick.java b/src/main/java/io/papermc/paper/util/Tick.java new file mode 100644 -index 0000000000000000000000000000000000000000..900f39c0c5c6f4f2c89e0b4dade0d26b367c4f57 +index 0000000000000000000000000000000000000000..10430f02e1d1e654383154c04473f07469bc7fee --- /dev/null +++ b/src/main/java/io/papermc/paper/util/Tick.java -@@ -0,0 +1,94 @@ +@@ -0,0 +1,95 @@ +package io.papermc.paper.util; + +import net.kyori.adventure.util.Ticks; +import org.jetbrains.annotations.NotNull; + +import java.time.Duration; ++import java.time.temporal.ChronoUnit; +import java.time.temporal.Temporal; +import java.time.temporal.TemporalUnit; +import java.util.Objects; @@ -68,7 +69,7 @@ index 0000000000000000000000000000000000000000..900f39c0c5c6f4f2c89e0b4dade0d26b + */ + public int fromDuration(@NotNull Duration duration) { + Objects.requireNonNull(duration, "duration cannot be null"); -+ return Math.toIntExact(Math.floorDiv(duration.toMillis(), INSTANCE.milliseconds)); ++ return Math.toIntExact(Math.floorDiv(duration.toMillis(), this.milliseconds)); + } + + @Override @@ -96,23 +97,26 @@ index 0000000000000000000000000000000000000000..900f39c0c5c6f4f2c89e0b4dade0d26b + @SuppressWarnings("unchecked") // following ChronoUnit#addTo + @Override + public @NotNull R addTo(@NotNull R temporal, long amount) { -+ return (R) temporal.plus(amount, this); ++ return (R) temporal.plus(getDuration().multipliedBy(amount)); + } + + @Override + public long between(@NotNull Temporal start, @NotNull Temporal end) { -+ return start.until(end, this); ++ return start.until(end, ChronoUnit.MILLIS) / this.milliseconds; + } +} diff --git a/src/test/java/io/papermc/paper/util/TickTest.java b/src/test/java/io/papermc/paper/util/TickTest.java new file mode 100644 -index 0000000000000000000000000000000000000000..9a48f7a82636d4047a3f5fefe69bb88c2f5aaaef +index 0000000000000000000000000000000000000000..6d6d0564e07c0886648000490337272e1740ea21 --- /dev/null +++ b/src/test/java/io/papermc/paper/util/TickTest.java -@@ -0,0 +1,23 @@ +@@ -0,0 +1,44 @@ +package io.papermc.paper.util; + +import java.time.Duration; ++import java.time.Instant; ++import java.time.temporal.ChronoUnit; ++ +import org.junit.Test; + +import static org.junit.Assert.assertEquals; @@ -132,4 +136,22 @@ index 0000000000000000000000000000000000000000..9a48f7a82636d4047a3f5fefe69bb88c + assertEquals(1, Tick.tick().fromDuration(Duration.ofMillis(60))); + assertEquals(2, Tick.tick().fromDuration(Duration.ofMillis(100))); + } ++ ++ @Test ++ public void testAddTickToInstant() { ++ Instant now = Instant.now(); ++ assertEquals(now, now.plus(0, Tick.tick())); ++ assertEquals(now.plus(50, ChronoUnit.MILLIS), now.plus(1, Tick.tick())); ++ assertEquals(now.plus(100, ChronoUnit.MILLIS), now.plus(2, Tick.tick())); ++ assertEquals(now.plus(150, ChronoUnit.MILLIS), now.plus(3, Tick.tick())); ++ } ++ ++ @Test ++ public void testTicksBetweenInstants() { ++ Instant now = Instant.now(); ++ assertEquals(0, now.until(now.plus(20, ChronoUnit.MILLIS), Tick.tick())); ++ assertEquals(1, now.until(now.plus(50, ChronoUnit.MILLIS), Tick.tick())); ++ assertEquals(1, now.until(now.plus(60, ChronoUnit.MILLIS), Tick.tick())); ++ assertEquals(2, now.until(now.plus(100, ChronoUnit.MILLIS), Tick.tick())); ++ } +} diff --git a/patches/api/0414-Friction-API.patch b/patches/api/0401-Friction-API.patch similarity index 96% rename from patches/api/0414-Friction-API.patch rename to patches/api/0401-Friction-API.patch index 8cff02f9c4..b2370553c0 100644 --- a/patches/api/0414-Friction-API.patch +++ b/patches/api/0401-Friction-API.patch @@ -59,7 +59,7 @@ index d0bef15785493b512ff0f7414c1d58d38fead581..58017fce436cdbda255f7172fbdadb72 /** * Gets the item stack associated with this item drop. diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index f6cbada38ca48638e5ad0bd99d0b6ea65f6b02de..97336be470a9d545d93f78e683a793f328013ad8 100644 +index 285b4028eb45439c052d6a2e9001a8c0bfacd49a..6555397148b84dba7a87cae505544b65452f1742 100644 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java @@ -25,7 +25,7 @@ import org.jetbrains.annotations.Nullable; diff --git a/patches/api/0415-Player-Entity-Tracking-Events.patch b/patches/api/0402-Player-Entity-Tracking-Events.patch similarity index 100% rename from patches/api/0415-Player-Entity-Tracking-Events.patch rename to patches/api/0402-Player-Entity-Tracking-Events.patch diff --git a/patches/api/0416-Add-missing-Fluid-type.patch b/patches/api/0403-Add-missing-Fluid-type.patch similarity index 100% rename from patches/api/0416-Add-missing-Fluid-type.patch rename to patches/api/0403-Add-missing-Fluid-type.patch diff --git a/patches/api/0418-Mark-experimental-api-as-such.patch b/patches/api/0404-Mark-experimental-api-as-such.patch similarity index 89% rename from patches/api/0418-Mark-experimental-api-as-such.patch rename to patches/api/0404-Mark-experimental-api-as-such.patch index a75596d1c2..f9ae383a2e 100644 --- a/patches/api/0418-Mark-experimental-api-as-such.patch +++ b/patches/api/0404-Mark-experimental-api-as-such.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Mark experimental api as such diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java -index 56459876a7736bd3a015e0aba511313997f9ec65..e5b94299793ba7cb9071a3f3a35ddbe08b0b9906 100644 +index 33371518fc8c5d97625f3d528ba8fee25d8c9c00..7eb5413ea1d94ddacd98edb57074611dac94a41c 100644 --- a/src/main/java/org/bukkit/Material.java +++ b/src/main/java/org/bukkit/Material.java -@@ -154,9 +154,11 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -154,9 +154,11 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla ACACIA_PLANKS(31312), DARK_OAK_PLANKS(20869), MANGROVE_PLANKS(7078), @@ -20,7 +20,7 @@ index 56459876a7736bd3a015e0aba511313997f9ec65..e5b94299793ba7cb9071a3f3a35ddbe0 BAMBOO_MOSAIC(10715), /** * BlockData: {@link Sapling} -@@ -352,6 +354,7 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -352,6 +354,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla /** * BlockData: {@link Orientable} */ @@ -28,7 +28,7 @@ index 56459876a7736bd3a015e0aba511313997f9ec65..e5b94299793ba7cb9071a3f3a35ddbe0 BAMBOO_BLOCK(20770, Orientable.class), /** * BlockData: {@link Orientable} -@@ -428,6 +431,7 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -428,6 +431,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla /** * BlockData: {@link Orientable} */ @@ -36,7 +36,7 @@ index 56459876a7736bd3a015e0aba511313997f9ec65..e5b94299793ba7cb9071a3f3a35ddbe0 STRIPPED_BAMBOO_BLOCK(14799, Orientable.class), /** * BlockData: {@link Orientable} -@@ -622,10 +626,12 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -622,10 +626,12 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla /** * BlockData: {@link Slab} */ @@ -49,7 +49,7 @@ index 56459876a7736bd3a015e0aba511313997f9ec65..e5b94299793ba7cb9071a3f3a35ddbe0 BAMBOO_MOSAIC_SLAB(22118, Slab.class), /** * BlockData: {@link Slab} -@@ -712,6 +718,7 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -712,6 +718,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla /** * BlockData: {@link ChiseledBookshelf} */ @@ -57,7 +57,7 @@ index 56459876a7736bd3a015e0aba511313997f9ec65..e5b94299793ba7cb9071a3f3a35ddbe0 CHISELED_BOOKSHELF(8099, ChiseledBookshelf.class), MOSSY_COBBLESTONE(21900), OBSIDIAN(32723), -@@ -805,6 +812,7 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -805,6 +812,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla /** * BlockData: {@link Fence} */ @@ -65,7 +65,7 @@ index 56459876a7736bd3a015e0aba511313997f9ec65..e5b94299793ba7cb9071a3f3a35ddbe0 BAMBOO_FENCE(17207, Fence.class), /** * BlockData: {@link Fence} -@@ -981,10 +989,12 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -981,10 +989,12 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla /** * BlockData: {@link Stairs} */ @@ -78,7 +78,7 @@ index 56459876a7736bd3a015e0aba511313997f9ec65..e5b94299793ba7cb9071a3f3a35ddbe0 BAMBOO_MOSAIC_STAIRS(20977, Stairs.class), /** * BlockData: {@link Stairs} -@@ -1828,6 +1838,7 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -1828,6 +1838,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla /** * BlockData: {@link Switch} */ @@ -86,7 +86,7 @@ index 56459876a7736bd3a015e0aba511313997f9ec65..e5b94299793ba7cb9071a3f3a35ddbe0 BAMBOO_BUTTON(21810, Switch.class), /** * BlockData: {@link Switch} -@@ -1884,6 +1895,7 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -1884,6 +1895,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla /** * BlockData: {@link Powerable} */ @@ -94,7 +94,7 @@ index 56459876a7736bd3a015e0aba511313997f9ec65..e5b94299793ba7cb9071a3f3a35ddbe0 BAMBOO_PRESSURE_PLATE(26740, Powerable.class), /** * BlockData: {@link Powerable} -@@ -1928,6 +1940,7 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -1928,6 +1940,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla /** * BlockData: {@link Door} */ @@ -102,7 +102,7 @@ index 56459876a7736bd3a015e0aba511313997f9ec65..e5b94299793ba7cb9071a3f3a35ddbe0 BAMBOO_DOOR(19971, Door.class), /** * BlockData: {@link Door} -@@ -1972,6 +1985,7 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -1972,6 +1985,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla /** * BlockData: {@link TrapDoor} */ @@ -110,7 +110,7 @@ index 56459876a7736bd3a015e0aba511313997f9ec65..e5b94299793ba7cb9071a3f3a35ddbe0 BAMBOO_TRAPDOOR(9174, TrapDoor.class), /** * BlockData: {@link TrapDoor} -@@ -2012,6 +2026,7 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -2012,6 +2026,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla /** * BlockData: {@link Gate} */ @@ -118,7 +118,7 @@ index 56459876a7736bd3a015e0aba511313997f9ec65..e5b94299793ba7cb9071a3f3a35ddbe0 BAMBOO_FENCE_GATE(14290, Gate.class), /** * BlockData: {@link Gate} -@@ -2060,7 +2075,9 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -2060,7 +2075,9 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla DARK_OAK_CHEST_BOAT(8733, 1), MANGROVE_BOAT(20792, 1), MANGROVE_CHEST_BOAT(18572, 1), @@ -128,7 +128,7 @@ index 56459876a7736bd3a015e0aba511313997f9ec65..e5b94299793ba7cb9071a3f3a35ddbe0 BAMBOO_CHEST_RAFT(20056, 1), /** * BlockData: {@link StructureBlock} -@@ -2194,6 +2211,7 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -2194,6 +2211,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla /** * BlockData: {@link Sign} */ @@ -136,7 +136,7 @@ index 56459876a7736bd3a015e0aba511313997f9ec65..e5b94299793ba7cb9071a3f3a35ddbe0 BAMBOO_SIGN(26139, 16, Sign.class), /** * BlockData: {@link Sign} -@@ -2206,42 +2224,52 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -2206,42 +2224,52 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla /** * BlockData: {@link HangingSign} */ @@ -189,7 +189,7 @@ index 56459876a7736bd3a015e0aba511313997f9ec65..e5b94299793ba7cb9071a3f3a35ddbe0 WARPED_HANGING_SIGN(8195, 16, HangingSign.class), BUCKET(15215, 16), WATER_BUCKET(8802, 1), -@@ -2265,6 +2293,7 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -2265,6 +2293,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla EGG(21603, 16), COMPASS(24139), RECOVERY_COMPASS(12710), @@ -197,7 +197,7 @@ index 56459876a7736bd3a015e0aba511313997f9ec65..e5b94299793ba7cb9071a3f3a35ddbe0 BUNDLE(16835, 1), FISHING_ROD(4167, 1, 64), CLOCK(14980), -@@ -2405,6 +2434,7 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -2405,6 +2434,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla BEE_SPAWN_EGG(22924), BLAZE_SPAWN_EGG(4759), CAT_SPAWN_EGG(29583), @@ -205,7 +205,7 @@ index 56459876a7736bd3a015e0aba511313997f9ec65..e5b94299793ba7cb9071a3f3a35ddbe0 CAMEL_SPAWN_EGG(14760), CAVE_SPIDER_SPAWN_EGG(23341), CHICKEN_SPAWN_EGG(5462), -@@ -2515,6 +2545,7 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -2515,6 +2545,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla /** * BlockData: {@link Rotatable} */ @@ -213,7 +213,7 @@ index 56459876a7736bd3a015e0aba511313997f9ec65..e5b94299793ba7cb9071a3f3a35ddbe0 PIGLIN_HEAD(5512, Rotatable.class), NETHER_STAR(12469), PUMPKIN_PIE(28725), -@@ -2916,46 +2947,57 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -2916,46 +2947,57 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla /** * BlockData: {@link WallSign} */ @@ -271,7 +271,7 @@ index 56459876a7736bd3a015e0aba511313997f9ec65..e5b94299793ba7cb9071a3f3a35ddbe0 BAMBOO_WALL_HANGING_SIGN(6669, WallHangingSign.class), /** * BlockData: {@link RedstoneWallTorch} -@@ -3063,6 +3105,7 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -3063,6 +3105,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla /** * BlockData: {@link Directional} */ @@ -427,10 +427,10 @@ index 17e4e0a822d4372e0a98612294ec0bd728830164..f827d8f508441a035974974d34450879 /** diff --git a/src/main/java/org/bukkit/entity/EntityType.java b/src/main/java/org/bukkit/entity/EntityType.java -index 5a0c96875d9c3bd32b4649a3fccd43af1ccb195b..b507b715f9b28b98e32f6589344a5066d1009f64 100644 +index 4915c1064a9b6bf1d485f9e6e42b9f6e4e12f236..91664b99f1158cb8a2e3c72ec082bf3c39487649 100644 --- a/src/main/java/org/bukkit/entity/EntityType.java +++ b/src/main/java/org/bukkit/entity/EntityType.java -@@ -276,6 +276,7 @@ public enum EntityType implements Keyed, net.kyori.adventure.translation.Transla +@@ -278,6 +278,7 @@ public enum EntityType implements Keyed, Translatable, net.kyori.adventure.trans FROG("frog", Frog.class, -1), TADPOLE("tadpole", Tadpole.class, -1), WARDEN("warden", Warden.class, -1), diff --git a/patches/api/0419-fix-Instruments.patch b/patches/api/0405-fix-Instruments.patch similarity index 98% rename from patches/api/0419-fix-Instruments.patch rename to patches/api/0405-fix-Instruments.patch index 701943942f..199e7067e4 100644 --- a/patches/api/0419-fix-Instruments.patch +++ b/patches/api/0405-fix-Instruments.patch @@ -105,7 +105,7 @@ index de976be7132d05506fde7a839cac3954b0dd8da4..27dafd1850d3b984a6af155f5c08ee54 public static Instrument getByType(final byte type) { return BY_DATA.get(type); diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 1e27b9de47f111b9c000243214e22890e323f7fc..19995314b01f19c312efa2a4584ccfba2d700c52 100644 +index 3a450af12df6c71e91eab34237dcbf870708f3c6..4d7089da20e0667fd7e67ef4da073d938e7b9a67 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java @@ -393,9 +393,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM diff --git a/patches/api/0420-Add-BlockLockCheckEvent.patch b/patches/api/0406-Add-BlockLockCheckEvent.patch similarity index 100% rename from patches/api/0420-Add-BlockLockCheckEvent.patch rename to patches/api/0406-Add-BlockLockCheckEvent.patch diff --git a/patches/api/0421-Add-Sneaking-API-for-Entities.patch b/patches/api/0407-Add-Sneaking-API-for-Entities.patch similarity index 95% rename from patches/api/0421-Add-Sneaking-API-for-Entities.patch rename to patches/api/0407-Add-Sneaking-API-for-Entities.patch index 5e878c634d..601c064327 100644 --- a/patches/api/0421-Add-Sneaking-API-for-Entities.patch +++ b/patches/api/0407-Add-Sneaking-API-for-Entities.patch @@ -35,7 +35,7 @@ index 33a6b7a27dc91552799c07a7aad9b3df31ad13f7..cdbc7329cf5f67d66e31eb31e83b9e79 * Get the category of spawn to which this entity belongs. * diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 19995314b01f19c312efa2a4584ccfba2d700c52..9f762cf670bf5db9138e468e72e57781d8d22f54 100644 +index 4d7089da20e0667fd7e67ef4da073d938e7b9a67..b27d7414f34f1d49c56dbc33d6d23bc822adf721 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java @@ -296,6 +296,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM diff --git a/patches/api/0422-Improve-PortalEvents.patch b/patches/api/0408-Improve-PortalEvents.patch similarity index 100% rename from patches/api/0422-Improve-PortalEvents.patch rename to patches/api/0408-Improve-PortalEvents.patch diff --git a/patches/api/0423-Add-exploded-block-state-to-BlockExplodeEvent.patch b/patches/api/0409-Add-exploded-block-state-to-BlockExplodeEvent.patch similarity index 100% rename from patches/api/0423-Add-exploded-block-state-to-BlockExplodeEvent.patch rename to patches/api/0409-Add-exploded-block-state-to-BlockExplodeEvent.patch diff --git a/patches/api/0424-Flying-Fall-Damage-API.patch b/patches/api/0410-Flying-Fall-Damage-API.patch similarity index 88% rename from patches/api/0424-Flying-Fall-Damage-API.patch rename to patches/api/0410-Flying-Fall-Damage-API.patch index 37e1c1b503..4ef427e75e 100644 --- a/patches/api/0424-Flying-Fall-Damage-API.patch +++ b/patches/api/0410-Flying-Fall-Damage-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Flying Fall Damage API diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 9f762cf670bf5db9138e468e72e57781d8d22f54..de960716478477ce199526b8f860cfafa1541ee9 100644 +index b27d7414f34f1d49c56dbc33d6d23bc822adf721..b06f759b6188d87cf406072b6d7ef8266512ce50 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java -@@ -1391,6 +1391,23 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -1416,6 +1416,23 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM */ public void setAllowFlight(boolean flight); diff --git a/patches/api/0425-Expose-pre-collision-moving-velocity-to-VehicleBlock.patch b/patches/api/0411-Expose-pre-collision-moving-velocity-to-VehicleBlock.patch similarity index 100% rename from patches/api/0425-Expose-pre-collision-moving-velocity-to-VehicleBlock.patch rename to patches/api/0411-Expose-pre-collision-moving-velocity-to-VehicleBlock.patch diff --git a/patches/api/0426-Replace-ItemFlag.HIDE_POTION_EFFECTS.patch b/patches/api/0412-Replace-ItemFlag.HIDE_POTION_EFFECTS.patch similarity index 100% rename from patches/api/0426-Replace-ItemFlag.HIDE_POTION_EFFECTS.patch rename to patches/api/0412-Replace-ItemFlag.HIDE_POTION_EFFECTS.patch diff --git a/patches/api/0427-Add-Player-sendEquipmentChange-Map-API.patch b/patches/api/0413-Add-Player-sendEquipmentChange-Map-API.patch similarity index 90% rename from patches/api/0427-Add-Player-sendEquipmentChange-Map-API.patch rename to patches/api/0413-Add-Player-sendEquipmentChange-Map-API.patch index af8d147f90..b62f95da72 100644 --- a/patches/api/0427-Add-Player-sendEquipmentChange-Map-API.patch +++ b/patches/api/0413-Add-Player-sendEquipmentChange-Map-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add Player#sendEquipmentChange(Map) API diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index de960716478477ce199526b8f860cfafa1541ee9..eb2fd6f0e09e50eeacfe4ceccf8fdede55c135a3 100644 +index b06f759b6188d87cf406072b6d7ef8266512ce50..1604351236f748b5009eed29f6051e68092d6090 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java -@@ -666,7 +666,21 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -691,7 +691,21 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM * @param slot The slot of the spoofed equipment change * @param item The ItemStack to display for the player */ diff --git a/patches/api/0414-Win-Screen-API.patch b/patches/api/0414-Win-Screen-API.patch new file mode 100644 index 0000000000..ba18c74e5a --- /dev/null +++ b/patches/api/0414-Win-Screen-API.patch @@ -0,0 +1,58 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Lama06 +Date: Sat, 21 Jan 2023 13:45:22 +0100 +Subject: [PATCH] Win Screen API + + +diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java +index 1604351236f748b5009eed29f6051e68092d6090..d7d94b954262da0cbe11850cbc3ebd45e32c8c76 100644 +--- a/src/main/java/org/bukkit/entity/Player.java ++++ b/src/main/java/org/bukkit/entity/Player.java +@@ -861,6 +861,47 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM + */ + public void sendMap(@NotNull MapView map); + ++ // Paper start ++ /** ++ * Shows the player the win screen that normally is only displayed after one kills the ender dragon ++ * and exits the end for the first time. ++ * In vanilla, the win screen starts with a poem and then continues with the credits but its content can be ++ * changed by using a resource pack. ++ *
++ * Calling this method does not change the value of {@link #hasSeenWinScreen()}. ++ * That means that the win screen is still displayed to a player if they leave the end for the first time, even though ++ * they have seen it before because this method was called. ++ * Note this method does not make the player invulnerable, which is normally expected when viewing credits. ++ * ++ * @see #hasSeenWinScreen() ++ * @see #setHasSeenWinScreen(boolean) ++ * @see https://minecraft.fandom.com/wiki/End_Poem#Technical_details ++ */ ++ public void showWinScreen(); ++ ++ /** ++ * Returns whether this player has seen the win screen before. ++ * When a player leaves the end the win screen is shown to them if they have not seen it before. ++ * ++ * @return Whether this player has seen the win screen before ++ * @see #setHasSeenWinScreen(boolean) ++ * @see #showWinScreen() ++ * @see https://minecraft.fandom.com/wiki/End_Poem ++ */ ++ public boolean hasSeenWinScreen(); ++ ++ /** ++ * Changes whether this player has seen the win screen before. ++ * When a player leaves the end the win screen is shown to them if they have not seen it before. ++ * ++ * @param hasSeenWinScreen Whether this player has seen the win screen before ++ * @see #hasSeenWinScreen() ++ * @see #showWinScreen() ++ * @see https://minecraft.fandom.com/wiki/End_Poem ++ */ ++ public void setHasSeenWinScreen(boolean hasSeenWinScreen); ++ // Paper end ++ + // Paper start + /** + * Permanently Bans the Profile and IP address currently used by the player. diff --git a/patches/api/0415-Add-Entity-Body-Yaw-API.patch b/patches/api/0415-Add-Entity-Body-Yaw-API.patch new file mode 100644 index 0000000000..ffe913f4aa --- /dev/null +++ b/patches/api/0415-Add-Entity-Body-Yaw-API.patch @@ -0,0 +1,32 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: TheTuso +Date: Thu, 2 Feb 2023 16:40:11 +0100 +Subject: [PATCH] Add Entity Body Yaw API + + +diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java +index df91f612978dcea83a99f8403820cea1ab462c06..d045f41d929c6101060caf3a9fb48c8ffc036f16 100644 +--- a/src/main/java/org/bukkit/entity/LivingEntity.java ++++ b/src/main/java/org/bukkit/entity/LivingEntity.java +@@ -1129,5 +1129,21 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource + * @param amount the amount of damage to do + */ + void damageItemStack(org.bukkit.inventory.@NotNull EquipmentSlot slot, int amount); ++ ++ /** ++ * Gets entity body yaw ++ * ++ * @return entity body yaw ++ * @see Location#getYaw() ++ */ ++ float getBodyYaw(); ++ ++ /** ++ * Sets entity body yaw ++ * ++ * @param bodyYaw new entity body yaw ++ * @see Location#setYaw(float) ++ */ ++ void setBodyYaw(float bodyYaw); + // Paper end + } diff --git a/patches/api/0416-Add-missing-isFuel-Material-entries.patch b/patches/api/0416-Add-missing-isFuel-Material-entries.patch new file mode 100644 index 0000000000..e240cc62ea --- /dev/null +++ b/patches/api/0416-Add-missing-isFuel-Material-entries.patch @@ -0,0 +1,102 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Sun, 12 Feb 2023 10:52:22 -0800 +Subject: [PATCH] Add missing isFuel Material entries + + +diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java +index 7eb5413ea1d94ddacd98edb57074611dac94a41c..6bbb47d1f9d8d45326232024e82a0ebaf764fae7 100644 +--- a/src/main/java/org/bukkit/Material.java ++++ b/src/main/java/org/bukkit/Material.java +@@ -7459,6 +7459,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla + case ACACIA_DOOR: + case ACACIA_FENCE: + case ACACIA_FENCE_GATE: ++ case ACACIA_HANGING_SIGN: // Paper + case ACACIA_LOG: + case ACACIA_PLANKS: + case ACACIA_PRESSURE_PLATE: +@@ -7470,9 +7471,27 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla + case ACACIA_WOOD: + case AZALEA: + case BAMBOO: ++ // Paper start - add missing fuels ++ case BAMBOO_BLOCK: ++ case BAMBOO_BUTTON: ++ case BAMBOO_CHEST_RAFT: ++ case BAMBOO_DOOR: ++ case BAMBOO_FENCE: ++ case BAMBOO_FENCE_GATE: ++ case BAMBOO_HANGING_SIGN: ++ // Paper end + case BAMBOO_MOSAIC: + case BAMBOO_MOSAIC_SLAB: + case BAMBOO_MOSAIC_STAIRS: ++ // Paper start - add missing fuels ++ case BAMBOO_PLANKS: ++ case BAMBOO_PRESSURE_PLATE: ++ case BAMBOO_RAFT: ++ case BAMBOO_SIGN: ++ case BAMBOO_SLAB: ++ case BAMBOO_STAIRS: ++ case BAMBOO_TRAPDOOR: ++ // Paper end + case BARREL: + case BIRCH_BOAT: + case BIRCH_BUTTON: +@@ -7480,6 +7499,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla + case BIRCH_DOOR: + case BIRCH_FENCE: + case BIRCH_FENCE_GATE: ++ case BIRCH_HANGING_SIGN: // Paper + case BIRCH_LOG: + case BIRCH_PLANKS: + case BIRCH_PRESSURE_PLATE: +@@ -7520,6 +7540,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla + case DARK_OAK_DOOR: + case DARK_OAK_FENCE: + case DARK_OAK_FENCE_GATE: ++ case DARK_OAK_HANGING_SIGN: // Paper + case DARK_OAK_LOG: + case DARK_OAK_PLANKS: + case DARK_OAK_PRESSURE_PLATE: +@@ -7548,6 +7569,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla + case JUNGLE_DOOR: + case JUNGLE_FENCE: + case JUNGLE_FENCE_GATE: ++ case JUNGLE_HANGING_SIGN: // Paper + case JUNGLE_LOG: + case JUNGLE_PLANKS: + case JUNGLE_PRESSURE_PLATE: +@@ -7579,6 +7601,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla + case MANGROVE_DOOR: + case MANGROVE_FENCE: + case MANGROVE_FENCE_GATE: ++ case MANGROVE_HANGING_SIGN: // Paper + case MANGROVE_LOG: + case MANGROVE_PLANKS: + case MANGROVE_PRESSURE_PLATE: +@@ -7596,6 +7619,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla + case OAK_DOOR: + case OAK_FENCE: + case OAK_FENCE_GATE: ++ case OAK_HANGING_SIGN: // Paper + case OAK_LOG: + case OAK_PLANKS: + case OAK_PRESSURE_PLATE: +@@ -7625,6 +7649,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla + case SPRUCE_DOOR: + case SPRUCE_FENCE: + case SPRUCE_FENCE_GATE: ++ case SPRUCE_HANGING_SIGN: // Paper + case SPRUCE_LOG: + case SPRUCE_PLANKS: + case SPRUCE_PRESSURE_PLATE: +@@ -7637,6 +7662,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla + case STICK: + case STRIPPED_ACACIA_LOG: + case STRIPPED_ACACIA_WOOD: ++ case STRIPPED_BAMBOO_BLOCK: // Paper + case STRIPPED_BIRCH_LOG: + case STRIPPED_BIRCH_WOOD: + case STRIPPED_DARK_OAK_LOG: diff --git a/patches/api/0417-Fix-HandlerList-for-InventoryBlockStartEvent-subclas.patch b/patches/api/0417-Fix-HandlerList-for-InventoryBlockStartEvent-subclas.patch new file mode 100644 index 0000000000..98799cd97d --- /dev/null +++ b/patches/api/0417-Fix-HandlerList-for-InventoryBlockStartEvent-subclas.patch @@ -0,0 +1,93 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Tue, 7 Feb 2023 08:20:27 -0800 +Subject: [PATCH] Fix HandlerList for InventoryBlockStartEvent subclasses + + +diff --git a/src/main/java/org/bukkit/event/block/BrewingStartEvent.java b/src/main/java/org/bukkit/event/block/BrewingStartEvent.java +index 9e54ef5b60bf5583c12e1edfa76f19013a5b2a65..fe6573d8fca0aa8d8f37f8b476fc45adc786795f 100644 +--- a/src/main/java/org/bukkit/event/block/BrewingStartEvent.java ++++ b/src/main/java/org/bukkit/event/block/BrewingStartEvent.java +@@ -10,7 +10,7 @@ import org.jetbrains.annotations.NotNull; + */ + public class BrewingStartEvent extends InventoryBlockStartEvent { + +- private static final HandlerList handlers = new HandlerList(); ++ // Paper - remove HandlerList + private int brewingTime; + + public BrewingStartEvent(@NotNull final Block furnace, @NotNull ItemStack source, int brewingTime) { +@@ -36,14 +36,5 @@ public class BrewingStartEvent extends InventoryBlockStartEvent { + this.brewingTime = brewTime; + } + +- @NotNull +- @Override +- public HandlerList getHandlers() { +- return handlers; +- } +- +- @NotNull +- public static HandlerList getHandlerList() { +- return handlers; +- } ++ // Paper - remove HandlerList + } +diff --git a/src/main/java/org/bukkit/event/block/CampfireStartEvent.java b/src/main/java/org/bukkit/event/block/CampfireStartEvent.java +index 53119742beda00a38111063243665bb995ae2188..1f7a8bf65e9ac3188f759f9b3c4d6edbf255942a 100644 +--- a/src/main/java/org/bukkit/event/block/CampfireStartEvent.java ++++ b/src/main/java/org/bukkit/event/block/CampfireStartEvent.java +@@ -11,7 +11,7 @@ import org.jetbrains.annotations.NotNull; + */ + public class CampfireStartEvent extends InventoryBlockStartEvent { + +- private static final HandlerList handlers = new HandlerList(); ++ // Paper - remove HandlerList + private int cookingTime; + private CampfireRecipe campfireRecipe; + +@@ -49,14 +49,5 @@ public class CampfireStartEvent extends InventoryBlockStartEvent { + this.cookingTime = cookTime; + } + +- @NotNull +- @Override +- public HandlerList getHandlers() { +- return handlers; +- } +- +- @NotNull +- public static HandlerList getHandlerList() { +- return handlers; +- } ++ // Paper - remove HandlerList + } +diff --git a/src/main/java/org/bukkit/event/inventory/FurnaceStartSmeltEvent.java b/src/main/java/org/bukkit/event/inventory/FurnaceStartSmeltEvent.java +index 1e55f50f04de78ae0b8832a8021ffc7327676e8e..e6ebc17c438f231d67e44a5390d06a8dafba6dfd 100644 +--- a/src/main/java/org/bukkit/event/inventory/FurnaceStartSmeltEvent.java ++++ b/src/main/java/org/bukkit/event/inventory/FurnaceStartSmeltEvent.java +@@ -11,7 +11,7 @@ import org.jetbrains.annotations.NotNull; + * Called when a Furnace starts smelting. + */ + public class FurnaceStartSmeltEvent extends InventoryBlockStartEvent { +- private static final HandlerList handlers = new HandlerList(); ++ // Paper - remove HandlerList + private final CookingRecipe recipe; + private int totalCookTime; + +@@ -56,14 +56,5 @@ public class FurnaceStartSmeltEvent extends InventoryBlockStartEvent { + this.totalCookTime = cookTime; + } + +- @NotNull +- @Override +- public HandlerList getHandlers() { +- return handlers; +- } +- +- @NotNull +- public static HandlerList getHandlerList() { +- return handlers; +- } ++ // Paper - remove HandlerList + } diff --git a/patches/api/0429-Initialisation-improvements.patch b/patches/api/0418-Initialisation-improvements.patch similarity index 85% rename from patches/api/0429-Initialisation-improvements.patch rename to patches/api/0418-Initialisation-improvements.patch index 6c3cb3bb8d..d07664d188 100644 --- a/patches/api/0429-Initialisation-improvements.patch +++ b/patches/api/0418-Initialisation-improvements.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Initialisation improvements diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java -index f7cfe6c0d9d52ed72d0d45baaaf856c15769c668..5ca6976c86d680ec6e2fc8bc3bcb54af56ac8138 100644 +index 7d300a539ac2ef1c773cfa90cecc8655490a8686..f5fdc6b0f8917db82fcac7dd6efe8314c87eb25e 100644 --- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java +++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java -@@ -180,47 +180,7 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot +@@ -189,47 +189,7 @@ public final class PluginClassLoader extends URLClassLoader implements io.paperm Class result = classes.get(name); if (result == null) { @@ -24,7 +24,7 @@ index f7cfe6c0d9d52ed72d0d45baaaf856c15769c668..5ca6976c86d680ec6e2fc8bc3bcb54af - throw new ClassNotFoundException(name, ex); - } - -- classBytes = loader.server.getUnsafe().processClass(description, path, classBytes); +- classBytes = org.bukkit.Bukkit.getServer().getUnsafe().processClass(description, path, classBytes); // Paper - - int dot = name.lastIndexOf('.'); - if (dot != -1) { @@ -55,5 +55,5 @@ index f7cfe6c0d9d52ed72d0d45baaaf856c15769c668..5ca6976c86d680ec6e2fc8bc3bcb54af - } + result = super.findClass(name); - loader.setClass(name, result); classes.put(name, result); + this.setClass(name, result); // Paper diff --git a/patches/api/0428-Win-Screen-API.patch b/patches/api/0428-Win-Screen-API.patch deleted file mode 100644 index b36ae9abfa..0000000000 --- a/patches/api/0428-Win-Screen-API.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Lama06 -Date: Sat, 21 Jan 2023 13:45:22 +0100 -Subject: [PATCH] Win Screen API - - -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index eb2fd6f0e09e50eeacfe4ceccf8fdede55c135a3..c68df5e5cc63b26da8623cf27e257ef07a61897d 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -836,6 +836,18 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - */ - public void sendMap(@NotNull MapView map); - -+ // Paper start -+ /** -+ * Shows the player the win screen that normally is only displayed after one kills the ender dragon -+ * and exits the end for the first time. -+ * In vanilla, the win screen starts with a poem and then continues with the credits but its content can be -+ * changed by using a resource pack. -+ * -+ * @see https://minecraft.fandom.com/wiki/End_Poem#Technical_details -+ */ -+ public void showWinScreen(); -+ // Paper end -+ - // Paper start - /** - * Permanently Bans the Profile and IP address currently used by the player. diff --git a/patches/api/0018-Automatically-disable-plugins-that-fail-to-load.patch b/patches/removed/1.19.3-paper-plugins/api/0019-Automatically-disable-plugins-that-fail-to-load.patch similarity index 86% rename from patches/api/0018-Automatically-disable-plugins-that-fail-to-load.patch rename to patches/removed/1.19.3-paper-plugins/api/0019-Automatically-disable-plugins-that-fail-to-load.patch index 61b71bb093..51fb196a9b 100644 --- a/patches/api/0018-Automatically-disable-plugins-that-fail-to-load.patch +++ b/patches/removed/1.19.3-paper-plugins/api/0019-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 333c47a1f7e9d7ddf91aad5ec15163427f7b8039..5eb24f38f158d43fb42836b83c108f808c89512e 100644 +index 88d852c1a729ffd5951da803da424b31591c9f9a..c95833aaeda48bbdad6e8f67f98e1070171db7de 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 { +@@ -337,6 +337,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/patches/api/0067-Make-plugins-list-alphabetical.patch b/patches/removed/1.19.3-paper-plugins/api/0068-Make-plugins-list-alphabetical.patch similarity index 100% rename from patches/api/0067-Make-plugins-list-alphabetical.patch rename to patches/removed/1.19.3-paper-plugins/api/0068-Make-plugins-list-alphabetical.patch diff --git a/patches/api/0103-Close-Plugin-Class-Loaders-on-Disable.patch b/patches/removed/1.19.3-paper-plugins/api/0104-Close-Plugin-Class-Loaders-on-Disable.patch similarity index 84% rename from patches/api/0103-Close-Plugin-Class-Loaders-on-Disable.patch rename to patches/removed/1.19.3-paper-plugins/api/0104-Close-Plugin-Class-Loaders-on-Disable.patch index 834dc85486..cecc785a80 100644 --- a/patches/api/0103-Close-Plugin-Class-Loaders-on-Disable.patch +++ b/patches/removed/1.19.3-paper-plugins/api/0104-Close-Plugin-Class-Loaders-on-Disable.patch @@ -13,10 +13,10 @@ PluginClassLoader fails to disable, as upstream decided to ignore the exception. diff --git a/src/main/java/org/bukkit/plugin/PluginLoader.java b/src/main/java/org/bukkit/plugin/PluginLoader.java -index a88733f1cd1ddb5d85ab1b0e6af4fd5b80bbc1c6..256e440e699942e3c9da4205bb964bdc10ec92c4 100644 +index cb530369e667c426c842da356c31304bb5c3ecfa..a11515b81575fc42c771a218a81fea8f05d2289d 100644 --- a/src/main/java/org/bukkit/plugin/PluginLoader.java +++ b/src/main/java/org/bukkit/plugin/PluginLoader.java -@@ -77,4 +77,21 @@ public interface PluginLoader { +@@ -78,4 +78,21 @@ public interface PluginLoader { * @param plugin Plugin to disable */ public void disablePlugin(@NotNull Plugin plugin); @@ -39,10 +39,10 @@ index a88733f1cd1ddb5d85ab1b0e6af4fd5b80bbc1c6..256e440e699942e3c9da4205bb964bdc + // Paper end - close Classloader on disable } diff --git a/src/main/java/org/bukkit/plugin/PluginManager.java b/src/main/java/org/bukkit/plugin/PluginManager.java -index 41e26451fe12d8e6e0ef73c85731b24b4e3f200c..0d1b20f2b5580ea5505ccc2f003925dbcee67199 100644 +index 03213fde8315384ec56c16031cfc606ade2e8091..94fef99525a3613dcc313a0d0b03e47a91d4117b 100644 --- a/src/main/java/org/bukkit/plugin/PluginManager.java +++ b/src/main/java/org/bukkit/plugin/PluginManager.java -@@ -161,6 +161,22 @@ public interface PluginManager { +@@ -162,6 +162,22 @@ public interface PluginManager extends io.papermc.paper.plugin.PermissionManager */ public void disablePlugin(@NotNull Plugin plugin); @@ -66,10 +66,10 @@ index 41e26451fe12d8e6e0ef73c85731b24b4e3f200c..0d1b20f2b5580ea5505ccc2f003925db * Gets a {@link Permission} from its fully qualified name * diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java -index 77caec9f974077ed6580d3cbbc20feb1199feb11..9f32b57464352c08617f6adec144111b8fcad50c 100644 +index 2b8308989fce7f8a16907f8711b362e671fdbfb6..f96164a2bc4e042bdd7c6045a9b392ad4e4dbea7 100644 --- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java +++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java -@@ -504,6 +504,21 @@ public final class SimplePluginManager implements PluginManager { +@@ -532,6 +532,21 @@ public final class SimplePluginManager implements PluginManager { } } @@ -90,12 +90,12 @@ index 77caec9f974077ed6580d3cbbc20feb1199feb11..9f32b57464352c08617f6adec144111b + @Override public void disablePlugin(@NotNull final Plugin plugin) { - if (plugin.isEnabled()) { + if (true) {this.paperPluginManager.disablePlugin(plugin); return;} // Paper diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -index 5d74fab03a15d7099e5dacb780eade4cdc185797..032ed2aba7d47144d241d616ba27489ce22d6fea 100644 +index ac1c884e950ce13e9e7b3a7be1378808012fafc4..e0423adf45bf5855c23259257863f67cec1c3d54 100644 --- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -@@ -366,6 +366,7 @@ public final class JavaPluginLoader implements PluginLoader { +@@ -368,6 +368,7 @@ public final class JavaPluginLoader implements PluginLoader { loader.close(); } catch (IOException ex) { // diff --git a/patches/api/0124-Add-an-asterisk-to-legacy-API-plugins.patch b/patches/removed/1.19.3-paper-plugins/api/0125-Add-an-asterisk-to-legacy-API-plugins.patch similarity index 90% rename from patches/api/0124-Add-an-asterisk-to-legacy-API-plugins.patch rename to patches/removed/1.19.3-paper-plugins/api/0125-Add-an-asterisk-to-legacy-API-plugins.patch index f9f9578ccb..1dfa20b766 100644 --- a/patches/api/0124-Add-an-asterisk-to-legacy-API-plugins.patch +++ b/patches/removed/1.19.3-paper-plugins/api/0125-Add-an-asterisk-to-legacy-API-plugins.patch @@ -7,10 +7,10 @@ Not here to name and shame, only so server admins can be aware of which plugins have and haven't been updated. diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index c67d2e96e30261e480f1df96464befac03d78a69..81da1def96d18704303cadd72261a1b2fcbb9fc5 100644 +index 5183d3b1893fdcad9a475b747cb34df5653774fd..4af059f9b32d2a0913e6d88c6a93e101018e88a2 100644 --- a/src/main/java/org/bukkit/UnsafeValues.java +++ b/src/main/java/org/bukkit/UnsafeValues.java -@@ -102,5 +102,11 @@ public interface UnsafeValues { +@@ -111,5 +111,11 @@ public interface UnsafeValues { default com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() { return new com.destroystokyo.paper.util.VersionFetcher.DummyVersionFetcher(); } @@ -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 032ed2aba7d47144d241d616ba27489ce22d6fea..e98934d32b8dac88b3c3fd14ea5d726872212807 100644 +index e0423adf45bf5855c23259257863f67cec1c3d54..c0b9ed3a1e28c51d0195c53ec3d301dcdf58046f 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 { +@@ -308,7 +308,14 @@ public final class JavaPluginLoader implements PluginLoader { Preconditions.checkArgument(plugin instanceof JavaPlugin, "Plugin is not associated with this PluginLoader"); if (!plugin.isEnabled()) { diff --git a/patches/api/0134-Remove-deadlock-risk-in-firing-async-events.patch b/patches/removed/1.19.3-paper-plugins/api/0134-Remove-deadlock-risk-in-firing-async-events.patch similarity index 93% rename from patches/api/0134-Remove-deadlock-risk-in-firing-async-events.patch rename to patches/removed/1.19.3-paper-plugins/api/0134-Remove-deadlock-risk-in-firing-async-events.patch index 255f60b605..3982bba952 100644 --- a/patches/api/0134-Remove-deadlock-risk-in-firing-async-events.patch +++ b/patches/removed/1.19.3-paper-plugins/api/0134-Remove-deadlock-risk-in-firing-async-events.patch @@ -84,11 +84,11 @@ index 9f32b57464352c08617f6adec144111b8fcad50c..5af99aa87e6d4fbff81bd9de40484f4e RegisteredListener[] listeners = handlers.getRegisteredListeners(); diff --git a/src/test/java/org/bukkit/plugin/PluginManagerTest.java b/src/test/java/org/bukkit/plugin/PluginManagerTest.java -index f188cd4f3b07027c30d41f1162db77a506b7b6bb..1941c9f49e9514c1236c5f4ea9f7af47f7be85c5 100644 +index c46ed2acb82db814d660459b705dd49e6d44240f..24dc87898e0fc40dfaf52f17a1bd26eccfbc7abc 100644 --- a/src/test/java/org/bukkit/plugin/PluginManagerTest.java +++ b/src/test/java/org/bukkit/plugin/PluginManagerTest.java -@@ -17,7 +17,7 @@ public class PluginManagerTest { - private static final PluginManager pm = TestServer.getInstance().getPluginManager(); +@@ -16,7 +16,7 @@ public class PluginManagerTest { + private static final PluginManager pm = org.bukkit.Bukkit.getServer().getPluginManager(); // Paper private final MutableObject store = new MutableObject(); - @@ -96,7 +96,7 @@ index f188cd4f3b07027c30d41f1162db77a506b7b6bb..1941c9f49e9514c1236c5f4ea9f7af47 @Test public void testAsyncSameThread() { final Event event = new TestEvent(true); -@@ -28,14 +28,14 @@ public class PluginManagerTest { +@@ -27,14 +27,14 @@ public class PluginManagerTest { return; } throw new IllegalStateException("No exception thrown"); @@ -113,7 +113,7 @@ index f188cd4f3b07027c30d41f1162db77a506b7b6bb..1941c9f49e9514c1236c5f4ea9f7af47 @Test public void testAsyncLocked() throws InterruptedException { final Event event = new TestEvent(true); -@@ -129,7 +129,7 @@ public class PluginManagerTest { +@@ -128,7 +128,7 @@ public class PluginManagerTest { if (store.value == null) { throw new IllegalStateException("No exception thrown"); } diff --git a/patches/api/0193-Disable-Sync-Events-firing-Async-errors-during-shutd.patch b/patches/removed/1.19.3-paper-plugins/api/0193-Disable-Sync-Events-firing-Async-errors-during-shutd.patch similarity index 100% rename from patches/api/0193-Disable-Sync-Events-firing-Async-errors-during-shutd.patch rename to patches/removed/1.19.3-paper-plugins/api/0193-Disable-Sync-Events-firing-Async-errors-during-shutd.patch diff --git a/patches/api/0194-Make-JavaPluginLoader-thread-safe.patch b/patches/removed/1.19.3-paper-plugins/api/0193-Make-JavaPluginLoader-thread-safe.patch similarity index 91% rename from patches/api/0194-Make-JavaPluginLoader-thread-safe.patch rename to patches/removed/1.19.3-paper-plugins/api/0193-Make-JavaPluginLoader-thread-safe.patch index 9afcec1657..80e221872b 100644 --- a/patches/api/0194-Make-JavaPluginLoader-thread-safe.patch +++ b/patches/removed/1.19.3-paper-plugins/api/0193-Make-JavaPluginLoader-thread-safe.patch @@ -5,10 +5,10 @@ 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 e98934d32b8dac88b3c3fd14ea5d726872212807..cf809eda2a3feb6abccf7286068280f430452135 100644 +index c0b9ed3a1e28c51d0195c53ec3d301dcdf58046f..e40224667f2abe48d709112f038904672fa8faf5 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; +@@ -53,6 +53,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$")}; @@ -17,7 +17,7 @@ index e98934d32b8dac88b3c3fd14ea5d726872212807..cf809eda2a3feb6abccf7286068280f4 private final List loaders = new CopyOnWriteArrayList(); private final LibraryLoader libraryLoader; -@@ -201,12 +203,33 @@ public final class JavaPluginLoader implements PluginLoader { +@@ -203,12 +205,33 @@ public final class JavaPluginLoader implements PluginLoader { @Nullable Class getClassByName(final String name, boolean resolve, PluginDescriptionFile description) { diff --git a/patches/api/0205-Prioritise-own-classes-where-possible.patch b/patches/removed/1.19.3-paper-plugins/api/0204-Prioritise-own-classes-where-possible.patch similarity index 79% rename from patches/api/0205-Prioritise-own-classes-where-possible.patch rename to patches/removed/1.19.3-paper-plugins/api/0204-Prioritise-own-classes-where-possible.patch index 948e2f95fa..a2ad52282f 100644 --- a/patches/api/0205-Prioritise-own-classes-where-possible.patch +++ b/patches/removed/1.19.3-paper-plugins/api/0204-Prioritise-own-classes-where-possible.patch @@ -25,18 +25,18 @@ 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 cf809eda2a3feb6abccf7286068280f430452135..4b54af83ef8fd18696d2d21ed52b61f13bff7988 100644 +index e40224667f2abe48d709112f038904672fa8faf5..84ae5b84a75baca4e12221e300006bb209f8671e 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; - */ +@@ -52,6 +52,7 @@ import org.yaml.snakeyaml.error.YAMLException; + @Deprecated(forRemoval = true) // Paper - The PluginLoader system will not function in the near future. This implementation will be moved. 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 classLoadLock = new java.util.HashMap(); // Paper private final Map classLoadLockCount = new java.util.HashMap(); // Paper -@@ -203,6 +204,11 @@ public final class JavaPluginLoader implements PluginLoader { +@@ -205,6 +206,11 @@ public final class JavaPluginLoader implements PluginLoader { @Nullable Class getClassByName(final String name, boolean resolve, PluginDescriptionFile description) { @@ -48,7 +48,7 @@ index cf809eda2a3feb6abccf7286068280f430452135..4b54af83ef8fd18696d2d21ed52b61f1 // Paper start - make MT safe java.util.concurrent.locks.ReentrantReadWriteLock lock; synchronized (classLoadLock) { -@@ -210,6 +216,13 @@ public final class JavaPluginLoader implements PluginLoader { +@@ -212,6 +218,13 @@ public final class JavaPluginLoader implements PluginLoader { classLoadLockCount.compute(name, (x, prev) -> prev != null ? prev + 1 : 1); } lock.writeLock().lock();try { @@ -63,10 +63,10 @@ index cf809eda2a3feb6abccf7286068280f430452135..4b54af83ef8fd18696d2d21ed52b61f1 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 0db641f5d5e1293b236ad0d2e3a156802ffed839..064c758b19bc8c9a4e94769dd205a1bdcc972a89 100644 +index ac62ad546dacfefd686bb824f60f4523631f7abc..3306c2e81ac66d649e3988aa1c142fb9fb7236fc 100644 --- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java +++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java -@@ -33,7 +33,7 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot +@@ -33,7 +33,7 @@ public final class PluginClassLoader extends URLClassLoader implements io.paperm public JavaPlugin getPlugin() { return plugin; } // Spigot private final JavaPluginLoader loader; private final Map> classes = new ConcurrentHashMap>(); @@ -75,12 +75,3 @@ index 0db641f5d5e1293b236ad0d2e3a156802ffed839..064c758b19bc8c9a4e94769dd205a1bd private final File dataFolder; private final File file; private final JarFile jar; -@@ -123,7 +123,7 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot - - if (checkGlobal) { - // This ignores the libraries of other plugins, unless they are transitive dependencies. -- Class result = loader.getClassByName(name, resolve, description); -+ Class result = loader.getClassByName(name, resolve, description, this); // Paper - prioritize self - - if (result != null) { - // If the class was loaded from a library instead of a PluginClassLoader, we can assume that its associated plugin is a transitive dependency and can therefore skip this check. diff --git a/patches/api/0206-Provide-a-useful-PluginClassLoader-toString.patch b/patches/removed/1.19.3-paper-plugins/api/0206-Provide-a-useful-PluginClassLoader-toString.patch similarity index 100% rename from patches/api/0206-Provide-a-useful-PluginClassLoader-toString.patch rename to patches/removed/1.19.3-paper-plugins/api/0206-Provide-a-useful-PluginClassLoader-toString.patch diff --git a/patches/api/0299-List-all-missing-hard-depends-not-just-first.patch b/patches/removed/1.19.3-paper-plugins/api/0299-List-all-missing-hard-depends-not-just-first.patch similarity index 100% rename from patches/api/0299-List-all-missing-hard-depends-not-just-first.patch rename to patches/removed/1.19.3-paper-plugins/api/0299-List-all-missing-hard-depends-not-just-first.patch diff --git a/patches/api/0327-Fix-plugin-provides-load-order.patch b/patches/removed/1.19.3-paper-plugins/api/0318-Fix-plugin-provides-load-order.patch similarity index 79% rename from patches/api/0327-Fix-plugin-provides-load-order.patch rename to patches/removed/1.19.3-paper-plugins/api/0318-Fix-plugin-provides-load-order.patch index 74b275da11..948a872c64 100644 --- a/patches/api/0327-Fix-plugin-provides-load-order.patch +++ b/patches/removed/1.19.3-paper-plugins/api/0318-Fix-plugin-provides-load-order.patch @@ -6,18 +6,18 @@ Subject: [PATCH] Fix plugin provides load order Fixes https://hub.spigotmc.org/jira/browse/SPIGOT-6740 diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java -index 60988665eb358d5566e9de61aec841db3f79722c..d1c1df75c011d8b4e10342c864aeb206e5cac23f 100644 +index 2b8308989fce7f8a16907f8711b362e671fdbfb6..758faf990ba96cbcd0203e9184bcad234b4cb728 100644 --- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java +++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java -@@ -277,6 +277,7 @@ public final class SimplePluginManager implements PluginManager { - // Paper end +@@ -283,6 +283,7 @@ public final class SimplePluginManager implements PluginManager { + } else if (!plugins.containsKey(dependency) && !pluginsProvided.containsKey(dependency)) { missingDependency = false; pluginIterator.remove(); + pluginsProvided.values().removeIf(s -> s.equals(plugin)); // Paper - remove provided plugins softDependencies.remove(plugin); dependencies.remove(plugin); -@@ -310,6 +311,7 @@ public final class SimplePluginManager implements PluginManager { +@@ -318,6 +319,7 @@ public final class SimplePluginManager implements PluginManager { // We're clear to load, no more soft or hard dependencies left File file = plugins.get(plugin); pluginIterator.remove(); diff --git a/patches/api/0364-Don-t-load-plugins-prefixed-with-a-dot.patch b/patches/removed/1.19.3-paper-plugins/api/0364-Don-t-load-plugins-prefixed-with-a-dot.patch similarity index 100% rename from patches/api/0364-Don-t-load-plugins-prefixed-with-a-dot.patch rename to patches/removed/1.19.3-paper-plugins/api/0364-Don-t-load-plugins-prefixed-with-a-dot.patch diff --git a/patches/api/0377-Update-Folder-Uses-Plugin-Name.patch b/patches/removed/1.19.3-paper-plugins/api/0367-Update-Folder-Uses-Plugin-Name.patch similarity index 89% rename from patches/api/0377-Update-Folder-Uses-Plugin-Name.patch rename to patches/removed/1.19.3-paper-plugins/api/0367-Update-Folder-Uses-Plugin-Name.patch index a5c98762cf..823069413c 100644 --- a/patches/api/0377-Update-Folder-Uses-Plugin-Name.patch +++ b/patches/removed/1.19.3-paper-plugins/api/0367-Update-Folder-Uses-Plugin-Name.patch @@ -5,19 +5,19 @@ Subject: [PATCH] Update Folder Uses Plugin Name diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java -index 94646b37c77fcb18fc4030306c431684e7e9a5cc..9db611841b73fed8dc8a71f4d7fdef95af3cf89d 100644 +index 758faf990ba96cbcd0203e9184bcad234b4cb728..fb19ab3bd929045b4d3e227ed961a24b16b8b2bd 100644 --- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java +++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java -@@ -396,7 +396,7 @@ public final class SimplePluginManager implements PluginManager { - public synchronized Plugin loadPlugin(@NotNull File file) throws InvalidPluginException, UnknownDependencyException { - Preconditions.checkArgument(file != null, "File cannot be null"); +@@ -412,7 +412,7 @@ public final class SimplePluginManager implements PluginManager { + } + // Paper end - checkUpdate(file); + file = checkUpdate(file); // Paper - update the reference in case checkUpdate renamed it Set filters = fileAssociations.keySet(); Plugin result = null; -@@ -423,16 +423,61 @@ public final class SimplePluginManager implements PluginManager { +@@ -439,16 +439,61 @@ public final class SimplePluginManager implements PluginManager { return result; } @@ -32,7 +32,7 @@ index 94646b37c77fcb18fc4030306c431684e7e9a5cc..9db611841b73fed8dc8a71f4d7fdef95 if (updateDirectory == null || !updateDirectory.isDirectory()) { - return; + return file; -+ } + } + PluginLoader pluginLoader = getPluginLoader(file); + try { + String pluginName = pluginLoader.getPluginDescription(file).getName(); @@ -59,7 +59,7 @@ index 94646b37c77fcb18fc4030306c431684e7e9a5cc..9db611841b73fed8dc8a71f4d7fdef95 + updateFile.delete(); + return newName; + } - } ++ } + catch (InvalidDescriptionException e) { + throw new InvalidPluginException(e); + } diff --git a/patches/api/0417-Future-API-Plans.patch b/patches/removed/1.19.3-paper-plugins/api/0413-Future-API-Plans.patch similarity index 67% rename from patches/api/0417-Future-API-Plans.patch rename to patches/removed/1.19.3-paper-plugins/api/0413-Future-API-Plans.patch index 9209318a74..7afa310be8 100644 --- a/patches/api/0417-Future-API-Plans.patch +++ b/patches/removed/1.19.3-paper-plugins/api/0413-Future-API-Plans.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Future API Plans diff --git a/src/main/java/org/bukkit/plugin/Plugin.java b/src/main/java/org/bukkit/plugin/Plugin.java -index 08aef59d8443038771704d9587e31f299e587307..cdf496598839380e073d7ccd89af473e9a702f00 100644 +index 8245de7dbf63a01336b8e291b0a3dd5e71ccd349..4eb639fbb46a0848be207149ea433455550fae1c 100644 --- a/src/main/java/org/bukkit/plugin/Plugin.java +++ b/src/main/java/org/bukkit/plugin/Plugin.java -@@ -94,6 +94,7 @@ public interface Plugin extends TabExecutor { +@@ -105,6 +105,7 @@ public interface Plugin extends TabExecutor { * * @return PluginLoader that controls this plugin */ @@ -29,10 +29,10 @@ index 256e440e699942e3c9da4205bb964bdc10ec92c4..a11515b81575fc42c771a218a81fea8f /** diff --git a/src/main/java/org/bukkit/plugin/PluginManager.java b/src/main/java/org/bukkit/plugin/PluginManager.java -index 0d1b20f2b5580ea5505ccc2f003925dbcee67199..efc04803a1eab01053a1f003d6feb2b712165d69 100644 +index e3460b19f3d2c27d7a9c3477467739221211f1d4..94fef99525a3613dcc313a0d0b03e47a91d4117b 100644 --- a/src/main/java/org/bukkit/plugin/PluginManager.java +++ b/src/main/java/org/bukkit/plugin/PluginManager.java -@@ -23,6 +23,7 @@ public interface PluginManager { +@@ -23,6 +23,7 @@ public interface PluginManager extends io.papermc.paper.plugin.PermissionManager * @throws IllegalArgumentException Thrown when the given Class is not a * valid PluginLoader */ @@ -40,21 +40,8 @@ index 0d1b20f2b5580ea5505ccc2f003925dbcee67199..efc04803a1eab01053a1f003d6feb2b7 public void registerInterface(@NotNull Class loader) throws IllegalArgumentException; /** -diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java -index 9db611841b73fed8dc8a71f4d7fdef95af3cf89d..b012ce40d82389c29d1b841ff685425ac10a7f9e 100644 ---- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java -+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java -@@ -43,6 +43,8 @@ import org.jetbrains.annotations.Nullable; - /** - * Handles all plugin management from the Server - */ -+@Deprecated(forRemoval = true) // Paper - This implementation may be replaced in a future version of Paper. -+// Plugins may still reflect into this class to modify permission logic for the time being. - public final class SimplePluginManager implements PluginManager { - private final Server server; - private final Map fileAssociations = new HashMap(); diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -index 8ff78fad47f6086aa289e32590f4fbec24b3d500..7e5149a21b6747f64425a277c142e69f0ef43b3f 100644 +index d104aa3c45bd65b3c6a521ef1ed249fb4e9de053..84ae5b84a75baca4e12221e300006bb209f8671e 100644 --- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java @@ -49,6 +49,7 @@ import org.yaml.snakeyaml.error.YAMLException; diff --git a/patches/server/0222-Add-CraftMagicNumbers.isSupportedApiVersion.patch b/patches/removed/1.19.3-paper-plugins/server/0223-Add-CraftMagicNumbers.isSupportedApiVersion.patch similarity index 84% rename from patches/server/0222-Add-CraftMagicNumbers.isSupportedApiVersion.patch rename to patches/removed/1.19.3-paper-plugins/server/0223-Add-CraftMagicNumbers.isSupportedApiVersion.patch index ed7c5137a2..1ee7037234 100644 --- a/patches/server/0222-Add-CraftMagicNumbers.isSupportedApiVersion.patch +++ b/patches/removed/1.19.3-paper-plugins/server/0223-Add-CraftMagicNumbers.isSupportedApiVersion.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add CraftMagicNumbers.isSupportedApiVersion() diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 176d5bdc5bf048940ceb46dd0a69d9fb7d39821f..9c189cc0596301c16e84f7df39b983a4392583d2 100644 +index cbb161e3daa0250ae2e12e3cec972708fccaeadc..4d74e7755d3812746d9e9014046c5c22f400deec 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -429,6 +429,11 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -453,6 +453,11 @@ public final class CraftMagicNumbers implements UnsafeValues { public com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() { return new com.destroystokyo.paper.PaperVersionFetcher(); } diff --git a/patches/server/0004-Test-changes.patch b/patches/server/0004-Test-changes.patch new file mode 100644 index 0000000000..249ce8aa70 --- /dev/null +++ b/patches/server/0004-Test-changes.patch @@ -0,0 +1,281 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Mon, 13 Feb 2023 14:14:56 -0800 +Subject: [PATCH] Test changes + + +diff --git a/build.gradle.kts b/build.gradle.kts +index 064a0c5b2a4b379ceec84652ff1e004d57419115..218a0db30ac8e4403da4ee50ca0a67ca7bda40e4 100644 +--- a/build.gradle.kts ++++ b/build.gradle.kts +@@ -12,6 +12,7 @@ dependencies { + implementation("org.apache.logging.log4j:log4j-iostreams:2.19.0") // Paper - remove exclusion + implementation("org.ow2.asm:asm:9.3") + implementation("org.ow2.asm:asm-commons:9.3") // Paper - ASM event executor generation ++ testImplementation("org.mockito:mockito-core:4.9.0") // Paper - switch to mockito + implementation("commons-lang:commons-lang:2.6") + runtimeOnly("org.xerial:sqlite-jdbc:3.36.0.3") + runtimeOnly("mysql:mysql-connector-java:8.0.29") +diff --git a/src/test/java/io/papermc/paper/testing/DummyServer.java b/src/test/java/io/papermc/paper/testing/DummyServer.java +new file mode 100644 +index 0000000000000000000000000000000000000000..c6503ff76f56bab5f383f0ca17d137155e9be447 +--- /dev/null ++++ b/src/test/java/io/papermc/paper/testing/DummyServer.java +@@ -0,0 +1,67 @@ ++package io.papermc.paper.testing; ++ ++import java.util.logging.Logger; ++import org.bukkit.Bukkit; ++import org.bukkit.Material; ++import org.bukkit.NamespacedKey; ++import org.bukkit.Server; ++import org.bukkit.command.SimpleCommandMap; ++import org.bukkit.craftbukkit.CraftRegistry; ++import org.bukkit.craftbukkit.block.data.CraftBlockData; ++import org.bukkit.craftbukkit.inventory.CraftItemFactory; ++import org.bukkit.craftbukkit.util.CraftMagicNumbers; ++import org.bukkit.craftbukkit.util.CraftNamespacedKey; ++import org.bukkit.plugin.PluginManager; ++import org.bukkit.plugin.SimplePluginManager; ++import org.bukkit.support.AbstractTestingBase; ++import org.mockito.Mockito; ++ ++import static org.mockito.Mockito.any; ++import static org.mockito.Mockito.mock; ++import static org.mockito.Mockito.when; ++ ++public final class DummyServer { ++ ++ @SuppressWarnings({"deprecation", "removal"}) ++ public static void setup() { ++ //noinspection ConstantValue ++ if (Bukkit.getServer() != null) { ++ return; ++ } ++ ++ final Server dummyServer = mock(Server.class, Mockito.withSettings().stubOnly()); ++ ++ final Logger logger = Logger.getLogger(DummyServer.class.getCanonicalName()); ++ when(dummyServer.getLogger()).thenReturn(logger); ++ when(dummyServer.getName()).thenReturn(DummyServer.class.getSimpleName()); ++ when(dummyServer.getVersion()).thenReturn("Version_" + DummyServer.class.getPackage().getImplementationVersion()); ++ when(dummyServer.getBukkitVersion()).thenReturn("BukkitVersion_" + DummyServer.class.getPackage().getImplementationVersion()); ++ ++ final Thread currentThread = Thread.currentThread(); ++ when(dummyServer.isPrimaryThread()).thenAnswer(ignored -> Thread.currentThread().equals(currentThread)); ++ ++ when(dummyServer.getItemFactory()).thenReturn(CraftItemFactory.instance()); ++ ++ when(dummyServer.getUnsafe()).thenAnswer(ignored -> CraftMagicNumbers.INSTANCE); // lambda for lazy load ++ ++ when(dummyServer.createBlockData(any(Material.class))).thenAnswer(invocation -> { ++ return CraftBlockData.newData(invocation.getArgument(0, Material.class), null); ++ }); ++ ++ when(dummyServer.getLootTable(any(NamespacedKey.class))).thenAnswer(invocation -> { ++ final NamespacedKey key = invocation.getArgument(0, NamespacedKey.class); ++ return new org.bukkit.craftbukkit.CraftLootTable(key, AbstractTestingBase.DATA_PACK.getLootTables().get(CraftNamespacedKey.toMinecraft(key))); ++ }); ++ ++ when(dummyServer.getRegistry(any())).thenAnswer(invocation -> { ++ // LazyRegistry because the vanilla data hasn't been bootstrapped yet. ++ return new LazyRegistry(() -> CraftRegistry.createRegistry(invocation.getArgument(0, Class.class), AbstractTestingBase.REGISTRY_CUSTOM)); ++ }); ++ ++ final PluginManager pluginManager = new SimplePluginManager(dummyServer, new SimpleCommandMap(dummyServer)); ++ when(dummyServer.getPluginManager()).thenReturn(pluginManager); ++ ++ Bukkit.setServer(dummyServer); ++ ++ } ++} +diff --git a/src/test/java/io/papermc/paper/testing/LazyRegistry.java b/src/test/java/io/papermc/paper/testing/LazyRegistry.java +new file mode 100644 +index 0000000000000000000000000000000000000000..8dd0df8c2cc25d37a2590a07872682230a9335f2 +--- /dev/null ++++ b/src/test/java/io/papermc/paper/testing/LazyRegistry.java +@@ -0,0 +1,23 @@ ++package io.papermc.paper.testing; ++ ++import java.util.Iterator; ++import java.util.function.Supplier; ++import org.bukkit.Keyed; ++import org.bukkit.NamespacedKey; ++import org.bukkit.Registry; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; ++ ++public record LazyRegistry(Supplier> supplier) implements Registry { ++ ++ @NotNull ++ @Override ++ public Iterator iterator() { ++ return this.supplier().get().iterator(); ++ } ++ ++ @Override ++ public @Nullable Keyed get(@NotNull final NamespacedKey key) { ++ return this.supplier().get().get(key); ++ } ++} +diff --git a/src/test/java/org/bukkit/support/AbstractTestingBase.java b/src/test/java/org/bukkit/support/AbstractTestingBase.java +index 492c1ec28a9f1facb117d05245b32231554385ad..8013cc99c063d2ca0c578c093e3112676f5361b7 100644 +--- a/src/test/java/org/bukkit/support/AbstractTestingBase.java ++++ b/src/test/java/org/bukkit/support/AbstractTestingBase.java +@@ -2,7 +2,6 @@ package org.bukkit.support; + + import com.google.common.collect.ImmutableList; + import com.google.common.util.concurrent.MoreExecutors; +-import java.util.Collections; + import java.util.List; + import net.minecraft.SharedConstants; + import net.minecraft.commands.Commands; +@@ -49,6 +48,7 @@ public abstract class AbstractTestingBase { + LayeredRegistryAccess layers = RegistryLayer.createRegistryAccess(); + layers = WorldLoader.loadAndReplaceLayer(resourceManager, layers, RegistryLayer.WORLDGEN, RegistryDataLoader.WORLDGEN_REGISTRIES); + REGISTRY_CUSTOM = layers.compositeAccess().freeze(); ++ io.papermc.paper.testing.DummyServer.setup(); // Paper + // Register vanilla pack + DATA_PACK = ReloadableServerResources.loadResources(resourceManager, REGISTRY_CUSTOM, FeatureFlags.REGISTRY.allFlags(), Commands.CommandSelection.DEDICATED, 0, MoreExecutors.directExecutor(), MoreExecutors.directExecutor()).join(); + // Bind tags +@@ -56,7 +56,6 @@ public abstract class AbstractTestingBase { + // Biome shortcut + BIOMES = REGISTRY_CUSTOM.registryOrThrow(Registries.BIOME); + +- DummyServer.setup(); + DummyEnchantments.setup(); + + ImmutableList.Builder builder = ImmutableList.builder(); +diff --git a/src/test/java/org/bukkit/support/DummyServer.java b/src/test/java/org/bukkit/support/DummyServer.java +deleted file mode 100644 +index 946497353a64421592d2bae012c9a3cb874dd5b8..0000000000000000000000000000000000000000 +--- a/src/test/java/org/bukkit/support/DummyServer.java ++++ /dev/null +@@ -1,127 +0,0 @@ +-package org.bukkit.support; +- +-import java.lang.reflect.InvocationHandler; +-import java.lang.reflect.Method; +-import java.lang.reflect.Proxy; +-import java.util.HashMap; +-import java.util.logging.Logger; +-import org.bukkit.Bukkit; +-import org.bukkit.Material; +-import org.bukkit.NamespacedKey; +-import org.bukkit.Server; +-import org.bukkit.craftbukkit.CraftLootTable; +-import org.bukkit.craftbukkit.CraftRegistry; +-import org.bukkit.craftbukkit.block.data.CraftBlockData; +-import org.bukkit.craftbukkit.inventory.CraftItemFactory; +-import org.bukkit.craftbukkit.util.CraftMagicNumbers; +-import org.bukkit.craftbukkit.util.CraftNamespacedKey; +-import org.bukkit.craftbukkit.util.Versioning; +- +-public final class DummyServer implements InvocationHandler { +- private static interface MethodHandler { +- Object handle(DummyServer server, Object[] args); +- } +- private static final HashMap methods = new HashMap(); +- static { +- try { +- methods.put( +- Server.class.getMethod("getItemFactory"), +- new MethodHandler() { +- @Override +- public Object handle(DummyServer server, Object[] args) { +- return CraftItemFactory.instance(); +- } +- } +- ); +- methods.put( +- Server.class.getMethod("getName"), +- new MethodHandler() { +- @Override +- public Object handle(DummyServer server, Object[] args) { +- return DummyServer.class.getName(); +- } +- } +- ); +- methods.put( +- Server.class.getMethod("getVersion"), +- new MethodHandler() { +- @Override +- public Object handle(DummyServer server, Object[] args) { +- return DummyServer.class.getPackage().getImplementationVersion(); +- } +- } +- ); +- methods.put( +- Server.class.getMethod("getBukkitVersion"), +- new MethodHandler() { +- @Override +- public Object handle(DummyServer server, Object[] args) { +- return Versioning.getBukkitVersion(); +- } +- } +- ); +- methods.put( +- Server.class.getMethod("getLogger"), +- new MethodHandler() { +- final Logger logger = Logger.getLogger(DummyServer.class.getCanonicalName()); +- @Override +- public Object handle(DummyServer server, Object[] args) { +- return logger; +- } +- } +- ); +- methods.put( +- Server.class.getMethod("getUnsafe"), +- new MethodHandler() { +- @Override +- public Object handle(DummyServer server, Object[] args) { +- return CraftMagicNumbers.INSTANCE; +- } +- } +- ); +- methods.put( +- Server.class.getMethod("createBlockData", Material.class), +- new MethodHandler() { +- final Logger logger = Logger.getLogger(DummyServer.class.getCanonicalName()); +- @Override +- public Object handle(DummyServer server, Object[] args) { +- return CraftBlockData.newData((Material) args[0], null); +- } +- } +- ); +- methods.put(Server.class.getMethod("getLootTable", NamespacedKey.class), +- new MethodHandler() { +- @Override +- public Object handle(DummyServer server, Object[] args) { +- NamespacedKey key = (NamespacedKey) args[0]; +- return new CraftLootTable(key, AbstractTestingBase.DATA_PACK.getLootTables().get(CraftNamespacedKey.toMinecraft(key))); +- } +- } +- ); +- methods.put(Server.class.getMethod("getRegistry", Class.class), +- new MethodHandler() { +- @Override +- public Object handle(DummyServer server, Object[] args) { +- return CraftRegistry.createRegistry((Class) args[0], AbstractTestingBase.REGISTRY_CUSTOM); +- } +- } +- ); +- Bukkit.setServer(Proxy.getProxyClass(Server.class.getClassLoader(), Server.class).asSubclass(Server.class).getConstructor(InvocationHandler.class).newInstance(new DummyServer())); +- } catch (Throwable t) { +- throw new Error(t); +- } +- } +- +- public static void setup() {} +- +- private DummyServer() {}; +- +- @Override +- public Object invoke(Object proxy, Method method, Object[] args) { +- MethodHandler handler = DummyServer.methods.get(method); +- if (handler != null) { +- return handler.handle(this, args); +- } +- throw new UnsupportedOperationException(String.valueOf(method)); +- } +-} diff --git a/patches/server/0004-Paper-config-files.patch b/patches/server/0005-Paper-config-files.patch similarity index 99% rename from patches/server/0004-Paper-config-files.patch rename to patches/server/0005-Paper-config-files.patch index 488d7a0304..354e5b4410 100644 --- a/patches/server/0004-Paper-config-files.patch +++ b/patches/server/0005-Paper-config-files.patch @@ -14,13 +14,13 @@ public org.spigotmc.SpigotWorldConfig getString(Ljava/lang/String;Ljava/lang/Str public net.minecraft.world.level.NaturalSpawner SPAWNING_CATEGORIES diff --git a/build.gradle.kts b/build.gradle.kts -index a2d2c817cdc1798cd30b3a852b3a495bcbe1b91b..ebf3d64afbb5679b97a7565a2f8e5490e4a38275 100644 +index 218a0db30ac8e4403da4ee50ca0a67ca7bda40e4..4ccaf2ac6f6ff3310ca2f0a0672875f2ab1f718f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts -@@ -12,6 +12,7 @@ dependencies { - implementation("org.apache.logging.log4j:log4j-iostreams:2.19.0") // Paper - remove exclusion +@@ -13,6 +13,7 @@ dependencies { implementation("org.ow2.asm:asm:9.3") implementation("org.ow2.asm:asm-commons:9.3") // Paper - ASM event executor generation + testImplementation("org.mockito:mockito-core:4.9.0") // Paper - switch to mockito + implementation("org.spongepowered:configurate-yaml:4.1.2") // Paper - config files implementation("commons-lang:commons-lang:2.6") runtimeOnly("org.xerial:sqlite-jdbc:3.36.0.3") @@ -1448,7 +1448,7 @@ index 0000000000000000000000000000000000000000..1bb16fc7598cd53e822d84b69d6a9727 +} diff --git a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java new file mode 100644 -index 0000000000000000000000000000000000000000..2e9590c73d867c3ebb42f695df4c796a0f477452 +index 0000000000000000000000000000000000000000..4532f3a0d74feae0a1249b53e1bfbc18a8808b32 --- /dev/null +++ b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java @@ -0,0 +1,475 @@ @@ -4002,7 +4002,7 @@ index 0000000000000000000000000000000000000000..fdc906b106a5c6fff2675d5399650f5b +} diff --git a/src/main/java/io/papermc/paper/configuration/type/EngineMode.java b/src/main/java/io/papermc/paper/configuration/type/EngineMode.java new file mode 100644 -index 0000000000000000000000000000000000000000..99e90636051fa0c770ee2eafb7f0d29c8195f9ae +index 0000000000000000000000000000000000000000..7f8b685762f59049fde88e8d1bc10e1504916010 --- /dev/null +++ b/src/main/java/io/papermc/paper/configuration/type/EngineMode.java @@ -0,0 +1,37 @@ @@ -4013,7 +4013,7 @@ index 0000000000000000000000000000000000000000..99e90636051fa0c770ee2eafb7f0d29c + +public enum EngineMode { + -+ HIDE(1, "hide ores"), OBFUSCATE(2, "obfuscate"); ++ HIDE(1, "hide ores"), OBFUSCATE(2, "obfuscate"), OBFUSCATE_LAYER(3, "obfuscate layer"); + + public static final ScalarSerializer SERIALIZER = new EngineModeSerializer(); + @@ -4576,7 +4576,7 @@ index 9afc0881f6891ef2696b6f2b37c0826f3beb0666..8873bf84c71c48297a360df9c99e511f world.serverLevelData.setDifficulty(config.difficulty); world.setSpawnSettings(config.spawnMonsters, config.spawnAnimals); diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 16c38195c3e4f5550122df0d65fcce8ca3a83822..1d4f6e7fcfaaee40b06f74d250d04f7a36b6458b 100644 +index 8842ac222e0dea1afb7ba4584512147bb53ccb56..7e9381fcdaafb15b22d9f79592422b165b3e2523 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -131,6 +131,19 @@ public class Main { @@ -4660,12 +4660,12 @@ index 0000000000000000000000000000000000000000..0396589795da1f83ddf62426236dde9a + } +} diff --git a/src/test/java/org/bukkit/support/AbstractTestingBase.java b/src/test/java/org/bukkit/support/AbstractTestingBase.java -index 492c1ec28a9f1facb117d05245b32231554385ad..abf31f0fc3e68f3702f0500dbff7bb9d8be26887 100644 +index 007239914bd48263b83112c2b82a5d6406dcdbdc..3d9ece71fecd5151bb3862282f6021df2d73e3dc 100644 --- a/src/test/java/org/bukkit/support/AbstractTestingBase.java +++ b/src/test/java/org/bukkit/support/AbstractTestingBase.java -@@ -58,6 +58,7 @@ public abstract class AbstractTestingBase { +@@ -57,6 +57,7 @@ public abstract class AbstractTestingBase { + BIOMES = REGISTRY_CUSTOM.registryOrThrow(Registries.BIOME); - DummyServer.setup(); DummyEnchantments.setup(); + io.papermc.paper.configuration.GlobalConfigTestingBase.setupGlobalConfigForTest(); // Paper diff --git a/patches/server/0005-MC-Dev-fixes.patch b/patches/server/0006-MC-Dev-fixes.patch similarity index 100% rename from patches/server/0005-MC-Dev-fixes.patch rename to patches/server/0006-MC-Dev-fixes.patch diff --git a/patches/server/0006-ConcurrentUtil.patch b/patches/server/0007-ConcurrentUtil.patch similarity index 100% rename from patches/server/0006-ConcurrentUtil.patch rename to patches/server/0007-ConcurrentUtil.patch diff --git a/patches/server/0007-CB-fixes.patch b/patches/server/0008-CB-fixes.patch similarity index 100% rename from patches/server/0007-CB-fixes.patch rename to patches/server/0008-CB-fixes.patch diff --git a/patches/server/0008-MC-Utils.patch b/patches/server/0009-MC-Utils.patch similarity index 99% rename from patches/server/0008-MC-Utils.patch rename to patches/server/0009-MC-Utils.patch index 79db606372..6949088e48 100644 --- a/patches/server/0008-MC-Utils.patch +++ b/patches/server/0009-MC-Utils.patch @@ -6523,7 +6523,7 @@ index 8309eb14140ebcf62ae7be1dfa0177ac7fcf83d7..8784b0702f10eb7582c309c15f18fe13 public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) { // Holder holder = worlddimension.type(); // CraftBukkit - decompile error diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 957e816429fdf1ab5e3f4431a3d19340cccea837..48972d64710fb0d3821e7c1a0722a1d203c47e07 100644 +index f7c5f0cd9d467305c123d3e86c5723055424600e..56016d59d66d90de2ac4326c16b09f86e4ac390b 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -247,6 +247,8 @@ public class ServerPlayer extends Player { @@ -6683,7 +6683,7 @@ index a0b5895abc88d297045e05f25bb09527991d43f0..6e0bd0eab0b06a4ac3042496bbb91292 super(type, world); this.xpReward = 5; diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index 1f7fe7995d3ecc1a47717927f5f2f74b8d99b33d..489cb50f70589c87dd8fb57087e5fa14fd5e1c43 100644 +index 6439fcbbd31158ce7a8ccf191b47d95911c8c3c2..cf810a1d645dd63595702a5f07456cd48393ee79 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java @@ -759,6 +759,25 @@ public final class ItemStack { @@ -7297,7 +7297,7 @@ index f66369ddaeab5c5ac643c0979dac3ed21337ff71..038abf2ac104ceecaab11b10d466ea69 return false; } else { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 6ca724889789f9ed3244991517b2d6ecb3bf8af8..1220c2f67ead85fdc0ca26a2fbee6a483a876975 100644 +index dc8f094dea2fd46fe4d860536908a42e4b5806a1..57ed87689c7cb709d54e611bfbdbb70890021df2 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -233,8 +233,8 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -7320,7 +7320,7 @@ index 6ca724889789f9ed3244991517b2d6ecb3bf8af8..1220c2f67ead85fdc0ca26a2fbee6a48 if (playerChunk == null) return false; playerChunk.getTickingChunkFuture().thenAccept(either -> { -@@ -1943,4 +1943,32 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -1959,4 +1959,32 @@ public class CraftWorld extends CraftRegionAccessor implements World { return this.spigot; } // Spigot end @@ -7618,13 +7618,13 @@ index 0000000000000000000000000000000000000000..909b2c98e7a9117d2f737245e4661792 + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 5499bdbd0d5e81f2e7dcf784eb80217082090010..ef2640eb9e98e9ce81abc604cc1c2264e0137ef6 100644 +index 8ded1f61a6088cf57847a409421e92e2d2007158..b39ded554ee86bf840ce04eba58ac19d40226c9f 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -99,8 +99,17 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -102,8 +102,17 @@ public final class CraftMagicNumbers implements UnsafeValues { + private static final BiMap FLUIDTYPE_FLUID = HashBiMap.create(); private static final Map MATERIAL_ITEM = new HashMap<>(); private static final Map MATERIAL_BLOCK = new HashMap<>(); - private static final Map MATERIAL_FLUID = new HashMap<>(); + // Paper start + private static final Map> ENTITY_TYPE_ENTITY_TYPES = new HashMap<>(); + private static final Map, org.bukkit.entity.EntityType> ENTITY_TYPES_ENTITY_TYPE = new HashMap<>(); @@ -7639,7 +7639,7 @@ index 5499bdbd0d5e81f2e7dcf784eb80217082090010..ef2640eb9e98e9ce81abc604cc1c2264 for (Block block : BuiltInRegistries.BLOCK) { BLOCK_MATERIAL.put(block, Material.getMaterial(BuiltInRegistries.BLOCK.getKey(block).getPath().toUpperCase(Locale.ROOT))); } -@@ -166,6 +175,14 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -167,6 +176,14 @@ public final class CraftMagicNumbers implements UnsafeValues { public static ResourceLocation key(Material mat) { return CraftNamespacedKey.toMinecraft(mat.getKey()); } diff --git a/patches/server/0009-Adventure.patch b/patches/server/0010-Adventure.patch similarity index 98% rename from patches/server/0009-Adventure.patch rename to patches/server/0010-Adventure.patch index 0904ed2ccc..e6f732e95f 100644 --- a/patches/server/0009-Adventure.patch +++ b/patches/server/0010-Adventure.patch @@ -2071,7 +2071,7 @@ index 0f7dd33d51281b383be0fb47d4e6b133f123ce1f..011c3d2dbd34dd0c2afba477202c937c } diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 48972d64710fb0d3821e7c1a0722a1d203c47e07..6a8c67dc668c775809227b455b2dd522ea0dd70b 100644 +index 56016d59d66d90de2ac4326c16b09f86e4ac390b..e06b2a8eece6f179e4a3f38754fd8d9e7b69bdc4 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -156,6 +156,7 @@ import net.minecraft.world.scores.Score; @@ -2160,7 +2160,7 @@ index 48972d64710fb0d3821e7c1a0722a1d203c47e07..6a8c67dc668c775809227b455b2dd522 // CraftBukkit end this.chatVisibility = packet.chatVisibility(); diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 478d40c7cc0374cddb76486b6bd148a846a16813..f4502ebedb31b101faa6c99c4fa51fb5b4fdf3f0 100644 +index 478d40c7cc0374cddb76486b6bd148a846a16813..032a21ffd22630c0d4d0456ac651b05105449350 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -185,6 +185,8 @@ import net.minecraft.world.phys.shapes.VoxelShape; @@ -2269,7 +2269,20 @@ index 478d40c7cc0374cddb76486b6bd148a846a16813..f4502ebedb31b101faa6c99c4fa51fb5 Player player = this.getCraftPlayer(); AsyncPlayerChatEvent event = new AsyncPlayerChatEvent(async, player, s, new LazyPlayerSet(this.server)); String originalFormat = event.getFormat(), originalMessage = event.getMessage(); -@@ -2980,30 +2992,30 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2357,6 +2369,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic + } + + public void sendPlayerChatMessage(PlayerChatMessage message, ChatType.Bound params) { ++ // Paper start ++ if (!this.getCraftPlayer().canSee(message.link().sender())) { ++ this.sendDisguisedChatMessage(message.decoratedContent(), params); ++ return; ++ } ++ // Paper end + this.send(new ClientboundPlayerChatPacket(message.link().sender(), message.link().index(), message.signature(), message.signedBody().pack(this.messageSignatureCache), message.unsignedContent(), message.filterMask(), params.toNetwork(this.player.level.registryAccess()))); + this.addPendingMessage(message); + } +@@ -2980,30 +2998,30 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic return; } @@ -2349,7 +2362,7 @@ index be097f13dba5d408f58d6fada893bed2638d4219..3d7d1ba148dbc3591d8c76b99a2ee7d9 @Override diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 25227822aa0e1dd7fbbe98a0925ccd023af8d0dc..8c1937ff71b8b4dad85e20b55dcf2a0cc06ce2df 100644 +index 25227822aa0e1dd7fbbe98a0925ccd023af8d0dc..dfd2f3ba256edc64e0016e7816ccefff9e7b1b7a 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -8,6 +8,7 @@ import com.mojang.logging.LogUtils; @@ -2487,7 +2500,7 @@ index 25227822aa0e1dd7fbbe98a0925ccd023af8d0dc..8c1937ff71b8b4dad85e20b55dcf2a0c boolean flag = this.verifyChatTrusted(message); - this.server.logChatMessage(message.decoratedContent(), params, flag ? null : "Not Secure"); -+ this.server.logChatMessage((unsignedFunction == null ? Component.literal(message.signedContent()) : unsignedFunction.apply(this.server.console)), params, flag ? null : "Not Secure"); // Paper ++ this.server.logChatMessage((unsignedFunction == null ? message.decoratedContent() : unsignedFunction.apply(this.server.console)), params, flag ? null : "Not Secure"); // Paper OutgoingChatMessage outgoingchatmessage = OutgoingChatMessage.create(message); boolean flag1 = false; @@ -2772,7 +2785,7 @@ index f29395b6bf9eebd4830bbcda7d96085fb8e3d8b0..877a104e3899debd387544b740896ffb + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 1220c2f67ead85fdc0ca26a2fbee6a483a876975..d0476e736610c8afb21c7b1fcfc17cf44309fd68 100644 +index 57ed87689c7cb709d54e611bfbdbb70890021df2..fd1da8431578832bcd1f3ca7890dd2150b916ebd 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -149,6 +149,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -2783,7 +2796,7 @@ index 1220c2f67ead85fdc0ca26a2fbee6a483a876975..d0476e736610c8afb21c7b1fcfc17cf4 private static final Random rand = new Random(); -@@ -1970,5 +1971,18 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -1986,5 +1987,18 @@ public class CraftWorld extends CraftRegionAccessor implements World { return ret; } @@ -3233,7 +3246,7 @@ index 5f6d4f553cab8f20c2049c706e69de3d79701dfd..55bf95017d58bb61f9c6af27335c8842 @Override public boolean isPermissionSet(String name) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -index ef3d6450b2ae2274b7e40c621aa30da279313669..19549dda26c24388bd13a5a2579789e2d1e3ad88 100644 +index aea8bdbfe0c16c664d787e8abcd189f1019fccce..e38c32708ac7969dbc342989d2a5a767e26e4c3d 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java @@ -321,9 +321,12 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { @@ -3285,7 +3298,7 @@ index 446fdca49a5a6999626a7ee3a1d5c168b15a09dd..f9863e138994f6c7a7975a852f106faa public boolean isOp() { return true; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index d2be98416529aea3bdbedd0ea7131bd8de2a0162..6bf9efe1f6c06fd2adaf68cd360482f252903c8c 100644 +index 87c9e95a184e316d1273debc9fc5f3ff6a5aa91f..8a78d0bde6f833b745c8a125bc251eb13ab2bb50 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -277,14 +277,39 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -3404,7 +3417,7 @@ index d2be98416529aea3bdbedd0ea7131bd8de2a0162..6bf9efe1f6c06fd2adaf68cd360482f2 @Override public void setCompassTarget(Location loc) { if (this.getHandle().connection == null) return; -@@ -670,6 +712,35 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -683,6 +725,35 @@ public class CraftPlayer extends CraftHumanEntity implements Player { this.getHandle().connection.send(packet); } @@ -3440,7 +3453,7 @@ index d2be98416529aea3bdbedd0ea7131bd8de2a0162..6bf9efe1f6c06fd2adaf68cd360482f2 @Override public void sendSignChange(Location loc, String[] lines) { this.sendSignChange(loc, lines, DyeColor.BLACK); -@@ -697,14 +768,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -710,14 +781,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } Component[] components = CraftSign.sanitizeLines(lines); @@ -3458,7 +3471,20 @@ index d2be98416529aea3bdbedd0ea7131bd8de2a0162..6bf9efe1f6c06fd2adaf68cd360482f2 } @Override -@@ -1475,7 +1547,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1351,6 +1423,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player { + return !this.hiddenEntities.containsKey(entity.getUniqueId()); + } + ++ // Paper start ++ public boolean canSee(UUID entityUUID) { ++ return !this.hiddenEntities.containsKey(entityUUID); ++ } ++ // Paper end ++ + @Override + public Map serialize() { + Map result = new LinkedHashMap(); +@@ -1488,7 +1566,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override public void setResourcePack(String url) { @@ -3467,7 +3493,7 @@ index d2be98416529aea3bdbedd0ea7131bd8de2a0162..6bf9efe1f6c06fd2adaf68cd360482f2 } @Override -@@ -1490,7 +1562,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1503,7 +1581,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override public void setResourcePack(String url, byte[] hash, boolean force) { @@ -3476,7 +3502,7 @@ index d2be98416529aea3bdbedd0ea7131bd8de2a0162..6bf9efe1f6c06fd2adaf68cd360482f2 } @Override -@@ -1506,6 +1578,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1519,6 +1597,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } } @@ -3498,7 +3524,7 @@ index d2be98416529aea3bdbedd0ea7131bd8de2a0162..6bf9efe1f6c06fd2adaf68cd360482f2 public void addChannel(String channel) { Preconditions.checkState(this.channels.size() < 128, "Cannot register channel '%s'. Too many channels registered!", channel); channel = StandardMessenger.validateAndCorrectChannel(channel); -@@ -1910,6 +1997,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1923,6 +2016,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player { return (this.getHandle().clientViewDistance == null) ? Bukkit.getViewDistance() : this.getHandle().clientViewDistance; } @@ -3511,7 +3537,7 @@ index d2be98416529aea3bdbedd0ea7131bd8de2a0162..6bf9efe1f6c06fd2adaf68cd360482f2 @Override public int getPing() { return this.getHandle().latency; -@@ -1955,6 +2048,254 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1968,6 +2067,254 @@ public class CraftPlayer extends CraftHumanEntity implements Player { return this.getHandle().allowsListing(); } @@ -4537,10 +4563,10 @@ index 78ea79b66cc9e90402ef5cdc2e5e04e0c74b1c26..4fede2161792ba3e7cdf0cc5a1f53318 boolean hadFormat = false; diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index ef2640eb9e98e9ce81abc604cc1c2264e0137ef6..92cf1be3a9e188307e6d4e8e710fa67af2bafa9d 100644 +index b39ded554ee86bf840ce04eba58ac19d40226c9f..750f4b3930278c291f10015c7a8a8df57d04a286 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -68,6 +68,43 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -72,6 +72,43 @@ public final class CraftMagicNumbers implements UnsafeValues { private CraftMagicNumbers() {} diff --git a/patches/server/0010-Paper-command.patch b/patches/server/0011-Paper-command.patch similarity index 100% rename from patches/server/0010-Paper-command.patch rename to patches/server/0011-Paper-command.patch diff --git a/patches/server/0011-Paper-Metrics.patch b/patches/server/0012-Paper-Metrics.patch similarity index 100% rename from patches/server/0011-Paper-Metrics.patch rename to patches/server/0012-Paper-Metrics.patch diff --git a/patches/server/0013-Paper-Plugins.patch b/patches/server/0013-Paper-Plugins.patch new file mode 100644 index 0000000000..6152aa959b --- /dev/null +++ b/patches/server/0013-Paper-Plugins.patch @@ -0,0 +1,7199 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> +Date: Wed, 6 Jul 2022 23:00:31 -0400 +Subject: [PATCH] Paper Plugins + + +diff --git a/src/main/java/io/papermc/paper/command/PaperCommand.java b/src/main/java/io/papermc/paper/command/PaperCommand.java +index b3a58bf4b654e336826dc04da9e2f80ff8b9a9a7..156334e3876d966fedc91d18da29f562395ab182 100644 +--- a/src/main/java/io/papermc/paper/command/PaperCommand.java ++++ b/src/main/java/io/papermc/paper/command/PaperCommand.java +@@ -4,6 +4,7 @@ import io.papermc.paper.command.subcommands.EntityCommand; + import io.papermc.paper.command.subcommands.HeapDumpCommand; + import io.papermc.paper.command.subcommands.ReloadCommand; + import io.papermc.paper.command.subcommands.VersionCommand; ++import io.papermc.paper.command.subcommands.DumpPluginsCommand; + import it.unimi.dsi.fastutil.Pair; + import java.util.ArrayList; + import java.util.Arrays; +@@ -40,6 +41,7 @@ public final class PaperCommand extends Command { + commands.put(Set.of("entity"), new EntityCommand()); + commands.put(Set.of("reload"), new ReloadCommand()); + commands.put(Set.of("version"), new VersionCommand()); ++ commands.put(Set.of("dumpplugins"), new DumpPluginsCommand()); + + return commands.entrySet().stream() + .flatMap(entry -> entry.getKey().stream().map(s -> Map.entry(s, entry.getValue()))) +diff --git a/src/main/java/io/papermc/paper/command/PaperCommands.java b/src/main/java/io/papermc/paper/command/PaperCommands.java +index 6a00f3d38da8107825ab1d405f337fd077b09f72..d44d0074446c1c54e87dc8078dff7fef1d92f343 100644 +--- a/src/main/java/io/papermc/paper/command/PaperCommands.java ++++ b/src/main/java/io/papermc/paper/command/PaperCommands.java +@@ -23,5 +23,6 @@ public final class PaperCommands { + COMMANDS.forEach((s, command) -> { + server.server.getCommandMap().register(s, "Paper", command); + }); ++ server.server.getCommandMap().register("bukkit", new PaperPluginsCommand()); + } + } +diff --git a/src/main/java/io/papermc/paper/command/PaperPluginsCommand.java b/src/main/java/io/papermc/paper/command/PaperPluginsCommand.java +new file mode 100644 +index 0000000000000000000000000000000000000000..f0fce4113fb07c64adbec029d177c236cbdcbae8 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/command/PaperPluginsCommand.java +@@ -0,0 +1,215 @@ ++package io.papermc.paper.command; ++ ++import com.google.common.collect.Lists; ++import io.leangen.geantyref.GenericTypeReflector; ++import io.leangen.geantyref.TypeToken; ++import io.papermc.paper.plugin.configuration.PluginMeta; ++import io.papermc.paper.plugin.entrypoint.Entrypoint; ++import io.papermc.paper.plugin.entrypoint.LaunchEntryPointHandler; ++import io.papermc.paper.plugin.provider.PluginProvider; ++import io.papermc.paper.plugin.provider.ProviderStatus; ++import io.papermc.paper.plugin.provider.ProviderStatusHolder; ++import io.papermc.paper.plugin.provider.type.paper.PaperPluginParent; ++import io.papermc.paper.plugin.provider.type.spigot.SpigotPluginProvider; ++import net.kyori.adventure.text.Component; ++import net.kyori.adventure.text.JoinConfiguration; ++import net.kyori.adventure.text.TextComponent; ++import net.kyori.adventure.text.event.ClickEvent; ++import net.kyori.adventure.text.format.NamedTextColor; ++import net.kyori.adventure.text.format.TextColor; ++import org.bukkit.Bukkit; ++import org.bukkit.command.CommandSender; ++import org.bukkit.command.defaults.BukkitCommand; ++import org.bukkit.craftbukkit.util.CraftMagicNumbers; ++import org.bukkit.plugin.Plugin; ++import org.bukkit.plugin.java.JavaPlugin; ++import org.jetbrains.annotations.NotNull; ++ ++import java.lang.reflect.Type; ++import java.util.ArrayList; ++import java.util.Arrays; ++import java.util.Collections; ++import java.util.List; ++import java.util.TreeMap; ++ ++public class PaperPluginsCommand extends BukkitCommand { ++ ++ private static final TextColor INFO_COLOR = TextColor.color(52, 159, 218); ++ ++ // TODO: LINK? ++ private static final Component SERVER_PLUGIN_INFO = Component.text("ℹ What is a server plugin?", INFO_COLOR) ++ .append(asPlainComponents(""" ++ Server plugins can add new behavior to your server! ++ You can find new plugins on Paper's plugin repository, Hangar. ++ ++ ++ """)); ++ ++ private static final Component SERVER_INITIALIZER_INFO = Component.text("ℹ What is a server initializer?", INFO_COLOR) ++ .append(asPlainComponents(""" ++ Server initializers are ran before your server ++ starts and are provided by paper plugins. ++ """)); ++ ++ private static final Component LEGACY_PLUGIN_INFO = Component.text("ℹ What is a legacy plugin?", INFO_COLOR) ++ .append(asPlainComponents(""" ++ A legacy plugin is a plugin that was made on ++ very old unsupported versions of the game. ++ ++ It is encouraged that you replace this plugin, ++ as they might not work in the future and may cause ++ performance issues. ++ """)); ++ ++ private static final Component LEGACY_PLUGIN_STAR = Component.text('*', TextColor.color(255, 212, 42)).hoverEvent(LEGACY_PLUGIN_INFO); ++ private static final Component INFO_ICON_START = Component.text("ℹ ", INFO_COLOR); ++ private static final Component PAPER_HEADER = Component.text("Paper Plugins:", TextColor.color(2, 136, 209)); ++ private static final Component BUKKIT_HEADER = Component.text("Bukkit Plugins:", TextColor.color(237, 129, 6)); ++ private static final Component PLUGIN_TICK = Component.text("- ", NamedTextColor.DARK_GRAY); ++ private static final Component PLUGIN_TICK_EMPTY = Component.text(" "); ++ ++ private static final Type JAVA_PLUGIN_PROVIDER_TYPE = new TypeToken>() {}.getType(); ++ ++ public PaperPluginsCommand() { ++ super("plugins"); ++ this.description = "Gets a list of plugins running on the server"; ++ this.usageMessage = "/plugins"; ++ this.setPermission("bukkit.command.plugins"); ++ this.setAliases(Arrays.asList("pl")); ++ } ++ ++ private static List formatProviders(TreeMap> plugins) { ++ List components = new ArrayList<>(plugins.size()); ++ for (PluginProvider entry : plugins.values()) { ++ components.add(formatProvider(entry)); ++ } ++ ++ boolean isFirst = true; ++ List formattedSublists = new ArrayList<>(); ++ /* ++ Split up the plugin list for each 10 plugins to get size down ++ ++ Plugin List: ++ - Plugin 1, Plugin 2, .... Plugin 10, ++ Plugin 11, Plugin 12 ... Plugin 20, ++ */ ++ for (List componentSublist : Lists.partition(components, 10)) { ++ Component component = Component.space(); ++ if (isFirst) { ++ component = component.append(PLUGIN_TICK); ++ isFirst = false; ++ } else { ++ component = PLUGIN_TICK_EMPTY; ++ //formattedSublists.add(Component.empty()); // Add an empty line, the auto chat wrapping and this makes it quite jarring. ++ } ++ ++ formattedSublists.add(component.append(Component.join(JoinConfiguration.commas(true), componentSublist))); ++ } ++ ++ return formattedSublists; ++ } ++ ++ private static Component formatProvider(PluginProvider provider) { ++ TextComponent.Builder builder = Component.text(); ++ if (provider instanceof SpigotPluginProvider spigotPluginProvider && CraftMagicNumbers.isLegacy(spigotPluginProvider.getMeta())) { ++ builder.append(LEGACY_PLUGIN_STAR); ++ } ++ ++ String name = provider.getMeta().getName(); ++ Component pluginName = Component.text(name, fromStatus(provider)) ++ .clickEvent(ClickEvent.runCommand("/version " + name)); ++ ++ builder.append(pluginName); ++ ++ return builder.build(); ++ } ++ ++ private static Component asPlainComponents(String strings) { ++ net.kyori.adventure.text.TextComponent.Builder builder = Component.text(); ++ for (String string : strings.split("\n")) { ++ builder.append(Component.newline()); ++ builder.append(Component.text(string, NamedTextColor.WHITE)); ++ } ++ ++ return builder.build(); ++ } ++ ++ private static TextColor fromStatus(PluginProvider provider) { ++ if (provider instanceof ProviderStatusHolder statusHolder && statusHolder.getLastProvidedStatus() != null) { ++ ProviderStatus status = statusHolder.getLastProvidedStatus(); ++ ++ // Handle enabled/disabled game plugins ++ if (status == ProviderStatus.INITIALIZED && GenericTypeReflector.isSuperType(JAVA_PLUGIN_PROVIDER_TYPE, provider.getClass())) { ++ Plugin plugin = Bukkit.getPluginManager().getPlugin(provider.getMeta().getName()); ++ // Plugin doesn't exist? Could be due to it being removed. ++ if (plugin == null) { ++ return NamedTextColor.RED; ++ } ++ ++ return plugin.isEnabled() ? NamedTextColor.GREEN : NamedTextColor.RED; ++ } ++ ++ return switch (status) { ++ case INITIALIZED -> NamedTextColor.GREEN; ++ case ERRORED -> NamedTextColor.RED; ++ }; ++ } else if (provider instanceof PaperPluginParent.PaperServerPluginProvider serverPluginProvider && serverPluginProvider.shouldSkipCreation()) { ++ // Paper plugins will be skipped if their provider is skipped due to their initializer failing. ++ // Show them as red ++ return NamedTextColor.RED; ++ } else { ++ // Separated for future logic choice, but this indicated a provider that failed to load due to ++ // dependency issues or what not. ++ return NamedTextColor.RED; ++ } ++ } ++ ++ @Override ++ public boolean execute(@NotNull CommandSender sender, @NotNull String currentAlias, @NotNull String[] args) { ++ if (!this.testPermission(sender)) return true; ++ ++ TreeMap> paperPlugins = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); ++ TreeMap> spigotPlugins = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); ++ ++ ++ for (PluginProvider provider : LaunchEntryPointHandler.INSTANCE.get(Entrypoint.PLUGIN).getRegisteredProviders()) { ++ PluginMeta configuration = provider.getMeta(); ++ ++ if (provider instanceof SpigotPluginProvider) { ++ spigotPlugins.put(configuration.getDisplayName(), provider); ++ } else if (provider instanceof PaperPluginParent.PaperServerPluginProvider) { ++ paperPlugins.put(configuration.getDisplayName(), provider); ++ } ++ } ++ ++ Component infoMessage = Component.text("Server Plugins (%s):".formatted(paperPlugins.size() + spigotPlugins.size()), NamedTextColor.WHITE); ++ //.append(INFO_ICON_START.hoverEvent(SERVER_PLUGIN_INFO)); TODO: Add docs ++ ++ sender.sendMessage(infoMessage); ++ ++ if (!paperPlugins.isEmpty()) { ++ sender.sendMessage(PAPER_HEADER); ++ } ++ ++ for (Component component : formatProviders(paperPlugins)) { ++ sender.sendMessage(component); ++ } ++ ++ if (!spigotPlugins.isEmpty()) { ++ sender.sendMessage(BUKKIT_HEADER); ++ } ++ ++ for (Component component : formatProviders(spigotPlugins)) { ++ sender.sendMessage(component); ++ } ++ ++ return true; ++ } ++ ++ @NotNull ++ @Override ++ public List tabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException { ++ return Collections.emptyList(); ++ } ++ ++} +diff --git a/src/main/java/io/papermc/paper/command/subcommands/DumpPluginsCommand.java b/src/main/java/io/papermc/paper/command/subcommands/DumpPluginsCommand.java +new file mode 100644 +index 0000000000000000000000000000000000000000..4ecd00b32c7abc15d655dd3c999b6feca332c3a1 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/command/subcommands/DumpPluginsCommand.java +@@ -0,0 +1,187 @@ ++package io.papermc.paper.command.subcommands; ++ ++import com.google.gson.JsonArray; ++import com.google.gson.JsonElement; ++import com.google.gson.JsonObject; ++import com.google.gson.JsonPrimitive; ++import com.google.gson.internal.Streams; ++import com.google.gson.stream.JsonWriter; ++import io.papermc.paper.command.PaperSubcommand; ++import io.papermc.paper.plugin.entrypoint.Entrypoint; ++import io.papermc.paper.plugin.entrypoint.LaunchEntryPointHandler; ++import io.papermc.paper.plugin.entrypoint.classloader.group.LockingClassLoaderGroup; ++import io.papermc.paper.plugin.entrypoint.classloader.group.PaperPluginClassLoaderStorage; ++import io.papermc.paper.plugin.entrypoint.classloader.group.SimpleListPluginClassLoaderGroup; ++import io.papermc.paper.plugin.provider.entrypoint.DependencyContext; ++import io.papermc.paper.plugin.entrypoint.strategy.ModernPluginLoadingStrategy; ++import io.papermc.paper.plugin.entrypoint.strategy.ProviderConfiguration; ++import io.papermc.paper.plugin.manager.PaperPluginManagerImpl; ++import io.papermc.paper.plugin.provider.PluginProvider; ++import io.papermc.paper.plugin.provider.classloader.ConfiguredPluginClassLoader; ++import io.papermc.paper.plugin.provider.classloader.PaperClassLoaderStorage; ++import io.papermc.paper.plugin.provider.classloader.PluginClassLoaderGroup; ++import io.papermc.paper.plugin.storage.ConfiguredProviderStorage; ++import io.papermc.paper.plugin.storage.ProviderStorage; ++import net.minecraft.server.MinecraftServer; ++import org.bukkit.command.CommandSender; ++import org.bukkit.plugin.Plugin; ++import org.checkerframework.checker.nullness.qual.NonNull; ++import org.checkerframework.framework.qual.DefaultQualifier; ++ ++import java.io.PrintStream; ++import java.io.StringWriter; ++import java.nio.charset.StandardCharsets; ++import java.nio.file.Files; ++import java.nio.file.Path; ++import java.time.LocalDateTime; ++import java.time.format.DateTimeFormatter; ++import java.util.ArrayList; ++import java.util.List; ++import java.util.Map; ++ ++import static net.kyori.adventure.text.Component.text; ++import static net.kyori.adventure.text.format.NamedTextColor.GREEN; ++import static net.kyori.adventure.text.format.NamedTextColor.RED; ++ ++@DefaultQualifier(NonNull.class) ++public final class DumpPluginsCommand implements PaperSubcommand { ++ @Override ++ public boolean execute(final CommandSender sender, final String subCommand, final String[] args) { ++ this.dumpPlugins(sender, args); ++ return true; ++ } ++ ++ private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd_HH.mm.ss"); ++ ++ private void dumpPlugins(final CommandSender sender, final String[] args) { ++ Path parent = Path.of("debug"); ++ Path path = parent.resolve("plugin-info" + FORMATTER.format(LocalDateTime.now()) + ".txt"); ++ try { ++ Files.createDirectories(parent); ++ Files.createFile(path); ++ sender.sendMessage(text("Writing plugin information to " + path, GREEN)); ++ ++ final JsonObject data = this.writeDebug(); ++ ++ StringWriter stringWriter = new StringWriter(); ++ JsonWriter jsonWriter = new JsonWriter(stringWriter); ++ jsonWriter.setIndent(" "); ++ jsonWriter.setLenient(false); ++ Streams.write(data, jsonWriter); ++ ++ try (PrintStream out = new PrintStream(Files.newOutputStream(path), false, StandardCharsets.UTF_8)) { ++ out.print(stringWriter); ++ } ++ sender.sendMessage(text("Successfully written plugin debug information!", GREEN)); ++ } catch (Throwable e) { ++ sender.sendMessage(text("Failed to write plugin information! See the console for more info.", RED)); ++ MinecraftServer.LOGGER.warn("Error occurred while dumping plugin info", e); ++ } ++ } ++ ++ private JsonObject writeDebug() { ++ JsonObject root = new JsonObject(); ++ if (ConfiguredProviderStorage.LEGACY_PLUGIN_LOADING) { ++ root.addProperty("legacy-loading-strategy", true); ++ } ++ ++ this.writeProviders(root); ++ this.writePlugins(root); ++ this.writeClassloaders(root); ++ ++ return root; ++ } ++ ++ private void writeProviders(JsonObject root) { ++ JsonObject rootProviders = new JsonObject(); ++ root.add("providers", rootProviders); ++ ++ for (Map.Entry, ProviderStorage> entry : LaunchEntryPointHandler.INSTANCE.getStorage().entrySet()) { ++ JsonObject entrypoint = new JsonObject(); ++ ++ JsonArray providers = new JsonArray(); ++ entrypoint.add("providers", providers); ++ ++ List> pluginProviders = new ArrayList<>(); ++ for (PluginProvider provider : entry.getValue().getRegisteredProviders()) { ++ JsonObject providerObj = new JsonObject(); ++ providerObj.addProperty("name", provider.getMeta().getName()); ++ providerObj.addProperty("version", provider.getMeta().getVersion()); ++ providerObj.addProperty("dependencies", provider.getMeta().getPluginDependencies().toString()); ++ providerObj.addProperty("soft-dependencies", provider.getMeta().getPluginSoftDependencies().toString()); ++ providerObj.addProperty("load-before", provider.getMeta().getLoadBeforePlugins().toString()); ++ ++ ++ providers.add(providerObj); ++ pluginProviders.add((PluginProvider) provider); ++ } ++ ++ JsonArray loadOrder = new JsonArray(); ++ entrypoint.add("load-order", loadOrder); ++ ++ ModernPluginLoadingStrategy modernPluginLoadingStrategy = new ModernPluginLoadingStrategy<>(new ProviderConfiguration<>() { ++ @Override ++ public void applyContext(PluginProvider provider, DependencyContext dependencyContext) { ++ } ++ ++ @Override ++ public boolean load(PluginProvider provider, Object provided) { ++ loadOrder.add(provider.getMeta().getName()); ++ return false; ++ } ++ ++ }); ++ modernPluginLoadingStrategy.loadProviders(pluginProviders); ++ ++ rootProviders.add(entry.getKey().getDebugName(), entrypoint); ++ } ++ } ++ ++ private void writePlugins(JsonObject root) { ++ JsonArray rootPlugins = new JsonArray(); ++ root.add("plugins", rootPlugins); ++ ++ for (Plugin plugin : PaperPluginManagerImpl.getInstance().getPlugins()) { ++ rootPlugins.add(plugin.toString()); ++ } ++ } ++ ++ private void writeClassloaders(JsonObject root) { ++ JsonObject classLoadersRoot = new JsonObject(); ++ root.add("classloaders", classLoadersRoot); ++ ++ PaperPluginClassLoaderStorage storage = (PaperPluginClassLoaderStorage) PaperClassLoaderStorage.instance(); ++ classLoadersRoot.addProperty("global", storage.getGlobalGroup().toString()); ++ classLoadersRoot.addProperty("dependency_graph", PaperPluginManagerImpl.getInstance().getInstanceManagerGraph().toString()); ++ ++ JsonArray array = new JsonArray(); ++ classLoadersRoot.add("children", array); ++ for (PluginClassLoaderGroup group : storage.getGroups()) { ++ array.add(this.writeClassloader(group)); ++ } ++ } ++ ++ private JsonObject writeClassloader(PluginClassLoaderGroup group) { ++ JsonObject classLoadersRoot = new JsonObject(); ++ if (group instanceof SimpleListPluginClassLoaderGroup listGroup) { ++ JsonArray array = new JsonArray(); ++ classLoadersRoot.addProperty("main", listGroup.toString()); ++ classLoadersRoot.add("children", array); ++ for (ConfiguredPluginClassLoader innerGroup : listGroup.getClassLoaders()) { ++ array.add(this.writeClassloader(innerGroup)); ++ } ++ ++ } else if (group instanceof LockingClassLoaderGroup locking) { ++ // Unwrap ++ return this.writeClassloader(locking.getParent()); ++ } else { ++ classLoadersRoot.addProperty("raw", group.toString()); ++ } ++ ++ return classLoadersRoot; ++ } ++ ++ private JsonElement writeClassloader(ConfiguredPluginClassLoader innerGroup) { ++ return new JsonPrimitive(innerGroup.toString()); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/PluginInitializerManager.java b/src/main/java/io/papermc/paper/plugin/PluginInitializerManager.java +new file mode 100644 +index 0000000000000000000000000000000000000000..21e43223d7942b0e5e3c6b63aa2c455ec17ffde9 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/PluginInitializerManager.java +@@ -0,0 +1,90 @@ ++package io.papermc.paper.plugin; ++ ++import com.mojang.logging.LogUtils; ++import io.papermc.paper.configuration.PaperConfigurations; ++import joptsimple.OptionSet; ++import org.bukkit.configuration.file.YamlConfiguration; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; ++import org.slf4j.Logger; ++ ++import java.io.File; ++import java.io.IOException; ++import java.nio.file.Files; ++import java.nio.file.Path; ++ ++public class PluginInitializerManager { ++ ++ private static final Logger LOGGER = LogUtils.getLogger(); ++ private static PluginInitializerManager impl; ++ private final Path pluginDirectory; ++ private final Path updateDirectory; ++ ++ PluginInitializerManager(final Path pluginDirectory, final Path updateDirectory) { ++ this.pluginDirectory = pluginDirectory; ++ this.updateDirectory = updateDirectory; ++ } ++ ++ private static PluginInitializerManager parse(@NotNull final OptionSet minecraftOptionSet) throws Exception { ++ // We have to load the bukkit configuration inorder to get the update folder location. ++ final File configFileLocationBukkit = (File) minecraftOptionSet.valueOf("bukkit-settings"); ++ ++ final Path pluginDirectory = ((File) minecraftOptionSet.valueOf("plugins")).toPath(); ++ ++ final YamlConfiguration configuration = PaperConfigurations.loadLegacyConfigFile(configFileLocationBukkit); ++ ++ final String updateDirectoryName = configuration.getString("settings.update-folder", "update"); ++ if (updateDirectoryName.isBlank()) { ++ return new PluginInitializerManager(pluginDirectory, null); ++ } ++ ++ final Path resolvedUpdateDirectory = pluginDirectory.resolve(updateDirectoryName); ++ if (!Files.isDirectory(resolvedUpdateDirectory)) { ++ if (Files.exists(resolvedUpdateDirectory)) { ++ LOGGER.error("Misconfigured update directory!"); ++ LOGGER.error("Your configured update directory ({}) in bukkit.yml is pointing to a non-directory path. " + ++ "Auto updating functionality will not work.", resolvedUpdateDirectory); ++ } ++ return new PluginInitializerManager(pluginDirectory, null); ++ } ++ ++ boolean isSameFile; ++ try { ++ isSameFile = Files.isSameFile(resolvedUpdateDirectory, pluginDirectory); ++ } catch (final IOException e) { ++ LOGGER.error("Misconfigured update directory!"); ++ LOGGER.error("Failed to compare update/plugin directory", e); ++ return new PluginInitializerManager(pluginDirectory, null); ++ } ++ ++ if (isSameFile) { ++ LOGGER.error("Misconfigured update directory!"); ++ LOGGER.error(("Your configured update directory (%s) in bukkit.yml is pointing to the same location as the plugin directory (%s). " + ++ "Disabling auto updating functionality.").formatted(resolvedUpdateDirectory, pluginDirectory)); ++ ++ return new PluginInitializerManager(pluginDirectory, null); ++ } ++ ++ return new PluginInitializerManager(pluginDirectory, resolvedUpdateDirectory); ++ } ++ ++ public static PluginInitializerManager init(final OptionSet optionSet) throws Exception { ++ impl = parse(optionSet); ++ return impl; ++ } ++ ++ public static PluginInitializerManager instance() { ++ return impl; ++ } ++ ++ @NotNull ++ public Path pluginDirectoryPath() { ++ return pluginDirectory; ++ } ++ ++ @Nullable ++ public Path pluginUpdatePath() { ++ return updateDirectory; ++ } ++ ++} +diff --git a/src/main/java/io/papermc/paper/plugin/bootstrap/PluginProviderContextImpl.java b/src/main/java/io/papermc/paper/plugin/bootstrap/PluginProviderContextImpl.java +new file mode 100644 +index 0000000000000000000000000000000000000000..8249a7024537fccd99735b92abb1368e6647b5ae +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/bootstrap/PluginProviderContextImpl.java +@@ -0,0 +1,40 @@ ++package io.papermc.paper.plugin.bootstrap; ++ ++import io.papermc.paper.plugin.PluginInitializerManager; ++import io.papermc.paper.plugin.configuration.PluginMeta; ++import io.papermc.paper.plugin.provider.PluginProvider; ++import org.jetbrains.annotations.NotNull; ++ ++import java.nio.file.Path; ++import java.util.logging.Logger; ++ ++public record PluginProviderContextImpl(PluginMeta config, Path dataFolder, ++ Logger logger) implements PluginProviderContext { ++ ++ public static PluginProviderContextImpl of(PluginMeta config, Logger logger) { ++ Path dataFolder = PluginInitializerManager.instance().pluginDirectoryPath().resolve(config.getDisplayName()); ++ ++ return new PluginProviderContextImpl(config, dataFolder, logger); ++ } ++ ++ public static PluginProviderContextImpl of(PluginProvider provider, Path pluginFolder) { ++ Path dataFolder = pluginFolder.resolve(provider.getMeta().getDisplayName()); ++ ++ return new PluginProviderContextImpl(provider.getMeta(), dataFolder, provider.getLogger()); ++ } ++ ++ @Override ++ public @NotNull PluginMeta getConfiguration() { ++ return this.config; ++ } ++ ++ @Override ++ public @NotNull Path getDataDirectory() { ++ return this.dataFolder; ++ } ++ ++ @Override ++ public @NotNull Logger getLogger() { ++ return this.logger; ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/entrypoint/Entrypoint.java b/src/main/java/io/papermc/paper/plugin/entrypoint/Entrypoint.java +new file mode 100644 +index 0000000000000000000000000000000000000000..125008ac7db8b9f3fb57c49f8e4facc4ad4bb136 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/entrypoint/Entrypoint.java +@@ -0,0 +1,25 @@ ++package io.papermc.paper.plugin.entrypoint; ++ ++import io.papermc.paper.plugin.bootstrap.PluginBootstrap; ++import org.bukkit.plugin.java.JavaPlugin; ++ ++/** ++ * Used to mark a certain place that {@link EntrypointHandler} will register {@link io.papermc.paper.plugin.provider.PluginProvider} under. ++ * Used for loading only certain providers at a certain time. ++ * @param provider type ++ */ ++public final class Entrypoint { ++ ++ public static final Entrypoint BOOTSTRAPPER = new Entrypoint<>("bootstrapper"); ++ public static final Entrypoint PLUGIN = new Entrypoint<>("plugin"); ++ ++ private final String debugName; ++ ++ private Entrypoint(String debugName) { ++ this.debugName = debugName; ++ } ++ ++ public String getDebugName() { ++ return debugName; ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/entrypoint/EntrypointHandler.java b/src/main/java/io/papermc/paper/plugin/entrypoint/EntrypointHandler.java +new file mode 100644 +index 0000000000000000000000000000000000000000..b38e1e0f3d3055086f51bb191fd4b60ecf32d016 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/entrypoint/EntrypointHandler.java +@@ -0,0 +1,14 @@ ++package io.papermc.paper.plugin.entrypoint; ++ ++import io.papermc.paper.plugin.provider.PluginProvider; ++ ++/** ++ * Represents a register that will register providers at a certain {@link Entrypoint}, ++ * where then when the given {@link Entrypoint} is registered those will be loaded. ++ */ ++public interface EntrypointHandler { ++ ++ void register(Entrypoint entrypoint, PluginProvider provider); ++ ++ void enter(Entrypoint entrypoint); ++} +diff --git a/src/main/java/io/papermc/paper/plugin/entrypoint/LaunchEntryPointHandler.java b/src/main/java/io/papermc/paper/plugin/entrypoint/LaunchEntryPointHandler.java +new file mode 100644 +index 0000000000000000000000000000000000000000..61a67971a41527c0e3b614bf48d2bc8eabd443b5 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/entrypoint/LaunchEntryPointHandler.java +@@ -0,0 +1,60 @@ ++package io.papermc.paper.plugin.entrypoint; ++ ++import io.papermc.paper.plugin.provider.PluginProvider; ++import io.papermc.paper.plugin.storage.BootstrapProviderStorage; ++import io.papermc.paper.plugin.storage.ProviderStorage; ++import io.papermc.paper.plugin.storage.ServerPluginProviderStorage; ++import org.jetbrains.annotations.ApiStatus; ++ ++import java.util.HashMap; ++import java.util.Map; ++ ++/** ++ * Used by the server to register/load plugin bootstrappers and plugins. ++ */ ++public class LaunchEntryPointHandler implements EntrypointHandler { ++ ++ public static final LaunchEntryPointHandler INSTANCE = new LaunchEntryPointHandler(); ++ private final Map, ProviderStorage> storage = new HashMap<>(); ++ ++ LaunchEntryPointHandler() { ++ this.storage.put(Entrypoint.BOOTSTRAPPER, new BootstrapProviderStorage()); ++ this.storage.put(Entrypoint.PLUGIN, new ServerPluginProviderStorage()); ++ } ++ ++ // Utility ++ public static void enterBootstrappers() { ++ LaunchEntryPointHandler.INSTANCE.enter(Entrypoint.BOOTSTRAPPER); ++ } ++ ++ @Override ++ public void enter(Entrypoint entrypoint) { ++ ProviderStorage storage = this.storage.get(entrypoint); ++ if (storage == null) { ++ throw new IllegalArgumentException("No storage registered for entrypoint %s.".formatted(entrypoint)); ++ } ++ ++ storage.enter(); ++ } ++ ++ @Override ++ public void register(Entrypoint entrypoint, PluginProvider provider) { ++ ProviderStorage storage = this.get(entrypoint); ++ if (storage == null) { ++ throw new IllegalArgumentException("No storage registered for entrypoint %s.".formatted(entrypoint)); ++ } ++ ++ storage.register(provider); ++ } ++ ++ @SuppressWarnings("unchecked") ++ public ProviderStorage get(Entrypoint entrypoint) { ++ return (ProviderStorage) this.storage.get(entrypoint); ++ } ++ ++ // Debug only ++ @ApiStatus.Internal ++ public Map, ProviderStorage> getStorage() { ++ return storage; ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/entrypoint/classloader/ClassloaderBytecodeModifier.java b/src/main/java/io/papermc/paper/plugin/entrypoint/classloader/ClassloaderBytecodeModifier.java +new file mode 100644 +index 0000000000000000000000000000000000000000..93b5196a960f3efbe0d28f5527ea2752426213ce +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/entrypoint/classloader/ClassloaderBytecodeModifier.java +@@ -0,0 +1,22 @@ ++package io.papermc.paper.plugin.entrypoint.classloader; ++ ++import io.papermc.paper.plugin.configuration.PluginMeta; ++import net.kyori.adventure.util.Services; ++import org.jetbrains.annotations.ApiStatus; ++ ++@ApiStatus.Internal ++public interface ClassloaderBytecodeModifier { ++ ++ static ClassloaderBytecodeModifier bytecodeModifier() { ++ return Provider.INSTANCE; ++ } ++ ++ byte[] modify(PluginMeta config, byte[] bytecode); ++ ++ class Provider { ++ ++ private static final ClassloaderBytecodeModifier INSTANCE = Services.service(ClassloaderBytecodeModifier.class).orElseThrow(); ++ ++ } ++ ++} +diff --git a/src/main/java/io/papermc/paper/plugin/entrypoint/classloader/PaperClassloaderBytecodeModifier.java b/src/main/java/io/papermc/paper/plugin/entrypoint/classloader/PaperClassloaderBytecodeModifier.java +new file mode 100644 +index 0000000000000000000000000000000000000000..f9a2c55a354c877749db3f92956de802ae575788 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/entrypoint/classloader/PaperClassloaderBytecodeModifier.java +@@ -0,0 +1,12 @@ ++package io.papermc.paper.plugin.entrypoint.classloader; ++ ++import io.papermc.paper.plugin.configuration.PluginMeta; ++ ++// Stub, implement in future. ++public class PaperClassloaderBytecodeModifier implements ClassloaderBytecodeModifier { ++ ++ @Override ++ public byte[] modify(PluginMeta configuration, byte[] bytecode) { ++ return bytecode; ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/entrypoint/classloader/PaperPluginClassLoader.java b/src/main/java/io/papermc/paper/plugin/entrypoint/classloader/PaperPluginClassLoader.java +new file mode 100644 +index 0000000000000000000000000000000000000000..392eb260b44d5f9e685ce09596c19f0af9cc0339 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/entrypoint/classloader/PaperPluginClassLoader.java +@@ -0,0 +1,204 @@ ++package io.papermc.paper.plugin.entrypoint.classloader; ++ ++import io.papermc.paper.plugin.configuration.PluginMeta; ++import io.papermc.paper.plugin.provider.entrypoint.DependencyContext; ++import io.papermc.paper.plugin.provider.classloader.ConfiguredPluginClassLoader; ++import io.papermc.paper.plugin.entrypoint.classloader.group.PaperPluginClassLoaderStorage; ++import io.papermc.paper.plugin.provider.classloader.PaperClassLoaderStorage; ++import io.papermc.paper.plugin.provider.classloader.PluginClassLoaderGroup; ++import io.papermc.paper.plugin.provider.configuration.PaperPluginMeta; ++import org.bukkit.Bukkit; ++import org.bukkit.plugin.PluginDescriptionFile; ++import org.bukkit.plugin.java.JavaPlugin; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; ++ ++import java.io.File; ++import java.io.IOException; ++import java.net.URL; ++import java.net.URLClassLoader; ++import java.nio.file.Path; ++import java.util.ArrayList; ++import java.util.Collections; ++import java.util.Enumeration; ++import java.util.List; ++import java.util.Map; ++import java.util.Set; ++import java.util.concurrent.ConcurrentHashMap; ++import java.util.jar.JarFile; ++import java.util.logging.Logger; ++ ++/** ++ * This is similar to a {@link org.bukkit.plugin.java.PluginClassLoader} but is completely kept hidden from the api. ++ * This is only used with Paper plugins. ++ * ++ * @see PaperPluginClassLoaderStorage ++ */ ++public class PaperPluginClassLoader extends PaperSimplePluginClassLoader implements ConfiguredPluginClassLoader { ++ ++ static { ++ registerAsParallelCapable(); ++ } ++ ++ private final URLClassLoader libraryLoader; ++ private final Set seenIllegalAccess = Collections.newSetFromMap(new ConcurrentHashMap<>()); ++ private final Logger logger; ++ @Nullable ++ private JavaPlugin loadedJavaPlugin; ++ @Nullable ++ private PluginClassLoaderGroup group; ++ ++ public PaperPluginClassLoader(Logger logger, Path source, JarFile file, PaperPluginMeta configuration, ClassLoader parentLoader, URLClassLoader libraryLoader) throws IOException { ++ super(source, file, configuration, parentLoader); ++ this.libraryLoader = libraryLoader; ++ ++ this.logger = logger; ++ if (this.configuration.hasOpenClassloader()) { ++ this.group = PaperClassLoaderStorage.instance().registerOpenGroup(this); ++ } ++ } ++ ++ public void refreshClassloaderDependencyTree(DependencyContext dependencyContext) { ++ if (this.configuration.hasOpenClassloader()) { ++ return; ++ } ++ if (this.group != null) { ++ // We need to unregister the classloader inorder to allow for dependencies ++ // to be recalculated ++ PaperClassLoaderStorage.instance().unregisterClassloader(this); ++ } ++ ++ this.group = PaperClassLoaderStorage.instance().registerAccessBackedGroup(this, (classLoader) -> { ++ return dependencyContext.isTransitiveDependency(PaperPluginClassLoader.this.configuration, classLoader.getConfiguration()); ++ }); ++ } ++ ++ @Override ++ public URL getResource(String name) { ++ URL resource = findResource(name); ++ if (resource == null && this.libraryLoader != null) { ++ return this.libraryLoader.getResource(name); ++ } ++ return resource; ++ } ++ ++ @Override ++ public Enumeration getResources(String name) throws IOException { ++ List resources = new ArrayList<>(); ++ this.addEnumeration(resources, this.findResources(name)); ++ if (this.libraryLoader != null) { ++ addEnumeration(resources, this.libraryLoader.getResources(name)); ++ } ++ return Collections.enumeration(resources); ++ } ++ ++ private void addEnumeration(List list, Enumeration enumeration) { ++ while (enumeration.hasMoreElements()) { ++ list.add(enumeration.nextElement()); ++ } ++ } ++ ++ @Override ++ protected Class loadClass(String name, boolean resolve) throws ClassNotFoundException { ++ return this.loadClass(name, resolve, true, true); ++ } ++ ++ @Override ++ public PluginMeta getConfiguration() { ++ return this.configuration; ++ } ++ ++ @Override ++ public Class loadClass(@NotNull String name, boolean resolve, boolean checkGroup, boolean checkLibraries) throws ClassNotFoundException { ++ try { ++ Class result = super.loadClass(name, resolve); ++ ++ // SPIGOT-6749: Library classes will appear in the above, but we don't want to return them to other plugins ++ if (checkGroup || result.getClassLoader() == this) { ++ return result; ++ } ++ } catch (ClassNotFoundException ignored) { ++ } ++ ++ if (checkLibraries) { ++ try { ++ return this.libraryLoader.loadClass(name); ++ } catch (ClassNotFoundException ignored) { ++ } ++ } ++ ++ if (checkGroup) { ++ // This ignores the libraries of other plugins, unless they are transitive dependencies. ++ if (this.group == null) { ++ throw new IllegalStateException("Tried to resolve class while group was not yet initialized"); ++ } ++ ++ Class clazz = this.group.getClassByName(name, resolve, this); ++ if (clazz != null) { ++ return clazz; ++ } ++ } ++ ++ throw new ClassNotFoundException(name); ++ } ++ ++ @Override ++ public void init(JavaPlugin plugin) { ++ PluginMeta config = this.configuration; ++ PluginDescriptionFile pluginDescriptionFile = new PluginDescriptionFile( ++ config.getName(), ++ config.getDisplayName(), ++ config.getProvidedPlugins(), ++ config.getMainClass(), ++ "", // Classloader load order api ++ config.getPluginDependencies(), // Dependencies ++ config.getPluginSoftDependencies(), // Soft Depends ++ config.getLoadBeforePlugins(), // Load Before ++ config.getVersion(), ++ Map.of(), // Commands, we use a separate system ++ config.getDescription(), ++ config.getAuthors(), ++ config.getContributors(), ++ config.getWebsite(), ++ config.getLoggerPrefix(), ++ config.getLoadOrder(), ++ config.getPermissions(), ++ config.getPermissionDefault(), ++ Set.of(), // Aware api ++ config.getAPIVersion(), ++ List.of() // Libraries ++ ); ++ ++ File dataFolder = new File(Bukkit.getPluginsFolder(), pluginDescriptionFile.getName()); ++ ++ plugin.init(Bukkit.getServer(), pluginDescriptionFile, dataFolder, this.source.toFile(), this, config); ++ plugin.logger = this.logger; ++ ++ this.loadedJavaPlugin = plugin; ++ } ++ ++ @Nullable ++ @Override ++ public JavaPlugin getPlugin() { ++ return this.loadedJavaPlugin; ++ } ++ ++ @Override ++ public String toString() { ++ return "PaperPluginClassLoader{" + ++ "libraryLoader=" + this.libraryLoader + ++ ", seenIllegalAccess=" + this.seenIllegalAccess + ++ ", loadedJavaPlugin=" + this.loadedJavaPlugin + ++ ", group=" + this.group + ++ '}'; ++ } ++ ++ @Override ++ public void close() throws IOException { ++ try { ++ super.close(); ++ } finally { ++ this.libraryLoader.close(); ++ } ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/entrypoint/classloader/PaperSimplePluginClassLoader.java b/src/main/java/io/papermc/paper/plugin/entrypoint/classloader/PaperSimplePluginClassLoader.java +new file mode 100644 +index 0000000000000000000000000000000000000000..6688f2af4a32c2f79785f162e2eac0330d439ac1 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/entrypoint/classloader/PaperSimplePluginClassLoader.java +@@ -0,0 +1,116 @@ ++package io.papermc.paper.plugin.entrypoint.classloader; ++ ++import io.papermc.paper.plugin.provider.configuration.PaperPluginMeta; ++import io.papermc.paper.plugin.util.NamespaceChecker; ++import org.jetbrains.annotations.ApiStatus; ++ ++import java.io.IOException; ++import java.io.InputStream; ++import java.net.URL; ++import java.net.URLClassLoader; ++import java.nio.file.Path; ++import java.security.CodeSigner; ++import java.security.CodeSource; ++import java.util.Enumeration; ++import java.util.jar.JarEntry; ++import java.util.jar.JarFile; ++import java.util.jar.Manifest; ++ ++/** ++ * Represents a simple classloader used for paper plugin bootstrappers. ++ */ ++@ApiStatus.Internal ++public class PaperSimplePluginClassLoader extends URLClassLoader { ++ ++ static { ++ ClassLoader.registerAsParallelCapable(); ++ } ++ ++ protected final PaperPluginMeta configuration; ++ protected final Path source; ++ protected final Manifest jarManifest; ++ protected final URL jarUrl; ++ protected final JarFile jar; ++ ++ public PaperSimplePluginClassLoader(Path source, JarFile file, PaperPluginMeta configuration, ClassLoader parentLoader) throws IOException { ++ super(source.getFileName().toString(), new URL[]{source.toUri().toURL()}, parentLoader); ++ ++ this.source = source; ++ this.jarManifest = file.getManifest(); ++ this.jarUrl = source.toUri().toURL(); ++ this.configuration = configuration; ++ this.jar = file; ++ } ++ ++ @Override ++ public URL getResource(String name) { ++ return this.findResource(name); ++ } ++ ++ @Override ++ public Enumeration getResources(String name) throws IOException { ++ return this.findResources(name); ++ } ++ ++ // Bytecode modification supported loader ++ @Override ++ protected Class findClass(String name) throws ClassNotFoundException { ++ NamespaceChecker.validateNameSpaceForClassloading(name); ++ ++ // See UrlClassLoader#findClass(String) ++ String path = name.replace('.', '/').concat(".class"); ++ JarEntry entry = this.jar.getJarEntry(path); ++ if (entry == null) { ++ throw new ClassNotFoundException(); ++ } ++ ++ // See URLClassLoader#defineClass(String, Resource) ++ byte[] classBytes; ++ ++ try (InputStream is = this.jar.getInputStream(entry)) { ++ classBytes = is.readAllBytes(); ++ } catch (IOException ex) { ++ throw new ClassNotFoundException(name, ex); ++ } ++ ++ classBytes = ClassloaderBytecodeModifier.bytecodeModifier().modify(this.configuration, classBytes); ++ ++ int dot = name.lastIndexOf('.'); ++ if (dot != -1) { ++ String pkgName = name.substring(0, dot); ++ // Get defined package does not correctly handle sealed packages. ++ if (this.getDefinedPackage(pkgName) == null) { ++ try { ++ if (this.jarManifest != null) { ++ this.definePackage(pkgName, this.jarManifest, this.jarUrl); ++ } else { ++ this.definePackage(pkgName, null, null, null, null, null, null, null); ++ } ++ } catch (IllegalArgumentException ex) { ++ // parallel-capable class loaders: re-verify in case of a ++ // race condition ++ if (this.getDefinedPackage(pkgName) == null) { ++ // Should never happen ++ throw new IllegalStateException("Cannot find package " + pkgName); ++ } ++ } ++ } ++ } ++ ++ CodeSigner[] signers = entry.getCodeSigners(); ++ CodeSource source = new CodeSource(this.jarUrl, signers); ++ ++ return this.defineClass(name, classBytes, 0, classBytes.length, source); ++ } ++ ++ @Override ++ public String toString() { ++ return "PaperSimplePluginClassLoader{" + ++ "configuration=" + this.configuration + ++ ", source=" + this.source + ++ ", jarManifest=" + this.jarManifest + ++ ", jarUrl=" + this.jarUrl + ++ ", jar=" + this.jar + ++ '}'; ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/entrypoint/classloader/group/DependencyBasedPluginClassLoaderGroup.java b/src/main/java/io/papermc/paper/plugin/entrypoint/classloader/group/DependencyBasedPluginClassLoaderGroup.java +new file mode 100644 +index 0000000000000000000000000000000000000000..eaf5c794cbe8d6138c9d60eaae20f5fc7711f541 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/entrypoint/classloader/group/DependencyBasedPluginClassLoaderGroup.java +@@ -0,0 +1,47 @@ ++package io.papermc.paper.plugin.entrypoint.classloader.group; ++ ++import io.papermc.paper.plugin.provider.classloader.ClassLoaderAccess; ++import io.papermc.paper.plugin.provider.classloader.ConfiguredPluginClassLoader; ++import org.jetbrains.annotations.ApiStatus; ++ ++import java.util.ArrayList; ++ ++@ApiStatus.Internal ++public class DependencyBasedPluginClassLoaderGroup extends SimpleListPluginClassLoaderGroup { ++ ++ private final GlobalPluginClassLoaderGroup globalPluginClassLoaderGroup; ++ private final ClassLoaderAccess access; ++ ++ public DependencyBasedPluginClassLoaderGroup(GlobalPluginClassLoaderGroup globalPluginClassLoaderGroup, ClassLoaderAccess access) { ++ super(new ArrayList<>()); ++ this.access = access; ++ this.globalPluginClassLoaderGroup = globalPluginClassLoaderGroup; ++ } ++ ++ /** ++ * This will refresh the dependencies of the current classloader. ++ */ ++ public void populateDependencies() { ++ this.classloaders.clear(); ++ for (ConfiguredPluginClassLoader configuredPluginClassLoader : this.globalPluginClassLoaderGroup.getClassLoaders()) { ++ if (this.access.canAccess(configuredPluginClassLoader)) { ++ this.classloaders.add(configuredPluginClassLoader); ++ } ++ } ++ ++ } ++ ++ @Override ++ public ClassLoaderAccess getAccess() { ++ return this.access; ++ } ++ ++ @Override ++ public String toString() { ++ return "DependencyBasedPluginClassLoaderGroup{" + ++ "globalPluginClassLoaderGroup=" + this.globalPluginClassLoaderGroup + ++ ", access=" + this.access + ++ ", classloaders=" + this.classloaders + ++ '}'; ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/entrypoint/classloader/group/GlobalPluginClassLoaderGroup.java b/src/main/java/io/papermc/paper/plugin/entrypoint/classloader/group/GlobalPluginClassLoaderGroup.java +new file mode 100644 +index 0000000000000000000000000000000000000000..2b7eef787f83e5a32896cb30c215406b6f652786 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/entrypoint/classloader/group/GlobalPluginClassLoaderGroup.java +@@ -0,0 +1,18 @@ ++package io.papermc.paper.plugin.entrypoint.classloader.group; ++ ++import io.papermc.paper.plugin.provider.classloader.ClassLoaderAccess; ++import org.jetbrains.annotations.ApiStatus; ++ ++@ApiStatus.Internal ++public class GlobalPluginClassLoaderGroup extends SimpleListPluginClassLoaderGroup { ++ ++ @Override ++ public ClassLoaderAccess getAccess() { ++ return (v) -> true; ++ } ++ ++ @Override ++ public String toString() { ++ return super.toString(); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/entrypoint/classloader/group/LockingClassLoaderGroup.java b/src/main/java/io/papermc/paper/plugin/entrypoint/classloader/group/LockingClassLoaderGroup.java +new file mode 100644 +index 0000000000000000000000000000000000000000..aae50ebba6ba1579b75af5370c8b020d2a927b2c +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/entrypoint/classloader/group/LockingClassLoaderGroup.java +@@ -0,0 +1,76 @@ ++package io.papermc.paper.plugin.entrypoint.classloader.group; ++ ++import io.papermc.paper.plugin.provider.classloader.ClassLoaderAccess; ++import io.papermc.paper.plugin.provider.classloader.ConfiguredPluginClassLoader; ++import io.papermc.paper.plugin.provider.classloader.PluginClassLoaderGroup; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Nullable; ++ ++import java.util.HashMap; ++import java.util.Map; ++import java.util.concurrent.atomic.AtomicInteger; ++import java.util.concurrent.locks.ReentrantReadWriteLock; ++ ++@ApiStatus.Internal ++public class LockingClassLoaderGroup implements PluginClassLoaderGroup { ++ ++ private final PluginClassLoaderGroup parent; ++ private final Map classLoadLock = new HashMap<>(); ++ ++ public LockingClassLoaderGroup(PluginClassLoaderGroup parent) { ++ this.parent = parent; ++ } ++ ++ @Override ++ public @Nullable Class getClassByName(String name, boolean resolve, ConfiguredPluginClassLoader requester) { ++ // make MT safe ++ ClassLockEntry lock; ++ synchronized (this.classLoadLock) { ++ lock = this.classLoadLock.computeIfAbsent(name, (x) -> new ClassLockEntry(new AtomicInteger(0), new java.util.concurrent.locks.ReentrantReadWriteLock())); ++ lock.count.incrementAndGet(); ++ } ++ lock.reentrantReadWriteLock.writeLock().lock(); ++ try { ++ return parent.getClassByName(name, resolve, requester); ++ } finally { ++ synchronized (this.classLoadLock) { ++ lock.reentrantReadWriteLock.writeLock().unlock(); ++ if (lock.count.get() == 1) { ++ this.classLoadLock.remove(name); ++ } else { ++ lock.count.decrementAndGet(); ++ } ++ } ++ } ++ } ++ ++ @Override ++ public void remove(ConfiguredPluginClassLoader configuredPluginClassLoader) { ++ this.parent.remove(configuredPluginClassLoader); ++ } ++ ++ @Override ++ public void add(ConfiguredPluginClassLoader configuredPluginClassLoader) { ++ this.parent.add(configuredPluginClassLoader); ++ } ++ ++ @Override ++ public ClassLoaderAccess getAccess() { ++ return this.parent.getAccess(); ++ } ++ ++ public PluginClassLoaderGroup getParent() { ++ return parent; ++ } ++ ++ record ClassLockEntry(AtomicInteger count, ReentrantReadWriteLock reentrantReadWriteLock) { ++ } ++ ++ @Override ++ public String toString() { ++ return "LockingClassLoaderGroup{" + ++ "parent=" + this.parent + ++ ", classLoadLock=" + this.classLoadLock + ++ '}'; ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/entrypoint/classloader/group/PaperPluginClassLoaderStorage.java b/src/main/java/io/papermc/paper/plugin/entrypoint/classloader/group/PaperPluginClassLoaderStorage.java +new file mode 100644 +index 0000000000000000000000000000000000000000..2c906e2c7d972b221a41acd614e00d0fbc1227c6 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/entrypoint/classloader/group/PaperPluginClassLoaderStorage.java +@@ -0,0 +1,93 @@ ++package io.papermc.paper.plugin.entrypoint.classloader.group; ++ ++import io.papermc.paper.plugin.provider.classloader.ClassLoaderAccess; ++import io.papermc.paper.plugin.provider.classloader.ConfiguredPluginClassLoader; ++import io.papermc.paper.plugin.provider.classloader.PaperClassLoaderStorage; ++import io.papermc.paper.plugin.provider.classloader.PluginClassLoaderGroup; ++import org.bukkit.Bukkit; ++import org.bukkit.plugin.java.PluginClassLoader; ++import org.jetbrains.annotations.ApiStatus; ++ ++import java.util.ArrayList; ++import java.util.List; ++import java.util.concurrent.CopyOnWriteArrayList; ++ ++/** ++ * This is used for connecting multiple classloaders. ++ */ ++public final class PaperPluginClassLoaderStorage implements PaperClassLoaderStorage { ++ ++ private final GlobalPluginClassLoaderGroup globalGroup = new GlobalPluginClassLoaderGroup(); ++ private final List groups = new CopyOnWriteArrayList<>(); ++ ++ public PaperPluginClassLoaderStorage() { ++ this.groups.add(this.globalGroup); ++ } ++ ++ @Override ++ public PluginClassLoaderGroup registerSpigotGroup(PluginClassLoader pluginClassLoader) { ++ return this.registerGroup(pluginClassLoader, new SpigotPluginClassLoaderGroup(this.globalGroup, (library) -> { ++ return Bukkit.getServer().getPluginManager().isTransitiveDependency(pluginClassLoader.getConfiguration(), library.getConfiguration()); ++ })); ++ } ++ ++ @Override ++ public PluginClassLoaderGroup registerOpenGroup(ConfiguredPluginClassLoader classLoader) { ++ return this.registerGroup(classLoader, this.globalGroup); ++ } ++ ++ @Override ++ public PluginClassLoaderGroup registerAccessBackedGroup(ConfiguredPluginClassLoader classLoader, ClassLoaderAccess access) { ++ List allowedLoaders = new ArrayList<>(); ++ for (ConfiguredPluginClassLoader configuredPluginClassLoader : this.globalGroup.getClassLoaders()) { ++ if (access.canAccess(configuredPluginClassLoader)) { ++ allowedLoaders.add(configuredPluginClassLoader); ++ } ++ } ++ ++ return this.registerGroup(classLoader, new StaticPluginClassLoaderGroup(allowedLoaders, access)); ++ } ++ ++ private PluginClassLoaderGroup registerGroup(ConfiguredPluginClassLoader classLoader, PluginClassLoaderGroup group) { ++ // Now add this classloader to any groups that allows it (includes global) ++ for (PluginClassLoaderGroup loaderGroup : this.groups) { ++ if (loaderGroup.getAccess().canAccess(classLoader)) { ++ loaderGroup.add(classLoader); ++ } ++ } ++ ++ group = new LockingClassLoaderGroup(group); ++ this.groups.add(group); ++ return group; ++ } ++ ++ @Override ++ public void unregisterClassloader(ConfiguredPluginClassLoader configuredPluginClassLoader) { ++ this.globalGroup.remove(configuredPluginClassLoader); ++ for (PluginClassLoaderGroup group : this.groups) { ++ group.remove(configuredPluginClassLoader); ++ } ++ } ++ ++ @Override ++ public boolean registerUnsafePlugin(ConfiguredPluginClassLoader pluginLoader) { ++ if (this.globalGroup.getClassLoaders().contains(pluginLoader)) { ++ return false; ++ } else { ++ this.globalGroup.getClassLoaders().add(pluginLoader); ++ return true; ++ } ++ } ++ ++ // Debug only ++ @ApiStatus.Internal ++ public GlobalPluginClassLoaderGroup getGlobalGroup() { ++ return this.globalGroup; ++ } ++ ++ // Debug only ++ @ApiStatus.Internal ++ public List getGroups() { ++ return this.groups; ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/entrypoint/classloader/group/SimpleListPluginClassLoaderGroup.java b/src/main/java/io/papermc/paper/plugin/entrypoint/classloader/group/SimpleListPluginClassLoaderGroup.java +new file mode 100644 +index 0000000000000000000000000000000000000000..23b6cb297f46c9c2b2944a3ab4031c31414620ad +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/entrypoint/classloader/group/SimpleListPluginClassLoaderGroup.java +@@ -0,0 +1,69 @@ ++package io.papermc.paper.plugin.entrypoint.classloader.group; ++ ++import io.papermc.paper.plugin.provider.classloader.ConfiguredPluginClassLoader; ++import io.papermc.paper.plugin.provider.classloader.PluginClassLoaderGroup; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Nullable; ++ ++import java.util.List; ++import java.util.concurrent.CopyOnWriteArrayList; ++ ++@ApiStatus.Internal ++public abstract class SimpleListPluginClassLoaderGroup implements PluginClassLoaderGroup { ++ ++ private static final boolean DISABLE_CLASS_PRIORITIZATION = Boolean.getBoolean("Paper.DisableClassPrioritization"); ++ ++ protected final List classloaders; ++ ++ protected SimpleListPluginClassLoaderGroup() { ++ this(new CopyOnWriteArrayList<>()); ++ } ++ ++ protected SimpleListPluginClassLoaderGroup(List classloaders) { ++ this.classloaders = classloaders; ++ } ++ ++ @Override ++ public @Nullable Class getClassByName(String name, boolean resolve, ConfiguredPluginClassLoader requester) { ++ if (!DISABLE_CLASS_PRIORITIZATION) { ++ try { ++ return this.lookupClass(name, false, requester); // First check the requester ++ } catch (ClassNotFoundException ignored) { ++ } ++ } ++ ++ for (ConfiguredPluginClassLoader loader : this.classloaders) { ++ try { ++ return this.lookupClass(name, resolve, loader); ++ } catch (ClassNotFoundException ignored) { ++ } ++ } ++ ++ return null; ++ } ++ ++ protected Class lookupClass(String name, boolean resolve, ConfiguredPluginClassLoader current) throws ClassNotFoundException { ++ return current.loadClass(name, resolve, false, true); ++ } ++ ++ @Override ++ public void remove(ConfiguredPluginClassLoader configuredPluginClassLoader) { ++ this.classloaders.remove(configuredPluginClassLoader); ++ } ++ ++ @Override ++ public void add(ConfiguredPluginClassLoader configuredPluginClassLoader) { ++ this.classloaders.add(configuredPluginClassLoader); ++ } ++ ++ public List getClassLoaders() { ++ return classloaders; ++ } ++ ++ @Override ++ public String toString() { ++ return "SimpleListPluginClassLoaderGroup{" + ++ "classloaders=" + this.classloaders + ++ '}'; ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/entrypoint/classloader/group/SingletonPluginClassLoaderGroup.java b/src/main/java/io/papermc/paper/plugin/entrypoint/classloader/group/SingletonPluginClassLoaderGroup.java +new file mode 100644 +index 0000000000000000000000000000000000000000..3b670bd6b35ae7f56488a9b50df54709a0b28901 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/entrypoint/classloader/group/SingletonPluginClassLoaderGroup.java +@@ -0,0 +1,60 @@ ++package io.papermc.paper.plugin.entrypoint.classloader.group; ++ ++import io.papermc.paper.plugin.provider.classloader.ClassLoaderAccess; ++import io.papermc.paper.plugin.provider.classloader.ConfiguredPluginClassLoader; ++import io.papermc.paper.plugin.provider.classloader.PluginClassLoaderGroup; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Nullable; ++ ++@ApiStatus.Internal ++public class SingletonPluginClassLoaderGroup implements PluginClassLoaderGroup { ++ ++ private final ConfiguredPluginClassLoader configuredPluginClassLoader; ++ private final Access access; ++ ++ public SingletonPluginClassLoaderGroup(ConfiguredPluginClassLoader configuredPluginClassLoader) { ++ this.configuredPluginClassLoader = configuredPluginClassLoader; ++ this.access = new Access(); ++ } ++ ++ @Override ++ public @Nullable Class getClassByName(String name, boolean resolve, ConfiguredPluginClassLoader requester) { ++ try { ++ return this.configuredPluginClassLoader.loadClass(name, resolve, false, true); ++ } catch (ClassNotFoundException ignored) { ++ } ++ ++ return null; ++ } ++ ++ @Override ++ public void remove(ConfiguredPluginClassLoader configuredPluginClassLoader) { ++ } ++ ++ @Override ++ public void add(ConfiguredPluginClassLoader configuredPluginClassLoader) { ++ } ++ ++ @Override ++ public ClassLoaderAccess getAccess() { ++ return this.access; ++ } ++ ++ @ApiStatus.Internal ++ private class Access implements ClassLoaderAccess { ++ ++ @Override ++ public boolean canAccess(ConfiguredPluginClassLoader classLoader) { ++ return SingletonPluginClassLoaderGroup.this.configuredPluginClassLoader == classLoader; ++ } ++ ++ } ++ ++ @Override ++ public String toString() { ++ return "SingletonPluginClassLoaderGroup{" + ++ "configuredPluginClassLoader=" + this.configuredPluginClassLoader + ++ ", access=" + this.access + ++ '}'; ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/entrypoint/classloader/group/SpigotPluginClassLoaderGroup.java b/src/main/java/io/papermc/paper/plugin/entrypoint/classloader/group/SpigotPluginClassLoaderGroup.java +new file mode 100644 +index 0000000000000000000000000000000000000000..5d26367524389388be163ae3120c1d2bf55cfef7 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/entrypoint/classloader/group/SpigotPluginClassLoaderGroup.java +@@ -0,0 +1,49 @@ ++package io.papermc.paper.plugin.entrypoint.classloader.group; ++ ++import io.papermc.paper.plugin.provider.classloader.ClassLoaderAccess; ++import io.papermc.paper.plugin.provider.classloader.ConfiguredPluginClassLoader; ++import org.jetbrains.annotations.ApiStatus; ++ ++import java.util.function.Predicate; ++ ++/** ++ * Spigot classloaders have the ability to see everything. ++ * However, libraries are ONLY shared depending on their dependencies. ++ */ ++@ApiStatus.Internal ++public class SpigotPluginClassLoaderGroup extends SimpleListPluginClassLoaderGroup { ++ ++ private final Predicate libraryClassloaderPredicate; ++ ++ public SpigotPluginClassLoaderGroup(GlobalPluginClassLoaderGroup globalPluginClassLoaderGroup, Predicate libraryClassloaderPredicate) { ++ super(globalPluginClassLoaderGroup.getClassLoaders()); ++ this.libraryClassloaderPredicate = libraryClassloaderPredicate; ++ } ++ ++ // Mirrors global list ++ @Override ++ public void add(ConfiguredPluginClassLoader configuredPluginClassLoader) { ++ } ++ ++ @Override ++ public void remove(ConfiguredPluginClassLoader configuredPluginClassLoader) { ++ } ++ ++ @Override ++ protected Class lookupClass(String name, boolean resolve, ConfiguredPluginClassLoader current) throws ClassNotFoundException { ++ return current.loadClass(name, resolve, false, this.libraryClassloaderPredicate.test(current)); ++ } ++ ++ @Override ++ public ClassLoaderAccess getAccess() { ++ return v -> true; ++ } ++ ++ @Override ++ public String toString() { ++ return "SpigotPluginClassLoaderGroup{" + ++ "libraryClassloaderPredicate=" + this.libraryClassloaderPredicate + ++ ", classloaders=" + this.classloaders + ++ '}'; ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/entrypoint/classloader/group/StaticPluginClassLoaderGroup.java b/src/main/java/io/papermc/paper/plugin/entrypoint/classloader/group/StaticPluginClassLoaderGroup.java +new file mode 100644 +index 0000000000000000000000000000000000000000..7f7085b06271adf8a37485f4c9c9b8af605dd27d +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/entrypoint/classloader/group/StaticPluginClassLoaderGroup.java +@@ -0,0 +1,31 @@ ++package io.papermc.paper.plugin.entrypoint.classloader.group; ++ ++import io.papermc.paper.plugin.provider.classloader.ClassLoaderAccess; ++import io.papermc.paper.plugin.provider.classloader.ConfiguredPluginClassLoader; ++import org.jetbrains.annotations.ApiStatus; ++ ++import java.util.List; ++ ++@ApiStatus.Internal ++public class StaticPluginClassLoaderGroup extends SimpleListPluginClassLoaderGroup { ++ ++ private final ClassLoaderAccess access; ++ ++ public StaticPluginClassLoaderGroup(List classloaders, ClassLoaderAccess access) { ++ super(classloaders); ++ this.access = access; ++ } ++ ++ @Override ++ public ClassLoaderAccess getAccess() { ++ return this.access; ++ } ++ ++ @Override ++ public String toString() { ++ return "StaticPluginClassLoaderGroup{" + ++ "access=" + this.access + ++ ", classloaders=" + this.classloaders + ++ '}'; ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/entrypoint/dependency/DependencyContextHolder.java b/src/main/java/io/papermc/paper/plugin/entrypoint/dependency/DependencyContextHolder.java +new file mode 100644 +index 0000000000000000000000000000000000000000..f43295fdeaa587cf30c35a1d545167071d58ce4b +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/entrypoint/dependency/DependencyContextHolder.java +@@ -0,0 +1,9 @@ ++package io.papermc.paper.plugin.entrypoint.dependency; ++ ++import io.papermc.paper.plugin.provider.entrypoint.DependencyContext; ++ ++public interface DependencyContextHolder { ++ ++ void setContext(DependencyContext context); ++ ++} +diff --git a/src/main/java/io/papermc/paper/plugin/entrypoint/dependency/DependencyUtil.java b/src/main/java/io/papermc/paper/plugin/entrypoint/dependency/DependencyUtil.java +new file mode 100644 +index 0000000000000000000000000000000000000000..bfa258faf17ca6118aeddfa4e95bbd082bcd1390 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/entrypoint/dependency/DependencyUtil.java +@@ -0,0 +1,75 @@ ++package io.papermc.paper.plugin.entrypoint.dependency; ++ ++import com.google.common.graph.MutableGraph; ++import io.papermc.paper.plugin.configuration.PluginMeta; ++import io.papermc.paper.plugin.provider.PluginProvider; ++import io.papermc.paper.plugin.provider.configuration.LoadOrderConfiguration; ++import org.bukkit.plugin.PluginDescriptionFile; ++import org.jetbrains.annotations.NotNull; ++ ++import java.util.ArrayList; ++import java.util.List; ++import java.util.Map; ++import java.util.function.Predicate; ++ ++@SuppressWarnings("UnstableApiUsage") ++public class DependencyUtil { ++ ++ @NotNull ++ public static MutableGraph buildDependencyGraph(@NotNull MutableGraph dependencyGraph, @NotNull PluginMeta configuration) { ++ List dependencies = new ArrayList<>(); ++ dependencies.addAll(configuration.getPluginDependencies()); ++ dependencies.addAll(configuration.getPluginSoftDependencies()); ++ ++ return buildDependencyGraph(dependencyGraph, configuration.getName(), dependencies); ++ } ++ ++ @NotNull ++ public static MutableGraph buildDependencyGraph(@NotNull MutableGraph dependencyGraph, String identifier, @NotNull Iterable depends) { ++ for (String dependency : depends) { ++ dependencyGraph.putEdge(identifier, dependency); ++ } ++ ++ dependencyGraph.addNode(identifier); // Make sure dependencies at least have a node ++ return dependencyGraph; ++ } ++ ++ @NotNull ++ public static MutableGraph buildLoadGraph(@NotNull MutableGraph dependencyGraph, @NotNull LoadOrderConfiguration configuration, Predicate validator) { ++ String identifier = configuration.getMeta().getName(); ++ for (String dependency : configuration.getLoadAfter()) { ++ if (validator.test(dependency)) { ++ dependencyGraph.putEdge(identifier, dependency); ++ } ++ } ++ ++ for (String loadBeforeTarget : configuration.getLoadBefore()) { ++ if (validator.test(loadBeforeTarget)) { ++ dependencyGraph.putEdge(loadBeforeTarget, identifier); ++ } ++ } ++ ++ dependencyGraph.addNode(identifier); // Make sure dependencies at least have a node ++ return dependencyGraph; ++ } ++ ++ // This adds a provided plugin to another plugin, basically making it seem like a "dependency" ++ // in order to have plugins that need the provided plugin to load after the specified plugin name ++ @NotNull ++ public static MutableGraph addProvidedPlugin(@NotNull MutableGraph dependencyGraph, @NotNull String pluginName, @NotNull String providedName) { ++ dependencyGraph.putEdge(pluginName, providedName); ++ ++ return dependencyGraph; ++ } ++ ++ public static List validateSimple(PluginMeta meta, Map> toLoad) { ++ List missingDependencies = new ArrayList<>(); ++ for (String hardDependency : meta.getPluginDependencies()) { ++ if (!toLoad.containsKey(hardDependency)) { ++ missingDependencies.add(hardDependency); ++ } ++ } ++ ++ return missingDependencies; ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/entrypoint/dependency/GraphDependencyContext.java b/src/main/java/io/papermc/paper/plugin/entrypoint/dependency/GraphDependencyContext.java +new file mode 100644 +index 0000000000000000000000000000000000000000..6f201a8131ca9631ac4af62c75e6f2e889cb5eae +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/entrypoint/dependency/GraphDependencyContext.java +@@ -0,0 +1,43 @@ ++package io.papermc.paper.plugin.entrypoint.dependency; ++ ++import com.google.common.graph.Graph; ++import com.google.common.graph.Graphs; ++import io.papermc.paper.plugin.configuration.PluginMeta; ++import io.papermc.paper.plugin.provider.entrypoint.DependencyContext; ++ ++import java.util.Set; ++ ++@SuppressWarnings("UnstableApiUsage") ++public class GraphDependencyContext implements DependencyContext { ++ ++ private final Graph dependencyGraph; ++ ++ public GraphDependencyContext(Graph dependencyGraph) { ++ this.dependencyGraph = dependencyGraph; ++ } ++ ++ @Override ++ public boolean isTransitiveDependency(PluginMeta plugin, PluginMeta depend) { ++ String pluginIdentifier = plugin.getName(); ++ ++ if (this.dependencyGraph.nodes().contains(pluginIdentifier)) { ++ Set reachableNodes = Graphs.reachableNodes(this.dependencyGraph, pluginIdentifier); ++ if (reachableNodes.contains(depend.getName())) { ++ return true; ++ } ++ for (String provided : depend.getProvidedPlugins()) { ++ if (reachableNodes.contains(provided)) { ++ return true; ++ } ++ } ++ } ++ ++ return false; ++ } ++ ++ @Override ++ public boolean hasDependency(String pluginIdentifier) { ++ return this.dependencyGraph.nodes().contains(pluginIdentifier); ++ } ++ ++} +diff --git a/src/main/java/io/papermc/paper/plugin/entrypoint/strategy/JohnsonSimpleCycles.java b/src/main/java/io/papermc/paper/plugin/entrypoint/strategy/JohnsonSimpleCycles.java +new file mode 100644 +index 0000000000000000000000000000000000000000..22189a1c42459c00d3e8bdeb980d15a69b720805 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/entrypoint/strategy/JohnsonSimpleCycles.java +@@ -0,0 +1,350 @@ ++/* ++ * (C) Copyright 2013-2021, by Nikolay Ognyanov and Contributors. ++ * ++ * JGraphT : a free Java graph-theory library ++ * ++ * See the CONTRIBUTORS.md file distributed with this work for additional ++ * information regarding copyright ownership. ++ * ++ * This program and the accompanying materials are made available under the ++ * terms of the Eclipse Public License 2.0 which is available at ++ * http://www.eclipse.org/legal/epl-2.0, or the ++ * GNU Lesser General Public License v2.1 or later ++ * which is available at ++ * http://www.gnu.org/licenses/old-licenses/lgpl-2.1-standalone.html. ++ * ++ * SPDX-License-Identifier: EPL-2.0 OR LGPL-2.1-or-later ++ */ ++ ++// MODIFICATIONS: ++// - Modified to use a guava graph directly ++ ++package io.papermc.paper.plugin.entrypoint.strategy; ++ ++import com.google.common.base.Preconditions; ++import com.google.common.graph.Graph; ++import com.google.common.graph.GraphBuilder; ++import com.google.common.graph.MutableGraph; ++import com.mojang.datafixers.util.Pair; ++ ++import java.util.ArrayDeque; ++import java.util.ArrayList; ++import java.util.HashMap; ++import java.util.HashSet; ++import java.util.List; ++import java.util.Map; ++import java.util.Set; ++import java.util.function.Consumer; ++ ++/** ++ * Find all simple cycles of a directed graph using the Johnson's algorithm. ++ * ++ *

++ * See:
++ * D.B.Johnson, Finding all the elementary circuits of a directed graph, SIAM J. Comput., 4 (1975), ++ * pp. 77-84. ++ * ++ * @param the vertex type. ++ * ++ * @author Nikolay Ognyanov ++ */ ++public class JohnsonSimpleCycles ++{ ++ // The graph. ++ private Graph graph; ++ ++ // The main state of the algorithm. ++ private Consumer> cycleConsumer = null; ++ private V[] iToV = null; ++ private Map vToI = null; ++ private Set blocked = null; ++ private Map> bSets = null; ++ private ArrayDeque stack = null; ++ ++ // The state of the embedded Tarjan SCC algorithm. ++ private List> foundSCCs = null; ++ private int index = 0; ++ private Map vIndex = null; ++ private Map vLowlink = null; ++ private ArrayDeque path = null; ++ private Set pathSet = null; ++ ++ /** ++ * Create a simple cycle finder for the specified graph. ++ * ++ * @param graph - the DirectedGraph in which to find cycles. ++ * ++ * @throws IllegalArgumentException if the graph argument is ++ * null. ++ */ ++ public JohnsonSimpleCycles(Graph graph) ++ { ++ Preconditions.checkState(graph.isDirected(), "Graph must be directed"); ++ this.graph = graph; ++ } ++ ++ /** ++ * Find the simple cycles of the graph. ++ * ++ * @return The list of all simple cycles. Possibly empty but never null. ++ */ ++ public List> findSimpleCycles() ++ { ++ List> result = new ArrayList<>(); ++ findSimpleCycles(result::add); ++ return result; ++ } ++ ++ /** ++ * Find the simple cycles of the graph. ++ * ++ * @param consumer Consumer that will be called with each cycle found. ++ */ ++ public void findSimpleCycles(Consumer> consumer) ++ { ++ if (graph == null) { ++ throw new IllegalArgumentException("Null graph."); ++ } ++ initState(consumer); ++ ++ int startIndex = 0; ++ int size = graph.nodes().size(); ++ while (startIndex < size) { ++ Pair, Integer> minSCCGResult = findMinSCSG(startIndex); ++ if (minSCCGResult != null) { ++ startIndex = minSCCGResult.getSecond(); ++ Graph scg = minSCCGResult.getFirst(); ++ V startV = toV(startIndex); ++ for (V v : scg.successors(startV)) { ++ blocked.remove(v); ++ getBSet(v).clear(); ++ } ++ findCyclesInSCG(startIndex, startIndex, scg); ++ startIndex++; ++ } else { ++ break; ++ } ++ } ++ ++ clearState(); ++ } ++ ++ private Pair, Integer> findMinSCSG(int startIndex) ++ { ++ /* ++ * Per Johnson : "adjacency structure of strong component $K$ with least vertex in subgraph ++ * of $G$ induced by $(s, s + 1, n)$". Or in contemporary terms: the strongly connected ++ * component of the subgraph induced by $(v_1, \dotso ,v_n)$ which contains the minimum ++ * (among those SCCs) vertex index. We return that index together with the graph. ++ */ ++ initMinSCGState(); ++ ++ List> foundSCCs = findSCCS(startIndex); ++ ++ // find the SCC with the minimum index ++ int minIndexFound = Integer.MAX_VALUE; ++ Set minSCC = null; ++ for (Set scc : foundSCCs) { ++ for (V v : scc) { ++ int t = toI(v); ++ if (t < minIndexFound) { ++ minIndexFound = t; ++ minSCC = scc; ++ } ++ } ++ } ++ if (minSCC == null) { ++ return null; ++ } ++ ++ // build a graph for the SCC found ++ MutableGraph dependencyGraph = GraphBuilder.directed().allowsSelfLoops(true).build(); ++ ++ for (V v : minSCC) { ++ for (V w : minSCC) { ++ if (graph.hasEdgeConnecting(v, w)) { ++ dependencyGraph.putEdge(v, w); ++ } ++ } ++ } ++ ++ Pair, Integer> result = Pair.of(dependencyGraph, minIndexFound); ++ clearMinSCCState(); ++ return result; ++ } ++ ++ private List> findSCCS(int startIndex) ++ { ++ // Find SCCs in the subgraph induced ++ // by vertices startIndex and beyond. ++ // A call to StrongConnectivityAlgorithm ++ // would be too expensive because of the ++ // need to materialize the subgraph. ++ // So - do a local search by the Tarjan's ++ // algorithm and pretend that vertices ++ // with an index smaller than startIndex ++ // do not exist. ++ for (V v : graph.nodes()) { ++ int vI = toI(v); ++ if (vI < startIndex) { ++ continue; ++ } ++ if (!vIndex.containsKey(v)) { ++ getSCCs(startIndex, vI); ++ } ++ } ++ List> result = foundSCCs; ++ foundSCCs = null; ++ return result; ++ } ++ ++ private void getSCCs(int startIndex, int vertexIndex) ++ { ++ V vertex = toV(vertexIndex); ++ vIndex.put(vertex, index); ++ vLowlink.put(vertex, index); ++ index++; ++ path.push(vertex); ++ pathSet.add(vertex); ++ ++ Set edges = graph.successors(vertex); ++ for (V successor : edges) { ++ int successorIndex = toI(successor); ++ if (successorIndex < startIndex) { ++ continue; ++ } ++ if (!vIndex.containsKey(successor)) { ++ getSCCs(startIndex, successorIndex); ++ vLowlink.put(vertex, Math.min(vLowlink.get(vertex), vLowlink.get(successor))); ++ } else if (pathSet.contains(successor)) { ++ vLowlink.put(vertex, Math.min(vLowlink.get(vertex), vIndex.get(successor))); ++ } ++ } ++ if (vLowlink.get(vertex).equals(vIndex.get(vertex))) { ++ Set result = new HashSet<>(); ++ V temp; ++ do { ++ temp = path.pop(); ++ pathSet.remove(temp); ++ result.add(temp); ++ } while (!vertex.equals(temp)); ++ if (result.size() == 1) { ++ V v = result.iterator().next(); ++ if (graph.edges().contains(vertex)) { ++ foundSCCs.add(result); ++ } ++ } else { ++ foundSCCs.add(result); ++ } ++ } ++ } ++ ++ private boolean findCyclesInSCG(int startIndex, int vertexIndex, Graph scg) ++ { ++ /* ++ * Find cycles in a strongly connected graph per Johnson. ++ */ ++ boolean foundCycle = false; ++ V vertex = toV(vertexIndex); ++ stack.push(vertex); ++ blocked.add(vertex); ++ ++ for (V successor : scg.successors(vertex)) { ++ int successorIndex = toI(successor); ++ if (successorIndex == startIndex) { ++ List cycle = new ArrayList<>(stack.size()); ++ stack.descendingIterator().forEachRemaining(cycle::add); ++ cycleConsumer.accept(cycle); ++ foundCycle = true; ++ } else if (!blocked.contains(successor)) { ++ boolean gotCycle = findCyclesInSCG(startIndex, successorIndex, scg); ++ foundCycle = foundCycle || gotCycle; ++ } ++ } ++ if (foundCycle) { ++ unblock(vertex); ++ } else { ++ for (V w : scg.successors(vertex)) { ++ Set bSet = getBSet(w); ++ bSet.add(vertex); ++ } ++ } ++ stack.pop(); ++ return foundCycle; ++ } ++ ++ private void unblock(V vertex) ++ { ++ blocked.remove(vertex); ++ Set bSet = getBSet(vertex); ++ while (bSet.size() > 0) { ++ V w = bSet.iterator().next(); ++ bSet.remove(w); ++ if (blocked.contains(w)) { ++ unblock(w); ++ } ++ } ++ } ++ ++ @SuppressWarnings("unchecked") ++ private void initState(Consumer> consumer) ++ { ++ cycleConsumer = consumer; ++ iToV = (V[]) graph.nodes().toArray(); ++ vToI = new HashMap<>(); ++ blocked = new HashSet<>(); ++ bSets = new HashMap<>(); ++ stack = new ArrayDeque<>(); ++ ++ for (int i = 0; i < iToV.length; i++) { ++ vToI.put(iToV[i], i); ++ } ++ } ++ ++ private void clearState() ++ { ++ cycleConsumer = null; ++ iToV = null; ++ vToI = null; ++ blocked = null; ++ bSets = null; ++ stack = null; ++ } ++ ++ private void initMinSCGState() ++ { ++ index = 0; ++ foundSCCs = new ArrayList<>(); ++ vIndex = new HashMap<>(); ++ vLowlink = new HashMap<>(); ++ path = new ArrayDeque<>(); ++ pathSet = new HashSet<>(); ++ } ++ ++ private void clearMinSCCState() ++ { ++ index = 0; ++ foundSCCs = null; ++ vIndex = null; ++ vLowlink = null; ++ path = null; ++ pathSet = null; ++ } ++ ++ private Integer toI(V vertex) ++ { ++ return vToI.get(vertex); ++ } ++ ++ private V toV(Integer i) ++ { ++ return iToV[i]; ++ } ++ ++ private Set getBSet(V v) ++ { ++ // B sets typically not all needed, ++ // so instantiate lazily. ++ return bSets.computeIfAbsent(v, k -> new HashSet<>()); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/entrypoint/strategy/LegacyPluginLoadingStrategy.java b/src/main/java/io/papermc/paper/plugin/entrypoint/strategy/LegacyPluginLoadingStrategy.java +new file mode 100644 +index 0000000000000000000000000000000000000000..746272e0f8fb5311d5408175abe08db8aa356376 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/entrypoint/strategy/LegacyPluginLoadingStrategy.java +@@ -0,0 +1,269 @@ ++package io.papermc.paper.plugin.entrypoint.strategy; ++ ++import com.google.common.graph.GraphBuilder; ++import com.google.common.graph.MutableGraph; ++import io.papermc.paper.plugin.configuration.PluginMeta; ++import io.papermc.paper.plugin.entrypoint.dependency.GraphDependencyContext; ++import io.papermc.paper.plugin.provider.PluginProvider; ++import io.papermc.paper.plugin.provider.type.paper.PaperPluginParent; ++import org.bukkit.plugin.UnknownDependencyException; ++ ++import java.util.ArrayList; ++import java.util.Collection; ++import java.util.HashMap; ++import java.util.HashSet; ++import java.util.Iterator; ++import java.util.LinkedList; ++import java.util.List; ++import java.util.Map; ++import java.util.Set; ++import java.util.logging.Level; ++import java.util.logging.Logger; ++ ++@SuppressWarnings("UnstableApiUsage") ++public class LegacyPluginLoadingStrategy implements ProviderLoadingStrategy { ++ ++ private static final Logger LOGGER = Logger.getLogger("LegacyPluginLoadingStrategy"); ++ private final ProviderConfiguration configuration; ++ ++ public LegacyPluginLoadingStrategy(ProviderConfiguration onLoad) { ++ this.configuration = onLoad; ++ } ++ ++ @Override ++ public List> loadProviders(List> providers) { ++ List> javapluginsLoaded = new ArrayList<>(); ++ MutableGraph dependencyGraph = GraphBuilder.directed().build(); ++ GraphDependencyContext dependencyContext = new GraphDependencyContext(dependencyGraph); ++ ++ Map> providersToLoad = new HashMap<>(); ++ Set loadedPlugins = new HashSet<>(); ++ Map pluginsProvided = new HashMap<>(); ++ Map> dependencies = new HashMap<>(); ++ Map> softDependencies = new HashMap<>(); ++ ++ for (PluginProvider provider : providers) { ++ PluginMeta configuration = provider.getMeta(); ++ ++ PluginProvider replacedProvider = providersToLoad.put(configuration.getName(), provider); ++ if (replacedProvider != null) { ++ LOGGER.severe(String.format( ++ "Ambiguous plugin name `%s' for files `%s' and `%s' in `%s'", ++ configuration.getName(), ++ provider.getSource(), ++ replacedProvider.getSource(), ++ replacedProvider.getParentSource() ++ )); ++ } ++ ++ String removedProvided = pluginsProvided.remove(configuration.getName()); ++ if (removedProvided != null) { ++ LOGGER.warning(String.format( ++ "Ambiguous plugin name `%s'. It is also provided by `%s'", ++ configuration.getName(), ++ removedProvided ++ )); ++ } ++ ++ for (String provided : configuration.getProvidedPlugins()) { ++ PluginProvider pluginProvider = providersToLoad.get(provided); ++ ++ if (pluginProvider != null) { ++ LOGGER.warning(String.format( ++ "`%s provides `%s' while this is also the name of `%s' in `%s'", ++ provider.getSource(), ++ provided, ++ pluginProvider.getSource(), ++ provider.getParentSource() ++ )); ++ } else { ++ String replacedPlugin = pluginsProvided.put(provided, configuration.getName()); ++ if (replacedPlugin != null) { ++ LOGGER.warning(String.format( ++ "`%s' is provided by both `%s' and `%s'", ++ provided, ++ configuration.getName(), ++ replacedPlugin ++ )); ++ } ++ } ++ } ++ ++ Collection softDependencySet = provider.getMeta().getPluginSoftDependencies(); ++ if (softDependencySet != null && !softDependencySet.isEmpty()) { ++ if (softDependencies.containsKey(configuration.getName())) { ++ // Duplicates do not matter, they will be removed together if applicable ++ softDependencies.get(configuration.getName()).addAll(softDependencySet); ++ } else { ++ softDependencies.put(configuration.getName(), new LinkedList(softDependencySet)); ++ } ++ ++ for (String depend : softDependencySet) { ++ dependencyGraph.putEdge(configuration.getName(), depend); ++ } ++ } ++ ++ Collection dependencySet = provider.getMeta().getPluginDependencies(); ++ if (dependencySet != null && !dependencySet.isEmpty()) { ++ dependencies.put(configuration.getName(), new LinkedList(dependencySet)); ++ ++ for (String depend : dependencySet) { ++ dependencyGraph.putEdge(configuration.getName(), depend); ++ } ++ } ++ ++ Collection loadBeforeSet = provider.getMeta().getPluginSoftDependencies(); ++ if (loadBeforeSet != null && !loadBeforeSet.isEmpty()) { ++ for (String loadBeforeTarget : loadBeforeSet) { ++ if (softDependencies.containsKey(loadBeforeTarget)) { ++ softDependencies.get(loadBeforeTarget).add(configuration.getName()); ++ } else { ++ // softDependencies is never iterated, so 'ghost' plugins aren't an issue ++ Collection shortSoftDependency = new LinkedList(); ++ shortSoftDependency.add(configuration.getName()); ++ softDependencies.put(loadBeforeTarget, shortSoftDependency); ++ } ++ ++ dependencyGraph.putEdge(loadBeforeTarget, configuration.getName()); ++ } ++ } ++ } ++ ++ while (!providersToLoad.isEmpty()) { ++ boolean missingDependency = true; ++ Iterator>> providerIterator = providersToLoad.entrySet().iterator(); ++ ++ while (providerIterator.hasNext()) { ++ Map.Entry> entry = providerIterator.next(); ++ String providerIdentifier = entry.getKey(); ++ ++ if (dependencies.containsKey(providerIdentifier)) { ++ Iterator dependencyIterator = dependencies.get(providerIdentifier).iterator(); ++ final Set missingHardDependencies = new HashSet<>(dependencies.get(providerIdentifier).size()); // Paper - list all missing hard depends ++ ++ while (dependencyIterator.hasNext()) { ++ String dependency = dependencyIterator.next(); ++ ++ // Dependency loaded ++ if (loadedPlugins.contains(dependency)) { ++ dependencyIterator.remove(); ++ ++ // We have a dependency not found ++ } else if (!providersToLoad.containsKey(dependency) && !pluginsProvided.containsKey(dependency)) { ++ // Paper start ++ missingHardDependencies.add(dependency); ++ } ++ } ++ if (!missingHardDependencies.isEmpty()) { ++ // Paper end ++ missingDependency = false; ++ providerIterator.remove(); ++ pluginsProvided.values().removeIf(s -> s.equals(providerIdentifier)); // Paper - remove provided plugins ++ softDependencies.remove(providerIdentifier); ++ dependencies.remove(providerIdentifier); ++ ++ LOGGER.log( ++ Level.SEVERE, ++ "Could not load '" + entry.getValue().getSource() + "' in folder '" + entry.getValue().getParentSource() + "'", // Paper ++ new UnknownDependencyException(missingHardDependencies, providerIdentifier)); // Paper ++ } ++ ++ if (dependencies.containsKey(providerIdentifier) && dependencies.get(providerIdentifier).isEmpty()) { ++ dependencies.remove(providerIdentifier); ++ } ++ } ++ if (softDependencies.containsKey(providerIdentifier)) { ++ Iterator softDependencyIterator = softDependencies.get(providerIdentifier).iterator(); ++ ++ while (softDependencyIterator.hasNext()) { ++ String softDependency = softDependencyIterator.next(); ++ ++ // Soft depend is no longer around ++ if (!providersToLoad.containsKey(softDependency) && !pluginsProvided.containsKey(softDependency)) { ++ softDependencyIterator.remove(); ++ } ++ } ++ ++ if (softDependencies.get(providerIdentifier).isEmpty()) { ++ softDependencies.remove(providerIdentifier); ++ } ++ } ++ if (!(dependencies.containsKey(providerIdentifier) || softDependencies.containsKey(providerIdentifier)) && providersToLoad.containsKey(providerIdentifier)) { ++ // We're clear to load, no more soft or hard dependencies left ++ PluginProvider file = providersToLoad.get(providerIdentifier); ++ providerIterator.remove(); ++ pluginsProvided.values().removeIf(s -> s.equals(providerIdentifier)); // Paper - remove provided plugins ++ missingDependency = false; ++ ++ try { ++ this.configuration.applyContext(file, dependencyContext); ++ T loadedPlugin = file.createInstance(); ++ this.warnIfPaperPlugin(file); ++ ++ if (this.configuration.load(file, loadedPlugin)) { ++ loadedPlugins.add(file.getMeta().getName()); ++ loadedPlugins.addAll(file.getMeta().getProvidedPlugins()); ++ javapluginsLoaded.add(new ProviderPair<>(file, loadedPlugin)); ++ } ++ ++ } catch (Throwable ex) { ++ LOGGER.log(Level.SEVERE, "Could not load '" + file.getSource() + "' in folder '" + file.getParentSource() + "'", ex); // Paper ++ } ++ } ++ } ++ ++ if (missingDependency) { ++ // We now iterate over plugins until something loads ++ // This loop will ignore soft dependencies ++ providerIterator = providersToLoad.entrySet().iterator(); ++ ++ while (providerIterator.hasNext()) { ++ Map.Entry> entry = providerIterator.next(); ++ String plugin = entry.getKey(); ++ ++ if (!dependencies.containsKey(plugin)) { ++ softDependencies.remove(plugin); ++ missingDependency = false; ++ PluginProvider file = entry.getValue(); ++ providerIterator.remove(); ++ ++ try { ++ this.configuration.applyContext(file, dependencyContext); ++ T loadedPlugin = file.createInstance(); ++ this.warnIfPaperPlugin(file); ++ ++ if (this.configuration.load(file, loadedPlugin)) { ++ loadedPlugins.add(file.getMeta().getName()); ++ loadedPlugins.addAll(file.getMeta().getProvidedPlugins()); ++ javapluginsLoaded.add(new ProviderPair<>(file, loadedPlugin)); ++ } ++ break; ++ } catch (Throwable ex) { ++ LOGGER.log(Level.SEVERE, "Could not load '" + file.getSource() + "' in folder '" + file.getParentSource() + "'", ex); // Paper ++ } ++ } ++ } ++ // We have no plugins left without a depend ++ if (missingDependency) { ++ softDependencies.clear(); ++ dependencies.clear(); ++ Iterator> failedPluginIterator = providersToLoad.values().iterator(); ++ ++ while (failedPluginIterator.hasNext()) { ++ PluginProvider file = failedPluginIterator.next(); ++ failedPluginIterator.remove(); ++ LOGGER.log(Level.SEVERE, "Could not load '" + file.getSource() + "' in folder '" + file.getParentSource() + "': circular dependency detected"); // Paper ++ } ++ } ++ } ++ } ++ ++ return javapluginsLoaded; ++ } ++ ++ private void warnIfPaperPlugin(PluginProvider provider) { ++ if (provider instanceof PaperPluginParent.PaperServerPluginProvider) { ++ provider.getLogger().warning("Loading Paper plugin in the legacy plugin loading logic. This is not recommended and may introduce some differences into load order. It's highly recommended you move away from this if you are wanting to use Paper plugins."); ++ } ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/entrypoint/strategy/ModernPluginLoadingStrategy.java b/src/main/java/io/papermc/paper/plugin/entrypoint/strategy/ModernPluginLoadingStrategy.java +new file mode 100644 +index 0000000000000000000000000000000000000000..fa7bbfeff53d5cab3d96a5f1181b610f4ce22518 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/entrypoint/strategy/ModernPluginLoadingStrategy.java +@@ -0,0 +1,148 @@ ++package io.papermc.paper.plugin.entrypoint.strategy; ++ ++import com.google.common.collect.Lists; ++import com.google.common.collect.Maps; ++import com.google.common.graph.GraphBuilder; ++import com.google.common.graph.MutableGraph; ++import com.mojang.logging.LogUtils; ++import io.papermc.paper.plugin.configuration.PluginMeta; ++import io.papermc.paper.plugin.entrypoint.dependency.DependencyUtil; ++import io.papermc.paper.plugin.entrypoint.dependency.GraphDependencyContext; ++import io.papermc.paper.plugin.provider.PluginProvider; ++import io.papermc.paper.plugin.provider.configuration.LoadOrderConfiguration; ++import org.bukkit.plugin.UnknownDependencyException; ++import org.slf4j.Logger; ++ ++import java.util.ArrayList; ++import java.util.HashMap; ++import java.util.List; ++import java.util.Map; ++ ++@SuppressWarnings("UnstableApiUsage") ++public class ModernPluginLoadingStrategy implements ProviderLoadingStrategy { ++ ++ private static final Logger LOGGER = LogUtils.getClassLogger(); ++ private final ProviderConfiguration configuration; ++ ++ public ModernPluginLoadingStrategy(ProviderConfiguration onLoad) { ++ this.configuration = onLoad; ++ } ++ ++ @Override ++ public List> loadProviders(List> pluginProviders) { ++ Map> providerMap = new HashMap<>(); ++ Map> providerMapMirror = Maps.transformValues(providerMap, (entry) -> entry.provider); ++ List> validatedProviders = new ArrayList<>(); ++ ++ // Populate provider map ++ for (PluginProvider provider : pluginProviders) { ++ PluginMeta providerConfig = provider.getMeta(); ++ PluginProviderEntry entry = new PluginProviderEntry<>(provider); ++ ++ PluginProviderEntry replacedProvider = providerMap.put(providerConfig.getName(), entry); ++ if (replacedProvider != null) { ++ LOGGER.error(String.format( ++ "Ambiguous plugin name '%s' for files '%s' and '%s' in '%s'", ++ providerConfig.getName(), ++ provider.getSource(), ++ replacedProvider.provider.getSource(), ++ replacedProvider.provider.getParentSource() ++ )); ++ } ++ ++ for (String extra : providerConfig.getProvidedPlugins()) { ++ PluginProviderEntry replacedExtraProvider = providerMap.putIfAbsent(extra, entry); ++ if (replacedExtraProvider != null) { ++ LOGGER.warn(String.format( ++ "`%s' is provided by both `%s' and `%s'", ++ extra, ++ providerConfig.getName(), ++ replacedExtraProvider.provider.getMeta().getName() ++ )); ++ } ++ } ++ } ++ ++ // Validate providers, ensuring all of them have valid dependencies. Removing those who are invalid ++ for (PluginProvider provider : pluginProviders) { ++ PluginMeta configuration = provider.getMeta(); ++ ++ // Populate missing dependencies to capture if there are multiple missing ones. ++ List missingDependencies = provider.validateDependencies(providerMapMirror); ++ ++ if (missingDependencies.isEmpty()) { ++ validatedProviders.add(provider); ++ } else { ++ LOGGER.error("Could not load '%s' in '%s'".formatted(provider.getSource(), provider.getParentSource()), new UnknownDependencyException(missingDependencies, configuration.getName())); // Paper ++ // Because the validator is invalid, remove it from the provider map ++ providerMap.remove(configuration.getName()); ++ } ++ } ++ ++ MutableGraph loadOrderGraph = GraphBuilder.directed().build(); ++ MutableGraph dependencyGraph = GraphBuilder.directed().build(); ++ for (PluginProvider validated : validatedProviders) { ++ PluginMeta configuration = validated.getMeta(); ++ LoadOrderConfiguration loadOrderConfiguration = validated.createConfiguration(providerMapMirror); ++ ++ // Build a validated provider's load order changes ++ DependencyUtil.buildLoadGraph(loadOrderGraph, loadOrderConfiguration, providerMap::containsKey); ++ ++ // Build a validated provider's dependencies into the graph ++ DependencyUtil.buildDependencyGraph(dependencyGraph, configuration); ++ ++ // Add the provided plugins to the graph as well ++ for (String provides : configuration.getProvidedPlugins()) { ++ String name = configuration.getName(); ++ DependencyUtil.addProvidedPlugin(loadOrderGraph, name, provides); ++ DependencyUtil.addProvidedPlugin(dependencyGraph, name, provides); ++ } ++ } ++ ++ // Reverse the topographic search to let us see which providers we can load first. ++ List reversedTopographicSort; ++ try { ++ reversedTopographicSort = Lists.reverse(TopographicGraphSorter.sortGraph(loadOrderGraph)); ++ } catch (TopographicGraphSorter.GraphCycleException exception) { ++ throw new PluginGraphCycleException(new JohnsonSimpleCycles<>(loadOrderGraph).findSimpleCycles()); ++ } ++ ++ GraphDependencyContext graphDependencyContext = new GraphDependencyContext(dependencyGraph); ++ List> loadedPlugins = new ArrayList<>(); ++ for (String providerIdentifier : reversedTopographicSort) { ++ // It's possible that this will be null because the above dependencies for soft/load before aren't validated if they exist. ++ // The graph could be MutableGraph>, but we would have to check if each dependency exists there... just ++ // nicer to do it here TBH. ++ PluginProviderEntry retrievedProviderEntry = providerMap.get(providerIdentifier); ++ if (retrievedProviderEntry == null || retrievedProviderEntry.provided) { ++ // OR if this was already provided (most likely from a plugin that already "provides" that dependency) ++ // This won't matter since the provided plugin is loaded as a dependency, meaning it should have been loaded correctly anyways ++ continue; // Skip provider that doesn't exist.... ++ } ++ retrievedProviderEntry.provided = true; ++ PluginProvider retrievedProvider = retrievedProviderEntry.provider; ++ try { ++ this.configuration.applyContext(retrievedProvider, graphDependencyContext); ++ ++ T instance = retrievedProvider.createInstance(); ++ if (this.configuration.load(retrievedProvider, instance)) { ++ loadedPlugins.add(new ProviderPair<>(retrievedProvider, instance)); ++ } ++ } catch (Throwable ex) { ++ LOGGER.error("Could not load plugin '%s' in folder '%s'".formatted(retrievedProvider.getFileName(), retrievedProvider.getParentSource()), ex); // Paper ++ } ++ } ++ ++ return loadedPlugins; ++ } ++ ++ private static class PluginProviderEntry { ++ ++ private final PluginProvider provider; ++ private boolean provided; ++ ++ private PluginProviderEntry(PluginProvider provider) { ++ this.provider = provider; ++ } ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/entrypoint/strategy/PluginGraphCycleException.java b/src/main/java/io/papermc/paper/plugin/entrypoint/strategy/PluginGraphCycleException.java +new file mode 100644 +index 0000000000000000000000000000000000000000..2ea978ac957849260e7ca69c9ff56588d0ccc41b +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/entrypoint/strategy/PluginGraphCycleException.java +@@ -0,0 +1,19 @@ ++package io.papermc.paper.plugin.entrypoint.strategy; ++ ++import java.util.List; ++ ++/** ++ * Indicates a dependency cycle within a provider loading sequence. ++ */ ++public class PluginGraphCycleException extends RuntimeException { ++ ++ private final List> cycles; ++ ++ public PluginGraphCycleException(List> cycles) { ++ this.cycles = cycles; ++ } ++ ++ public List> getCycles() { ++ return this.cycles; ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/entrypoint/strategy/ProviderConfiguration.java b/src/main/java/io/papermc/paper/plugin/entrypoint/strategy/ProviderConfiguration.java +new file mode 100644 +index 0000000000000000000000000000000000000000..71536981075095ee06234c638c0dfa054e737fb8 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/entrypoint/strategy/ProviderConfiguration.java +@@ -0,0 +1,19 @@ ++package io.papermc.paper.plugin.entrypoint.strategy; ++ ++import io.papermc.paper.plugin.provider.PluginProvider; ++import io.papermc.paper.plugin.provider.entrypoint.DependencyContext; ++ ++import java.util.List; ++ ++/** ++ * Used to share code with the modern and legacy plugin load strategy. ++ * ++ * @param ++ */ ++public interface ProviderConfiguration { ++ ++ void applyContext(PluginProvider provider, DependencyContext dependencyContext); ++ ++ boolean load(PluginProvider provider, T provided); ++ ++} +diff --git a/src/main/java/io/papermc/paper/plugin/entrypoint/strategy/ProviderLoadingStrategy.java b/src/main/java/io/papermc/paper/plugin/entrypoint/strategy/ProviderLoadingStrategy.java +new file mode 100644 +index 0000000000000000000000000000000000000000..dee83e821dcc9baf3a3e5ca8325b03ed2d5eb81c +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/entrypoint/strategy/ProviderLoadingStrategy.java +@@ -0,0 +1,20 @@ ++package io.papermc.paper.plugin.entrypoint.strategy; ++ ++import io.papermc.paper.plugin.provider.PluginProvider; ++ ++import java.util.List; ++ ++/** ++ * Used by a {@link io.papermc.paper.plugin.storage.SimpleProviderStorage} to load plugin providers in a certain order. ++ *

++ * Returns providers loaded. ++ * @param

provider type ++ */ ++public interface ProviderLoadingStrategy

{ ++ ++ List> loadProviders(List> providers); ++ ++ record ProviderPair

(PluginProvider

provider, P provided) { ++ ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/entrypoint/strategy/TopographicGraphSorter.java b/src/main/java/io/papermc/paper/plugin/entrypoint/strategy/TopographicGraphSorter.java +new file mode 100644 +index 0000000000000000000000000000000000000000..0720af0d48b39ca46e7d3aba08d7b359ed053461 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/entrypoint/strategy/TopographicGraphSorter.java +@@ -0,0 +1,61 @@ ++package io.papermc.paper.plugin.entrypoint.strategy; ++ ++import com.google.common.graph.Graph; ++ ++import java.util.ArrayDeque; ++import java.util.ArrayList; ++import java.util.Deque; ++import java.util.HashMap; ++import java.util.List; ++import java.util.Map; ++ ++public class TopographicGraphSorter { ++ ++ // Topographically sort dependencies ++ public static List sortGraph(Graph graph) throws PluginGraphCycleException { ++ List sorted = new ArrayList<>(); ++ Deque roots = new ArrayDeque<>(); ++ Map nonRoots = new HashMap<>(); ++ ++ for (N node : graph.nodes()) { ++ // Is a node being referred to by any other nodes? ++ int degree = graph.inDegree(node); ++ if (degree == 0) { ++ // Is a root ++ roots.add(node); ++ } else { ++ // Isn't a root, the number represents how many nodes connect to it. ++ nonRoots.put(node, degree); ++ } ++ } ++ ++ // Pick from nodes that aren't referred to anywhere else ++ while (!roots.isEmpty()) { ++ N next = roots.remove(); ++ ++ for (N successor : graph.successors(next)) { ++ // Traverse through, moving down a degree ++ int newInDegree = nonRoots.get(successor) - 1; ++ ++ if (newInDegree == 0) { ++ nonRoots.remove(successor); ++ roots.add(successor); ++ } else { ++ nonRoots.put(successor, newInDegree); ++ } ++ ++ } ++ sorted.add(next); ++ } ++ ++ if (!nonRoots.isEmpty()) { ++ throw new GraphCycleException(); ++ } ++ ++ return sorted; ++ } ++ ++ public static class GraphCycleException extends RuntimeException { ++ ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/loader/PaperClasspathBuilder.java b/src/main/java/io/papermc/paper/plugin/loader/PaperClasspathBuilder.java +new file mode 100644 +index 0000000000000000000000000000000000000000..f38ecd7f65dc24e4a3f0bc675e3730287ac353f1 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/loader/PaperClasspathBuilder.java +@@ -0,0 +1,64 @@ ++package io.papermc.paper.plugin.loader; ++ ++import io.papermc.paper.plugin.bootstrap.PluginProviderContext; ++import io.papermc.paper.plugin.loader.library.ClassPathLibrary; ++import io.papermc.paper.plugin.loader.library.PaperLibraryStore; ++import io.papermc.paper.plugin.entrypoint.classloader.PaperPluginClassLoader; ++import io.papermc.paper.plugin.provider.configuration.PaperPluginMeta; ++import org.jetbrains.annotations.NotNull; ++ ++import java.io.IOException; ++import java.net.MalformedURLException; ++import java.net.URL; ++import java.net.URLClassLoader; ++import java.nio.file.Path; ++import java.util.ArrayList; ++import java.util.List; ++import java.util.jar.JarFile; ++import java.util.logging.Logger; ++ ++public class PaperClasspathBuilder implements PluginClasspathBuilder { ++ ++ private final List libraries = new ArrayList<>(); ++ ++ private final PluginProviderContext context; ++ ++ public PaperClasspathBuilder(PluginProviderContext context) { ++ this.context = context; ++ } ++ ++ @Override ++ public @NotNull PluginProviderContext getContext() { ++ return this.context; ++ } ++ ++ @Override ++ public @NotNull PluginClasspathBuilder addLibrary(@NotNull ClassPathLibrary classPathLibrary) { ++ this.libraries.add(classPathLibrary); ++ return this; ++ } ++ ++ public PaperPluginClassLoader buildClassLoader(Logger logger, Path source, JarFile jarFile, PaperPluginMeta configuration) { ++ PaperLibraryStore paperLibraryStore = new PaperLibraryStore(); ++ for (ClassPathLibrary library : this.libraries) { ++ library.register(paperLibraryStore); ++ } ++ ++ List paths = paperLibraryStore.getPaths(); ++ URL[] urls = new URL[paths.size()]; ++ for (int i = 0; i < paths.size(); i++) { ++ Path path = paperLibraryStore.getPaths().get(i); ++ try { ++ urls[i] = path.toUri().toURL(); ++ } catch (MalformedURLException e) { ++ throw new AssertionError(e); ++ } ++ } ++ ++ try { ++ return new PaperPluginClassLoader(logger, source, jarFile, configuration, this.getClass().getClassLoader(), new URLClassLoader(urls, getClass().getClassLoader())); ++ } catch (IOException exception) { ++ throw new RuntimeException(exception); ++ } ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/loader/library/PaperLibraryStore.java b/src/main/java/io/papermc/paper/plugin/loader/library/PaperLibraryStore.java +new file mode 100644 +index 0000000000000000000000000000000000000000..5fcce65009f715d46dd3013f1f92ec8393d66e15 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/loader/library/PaperLibraryStore.java +@@ -0,0 +1,21 @@ ++package io.papermc.paper.plugin.loader.library; ++ ++import org.jetbrains.annotations.NotNull; ++ ++import java.nio.file.Path; ++import java.util.ArrayList; ++import java.util.List; ++ ++public class PaperLibraryStore implements LibraryStore { ++ ++ private final List paths = new ArrayList<>(); ++ ++ @Override ++ public void addLibrary(@NotNull Path library) { ++ this.paths.add(library); ++ } ++ ++ public List getPaths() { ++ return this.paths; ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/manager/DummyBukkitPluginLoader.java b/src/main/java/io/papermc/paper/plugin/manager/DummyBukkitPluginLoader.java +new file mode 100644 +index 0000000000000000000000000000000000000000..ea37ace14849ef4589a4f97287e6dcd64351370f +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/manager/DummyBukkitPluginLoader.java +@@ -0,0 +1,57 @@ ++package io.papermc.paper.plugin.manager; ++ ++import org.bukkit.Bukkit; ++import org.bukkit.event.Event; ++import org.bukkit.event.Listener; ++import org.bukkit.plugin.InvalidDescriptionException; ++import org.bukkit.plugin.InvalidPluginException; ++import org.bukkit.plugin.Plugin; ++import org.bukkit.plugin.PluginDescriptionFile; ++import org.bukkit.plugin.PluginLoader; ++import org.bukkit.plugin.RegisteredListener; ++import org.bukkit.plugin.UnknownDependencyException; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++import java.io.File; ++import java.util.Map; ++import java.util.Set; ++import java.util.regex.Pattern; ++ ++/** ++ * A purely internal type that implements the now deprecated {@link PluginLoader} after the implementation ++ * of papers new plugin system. ++ */ ++@ApiStatus.Internal ++public class DummyBukkitPluginLoader implements PluginLoader { ++ ++ @Override ++ public @NotNull Plugin loadPlugin(@NotNull File file) throws InvalidPluginException, UnknownDependencyException { ++ throw new UnsupportedOperationException(); ++ } ++ ++ @Override ++ public @NotNull PluginDescriptionFile getPluginDescription(@NotNull File file) throws InvalidDescriptionException { ++ throw new UnsupportedOperationException(); ++ } ++ ++ @Override ++ public @NotNull Pattern[] getPluginFileFilters() { ++ throw new UnsupportedOperationException(); ++ } ++ ++ @Override ++ public @NotNull Map, Set> createRegisteredListeners(@NotNull Listener listener, @NotNull Plugin plugin) { ++ return PaperPluginManagerImpl.getInstance().paperEventManager.createRegisteredListeners(listener, plugin); ++ } ++ ++ @Override ++ public void enablePlugin(@NotNull Plugin plugin) { ++ Bukkit.getPluginManager().enablePlugin(plugin); ++ } ++ ++ @Override ++ public void disablePlugin(@NotNull Plugin plugin) { ++ Bukkit.getPluginManager().disablePlugin(plugin); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/manager/MultiRuntimePluginProviderStorage.java b/src/main/java/io/papermc/paper/plugin/manager/MultiRuntimePluginProviderStorage.java +new file mode 100644 +index 0000000000000000000000000000000000000000..365aa894c77b095bfe23bdaab354591df32bcda2 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/manager/MultiRuntimePluginProviderStorage.java +@@ -0,0 +1,49 @@ ++package io.papermc.paper.plugin.manager; ++ ++import com.mojang.logging.LogUtils; ++import io.papermc.paper.plugin.entrypoint.Entrypoint; ++import io.papermc.paper.plugin.entrypoint.LaunchEntryPointHandler; ++import io.papermc.paper.plugin.provider.PluginProvider; ++import io.papermc.paper.plugin.provider.type.paper.PaperPluginParent; ++import io.papermc.paper.plugin.storage.ServerPluginProviderStorage; ++import org.bukkit.plugin.java.JavaPlugin; ++import org.slf4j.Logger; ++ ++import java.util.ArrayList; ++import java.util.List; ++ ++public class MultiRuntimePluginProviderStorage extends ServerPluginProviderStorage { ++ ++ private static final Logger LOGGER = LogUtils.getLogger(); ++ private final List provided = new ArrayList<>(); ++ ++ @Override ++ public void register(PluginProvider provider) { ++ if (provider instanceof PaperPluginParent.PaperServerPluginProvider) { ++ LOGGER.warn("Skipping loading of paper plugin requested from SimplePluginManager."); ++ return; ++ } ++ super.register(provider); ++ /* ++ Register the provider into the server entrypoint, this allows it to show in /plugins correctly. Generally it might be better in the future to make a separate storage, ++ as putting it into the entrypoint handlers doesn't make much sense. ++ */ ++ LaunchEntryPointHandler.INSTANCE.register(Entrypoint.PLUGIN, provider); ++ } ++ ++ @Override ++ public void processProvided(PluginProvider provider, JavaPlugin provided) { ++ super.processProvided(provider, provided); ++ this.provided.add(provided); ++ } ++ ++ @Override ++ public boolean throwOnCycle() { ++ return false; ++ } ++ ++ public List getLoaded() { ++ return this.provided; ++ } ++ ++} +diff --git a/src/main/java/io/papermc/paper/plugin/manager/NormalPaperPermissionManager.java b/src/main/java/io/papermc/paper/plugin/manager/NormalPaperPermissionManager.java +new file mode 100644 +index 0000000000000000000000000000000000000000..6f6aaab295018017565ba27d6958a1f5c7b69bc8 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/manager/NormalPaperPermissionManager.java +@@ -0,0 +1,43 @@ ++package io.papermc.paper.plugin.manager; ++ ++import org.bukkit.permissions.Permissible; ++import org.bukkit.permissions.Permission; ++ ++import java.util.HashMap; ++import java.util.LinkedHashMap; ++import java.util.LinkedHashSet; ++import java.util.Map; ++import java.util.Set; ++ ++class NormalPaperPermissionManager extends PaperPermissionManager { ++ ++ private final Map permissions = new HashMap<>(); ++ private final Map> defaultPerms = new LinkedHashMap<>(); ++ private final Map> permSubs = new HashMap<>(); ++ private final Map> defSubs = new HashMap<>(); ++ ++ public NormalPaperPermissionManager() { ++ this.defaultPerms().put(true, new LinkedHashSet<>()); ++ this.defaultPerms().put(false, new LinkedHashSet<>()); ++ } ++ ++ @Override ++ public Map permissions() { ++ return this.permissions; ++ } ++ ++ @Override ++ public Map> defaultPerms() { ++ return this.defaultPerms; ++ } ++ ++ @Override ++ public Map> permSubs() { ++ return this.permSubs; ++ } ++ ++ @Override ++ public Map> defSubs() { ++ return this.defSubs; ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java b/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java +new file mode 100644 +index 0000000000000000000000000000000000000000..7ce9ebba8ce304d1f3f21d4f15ee5f3560d7700b +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java +@@ -0,0 +1,194 @@ ++package io.papermc.paper.plugin.manager; ++ ++import co.aikar.timings.TimedEventExecutor; ++import com.destroystokyo.paper.event.server.ServerExceptionEvent; ++import com.destroystokyo.paper.exception.ServerEventException; ++import com.google.common.collect.Sets; ++import org.bukkit.Server; ++import org.bukkit.Warning; ++import org.bukkit.event.Event; ++import org.bukkit.event.EventHandler; ++import org.bukkit.event.EventPriority; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.Listener; ++import org.bukkit.plugin.AuthorNagException; ++import org.bukkit.plugin.EventExecutor; ++import org.bukkit.plugin.IllegalPluginAccessException; ++import org.bukkit.plugin.Plugin; ++import org.bukkit.plugin.RegisteredListener; ++import org.jetbrains.annotations.NotNull; ++ ++import java.lang.reflect.Method; ++import java.util.Arrays; ++import java.util.HashMap; ++import java.util.HashSet; ++import java.util.Map; ++import java.util.Set; ++import java.util.logging.Level; ++ ++class PaperEventManager { ++ ++ private final Server server; ++ ++ public PaperEventManager(Server server) { ++ this.server = server; ++ } ++ ++ // SimplePluginManager ++ public void callEvent(@NotNull Event event) { ++ if (event.isAsynchronous() && this.server.isPrimaryThread()) { ++ throw new IllegalStateException(event.getEventName() + " may only be triggered asynchronously."); ++ } else if (!event.isAsynchronous() && !this.server.isPrimaryThread() && !this.server.isStopping()) { ++ throw new IllegalStateException(event.getEventName() + " may only be triggered synchronously."); ++ } ++ ++ HandlerList handlers = event.getHandlers(); ++ RegisteredListener[] listeners = handlers.getRegisteredListeners(); ++ ++ for (RegisteredListener registration : listeners) { ++ if (!registration.getPlugin().isEnabled()) { ++ continue; ++ } ++ ++ try { ++ registration.callEvent(event); ++ } catch (AuthorNagException ex) { ++ Plugin plugin = registration.getPlugin(); ++ ++ if (plugin.isNaggable()) { ++ plugin.setNaggable(false); ++ ++ this.server.getLogger().log(Level.SEVERE, String.format( ++ "Nag author(s): '%s' of '%s' about the following: %s", ++ plugin.getPluginMeta().getAuthors(), ++ plugin.getPluginMeta().getDisplayName(), ++ ex.getMessage() ++ )); ++ } ++ } catch (Throwable ex) { ++ String msg = "Could not pass event " + event.getEventName() + " to " + registration.getPlugin().getPluginMeta().getDisplayName(); ++ this.server.getLogger().log(Level.SEVERE, msg, ex); ++ if (!(event instanceof ServerExceptionEvent)) { // We don't want to cause an endless event loop ++ this.callEvent(new ServerExceptionEvent(new ServerEventException(msg, ex, registration.getPlugin(), registration.getListener(), event))); ++ } ++ } ++ } ++ } ++ ++ public void registerEvents(@NotNull Listener listener, @NotNull Plugin plugin) { ++ if (!plugin.isEnabled()) { ++ throw new IllegalPluginAccessException("Plugin attempted to register " + listener + " while not enabled"); ++ } ++ ++ for (Map.Entry, Set> entry : this.createRegisteredListeners(listener, plugin).entrySet()) { ++ this.getEventListeners(this.getRegistrationClass(entry.getKey())).registerAll(entry.getValue()); ++ } ++ ++ } ++ ++ public void registerEvent(@NotNull Class event, @NotNull Listener listener, @NotNull EventPriority priority, @NotNull EventExecutor executor, @NotNull Plugin plugin) { ++ this.registerEvent(event, listener, priority, executor, plugin, false); ++ } ++ ++ public void registerEvent(@NotNull Class event, @NotNull Listener listener, @NotNull EventPriority priority, @NotNull EventExecutor executor, @NotNull Plugin plugin, boolean ignoreCancelled) { ++ if (!plugin.isEnabled()) { ++ throw new IllegalPluginAccessException("Plugin attempted to register " + event + " while not enabled"); ++ } ++ ++ executor = new TimedEventExecutor(executor, plugin, null, event); ++ this.getEventListeners(event).register(new RegisteredListener(listener, executor, priority, plugin, ignoreCancelled)); ++ } ++ ++ @NotNull ++ private HandlerList getEventListeners(@NotNull Class type) { ++ try { ++ Method method = this.getRegistrationClass(type).getDeclaredMethod("getHandlerList"); ++ method.setAccessible(true); ++ return (HandlerList) method.invoke(null); ++ } catch (Exception e) { ++ throw new IllegalPluginAccessException(e.toString()); ++ } ++ } ++ ++ @NotNull ++ private Class getRegistrationClass(@NotNull Class clazz) { ++ try { ++ clazz.getDeclaredMethod("getHandlerList"); ++ return clazz; ++ } catch (NoSuchMethodException e) { ++ if (clazz.getSuperclass() != null ++ && !clazz.getSuperclass().equals(Event.class) ++ && Event.class.isAssignableFrom(clazz.getSuperclass())) { ++ return this.getRegistrationClass(clazz.getSuperclass().asSubclass(Event.class)); ++ } else { ++ throw new IllegalPluginAccessException("Unable to find handler list for event " + clazz.getName() + ". Static getHandlerList method required!"); ++ } ++ } ++ } ++ ++ // JavaPluginLoader ++ @NotNull ++ public Map, Set> createRegisteredListeners(@NotNull Listener listener, @NotNull final Plugin plugin) { ++ Map, Set> ret = new HashMap<>(); ++ ++ Set methods; ++ try { ++ Class listenerClazz = listener.getClass(); ++ methods = Sets.union( ++ Set.of(listenerClazz.getMethods()), ++ Set.of(listenerClazz.getDeclaredMethods()) ++ ); ++ } catch (NoClassDefFoundError e) { ++ plugin.getLogger().severe("Failed to register events for " + listener.getClass() + " because " + e.getMessage() + " does not exist."); ++ return ret; ++ } ++ ++ for (final Method method : methods) { ++ final EventHandler eh = method.getAnnotation(EventHandler.class); ++ if (eh == null) continue; ++ // Do not register bridge or synthetic methods to avoid event duplication ++ // Fixes SPIGOT-893 ++ if (method.isBridge() || method.isSynthetic()) { ++ continue; ++ } ++ final Class checkClass; ++ if (method.getParameterTypes().length != 1 || !Event.class.isAssignableFrom(checkClass = method.getParameterTypes()[0])) { ++ plugin.getLogger().severe(plugin.getPluginMeta().getDisplayName() + " attempted to register an invalid EventHandler method signature \"" + method.toGenericString() + "\" in " + listener.getClass()); ++ continue; ++ } ++ final Class eventClass = checkClass.asSubclass(Event.class); ++ method.setAccessible(true); ++ Set eventSet = ret.computeIfAbsent(eventClass, k -> new HashSet<>()); ++ ++ for (Class clazz = eventClass; Event.class.isAssignableFrom(clazz); clazz = clazz.getSuperclass()) { ++ // This loop checks for extending deprecated events ++ if (clazz.getAnnotation(Deprecated.class) != null) { ++ Warning warning = clazz.getAnnotation(Warning.class); ++ Warning.WarningState warningState = this.server.getWarningState(); ++ if (!warningState.printFor(warning)) { ++ break; ++ } ++ plugin.getLogger().log( ++ Level.WARNING, ++ String.format( ++ "\"%s\" has registered a listener for %s on method \"%s\", but the event is Deprecated. \"%s\"; please notify the authors %s.", ++ plugin.getPluginMeta().getDisplayName(), ++ clazz.getName(), ++ method.toGenericString(), ++ (warning != null && warning.reason().length() != 0) ? warning.reason() : "Server performance will be affected", ++ Arrays.toString(plugin.getPluginMeta().getAuthors().toArray())), ++ warningState == Warning.WarningState.ON ? new AuthorNagException(null) : null); ++ break; ++ } ++ } ++ ++ EventExecutor executor = new TimedEventExecutor(EventExecutor.create(method, eventClass), plugin, method, eventClass); ++ eventSet.add(new RegisteredListener(listener, executor, eh.priority(), plugin, eh.ignoreCancelled())); ++ } ++ return ret; ++ } ++ ++ public void clearEvents() { ++ HandlerList.unregisterAll(); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/manager/PaperPermissionManager.java b/src/main/java/io/papermc/paper/plugin/manager/PaperPermissionManager.java +new file mode 100644 +index 0000000000000000000000000000000000000000..92a69677f21b2c1c035119d8e5a6af63fa19b801 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/manager/PaperPermissionManager.java +@@ -0,0 +1,201 @@ ++package io.papermc.paper.plugin.manager; ++ ++import com.google.common.collect.ImmutableSet; ++import io.papermc.paper.plugin.PermissionManager; ++import org.bukkit.permissions.Permissible; ++import org.bukkit.permissions.Permission; ++import org.bukkit.permissions.PermissionDefault; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; ++ ++import java.util.HashSet; ++import java.util.List; ++import java.util.Locale; ++import java.util.Map; ++import java.util.Set; ++import java.util.WeakHashMap; ++ ++/** ++ * See ++ * {@link StupidSPMPermissionManagerWrapper} ++ */ ++abstract class PaperPermissionManager implements PermissionManager { ++ ++ public abstract Map permissions(); ++ ++ public abstract Map> defaultPerms(); ++ ++ public abstract Map> permSubs(); ++ ++ public abstract Map> defSubs(); ++ ++ @Override ++ @Nullable ++ public Permission getPermission(@NotNull String name) { ++ return this.permissions().get(name.toLowerCase(java.util.Locale.ENGLISH)); ++ } ++ ++ @Override ++ public void addPermission(@NotNull Permission perm) { ++ this.addPermission(perm, true); ++ } ++ ++ @Override ++ public void addPermissions(@NotNull List permissions) { ++ for (Permission permission : permissions) { ++ this.addPermission(permission, false); ++ } ++ this.dirtyPermissibles(); ++ } ++ ++ // Allow suppressing permission default calculations ++ private void addPermission(@NotNull Permission perm, boolean dirty) { ++ String name = perm.getName().toLowerCase(java.util.Locale.ENGLISH); ++ ++ if (this.permissions().containsKey(name)) { ++ throw new IllegalArgumentException("The permission " + name + " is already defined!"); ++ } ++ ++ this.permissions().put(name, perm); ++ this.calculatePermissionDefault(perm, dirty); ++ } ++ ++ @Override ++ @NotNull ++ public Set getDefaultPermissions(boolean op) { ++ return ImmutableSet.copyOf(this.defaultPerms().get(op)); ++ } ++ ++ ++ @Override ++ public void removePermission(@NotNull Permission perm) { ++ this.removePermission(perm.getName()); ++ } ++ ++ ++ @Override ++ public void removePermission(@NotNull String name) { ++ this.permissions().remove(name.toLowerCase(java.util.Locale.ENGLISH)); ++ } ++ ++ @Override ++ public void recalculatePermissionDefaults(@NotNull Permission perm) { ++ // we need a null check here because some plugins for some unknown reason pass null into this? ++ if (perm != null && this.permissions().containsKey(perm.getName().toLowerCase(Locale.ENGLISH))) { ++ this.defaultPerms().get(true).remove(perm); ++ this.defaultPerms().get(false).remove(perm); ++ ++ this.calculatePermissionDefault(perm, true); ++ } ++ } ++ ++ private void calculatePermissionDefault(@NotNull Permission perm, boolean dirty) { ++ if ((perm.getDefault() == PermissionDefault.OP) || (perm.getDefault() == PermissionDefault.TRUE)) { ++ this.defaultPerms().get(true).add(perm); ++ if (dirty) { ++ this.dirtyPermissibles(true); ++ } ++ } ++ if ((perm.getDefault() == PermissionDefault.NOT_OP) || (perm.getDefault() == PermissionDefault.TRUE)) { ++ this.defaultPerms().get(false).add(perm); ++ if (dirty) { ++ this.dirtyPermissibles(false); ++ } ++ } ++ } ++ ++ ++ @Override ++ public void subscribeToPermission(@NotNull String permission, @NotNull Permissible permissible) { ++ String name = permission.toLowerCase(java.util.Locale.ENGLISH); ++ Map map = this.permSubs().computeIfAbsent(name, k -> new WeakHashMap<>()); ++ ++ map.put(permissible, true); ++ } ++ ++ @Override ++ public void unsubscribeFromPermission(@NotNull String permission, @NotNull Permissible permissible) { ++ String name = permission.toLowerCase(java.util.Locale.ENGLISH); ++ Map map = this.permSubs().get(name); ++ ++ if (map != null) { ++ map.remove(permissible); ++ ++ if (map.isEmpty()) { ++ this.permSubs().remove(name); ++ } ++ } ++ } ++ ++ @Override ++ @NotNull ++ public Set getPermissionSubscriptions(@NotNull String permission) { ++ String name = permission.toLowerCase(java.util.Locale.ENGLISH); ++ Map map = this.permSubs().get(name); ++ ++ if (map == null) { ++ return ImmutableSet.of(); ++ } else { ++ return ImmutableSet.copyOf(map.keySet()); ++ } ++ } ++ ++ @Override ++ public void subscribeToDefaultPerms(boolean op, @NotNull Permissible permissible) { ++ Map map = this.defSubs().computeIfAbsent(op, k -> new WeakHashMap<>()); ++ ++ map.put(permissible, true); ++ } ++ ++ @Override ++ public void unsubscribeFromDefaultPerms(boolean op, @NotNull Permissible permissible) { ++ Map map = this.defSubs().get(op); ++ ++ if (map != null) { ++ map.remove(permissible); ++ ++ if (map.isEmpty()) { ++ this.defSubs().remove(op); ++ } ++ } ++ } ++ ++ @Override ++ @NotNull ++ public Set getDefaultPermSubscriptions(boolean op) { ++ Map map = this.defSubs().get(op); ++ ++ if (map == null) { ++ return ImmutableSet.of(); ++ } else { ++ return ImmutableSet.copyOf(map.keySet()); ++ } ++ } ++ ++ @Override ++ @NotNull ++ public Set getPermissions() { ++ return new HashSet<>(this.permissions().values()); ++ } ++ ++ @Override ++ public void clearPermissions() { ++ this.permissions().clear(); ++ this.defaultPerms().get(true).clear(); ++ this.defaultPerms().get(false).clear(); ++ } ++ ++ ++ void dirtyPermissibles(boolean op) { ++ Set permissibles = this.getDefaultPermSubscriptions(op); ++ ++ for (Permissible p : permissibles) { ++ p.recalculatePermissions(); ++ } ++ } ++ ++ void dirtyPermissibles() { ++ this.dirtyPermissibles(true); ++ this.dirtyPermissibles(false); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/manager/PaperPluginInstanceManager.java b/src/main/java/io/papermc/paper/plugin/manager/PaperPluginInstanceManager.java +new file mode 100644 +index 0000000000000000000000000000000000000000..c0e896343c22badd97c774c4ed1daa4e274f5d44 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/manager/PaperPluginInstanceManager.java +@@ -0,0 +1,304 @@ ++package io.papermc.paper.plugin.manager; ++ ++import com.google.common.base.Preconditions; ++import com.google.common.graph.GraphBuilder; ++import com.google.common.graph.MutableGraph; ++import io.papermc.paper.plugin.configuration.PluginMeta; ++import io.papermc.paper.plugin.entrypoint.Entrypoint; ++import io.papermc.paper.plugin.entrypoint.dependency.DependencyUtil; ++import io.papermc.paper.plugin.entrypoint.dependency.GraphDependencyContext; ++import io.papermc.paper.plugin.entrypoint.strategy.PluginGraphCycleException; ++import io.papermc.paper.plugin.provider.classloader.ConfiguredPluginClassLoader; ++import io.papermc.paper.plugin.provider.classloader.PaperClassLoaderStorage; ++import io.papermc.paper.plugin.provider.entrypoint.DependencyContext; ++import io.papermc.paper.plugin.provider.source.DirectoryProviderSource; ++import io.papermc.paper.plugin.provider.source.FileProviderSource; ++import org.bukkit.Bukkit; ++import org.bukkit.Server; ++import org.bukkit.World; ++import org.bukkit.command.Command; ++import org.bukkit.command.CommandMap; ++import org.bukkit.command.PluginCommandYamlParser; ++import org.bukkit.craftbukkit.util.CraftMagicNumbers; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.server.PluginDisableEvent; ++import org.bukkit.event.server.PluginEnableEvent; ++import org.bukkit.plugin.InvalidDescriptionException; ++import org.bukkit.plugin.InvalidPluginException; ++import org.bukkit.plugin.Plugin; ++import org.bukkit.plugin.PluginDescriptionFile; ++import org.bukkit.plugin.PluginManager; ++import org.bukkit.plugin.UnknownDependencyException; ++import org.bukkit.plugin.java.JavaPlugin; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; ++import org.spongepowered.configurate.serialize.SerializationException; ++ ++import java.io.IOException; ++import java.nio.file.Files; ++import java.nio.file.Path; ++import java.util.ArrayList; ++import java.util.HashMap; ++import java.util.List; ++import java.util.Map; ++import java.util.logging.Level; ++ ++@SuppressWarnings("UnstableApiUsage") ++class PaperPluginInstanceManager { ++ ++ private static final FileProviderSource FILE_PROVIDER_SOURCE = new FileProviderSource("File '%s'"::formatted); ++ private static final DirectoryProviderSource DIRECTORY_PROVIDER_SOURCE = new DirectoryProviderSource(); ++ ++ private final List plugins = new ArrayList<>(); ++ private final Map lookupNames = new HashMap<>(); ++ ++ private final PluginManager pluginManager; ++ private final CommandMap commandMap; ++ private final Server server; ++ ++ private final MutableGraph dependencyGraph = GraphBuilder.directed().build(); ++ private final DependencyContext context = new GraphDependencyContext(this.dependencyGraph); ++ ++ public PaperPluginInstanceManager(PluginManager pluginManager, CommandMap commandMap, Server server) { ++ this.commandMap = commandMap; ++ this.server = server; ++ this.pluginManager = pluginManager; ++ } ++ ++ public @Nullable Plugin getPlugin(@NotNull String name) { ++ return this.lookupNames.get(name.replace(' ', '_').toLowerCase(java.util.Locale.ENGLISH)); // Paper ++ } ++ ++ public @NotNull Plugin[] getPlugins() { ++ return this.plugins.toArray(new Plugin[0]); ++ } ++ ++ public boolean isPluginEnabled(@NotNull String name) { ++ Plugin plugin = this.getPlugin(name); ++ ++ return this.isPluginEnabled(plugin); ++ } ++ ++ public synchronized boolean isPluginEnabled(@Nullable Plugin plugin) { ++ if ((plugin != null) && (this.plugins.contains(plugin))) { ++ return plugin.isEnabled(); ++ } else { ++ return false; ++ } ++ } ++ ++ public void loadPlugin(Plugin provided) { ++ PluginMeta configuration = provided.getPluginMeta(); ++ ++ this.plugins.add(provided); ++ this.lookupNames.put(configuration.getName().toLowerCase(java.util.Locale.ENGLISH), provided); ++ for (String providedPlugin : configuration.getProvidedPlugins()) { ++ this.lookupNames.putIfAbsent(providedPlugin.toLowerCase(java.util.Locale.ENGLISH), provided); ++ } ++ ++ DependencyUtil.buildDependencyGraph(this.dependencyGraph, configuration); ++ } ++ ++ // InvalidDescriptionException is never used, because the old JavaPluginLoader would wrap the exception. ++ public @Nullable Plugin loadPlugin(@NotNull Path path) throws InvalidPluginException, UnknownDependencyException { ++ RuntimePluginEntrypointHandler runtimePluginEntrypointHandler = new RuntimePluginEntrypointHandler<>(new SingularRuntimePluginProviderStorage()); ++ ++ try { ++ FILE_PROVIDER_SOURCE.registerProviders(runtimePluginEntrypointHandler, path); ++ } catch (IllegalArgumentException exception) { ++ return null; // Return null when the plugin file is not valid / plugin type is unknown ++ } catch (PluginGraphCycleException exception) { ++ throw new InvalidPluginException("Cannot import plugin that causes cyclic dependencies!"); ++ } catch (SerializationException | ++ InvalidDescriptionException ex) { // The spigot implementation wraps it in an invalid plugin exception ++ throw new InvalidPluginException(ex); ++ } catch (Exception e) { ++ throw new InvalidPluginException(e); ++ } ++ ++ try { ++ runtimePluginEntrypointHandler.enter(Entrypoint.PLUGIN); ++ } catch (Throwable e) { ++ throw new InvalidPluginException(e); ++ } ++ ++ return runtimePluginEntrypointHandler.getPluginProviderStorage().getSingleLoaded() ++ .orElseThrow(() -> new InvalidPluginException("Plugin didn't load any plugin providers?")); ++ } ++ ++ // The behavior of this is that all errors are logged instead of being thrown ++ public @NotNull Plugin[] loadPlugins(@NotNull Path directory) { ++ Preconditions.checkArgument(Files.isDirectory(directory), "Directory must be a directory"); // Avoid creating a directory if it doesn't exist ++ ++ RuntimePluginEntrypointHandler runtimePluginEntrypointHandler = new RuntimePluginEntrypointHandler<>(new MultiRuntimePluginProviderStorage()); ++ try { ++ DIRECTORY_PROVIDER_SOURCE.registerProviders(runtimePluginEntrypointHandler, directory); ++ runtimePluginEntrypointHandler.enter(Entrypoint.PLUGIN); ++ } catch (Exception e) { ++ // This should never happen, any errors that occur in this provider should instead be logged. ++ this.server.getLogger().log(Level.SEVERE, "Unknown error occurred while loading plugins through PluginManager.", e); ++ } ++ ++ return runtimePluginEntrypointHandler.getPluginProviderStorage().getLoaded().toArray(new JavaPlugin[0]); ++ } ++ ++ // Plugins are disabled in order like this inorder to "rougly" prevent ++ // their dependencies unloading first. But, eh. ++ public void disablePlugins() { ++ Plugin[] plugins = this.getPlugins(); ++ for (int i = plugins.length - 1; i >= 0; i--) { ++ this.disablePlugin(plugins[i]); ++ } ++ } ++ ++ public void clearPlugins() { ++ synchronized (this) { ++ this.disablePlugins(); ++ this.plugins.clear(); ++ this.lookupNames.clear(); ++ } ++ } ++ ++ public synchronized void enablePlugin(@NotNull Plugin plugin) { ++ if (plugin.isEnabled()) { ++ return; ++ } ++ ++ if (plugin.getPluginMeta() instanceof PluginDescriptionFile) { ++ List bukkitCommands = PluginCommandYamlParser.parse(plugin); ++ ++ if (!bukkitCommands.isEmpty()) { ++ this.commandMap.registerAll(plugin.getPluginMeta().getName(), bukkitCommands); ++ } ++ } ++ ++ try { ++ String enableMsg = "Enabling " + plugin.getPluginMeta().getDisplayName(); ++ if (plugin.getPluginMeta() instanceof PluginDescriptionFile descriptionFile && CraftMagicNumbers.isLegacy(descriptionFile)) { ++ enableMsg += "*"; ++ } ++ plugin.getLogger().info(enableMsg); ++ ++ JavaPlugin jPlugin = (JavaPlugin) plugin; ++ ++ if (jPlugin.getClass().getClassLoader() instanceof ConfiguredPluginClassLoader classLoader) { // Paper ++ if (PaperClassLoaderStorage.instance().registerUnsafePlugin(classLoader)) { ++ this.server.getLogger().log(Level.WARNING, "Enabled plugin with unregistered ConfiguredPluginClassLoader " + plugin.getPluginMeta().getDisplayName()); ++ } ++ } // Paper ++ ++ try { ++ jPlugin.setEnabled(true); ++ } catch (Throwable ex) { ++ this.server.getLogger().log(Level.SEVERE, "Error occurred while enabling " + plugin.getPluginMeta().getDisplayName() + " (Is it up to date?)", ex); ++ // Paper start - Disable plugins that fail to load ++ this.server.getPluginManager().disablePlugin(jPlugin); ++ return; ++ // Paper end ++ } ++ ++ // Perhaps abort here, rather than continue going, but as it stands, ++ // an abort is not possible the way it's currently written ++ this.server.getPluginManager().callEvent(new PluginEnableEvent(plugin)); ++ } catch (Throwable ex) { ++ this.handlePluginException("Error occurred (in the plugin loader) while enabling " ++ + plugin.getPluginMeta().getDisplayName() + " (Is it up to date?)", ex, plugin); ++ } ++ ++ HandlerList.bakeAll(); ++ } ++ ++ public synchronized void disablePlugin(@NotNull Plugin plugin) { ++ if (!(plugin instanceof JavaPlugin javaPlugin)) { ++ throw new IllegalArgumentException("Only expects java plugins."); ++ } ++ if (!plugin.isEnabled()) { ++ return; ++ } ++ ++ String pluginName = plugin.getPluginMeta().getDisplayName(); ++ ++ try { ++ plugin.getLogger().info("Disabling %s".formatted(pluginName)); ++ ++ this.server.getPluginManager().callEvent(new PluginDisableEvent(plugin)); ++ ++ javaPlugin.setEnabled(false); ++ ++ ClassLoader classLoader = plugin.getClass().getClassLoader(); ++ if (classLoader instanceof ConfiguredPluginClassLoader configuredPluginClassLoader) { ++ try { ++ configuredPluginClassLoader.close(); ++ } catch (IOException ex) { ++ this.server.getLogger().log(Level.WARNING, "Error closing the classloader for '" + pluginName + "'", ex); // Paper - log exception ++ } ++ // Remove from the classloader pool inorder to prevent plugins from trying ++ // to access classes ++ PaperClassLoaderStorage.instance().unregisterClassloader(configuredPluginClassLoader); ++ } ++ ++ } catch (Throwable ex) { ++ this.handlePluginException("Error occurred (in the plugin loader) while disabling " ++ + pluginName + " (Is it up to date?)", ex, plugin); // Paper ++ } ++ ++ try { ++ this.server.getScheduler().cancelTasks(plugin); ++ } catch (Throwable ex) { ++ this.handlePluginException("Error occurred (in the plugin loader) while cancelling tasks for " ++ + pluginName + " (Is it up to date?)", ex, plugin); // Paper ++ } ++ ++ try { ++ this.server.getServicesManager().unregisterAll(plugin); ++ } catch (Throwable ex) { ++ this.handlePluginException("Error occurred (in the plugin loader) while unregistering services for " ++ + pluginName + " (Is it up to date?)", ex, plugin); // Paper ++ } ++ ++ try { ++ HandlerList.unregisterAll(plugin); ++ } catch (Throwable ex) { ++ this.handlePluginException("Error occurred (in the plugin loader) while unregistering events for " ++ + pluginName + " (Is it up to date?)", ex, plugin); // Paper ++ } ++ ++ try { ++ this.server.getMessenger().unregisterIncomingPluginChannel(plugin); ++ this.server.getMessenger().unregisterOutgoingPluginChannel(plugin); ++ } catch (Throwable ex) { ++ this.handlePluginException("Error occurred (in the plugin loader) while unregistering plugin channels for " ++ + pluginName + " (Is it up to date?)", ex, plugin); // Paper ++ } ++ ++ try { ++ for (World world : this.server.getWorlds()) { ++ world.removePluginChunkTickets(plugin); ++ } ++ } catch (Throwable ex) { ++ this.handlePluginException("Error occurred (in the plugin loader) while removing chunk tickets for " + pluginName + " (Is it up to date?)", ex, plugin); // Paper ++ } ++ ++ } ++ ++ // TODO: Implement event part in future patch (paper patch move up, this patch is lower) ++ private void handlePluginException(String msg, Throwable ex, Plugin plugin) { ++ Bukkit.getServer().getLogger().log(Level.SEVERE, msg, ex); ++ this.pluginManager.callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerPluginEnableDisableException(msg, ex, plugin))); ++ } ++ ++ public boolean isTransitiveDepend(@NotNull PluginMeta plugin, @NotNull PluginMeta depend) { ++ return this.context.isTransitiveDependency(plugin, depend); ++ } ++ ++ public boolean hasDependency(String pluginIdentifier) { ++ return this.getPlugin(pluginIdentifier) != null; ++ } ++ ++ // Debug only ++ @ApiStatus.Internal ++ public MutableGraph getDependencyGraph() { ++ return this.dependencyGraph; ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/manager/PaperPluginManagerImpl.java b/src/main/java/io/papermc/paper/plugin/manager/PaperPluginManagerImpl.java +new file mode 100644 +index 0000000000000000000000000000000000000000..dab211c458311869c61779305580a1c7da830f71 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/manager/PaperPluginManagerImpl.java +@@ -0,0 +1,241 @@ ++package io.papermc.paper.plugin.manager; ++ ++import com.google.common.graph.MutableGraph; ++import io.papermc.paper.plugin.PermissionManager; ++import io.papermc.paper.plugin.configuration.PluginMeta; ++import io.papermc.paper.plugin.provider.entrypoint.DependencyContext; ++import org.bukkit.Bukkit; ++import org.bukkit.Server; ++import org.bukkit.command.CommandMap; ++import org.bukkit.craftbukkit.CraftServer; ++import org.bukkit.event.Event; ++import org.bukkit.event.EventPriority; ++import org.bukkit.event.Listener; ++import org.bukkit.permissions.Permissible; ++import org.bukkit.permissions.Permission; ++import org.bukkit.plugin.EventExecutor; ++import org.bukkit.plugin.InvalidDescriptionException; ++import org.bukkit.plugin.InvalidPluginException; ++import org.bukkit.plugin.Plugin; ++import org.bukkit.plugin.PluginLoader; ++import org.bukkit.plugin.PluginManager; ++import org.bukkit.plugin.SimplePluginManager; ++import org.bukkit.plugin.UnknownDependencyException; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; ++ ++import java.io.File; ++import java.util.List; ++import java.util.Set; ++ ++public class PaperPluginManagerImpl implements PluginManager, DependencyContext { ++ ++ final PaperPluginInstanceManager instanceManager; ++ final PaperEventManager paperEventManager; ++ PermissionManager permissionManager; ++ ++ public PaperPluginManagerImpl(Server server, CommandMap commandMap, @Nullable SimplePluginManager permissionManager) { ++ this.instanceManager = new PaperPluginInstanceManager(this, commandMap, server); ++ this.paperEventManager = new PaperEventManager(server); ++ ++ if (permissionManager == null) { ++ this.permissionManager = new NormalPaperPermissionManager(); ++ } else { ++ this.permissionManager = new StupidSPMPermissionManagerWrapper(permissionManager); // TODO: See comment when SimplePermissionManager is removed ++ } ++ } ++ ++ // REMOVE THIS WHEN SimplePluginManager is removed. ++ // Just cast and use Bukkit.getServer().getPluginManager() ++ public static PaperPluginManagerImpl getInstance() { ++ return ((CraftServer) (Bukkit.getServer())).paperPluginManager; ++ } ++ ++ // Plugin Manipulation ++ ++ @Override ++ public @Nullable Plugin getPlugin(@NotNull String name) { ++ return this.instanceManager.getPlugin(name); ++ } ++ ++ @Override ++ public @NotNull Plugin[] getPlugins() { ++ return this.instanceManager.getPlugins(); ++ } ++ ++ @Override ++ public boolean isPluginEnabled(@NotNull String name) { ++ return this.instanceManager.isPluginEnabled(name); ++ } ++ ++ @Override ++ public boolean isPluginEnabled(@Nullable Plugin plugin) { ++ return this.instanceManager.isPluginEnabled(plugin); ++ } ++ ++ public void loadPlugin(Plugin plugin) { ++ this.instanceManager.loadPlugin(plugin); ++ } ++ ++ @Override ++ public @Nullable Plugin loadPlugin(@NotNull File file) throws InvalidPluginException, InvalidDescriptionException, UnknownDependencyException { ++ return this.instanceManager.loadPlugin(file.toPath()); ++ } ++ ++ @Override ++ public @NotNull Plugin[] loadPlugins(@NotNull File directory) { ++ return this.instanceManager.loadPlugins(directory.toPath()); ++ } ++ ++ @Override ++ public void disablePlugins() { ++ this.instanceManager.disablePlugins(); ++ } ++ ++ @Override ++ public synchronized void clearPlugins() { ++ this.instanceManager.clearPlugins(); ++ this.permissionManager.clearPermissions(); ++ this.paperEventManager.clearEvents(); ++ } ++ ++ @Override ++ public void enablePlugin(@NotNull Plugin plugin) { ++ this.instanceManager.enablePlugin(plugin); ++ } ++ ++ @Override ++ public void disablePlugin(@NotNull Plugin plugin) { ++ this.instanceManager.disablePlugin(plugin); ++ } ++ ++ @Override ++ public boolean isTransitiveDependency(PluginMeta pluginMeta, PluginMeta dependencyConfig) { ++ return this.instanceManager.isTransitiveDepend(pluginMeta, dependencyConfig); ++ } ++ ++ @Override ++ public boolean hasDependency(String pluginIdentifier) { ++ return this.instanceManager.hasDependency(pluginIdentifier); ++ } ++ ++ // Event manipulation ++ ++ @Override ++ public void callEvent(@NotNull Event event) throws IllegalStateException { ++ this.paperEventManager.callEvent(event); ++ } ++ ++ @Override ++ public void registerEvents(@NotNull Listener listener, @NotNull Plugin plugin) { ++ this.paperEventManager.registerEvents(listener, plugin); ++ } ++ ++ @Override ++ public void registerEvent(@NotNull Class event, @NotNull Listener listener, @NotNull EventPriority priority, @NotNull EventExecutor executor, @NotNull Plugin plugin) { ++ this.paperEventManager.registerEvent(event, listener, priority, executor, plugin); ++ } ++ ++ @Override ++ public void registerEvent(@NotNull Class event, @NotNull Listener listener, @NotNull EventPriority priority, @NotNull EventExecutor executor, @NotNull Plugin plugin, boolean ignoreCancelled) { ++ this.paperEventManager.registerEvent(event, listener, priority, executor, plugin, ignoreCancelled); ++ } ++ ++ // Permission manipulation ++ ++ @Override ++ public @Nullable Permission getPermission(@NotNull String name) { ++ return this.permissionManager.getPermission(name); ++ } ++ ++ @Override ++ public void addPermission(@NotNull Permission perm) { ++ this.permissionManager.addPermission(perm); ++ } ++ ++ @Override ++ public void removePermission(@NotNull Permission perm) { ++ this.permissionManager.removePermission(perm); ++ } ++ ++ @Override ++ public void removePermission(@NotNull String name) { ++ this.permissionManager.removePermission(name); ++ } ++ ++ @Override ++ public @NotNull Set getDefaultPermissions(boolean op) { ++ return this.permissionManager.getDefaultPermissions(op); ++ } ++ ++ @Override ++ public void recalculatePermissionDefaults(@NotNull Permission perm) { ++ this.permissionManager.recalculatePermissionDefaults(perm); ++ } ++ ++ @Override ++ public void subscribeToPermission(@NotNull String permission, @NotNull Permissible permissible) { ++ this.permissionManager.subscribeToPermission(permission, permissible); ++ } ++ ++ @Override ++ public void unsubscribeFromPermission(@NotNull String permission, @NotNull Permissible permissible) { ++ this.permissionManager.unsubscribeFromPermission(permission, permissible); ++ } ++ ++ @Override ++ public @NotNull Set getPermissionSubscriptions(@NotNull String permission) { ++ return this.permissionManager.getPermissionSubscriptions(permission); ++ } ++ ++ @Override ++ public void subscribeToDefaultPerms(boolean op, @NotNull Permissible permissible) { ++ this.permissionManager.subscribeToDefaultPerms(op, permissible); ++ } ++ ++ @Override ++ public void unsubscribeFromDefaultPerms(boolean op, @NotNull Permissible permissible) { ++ this.permissionManager.unsubscribeFromDefaultPerms(op, permissible); ++ } ++ ++ @Override ++ public @NotNull Set getDefaultPermSubscriptions(boolean op) { ++ return this.permissionManager.getDefaultPermSubscriptions(op); ++ } ++ ++ @Override ++ public @NotNull Set getPermissions() { ++ return this.permissionManager.getPermissions(); ++ } ++ ++ @Override ++ public void addPermissions(@NotNull List perm) { ++ this.permissionManager.addPermissions(perm); ++ } ++ ++ @Override ++ public void clearPermissions() { ++ this.permissionManager.clearPermissions(); ++ } ++ ++ @Override ++ public void overridePermissionManager(@NotNull Plugin plugin, @Nullable PermissionManager permissionManager) { ++ this.permissionManager = permissionManager; ++ } ++ ++ // Etc ++ ++ @Override ++ public boolean useTimings() { ++ return co.aikar.timings.Timings.isTimingsEnabled(); ++ } ++ ++ @Override ++ public void registerInterface(@NotNull Class loader) throws IllegalArgumentException { ++ throw new UnsupportedOperationException(); ++ } ++ ++ public MutableGraph getInstanceManagerGraph() { ++ return instanceManager.getDependencyGraph(); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/manager/RuntimePluginEntrypointHandler.java b/src/main/java/io/papermc/paper/plugin/manager/RuntimePluginEntrypointHandler.java +new file mode 100644 +index 0000000000000000000000000000000000000000..5d50d1d312388e979c0e1cd53a6bf5977ca6e549 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/manager/RuntimePluginEntrypointHandler.java +@@ -0,0 +1,47 @@ ++package io.papermc.paper.plugin.manager; ++ ++import com.destroystokyo.paper.util.SneakyThrow; ++import io.papermc.paper.plugin.entrypoint.Entrypoint; ++import io.papermc.paper.plugin.entrypoint.EntrypointHandler; ++import io.papermc.paper.plugin.provider.PluginProvider; ++import io.papermc.paper.plugin.storage.ProviderStorage; ++import org.bukkit.plugin.InvalidPluginException; ++import org.bukkit.plugin.java.JavaPlugin; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Used for loading plugins during runtime, only supporting providers that are plugins. ++ * This is only used for the plugin manager, as it only allows plugins to be ++ * registered to a provider storage. ++ */ ++class RuntimePluginEntrypointHandler> implements EntrypointHandler { ++ ++ private final T providerStorage; ++ ++ RuntimePluginEntrypointHandler(T providerStorage) { ++ this.providerStorage = providerStorage; ++ } ++ ++ @Override ++ public void register(Entrypoint entrypoint, PluginProvider provider) { ++ if (!entrypoint.equals(Entrypoint.PLUGIN)) { ++ SneakyThrow.sneaky(new InvalidPluginException("Plugin cannot register entrypoints other than PLUGIN during runtime. Tried registering %s!".formatted(entrypoint))); ++ // We have to throw an invalid plugin exception for legacy reasons ++ } ++ ++ this.providerStorage.register((PluginProvider) provider); ++ } ++ ++ @Override ++ public void enter(Entrypoint entrypoint) { ++ if (entrypoint != Entrypoint.PLUGIN) { ++ throw new IllegalArgumentException("Only plugin entrypoint supported"); ++ } ++ this.providerStorage.enter(); ++ } ++ ++ @NotNull ++ public T getPluginProviderStorage() { ++ return this.providerStorage; ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/manager/SingularRuntimePluginProviderStorage.java b/src/main/java/io/papermc/paper/plugin/manager/SingularRuntimePluginProviderStorage.java +new file mode 100644 +index 0000000000000000000000000000000000000000..3d1b60e0427b1da1965fe81fe02176a70a8d56a2 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/manager/SingularRuntimePluginProviderStorage.java +@@ -0,0 +1,80 @@ ++package io.papermc.paper.plugin.manager; ++ ++import com.destroystokyo.paper.util.SneakyThrow; ++import io.papermc.paper.plugin.entrypoint.Entrypoint; ++import io.papermc.paper.plugin.entrypoint.LaunchEntryPointHandler; ++import io.papermc.paper.plugin.provider.PluginProvider; ++import io.papermc.paper.plugin.provider.type.paper.PaperPluginParent; ++import io.papermc.paper.plugin.storage.ServerPluginProviderStorage; ++import org.bukkit.plugin.InvalidPluginException; ++import org.bukkit.plugin.PluginDescriptionFile; ++import org.bukkit.plugin.UnknownDependencyException; ++import org.bukkit.plugin.java.JavaPlugin; ++ ++import java.util.ArrayList; ++import java.util.List; ++import java.util.Optional; ++ ++/** ++ * Used for registering a single plugin provider. ++ * This has special behavior in that some errors are thrown instead of logged. ++ */ ++class SingularRuntimePluginProviderStorage extends ServerPluginProviderStorage { ++ ++ private PluginProvider lastProvider; ++ private JavaPlugin singleLoaded; ++ ++ @Override ++ public void register(PluginProvider provider) { ++ super.register(provider); ++ if (this.lastProvider != null) { ++ SneakyThrow.sneaky(new InvalidPluginException("Plugin registered two JavaPlugins")); ++ } ++ if (provider instanceof PaperPluginParent.PaperServerPluginProvider) { ++ throw new IllegalStateException("Cannot register paper plugins during runtime!"); ++ } ++ this.lastProvider = provider; ++ // Register the provider into the server entrypoint, this allows it to show in /plugins correctly. ++ // Generally it might be better in the future to make a separate storage, as putting it into the entrypoint handlers doesn't make much sense. ++ LaunchEntryPointHandler.INSTANCE.register(Entrypoint.PLUGIN, provider); ++ } ++ ++ @Override ++ public void enter() { ++ PluginProvider provider = this.lastProvider; ++ if (provider == null) { ++ return; ++ } ++ ++ // Manually validate dependencies, LEGACY BEHAVIOR. ++ // Normally it is logged, but manually adding one plugin will cause it to actually throw exceptions. ++ PluginDescriptionFile descriptionFile = (PluginDescriptionFile) provider.getMeta(); ++ List missingDependencies = new ArrayList<>(); ++ for (String dependency : descriptionFile.getDepend()) { ++ if (!PaperPluginManagerImpl.getInstance().isPluginEnabled(dependency)) { ++ missingDependencies.add(dependency); ++ } ++ } ++ if (!missingDependencies.isEmpty()) { ++ throw new UnknownDependencyException(missingDependencies, provider.getFileName().toString()); ++ } ++ ++ // Go through normal plugin loading logic ++ super.enter(); ++ } ++ ++ @Override ++ public void processProvided(PluginProvider provider, JavaPlugin provided) { ++ super.processProvided(provider, provided); ++ this.singleLoaded = provided; ++ } ++ ++ @Override ++ public boolean throwOnCycle() { ++ return false; ++ } ++ ++ public Optional getSingleLoaded() { ++ return Optional.ofNullable(this.singleLoaded); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/manager/StupidSPMPermissionManagerWrapper.java b/src/main/java/io/papermc/paper/plugin/manager/StupidSPMPermissionManagerWrapper.java +new file mode 100644 +index 0000000000000000000000000000000000000000..ea8cf22c35242eb9f3914b95df00e20504aef5c1 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/manager/StupidSPMPermissionManagerWrapper.java +@@ -0,0 +1,42 @@ ++package io.papermc.paper.plugin.manager; ++ ++import org.bukkit.permissions.Permissible; ++import org.bukkit.permissions.Permission; ++import org.bukkit.plugin.SimplePluginManager; ++ ++import java.util.Map; ++import java.util.Set; ++ ++/* ++This is actually so cursed I hate it. ++We need to wrap these in fields as people override the fields, so we need to access them lazily at all times. ++// TODO: When SimplePluginManager is GONE remove this and cleanup the PaperPermissionManager to use actual fields. ++ */ ++class StupidSPMPermissionManagerWrapper extends PaperPermissionManager { ++ ++ private final SimplePluginManager simplePluginManager; ++ ++ public StupidSPMPermissionManagerWrapper(SimplePluginManager simplePluginManager) { ++ this.simplePluginManager = simplePluginManager; ++ } ++ ++ @Override ++ public Map permissions() { ++ return this.simplePluginManager.permissions; ++ } ++ ++ @Override ++ public Map> defaultPerms() { ++ return this.simplePluginManager.defaultPerms; ++ } ++ ++ @Override ++ public Map> permSubs() { ++ return this.simplePluginManager.permSubs; ++ } ++ ++ @Override ++ public Map> defSubs() { ++ return this.simplePluginManager.defSubs; ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/provider/PluginProvider.java b/src/main/java/io/papermc/paper/plugin/provider/PluginProvider.java +new file mode 100644 +index 0000000000000000000000000000000000000000..a97ec947bc6cecf9d9183b236263fd4407e5fd7e +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/provider/PluginProvider.java +@@ -0,0 +1,55 @@ ++package io.papermc.paper.plugin.provider; ++ ++import io.papermc.paper.plugin.configuration.PluginMeta; ++import io.papermc.paper.plugin.provider.configuration.LoadOrderConfiguration; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++import java.nio.file.Path; ++import java.util.List; ++import java.util.Map; ++import java.util.jar.JarFile; ++import java.util.logging.Logger; ++ ++/** ++ * PluginProviders are created by a {@link io.papermc.paper.plugin.provider.source.ProviderSource}, ++ * which is loaded into an {@link io.papermc.paper.plugin.entrypoint.EntrypointHandler}. ++ *

++ * A PluginProvider is responsible for providing part of a plugin, whether it's a Bootstrapper or Server Plugin. ++ * The point of this class is to be able to create the actual instance later, as at the time this is created the server ++ * may be missing some key parts. For example, the Bukkit singleton will not be initialized yet, therefor we need to ++ * have a PluginServerProvider load the server plugin later. ++ *

++ * Plugin providers are currently not exposed in any way of the api. It is preferred that this stays this way, ++ * as providers are only needed for initialization. ++ * ++ * @param provider type ++ */ ++@ApiStatus.Internal ++public interface PluginProvider { ++ ++ @NotNull ++ Path getSource(); ++ ++ default Path getFileName() { ++ return this.getSource().getFileName(); ++ } ++ ++ default Path getParentSource() { ++ return this.getSource().getParent(); ++ } ++ ++ JarFile file(); ++ ++ T createInstance(); ++ ++ PluginMeta getMeta(); ++ ++ Logger getLogger(); ++ ++ LoadOrderConfiguration createConfiguration(@NotNull Map> toLoad); ++ ++ // Returns a list of missing dependencies ++ List validateDependencies(@NotNull Map> toLoad); ++ ++} +diff --git a/src/main/java/io/papermc/paper/plugin/provider/ProviderStatus.java b/src/main/java/io/papermc/paper/plugin/provider/ProviderStatus.java +new file mode 100644 +index 0000000000000000000000000000000000000000..6154e864b0ff01cb70acaaeee5ca8c9f4a90a90e +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/provider/ProviderStatus.java +@@ -0,0 +1,13 @@ ++package io.papermc.paper.plugin.provider; ++ ++import org.jetbrains.annotations.ApiStatus; ++ ++/** ++ * This is used for the /plugins command, where it will look in the {@link io.papermc.paper.plugin.entrypoint.LaunchEntryPointHandler} and ++ * use the provider statuses to determine the color. ++ */ ++@ApiStatus.Internal ++public enum ProviderStatus { ++ INITIALIZED, ++ ERRORED, ++} +diff --git a/src/main/java/io/papermc/paper/plugin/provider/ProviderStatusHolder.java b/src/main/java/io/papermc/paper/plugin/provider/ProviderStatusHolder.java +new file mode 100644 +index 0000000000000000000000000000000000000000..17284d0f61c459dff765c0adae4ad2c641e054c1 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/provider/ProviderStatusHolder.java +@@ -0,0 +1,11 @@ ++package io.papermc.paper.plugin.provider; ++ ++/** ++ * This is used to mark that a plugin provider is able to hold a status for the /plugins command. ++ */ ++public interface ProviderStatusHolder { ++ ++ ProviderStatus getLastProvidedStatus(); ++ ++ void setStatus(ProviderStatus status); ++} +diff --git a/src/main/java/io/papermc/paper/plugin/provider/configuration/FlattenedResolver.java b/src/main/java/io/papermc/paper/plugin/provider/configuration/FlattenedResolver.java +new file mode 100644 +index 0000000000000000000000000000000000000000..6ba3bcc468c0a60c76d6d0f0243bda661c737f2f +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/provider/configuration/FlattenedResolver.java +@@ -0,0 +1,29 @@ ++package io.papermc.paper.plugin.provider.configuration; ++ ++import org.checkerframework.checker.nullness.qual.Nullable; ++import org.spongepowered.configurate.objectmapping.meta.NodeResolver; ++ ++import java.lang.annotation.ElementType; ++import java.lang.annotation.Retention; ++import java.lang.annotation.RetentionPolicy; ++import java.lang.annotation.Target; ++import java.lang.reflect.AnnotatedElement; ++ ++@Retention(RetentionPolicy.RUNTIME) ++@Target(ElementType.FIELD) ++public @interface FlattenedResolver { ++ ++ final class Factory implements NodeResolver.Factory { ++ ++ @Override ++ public @Nullable NodeResolver make(String name, AnnotatedElement element) { ++ if (element.isAnnotationPresent(FlattenedResolver.class)) { ++ return (node) -> node; ++ } else { ++ return null; ++ } ++ } ++ } ++ ++ ++} +diff --git a/src/main/java/io/papermc/paper/plugin/provider/configuration/LoadOrderConfiguration.java b/src/main/java/io/papermc/paper/plugin/provider/configuration/LoadOrderConfiguration.java +new file mode 100644 +index 0000000000000000000000000000000000000000..e3430f535e8e9c3b8b44bf2daece8c47e8b14db7 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/provider/configuration/LoadOrderConfiguration.java +@@ -0,0 +1,38 @@ ++package io.papermc.paper.plugin.provider.configuration; ++ ++import io.papermc.paper.plugin.configuration.PluginMeta; ++import org.jetbrains.annotations.NotNull; ++ ++import java.util.List; ++ ++/** ++ * This is used for plugins to configure the load order of strategies. ++ */ ++public interface LoadOrderConfiguration { ++ ++ /** ++ * Provides a list of plugins that THIS configuration should load ++ * before. ++ * ++ * @return list of plugins ++ */ ++ @NotNull ++ List getLoadBefore(); ++ ++ /** ++ * Provides a list of plugins that THIS configuration should load ++ * before. ++ * ++ * @return list of plugins ++ */ ++ @NotNull ++ List getLoadAfter(); ++ ++ /** ++ * Gets the responsible plugin provider's meta. ++ * ++ * @return meta ++ */ ++ @NotNull ++ PluginMeta getMeta(); ++} +diff --git a/src/main/java/io/papermc/paper/plugin/provider/configuration/PaperPluginMeta.java b/src/main/java/io/papermc/paper/plugin/provider/configuration/PaperPluginMeta.java +new file mode 100644 +index 0000000000000000000000000000000000000000..3808f5a9abc9f084cbabfc4cb95394cc37aaf4bb +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/provider/configuration/PaperPluginMeta.java +@@ -0,0 +1,227 @@ ++package io.papermc.paper.plugin.provider.configuration; ++ ++import com.google.common.collect.ImmutableList; ++import io.leangen.geantyref.TypeToken; ++import io.papermc.paper.configuration.constraint.Constraint; ++import io.papermc.paper.configuration.serializer.ComponentSerializer; ++import io.papermc.paper.configuration.serializer.EnumValueSerializer; ++import io.papermc.paper.configuration.serializer.collections.MapSerializer; ++import io.papermc.paper.plugin.configuration.PluginMeta; ++import io.papermc.paper.plugin.provider.configuration.serializer.ImmutableListSerializer; ++import io.papermc.paper.plugin.provider.configuration.serializer.PermissionConfigurationSerializer; ++import io.papermc.paper.plugin.provider.configuration.serializer.constraints.PluginConfigConstraints; ++import io.papermc.paper.plugin.provider.configuration.type.DependencyConfiguration; ++import io.papermc.paper.plugin.provider.configuration.type.LoadConfiguration; ++import io.papermc.paper.plugin.provider.configuration.type.PermissionConfiguration; ++import org.bukkit.permissions.Permission; ++import org.bukkit.permissions.PermissionDefault; ++import org.bukkit.plugin.PluginLoadOrder; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; ++import org.spongepowered.configurate.CommentedConfigurationNode; ++import org.spongepowered.configurate.ConfigurateException; ++import org.spongepowered.configurate.loader.HeaderMode; ++import org.spongepowered.configurate.objectmapping.ConfigSerializable; ++import org.spongepowered.configurate.objectmapping.ObjectMapper; ++import org.spongepowered.configurate.objectmapping.meta.Required; ++import org.spongepowered.configurate.yaml.NodeStyle; ++import org.spongepowered.configurate.yaml.YamlConfigurationLoader; ++ ++import java.io.BufferedReader; ++import java.util.List; ++ ++@SuppressWarnings({"CanBeFinal", "FieldCanBeLocal", "FieldMayBeFinal", "NotNullFieldNotInitialized", "InnerClassMayBeStatic"}) ++@ConfigSerializable ++public class PaperPluginMeta implements PluginMeta { ++ ++ @PluginConfigConstraints.PluginName ++ @Required ++ private String name; ++ @Required ++ @PluginConfigConstraints.PluginNameSpace ++ private String main; ++ @PluginConfigConstraints.PluginNameSpace ++ private String bootstrapper; ++ @PluginConfigConstraints.PluginNameSpace ++ private String loader; ++ private List dependencies = List.of(); ++ private List loadBefore = List.of(); ++ private List loadAfter = List.of(); ++ private List provides = List.of(); ++ private boolean hasOpenClassloader = false; ++ @Required ++ private String version; ++ private String description; ++ private List authors = List.of(); ++ private List contributors = List.of(); ++ private String website; ++ private String prefix; ++ private PluginLoadOrder load = PluginLoadOrder.POSTWORLD; ++ @FlattenedResolver ++ private PermissionConfiguration permissionConfiguration = new PermissionConfiguration(PermissionDefault.OP, List.of()); ++ @Required ++ @PluginConfigConstraints.PluginVersion ++ private String apiVersion; ++ ++ private transient String displayName; ++ ++ public PaperPluginMeta() { ++ } ++ ++ public static PaperPluginMeta create(BufferedReader reader) throws ConfigurateException { ++ YamlConfigurationLoader loader = YamlConfigurationLoader.builder() ++ .indent(2) ++ .nodeStyle(NodeStyle.BLOCK) ++ .headerMode(HeaderMode.NONE) ++ .source(() -> reader) ++ .defaultOptions((options) -> { ++ ++ return options.serializers((serializers) -> { ++ serializers ++ .register(new EnumValueSerializer()) ++ .register(MapSerializer.TYPE, new MapSerializer(false)) ++ .register(new TypeToken<>() { ++ }, new ImmutableListSerializer()) ++ .register(PermissionConfiguration.class, PermissionConfigurationSerializer.SERIALIZER) ++ .register(new ComponentSerializer()) ++ .registerAnnotatedObjects( ++ ObjectMapper.factoryBuilder() ++ .addConstraint(Constraint.class, new Constraint.Factory()) ++ .addConstraint(PluginConfigConstraints.PluginName.class, String.class, new PluginConfigConstraints.PluginName.Factory()) ++ .addConstraint(PluginConfigConstraints.PluginVersion.class, String.class, new PluginConfigConstraints.PluginVersion.Factory()) ++ .addConstraint(PluginConfigConstraints.PluginNameSpace.class, String.class, new PluginConfigConstraints.PluginNameSpace.Factory()) ++ .addNodeResolver(new FlattenedResolver.Factory()) ++ .build() ++ ); ++ ++ }); ++ }) ++ .build(); ++ CommentedConfigurationNode node = loader.load(); ++ PaperPluginMeta pluginConfiguration = node.require(PaperPluginMeta.class); ++ ++ if (!node.node("author").virtual()) { ++ pluginConfiguration.authors = ImmutableList.builder() ++ .addAll(pluginConfiguration.authors) ++ .add(node.node("author").getString()) ++ .build(); ++ } ++ ++ pluginConfiguration.displayName = pluginConfiguration.name.replace('_', ' '); ++ ++ return pluginConfiguration; ++ } ++ ++ @Override ++ public @NotNull String getName() { ++ return this.name; ++ } ++ ++ @Override ++ public @NotNull String getMainClass() { ++ return this.main; ++ } ++ ++ @Override ++ public @NotNull String getVersion() { ++ return this.version; ++ } ++ ++ @Override ++ public @NotNull String getDisplayName() { ++ return this.displayName; ++ } ++ ++ @Override ++ public @Nullable String getLoggerPrefix() { ++ return this.prefix; ++ } ++ ++ @Override ++ public @NotNull List getPluginDependencies() { ++ return this.dependencies.stream().filter((dependency) -> dependency.required() && !dependency.bootstrap()).map(DependencyConfiguration::name).toList(); ++ } ++ ++ @Override ++ public @NotNull List getPluginSoftDependencies() { ++ return this.dependencies.stream().filter((dependency) -> !dependency.required() && !dependency.bootstrap()).map(DependencyConfiguration::name).toList(); ++ } ++ ++ @Override ++ public @NotNull List getLoadBeforePlugins() { ++ return this.loadBefore.stream().filter((dependency) -> !dependency.bootstrap()).map(LoadConfiguration::name).toList(); ++ } ++ ++ public @NotNull List getLoadAfterPlugins() { ++ return this.loadAfter.stream().filter((dependency) -> !dependency.bootstrap()).map(LoadConfiguration::name).toList(); ++ } ++ ++ public List getLoadAfter() { ++ return this.loadAfter; ++ } ++ ++ public List getLoadBefore() { ++ return this.loadBefore; ++ } ++ ++ @Override ++ public @NotNull PluginLoadOrder getLoadOrder() { ++ return this.load; ++ } ++ ++ @Override ++ public @NotNull String getDescription() { ++ return this.description; ++ } ++ ++ @Override ++ public @NotNull List getAuthors() { ++ return this.authors; ++ } ++ ++ @Override ++ public @NotNull List getContributors() { ++ return this.contributors; ++ } ++ ++ @Override ++ public String getWebsite() { ++ return this.website; ++ } ++ ++ @Override ++ public @NotNull List getPermissions() { ++ return this.permissionConfiguration.permissions(); ++ } ++ ++ @Override ++ public @NotNull PermissionDefault getPermissionDefault() { ++ return this.permissionConfiguration.defaultPerm(); ++ } ++ ++ @Override ++ public @NotNull String getAPIVersion() { ++ return this.apiVersion; ++ } ++ ++ @Override ++ public @NotNull List getProvidedPlugins() { ++ return this.provides; ++ } ++ ++ public String getBootstrapper() { ++ return this.bootstrapper; ++ } ++ ++ public String getLoader() { ++ return this.loader; ++ } ++ ++ public boolean hasOpenClassloader() { ++ return this.hasOpenClassloader; ++ } ++ ++ public List getDependencies() { ++ return dependencies; ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/provider/configuration/serializer/ImmutableCollectionSerializer.java b/src/main/java/io/papermc/paper/plugin/provider/configuration/serializer/ImmutableCollectionSerializer.java +new file mode 100644 +index 0000000000000000000000000000000000000000..f0cdb1bab30faaa438aa3e6de6125ade3fae98c2 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/provider/configuration/serializer/ImmutableCollectionSerializer.java +@@ -0,0 +1,90 @@ ++package io.papermc.paper.plugin.provider.configuration.serializer; ++ ++import com.google.common.collect.ImmutableCollection; ++import org.checkerframework.checker.nullness.qual.Nullable; ++import org.spongepowered.configurate.ConfigurationNode; ++import org.spongepowered.configurate.ConfigurationOptions; ++import org.spongepowered.configurate.serialize.SerializationException; ++import org.spongepowered.configurate.serialize.TypeSerializer; ++import org.spongepowered.configurate.util.CheckedConsumer; ++ ++import java.lang.reflect.Type; ++import java.util.Collection; ++import java.util.Collections; ++import java.util.List; ++ ++@SuppressWarnings("unchecked") ++public abstract class ImmutableCollectionSerializer, T extends Collection> implements TypeSerializer { ++ ++ protected ImmutableCollectionSerializer() { ++ } ++ ++ @Override ++ public final T deserialize(final Type type, final ConfigurationNode node) throws SerializationException { ++ final Type entryType = this.elementType(type); ++ final @Nullable TypeSerializer entrySerial = node.options().serializers().get(entryType); ++ if (entrySerial == null) { ++ throw new SerializationException(node, entryType, "No applicable type serializer for type"); ++ } ++ ++ if (node.isList()) { ++ final List values = node.childrenList(); ++ final B builder = this.createNew(values.size()); ++ for (ConfigurationNode value : values) { ++ try { ++ this.deserializeSingle(builder, entrySerial.deserialize(entryType, value)); ++ } catch (final SerializationException ex) { ++ ex.initPath(value::path); ++ throw ex; ++ } ++ } ++ return (T) builder.build(); ++ } else { ++ final @Nullable Object unwrappedVal = node.raw(); ++ if (unwrappedVal != null) { ++ final B builder = this.createNew(1); ++ this.deserializeSingle(builder, entrySerial.deserialize(entryType, node)); ++ return (T) builder.build(); ++ } ++ } ++ return this.emptyValue(type, null); ++ } ++ ++ @SuppressWarnings({"unchecked", "rawtypes"}) ++ @Override ++ public final void serialize(final Type type, final @Nullable T obj, final ConfigurationNode node) throws SerializationException { ++ final Type entryType = this.elementType(type); ++ final @Nullable TypeSerializer entrySerial = node.options().serializers().get(entryType); ++ if (entrySerial == null) { ++ throw new SerializationException(node, entryType, "No applicable type serializer for type"); ++ } ++ ++ node.raw(Collections.emptyList()); ++ if (obj != null) { ++ this.forEachElement(obj, el -> { ++ final ConfigurationNode child = node.appendListNode(); ++ try { ++ entrySerial.serialize(entryType, el, child); ++ } catch (final SerializationException ex) { ++ ex.initPath(child::path); ++ throw ex; ++ } ++ }); ++ } ++ } ++ ++ @SuppressWarnings({"unchecked"}) ++ @Override ++ public @Nullable T emptyValue(final Type specificType, final ConfigurationOptions options) { ++ return (T) this.createNew(0).build(); ++ } ++ ++ protected abstract Type elementType(Type containerType) throws SerializationException; ++ ++ protected abstract B createNew(int size); ++ ++ protected abstract void forEachElement(T collection, CheckedConsumer action) throws SerializationException; ++ ++ protected abstract void deserializeSingle(B builder, @Nullable Object deserialized) throws SerializationException; ++ ++} +diff --git a/src/main/java/io/papermc/paper/plugin/provider/configuration/serializer/ImmutableListSerializer.java b/src/main/java/io/papermc/paper/plugin/provider/configuration/serializer/ImmutableListSerializer.java +new file mode 100644 +index 0000000000000000000000000000000000000000..7757d7df70e39a6fe4d92d02b6f905a22f80dbf3 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/provider/configuration/serializer/ImmutableListSerializer.java +@@ -0,0 +1,43 @@ ++package io.papermc.paper.plugin.provider.configuration.serializer; ++ ++import com.google.common.collect.ImmutableList; ++import org.checkerframework.checker.nullness.qual.Nullable; ++import org.spongepowered.configurate.serialize.SerializationException; ++import org.spongepowered.configurate.util.CheckedConsumer; ++ ++import java.lang.reflect.ParameterizedType; ++import java.lang.reflect.Type; ++import java.util.List; ++ ++public class ImmutableListSerializer extends ImmutableCollectionSerializer, List> { ++ ++ @Override ++ protected Type elementType(Type containerType) throws SerializationException { ++ if (!(containerType instanceof ParameterizedType)) { ++ throw new SerializationException(containerType, "Raw types are not supported for collections"); ++ } ++ return ((ParameterizedType) containerType).getActualTypeArguments()[0]; ++ } ++ ++ @Override ++ protected ImmutableList.Builder createNew(int size) { ++ return ImmutableList.builderWithExpectedSize(size); ++ } ++ ++ @Override ++ protected void forEachElement(List collection, CheckedConsumer action) throws SerializationException { ++ for (Object obj : collection) { ++ action.accept(obj); ++ } ++ } ++ ++ @SuppressWarnings({"unchecked", "rawtypes"}) ++ @Override ++ protected void deserializeSingle(ImmutableList.Builder builder, @Nullable Object deserialized) throws SerializationException { ++ if (deserialized == null) { ++ return; ++ } ++ ++ ((ImmutableList.Builder) builder).add(deserialized); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/provider/configuration/serializer/PermissionConfigurationSerializer.java b/src/main/java/io/papermc/paper/plugin/provider/configuration/serializer/PermissionConfigurationSerializer.java +new file mode 100644 +index 0000000000000000000000000000000000000000..d1088e4b7fa5f8e689f23b150b83645ce1ae5a0e +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/provider/configuration/serializer/PermissionConfigurationSerializer.java +@@ -0,0 +1,56 @@ ++package io.papermc.paper.plugin.provider.configuration.serializer; ++ ++import io.papermc.paper.plugin.provider.configuration.type.PermissionConfiguration; ++import org.bukkit.permissions.Permission; ++import org.bukkit.permissions.PermissionDefault; ++import org.spongepowered.configurate.ConfigurationNode; ++import org.spongepowered.configurate.serialize.SerializationException; ++import org.spongepowered.configurate.serialize.TypeSerializer; ++ ++import java.lang.reflect.Type; ++import java.util.ArrayList; ++import java.util.List; ++import java.util.Map; ++ ++public class PermissionConfigurationSerializer { ++ ++ public static final Serializer SERIALIZER = new Serializer(); ++ ++ private static final class Serializer implements TypeSerializer { ++ private Serializer() { ++ super(); ++ } ++ ++ @Override ++ public PermissionConfiguration deserialize(Type type, ConfigurationNode node) throws SerializationException { ++ Map map = (Map) node.node("permissions").raw(); ++ ++ PermissionDefault permissionDefault; ++ ConfigurationNode permNode = node.node("defaultPerm"); ++ if (permNode.virtual()) { ++ permissionDefault = PermissionDefault.OP; ++ } else { ++ permissionDefault = PermissionDefault.getByName(permNode.getString()); ++ } ++ ++ List result = new ArrayList<>(); ++ if (map != null) { ++ for (Map.Entry entry : map.entrySet()) { ++ try { ++ result.add(Permission.loadPermission(entry.getKey().toString(), (Map) entry.getValue(), permissionDefault, result)); ++ } catch (Throwable ex) { ++ throw new SerializationException(null, "Error loading permission %s".formatted(entry.getKey()), ex); ++ } ++ } ++ } ++ ++ return new PermissionConfiguration(permissionDefault, List.copyOf(result)); ++ } ++ ++ @Override ++ public void serialize(Type type, @org.checkerframework.checker.nullness.qual.Nullable PermissionConfiguration obj, ConfigurationNode node) throws SerializationException { ++ ++ } ++ ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/provider/configuration/serializer/constraints/PluginConfigConstraints.java b/src/main/java/io/papermc/paper/plugin/provider/configuration/serializer/constraints/PluginConfigConstraints.java +new file mode 100644 +index 0000000000000000000000000000000000000000..a0109a388188b0808900405d334a40318ab16ec1 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/provider/configuration/serializer/constraints/PluginConfigConstraints.java +@@ -0,0 +1,86 @@ ++package io.papermc.paper.plugin.provider.configuration.serializer.constraints; ++ ++import io.papermc.paper.plugin.util.NamespaceChecker; ++import org.spongepowered.configurate.objectmapping.meta.Constraint; ++import org.spongepowered.configurate.serialize.SerializationException; ++ ++import java.lang.annotation.Documented; ++import java.lang.annotation.ElementType; ++import java.lang.annotation.Retention; ++import java.lang.annotation.RetentionPolicy; ++import java.lang.annotation.Target; ++import java.lang.reflect.Type; ++import java.util.Locale; ++import java.util.Set; ++import java.util.regex.Pattern; ++ ++public final class PluginConfigConstraints { ++ ++ public static final Set RESERVED_KEYS = Set.of("bukkit", "minecraft", "mojang", "spigot", "paper"); ++ public static final Set VALID_PAPER_VERSIONS = Set.of("1.19"); ++ ++ @Documented ++ @Retention(RetentionPolicy.RUNTIME) ++ @Target(ElementType.FIELD) ++ public @interface PluginName { ++ ++ final class Factory implements Constraint.Factory { ++ ++ private static final Pattern VALID_NAME = Pattern.compile("^[A-Za-z\\d _.-]+$"); ++ ++ @Override ++ public Constraint make(PluginName data, Type type) { ++ return value -> { ++ if (value != null) { ++ if (RESERVED_KEYS.contains(value.toLowerCase(Locale.ROOT))) { ++ throw new SerializationException("Restricted name, cannot use '%s' as a plugin name.".formatted(data)); ++ } else if (value.indexOf(' ') != -1) { ++ // For legacy reasons, the space condition has a separate exception message. ++ throw new SerializationException("Restricted name, cannot use 0x20 (space character) in a plugin name."); ++ } ++ ++ if (!VALID_NAME.matcher(value).matches()) { ++ throw new SerializationException("name '" + value + "' contains invalid characters."); ++ } ++ } ++ }; ++ } ++ } ++ } ++ ++ @Documented ++ @Retention(RetentionPolicy.RUNTIME) ++ @Target(ElementType.FIELD) ++ public @interface PluginNameSpace { ++ ++ final class Factory implements Constraint.Factory { ++ ++ @Override ++ public Constraint make(PluginNameSpace data, Type type) { ++ return value -> { ++ if (value != null && !NamespaceChecker.isValidNameSpace(value)) { ++ throw new SerializationException("provided class '%s' is in an invalid namespace.".formatted(value)); ++ } ++ }; ++ } ++ } ++ } ++ ++ @Documented ++ @Retention(RetentionPolicy.RUNTIME) ++ @Target(ElementType.FIELD) ++ public @interface PluginVersion { ++ ++ final class Factory implements Constraint.Factory { ++ ++ @Override ++ public Constraint make(PluginVersion data, Type type) { ++ return value -> { ++ if (value != null && !VALID_PAPER_VERSIONS.contains(value)) { ++ throw new SerializationException("Provided plugin's version (%s) is not supported on this version.".formatted(value)); ++ } ++ }; ++ } ++ } ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/provider/configuration/type/DependencyConfiguration.java b/src/main/java/io/papermc/paper/plugin/provider/configuration/type/DependencyConfiguration.java +new file mode 100644 +index 0000000000000000000000000000000000000000..071bff3f988a4391be424bdf7e98a6c35e6cac67 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/provider/configuration/type/DependencyConfiguration.java +@@ -0,0 +1,12 @@ ++package io.papermc.paper.plugin.provider.configuration.type; ++ ++import org.spongepowered.configurate.objectmapping.ConfigSerializable; ++import org.spongepowered.configurate.objectmapping.meta.Required; ++ ++@ConfigSerializable ++public record DependencyConfiguration( ++ @Required String name, ++ boolean required, ++ boolean bootstrap ++) { ++} +diff --git a/src/main/java/io/papermc/paper/plugin/provider/configuration/type/LoadConfiguration.java b/src/main/java/io/papermc/paper/plugin/provider/configuration/type/LoadConfiguration.java +new file mode 100644 +index 0000000000000000000000000000000000000000..4184e4232c59f15ef8bbc98f82f501fc524f37c7 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/provider/configuration/type/LoadConfiguration.java +@@ -0,0 +1,11 @@ ++package io.papermc.paper.plugin.provider.configuration.type; ++ ++import org.spongepowered.configurate.objectmapping.ConfigSerializable; ++import org.spongepowered.configurate.objectmapping.meta.Required; ++ ++@ConfigSerializable ++public record LoadConfiguration( ++ @Required String name, ++ boolean bootstrap ++) { ++} +diff --git a/src/main/java/io/papermc/paper/plugin/provider/configuration/type/PermissionConfiguration.java b/src/main/java/io/papermc/paper/plugin/provider/configuration/type/PermissionConfiguration.java +new file mode 100644 +index 0000000000000000000000000000000000000000..a180612a1ec395202dbae1ca5b97ec01382097e4 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/provider/configuration/type/PermissionConfiguration.java +@@ -0,0 +1,14 @@ ++package io.papermc.paper.plugin.provider.configuration.type; ++ ++import org.bukkit.permissions.Permission; ++import org.bukkit.permissions.PermissionDefault; ++import org.spongepowered.configurate.objectmapping.ConfigSerializable; ++ ++import java.util.List; ++ ++// Record components used for deserialization!!!! ++@ConfigSerializable ++public record PermissionConfiguration( ++ PermissionDefault defaultPerm, ++ List permissions) { ++} +diff --git a/src/main/java/io/papermc/paper/plugin/provider/source/DirectoryProviderSource.java b/src/main/java/io/papermc/paper/plugin/provider/source/DirectoryProviderSource.java +new file mode 100644 +index 0000000000000000000000000000000000000000..1822e076601db51c8a7954036853bee1fb8e3704 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/provider/source/DirectoryProviderSource.java +@@ -0,0 +1,40 @@ ++package io.papermc.paper.plugin.provider.source; ++ ++import com.mojang.logging.LogUtils; ++import io.papermc.paper.plugin.entrypoint.EntrypointHandler; ++import org.slf4j.Logger; ++ ++import java.nio.file.Files; ++import java.nio.file.Path; ++import java.util.logging.Level; ++ ++/** ++ * Loads all plugin providers in the given directory. ++ */ ++public class DirectoryProviderSource extends FileProviderSource { ++ ++ public static final DirectoryProviderSource INSTANCE = new DirectoryProviderSource(); ++ private static final Logger LOGGER = LogUtils.getLogger(); ++ ++ public DirectoryProviderSource() { ++ super("Directory '%s'"::formatted); ++ } ++ ++ @Override ++ public void registerProviders(EntrypointHandler entrypointHandler, Path context) throws Exception { ++ // Sym link happy, create file if missing. ++ if (!Files.isDirectory(context)) { ++ Files.createDirectories(context); ++ } ++ ++ Files.walk(context, 1).filter(Files::isRegularFile).forEach((path) -> { ++ try { ++ super.registerProviders(entrypointHandler, path); ++ } catch (IllegalArgumentException ignored) { ++ // Ignore initial argument exceptions ++ } catch (Exception e) { ++ LOGGER.error("Error loading plugin: " + e.getMessage(), e); ++ } ++ }); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/provider/source/FileProviderSource.java b/src/main/java/io/papermc/paper/plugin/provider/source/FileProviderSource.java +new file mode 100644 +index 0000000000000000000000000000000000000000..e6a99f422038fad519215abf239135b11edc2bce +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/provider/source/FileProviderSource.java +@@ -0,0 +1,156 @@ ++package io.papermc.paper.plugin.provider.source; ++ ++import io.papermc.paper.plugin.PluginInitializerManager; ++import io.papermc.paper.plugin.entrypoint.EntrypointHandler; ++import io.papermc.paper.plugin.provider.type.PluginFileType; ++import org.bukkit.plugin.InvalidPluginException; ++import org.jetbrains.annotations.Nullable; ++ ++import java.io.File; ++import java.io.IOException; ++import java.nio.file.FileVisitResult; ++import java.nio.file.FileVisitor; ++import java.nio.file.Files; ++import java.nio.file.Path; ++import java.nio.file.StandardCopyOption; ++import java.nio.file.attribute.BasicFileAttributes; ++import java.util.Set; ++import java.util.function.Function; ++import java.util.jar.JarFile; ++ ++/** ++ * Loads a plugin provider at the given plugin jar file path. ++ */ ++public class FileProviderSource implements ProviderSource { ++ ++ private final Function contextChecker; ++ ++ public FileProviderSource(Function contextChecker) { ++ this.contextChecker = contextChecker; ++ } ++ ++ @Override ++ public void registerProviders(EntrypointHandler entrypointHandler, Path context) throws Exception { ++ String source = this.contextChecker.apply(context); ++ ++ if (Files.notExists(context)) { ++ throw new IllegalArgumentException(source + " does not exist, cannot load a plugin from it!"); ++ } ++ ++ if (!Files.isRegularFile(context)) { ++ throw new IllegalArgumentException(source + " is not a file, cannot load a plugin from it!"); ++ } ++ ++ if (!context.getFileName().toString().endsWith(".jar")) { ++ throw new IllegalArgumentException(source + " is not a jar file, cannot load a plugin from it!"); ++ } ++ ++ try { ++ context = this.checkUpdate(context); ++ ++ JarFile file = new JarFile(context.toFile()); ++ PluginFileType type = PluginFileType.guessType(file); ++ if (type == null) { ++ throw new IllegalArgumentException(source + " is not a valid plugin file, cannot load a plugin from it!"); ++ } ++ ++ type.register(entrypointHandler, file, context); ++ } catch (Exception exception) { ++ throw new RuntimeException(source + " failed to load!", exception); ++ } ++ } ++ ++ /** ++ * Replaces a plugin with a plugin of the same plugin name in the update folder. ++ * ++ * @param file ++ */ ++ private Path checkUpdate(Path file) throws Exception { ++ PluginInitializerManager pluginSystem = PluginInitializerManager.instance(); ++ Path updateDirectory = pluginSystem.pluginUpdatePath(); ++ if (updateDirectory == null || !Files.isDirectory(updateDirectory)) { ++ return file; ++ } ++ ++ try { ++ String pluginName = this.getPluginName(file); ++ UpdateFileVisitor visitor = new UpdateFileVisitor(pluginName); ++ Files.walkFileTree(updateDirectory, Set.of(), 1, visitor); ++ if (visitor.getValidPlugin() != null) { ++ Path updateLocation = visitor.getValidPlugin(); ++ ++ try { ++ Files.copy(updateLocation, file, StandardCopyOption.REPLACE_EXISTING); ++ } catch (IOException exception) { ++ throw new RuntimeException("Could not copy '" + updateLocation + "' to '" + file + "' in update plugin process", exception); ++ } ++ ++ // Idk what this is about, TODO ++ File newName = new File(file.toFile().getParentFile(), updateLocation.toFile().getName()); ++ file.toFile().renameTo(newName); ++ updateLocation.toFile().delete(); ++ return newName.toPath(); ++ } ++ } catch (Exception e) { ++ throw new InvalidPluginException(e); ++ } ++ return file; ++ } ++ ++ private String getPluginName(Path path) throws Exception { ++ JarFile file = new JarFile(path.toFile()); ++ PluginFileType type = PluginFileType.guessType(file); ++ if (type == null) { ++ throw new IllegalArgumentException(path + " is not a valid plugin file, cannot load a plugin from it!"); ++ } ++ ++ return type.getConfig(file).getName(); ++ } ++ ++ private class UpdateFileVisitor implements FileVisitor { ++ ++ private final String targetName; ++ @Nullable ++ private Path validPlugin; ++ ++ private UpdateFileVisitor(String targetName) { ++ this.targetName = targetName; ++ } ++ ++ @Override ++ public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { ++ return FileVisitResult.CONTINUE; ++ } ++ ++ @Override ++ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { ++ try { ++ String updatePluginName = FileProviderSource.this.getPluginName(file); ++ if (this.targetName.equals(updatePluginName)) { ++ this.validPlugin = file; ++ return FileVisitResult.TERMINATE; ++ } ++ } catch (Exception e) { ++ // We failed to load this data for some reason, so, we'll skip over this ++ } ++ ++ ++ return FileVisitResult.CONTINUE; ++ } ++ ++ @Override ++ public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException { ++ return FileVisitResult.CONTINUE; ++ } ++ ++ @Override ++ public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { ++ return FileVisitResult.CONTINUE; ++ } ++ ++ @Nullable ++ public Path getValidPlugin() { ++ return validPlugin; ++ } ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/provider/source/PluginFlagProviderSource.java b/src/main/java/io/papermc/paper/plugin/provider/source/PluginFlagProviderSource.java +new file mode 100644 +index 0000000000000000000000000000000000000000..e62b476ddbce2bdc66061c116aa0228622f6fd16 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/provider/source/PluginFlagProviderSource.java +@@ -0,0 +1,29 @@ ++package io.papermc.paper.plugin.provider.source; ++ ++import com.mojang.logging.LogUtils; ++import io.papermc.paper.plugin.entrypoint.EntrypointHandler; ++import org.slf4j.Logger; ++ ++import java.io.File; ++import java.util.List; ++ ++/** ++ * Registers providers at the provided files in the add-plugin argument. ++ */ ++public class PluginFlagProviderSource implements ProviderSource> { ++ ++ public static final PluginFlagProviderSource INSTANCE = new PluginFlagProviderSource(); ++ private static final Logger LOGGER = LogUtils.getLogger(); ++ private final FileProviderSource providerSource = new FileProviderSource("File '%s' specified through 'add-plugin' argument"::formatted); ++ ++ @Override ++ public void registerProviders(EntrypointHandler entrypointHandler, List context) { ++ for (File file : context) { ++ try { ++ this.providerSource.registerProviders(entrypointHandler, file.toPath()); ++ } catch (Exception e) { ++ LOGGER.error("Error loading plugin: " + e.getMessage(), e); ++ } ++ } ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/provider/source/ProviderSource.java b/src/main/java/io/papermc/paper/plugin/provider/source/ProviderSource.java +new file mode 100644 +index 0000000000000000000000000000000000000000..6d247819ee842eb054a74711a0e5805ac8f0498e +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/provider/source/ProviderSource.java +@@ -0,0 +1,14 @@ ++package io.papermc.paper.plugin.provider.source; ++ ++import io.papermc.paper.plugin.entrypoint.EntrypointHandler; ++ ++/** ++ * A provider source is responsible for giving PluginTypes an EntrypointHandler for ++ * registering providers at. ++ * ++ * @param context ++ */ ++public interface ProviderSource { ++ ++ void registerProviders(EntrypointHandler entrypointHandler, C context) throws Throwable; ++} +diff --git a/src/main/java/io/papermc/paper/plugin/provider/type/PluginFileType.java b/src/main/java/io/papermc/paper/plugin/provider/type/PluginFileType.java +new file mode 100644 +index 0000000000000000000000000000000000000000..22c25dc6fdfd336f5074fa52c3a4e8128d433ccc +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/provider/type/PluginFileType.java +@@ -0,0 +1,77 @@ ++package io.papermc.paper.plugin.provider.type; ++ ++import io.papermc.paper.plugin.configuration.PluginMeta; ++import io.papermc.paper.plugin.entrypoint.Entrypoint; ++import io.papermc.paper.plugin.entrypoint.EntrypointHandler; ++import io.papermc.paper.plugin.provider.configuration.PaperPluginMeta; ++import io.papermc.paper.plugin.provider.type.paper.PaperPluginParent; ++import io.papermc.paper.plugin.provider.type.spigot.SpigotPluginProvider; ++import org.bukkit.plugin.PluginDescriptionFile; ++import org.jetbrains.annotations.Nullable; ++ ++import java.nio.file.Path; ++import java.util.List; ++import java.util.jar.JarEntry; ++import java.util.jar.JarFile; ++ ++/** ++ * This is where spigot/paper plugins are registered. ++ * This will get the jar and find a certain config file, create an object ++ * then registering it into a {@link EntrypointHandler} at a certain {@link Entrypoint}. ++ */ ++public abstract class PluginFileType { ++ ++ public static final PluginFileType PAPER = new PluginFileType<>("paper-plugin.yml", PaperPluginParent.FACTORY) { ++ @Override ++ protected void register(EntrypointHandler entrypointHandler, PaperPluginParent parent) { ++ PaperPluginParent.PaperBootstrapProvider bootstrapPluginProvider = null; ++ if (parent.shouldCreateBootstrap()) { ++ bootstrapPluginProvider = parent.createBootstrapProvider(); ++ entrypointHandler.register(Entrypoint.BOOTSTRAPPER, bootstrapPluginProvider); ++ } ++ ++ entrypointHandler.register(Entrypoint.PLUGIN, parent.createPluginProvider(bootstrapPluginProvider)); ++ } ++ }; ++ public static final PluginFileType SPIGOT = new PluginFileType<>("plugin.yml", SpigotPluginProvider.FACTORY) { ++ @Override ++ protected void register(EntrypointHandler entrypointHandler, SpigotPluginProvider provider) { ++ entrypointHandler.register(Entrypoint.PLUGIN, provider); ++ } ++ }; ++ ++ private static final List> VALUES = List.of(PAPER, SPIGOT); ++ ++ private final String config; ++ private final PluginTypeFactory factory; ++ ++ PluginFileType(String config, PluginTypeFactory factory) { ++ this.config = config; ++ this.factory = factory; ++ } ++ ++ @Nullable ++ public static PluginFileType guessType(JarFile file) { ++ for (PluginFileType type : VALUES) { ++ JarEntry entry = file.getJarEntry(type.config); ++ if (entry != null) { ++ return type; ++ } ++ } ++ ++ return null; ++ } ++ ++ public T register(EntrypointHandler entrypointHandler, JarFile file, Path context) throws Exception { ++ C config = this.getConfig(file); ++ T provider = this.factory.build(file, config, context); ++ this.register(entrypointHandler, provider); ++ return provider; ++ } ++ ++ public C getConfig(JarFile file) throws Exception { ++ return this.factory.create(file, file.getJarEntry(this.config)); ++ } ++ ++ protected abstract void register(EntrypointHandler entrypointHandler, T provider); ++} +diff --git a/src/main/java/io/papermc/paper/plugin/provider/type/PluginTypeFactory.java b/src/main/java/io/papermc/paper/plugin/provider/type/PluginTypeFactory.java +new file mode 100644 +index 0000000000000000000000000000000000000000..32f230d66f6953520b59ccbf3079c5a6242ca92c +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/provider/type/PluginTypeFactory.java +@@ -0,0 +1,21 @@ ++package io.papermc.paper.plugin.provider.type; ++ ++import io.papermc.paper.plugin.configuration.PluginMeta; ++ ++import java.nio.file.Path; ++import java.util.jar.JarEntry; ++import java.util.jar.JarFile; ++ ++/** ++ * A plugin type factory is responsible for building an object ++ * and config for a certain plugin type. ++ * ++ * @param plugin provider type (may not be a plugin provider) ++ * @param config type ++ */ ++public interface PluginTypeFactory { ++ ++ T build(JarFile file, C configuration, Path source) throws Exception; ++ ++ C create(JarFile file, JarEntry config) throws Exception; ++} +diff --git a/src/main/java/io/papermc/paper/plugin/provider/type/paper/PaperBootstrapOrderConfiguration.java b/src/main/java/io/papermc/paper/plugin/provider/type/paper/PaperBootstrapOrderConfiguration.java +new file mode 100644 +index 0000000000000000000000000000000000000000..362feffd88e117c0fb93ffeddafe8334275f0d95 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/provider/type/paper/PaperBootstrapOrderConfiguration.java +@@ -0,0 +1,47 @@ ++package io.papermc.paper.plugin.provider.type.paper; ++ ++import io.papermc.paper.plugin.configuration.PluginMeta; ++import io.papermc.paper.plugin.provider.configuration.LoadOrderConfiguration; ++import io.papermc.paper.plugin.provider.configuration.PaperPluginMeta; ++import io.papermc.paper.plugin.provider.configuration.type.LoadConfiguration; ++import org.jetbrains.annotations.NotNull; ++ ++import java.util.ArrayList; ++import java.util.List; ++ ++public class PaperBootstrapOrderConfiguration implements LoadOrderConfiguration { ++ ++ private final PaperPluginMeta paperPluginMeta; ++ private final List loadBefore = new ArrayList<>(); ++ private final List loadAfter = new ArrayList<>(); ++ ++ public PaperBootstrapOrderConfiguration(PaperPluginMeta paperPluginMeta) { ++ this.paperPluginMeta = paperPluginMeta; ++ ++ for (LoadConfiguration configuration : paperPluginMeta.getLoadAfter()) { ++ if (configuration.bootstrap()) { ++ this.loadAfter.add(configuration.name()); ++ } ++ } ++ for (LoadConfiguration configuration : paperPluginMeta.getLoadBefore()) { ++ if (configuration.bootstrap()) { ++ this.loadBefore.add(configuration.name()); ++ } ++ } ++ } ++ ++ @Override ++ public @NotNull List getLoadBefore() { ++ return this.loadBefore; ++ } ++ ++ @Override ++ public @NotNull List getLoadAfter() { ++ return this.loadAfter; ++ } ++ ++ @Override ++ public @NotNull PluginMeta getMeta() { ++ return this.paperPluginMeta; ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/provider/type/paper/PaperLoadOrderConfiguration.java b/src/main/java/io/papermc/paper/plugin/provider/type/paper/PaperLoadOrderConfiguration.java +new file mode 100644 +index 0000000000000000000000000000000000000000..b7e8a5ba375a558e0442aa9facf96954a9bb135f +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/provider/type/paper/PaperLoadOrderConfiguration.java +@@ -0,0 +1,44 @@ ++package io.papermc.paper.plugin.provider.type.paper; ++ ++import io.papermc.paper.plugin.configuration.PluginMeta; ++import io.papermc.paper.plugin.provider.PluginProvider; ++import io.papermc.paper.plugin.provider.configuration.LoadOrderConfiguration; ++import io.papermc.paper.plugin.provider.configuration.PaperPluginMeta; ++import io.papermc.paper.plugin.provider.type.spigot.SpigotPluginProvider; ++import org.bukkit.plugin.PluginDescriptionFile; ++import org.bukkit.plugin.java.JavaPlugin; ++import org.jetbrains.annotations.NotNull; ++ ++import java.util.ArrayList; ++import java.util.Iterator; ++import java.util.List; ++import java.util.Map; ++ ++public class PaperLoadOrderConfiguration implements LoadOrderConfiguration { ++ ++ private final PaperPluginMeta meta; ++ private final List loadBefore; ++ private final List loadAfter; ++ ++ public PaperLoadOrderConfiguration(PaperPluginMeta meta) { ++ this.meta = meta; ++ ++ this.loadBefore = this.meta.getLoadBeforePlugins(); ++ this.loadAfter = this.meta.getLoadAfterPlugins(); ++ } ++ ++ @Override ++ public @NotNull List getLoadBefore() { ++ return this.loadBefore; ++ } ++ ++ @Override ++ public @NotNull List getLoadAfter() { ++ return this.loadAfter; ++ } ++ ++ @Override ++ public @NotNull PluginMeta getMeta() { ++ return this.meta; ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/provider/type/paper/PaperPluginParent.java b/src/main/java/io/papermc/paper/plugin/provider/type/paper/PaperPluginParent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..a0773c6d24de1f2ce1f0d949cba26b9997b696e6 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/provider/type/paper/PaperPluginParent.java +@@ -0,0 +1,258 @@ ++package io.papermc.paper.plugin.provider.type.paper; ++ ++import com.destroystokyo.paper.util.SneakyThrow; ++import io.papermc.paper.plugin.bootstrap.PluginProviderContext; ++import io.papermc.paper.plugin.entrypoint.dependency.DependencyUtil; ++import io.papermc.paper.plugin.provider.configuration.LoadOrderConfiguration; ++import io.papermc.paper.plugin.provider.configuration.type.DependencyConfiguration; ++import io.papermc.paper.plugin.provider.entrypoint.DependencyContext; ++import io.papermc.paper.plugin.entrypoint.dependency.DependencyContextHolder; ++import io.papermc.paper.plugin.bootstrap.PluginBootstrap; ++import io.papermc.paper.plugin.entrypoint.classloader.PaperPluginClassLoader; ++import io.papermc.paper.plugin.provider.PluginProvider; ++import io.papermc.paper.plugin.provider.ProviderStatus; ++import io.papermc.paper.plugin.provider.ProviderStatusHolder; ++import io.papermc.paper.plugin.provider.configuration.PaperPluginMeta; ++import io.papermc.paper.plugin.provider.type.PluginTypeFactory; ++import io.papermc.paper.plugin.provider.util.ProviderUtil; ++import org.bukkit.plugin.java.JavaPlugin; ++import org.jetbrains.annotations.NotNull; ++ ++import java.nio.file.Path; ++import java.util.ArrayList; ++import java.util.List; ++import java.util.Map; ++import java.util.jar.JarFile; ++import java.util.logging.Logger; ++ ++public class PaperPluginParent { ++ ++ public static final PluginTypeFactory FACTORY = new PaperPluginProviderFactory(); ++ private final Path path; ++ private final JarFile jarFile; ++ private final PaperPluginMeta description; ++ private final PaperPluginClassLoader classLoader; ++ private final PluginProviderContext context; ++ private final Logger logger; ++ ++ public PaperPluginParent(Path path, JarFile jarFile, PaperPluginMeta description, PaperPluginClassLoader classLoader, PluginProviderContext context) { ++ this.path = path; ++ this.jarFile = jarFile; ++ this.description = description; ++ this.classLoader = classLoader; ++ this.context = context; ++ this.logger = context.getLogger(); ++ } ++ ++ public boolean shouldCreateBootstrap() { ++ return this.description.getBootstrapper() != null; ++ } ++ ++ public PaperBootstrapProvider createBootstrapProvider() { ++ return new PaperBootstrapProvider(); ++ } ++ ++ public PaperServerPluginProvider createPluginProvider(PaperBootstrapProvider provider) { ++ return new PaperServerPluginProvider(provider); ++ } ++ ++ public class PaperBootstrapProvider implements PluginProvider, ProviderStatusHolder, DependencyContextHolder { ++ ++ private ProviderStatus status; ++ private PluginBootstrap lastProvided; ++ ++ @Override ++ public @NotNull Path getSource() { ++ return PaperPluginParent.this.path; ++ } ++ ++ @Override ++ public JarFile file() { ++ return PaperPluginParent.this.jarFile; ++ } ++ ++ @Override ++ public PluginBootstrap createInstance() { ++ PluginBootstrap bootstrap = ProviderUtil.loadClass(PaperPluginParent.this.description.getBootstrapper(), ++ PluginBootstrap.class, PaperPluginParent.this.classLoader, () -> this.status = ProviderStatus.ERRORED); ++ this.status = ProviderStatus.INITIALIZED; ++ this.lastProvided = bootstrap; ++ return bootstrap; ++ } ++ ++ @Override ++ public PaperPluginMeta getMeta() { ++ return PaperPluginParent.this.description; ++ } ++ ++ @Override ++ public Logger getLogger() { ++ return PaperPluginParent.this.logger; ++ } ++ ++ @Override ++ public LoadOrderConfiguration createConfiguration(@NotNull Map> toLoad) { ++ return new PaperBootstrapOrderConfiguration(PaperPluginParent.this.description); ++ } ++ ++ @Override ++ public List validateDependencies(@NotNull Map> toLoad) { ++ List missingDependencies = new ArrayList<>(); ++ for (DependencyConfiguration configuration : this.getMeta().getDependencies()) { ++ String dependency = configuration.name(); ++ if (configuration.required() && configuration.bootstrap() && !toLoad.containsKey(dependency)) { ++ missingDependencies.add(dependency); ++ } ++ } ++ ++ return missingDependencies; ++ } ++ ++ @Override ++ public ProviderStatus getLastProvidedStatus() { ++ return this.status; ++ } ++ ++ @Override ++ public void setStatus(ProviderStatus status) { ++ this.status = status; ++ } ++ ++ public PluginBootstrap getLastProvided() { ++ return this.lastProvided; ++ } ++ ++ @Override ++ public void setContext(DependencyContext context) { ++ PaperPluginParent.this.classLoader.refreshClassloaderDependencyTree(context); ++ } ++ ++ @Override ++ public String toString() { ++ return "PaperBootstrapProvider{" + ++ "parent=" + PaperPluginParent.this + ++ "status=" + status + ++ ", lastProvided=" + lastProvided + ++ '}'; ++ } ++ } ++ ++ public class PaperServerPluginProvider implements PluginProvider, ProviderStatusHolder, DependencyContextHolder { ++ ++ private final PaperBootstrapProvider bootstrapProvider; ++ ++ private ProviderStatus status; ++ ++ PaperServerPluginProvider(PaperBootstrapProvider bootstrapProvider) { ++ this.bootstrapProvider = bootstrapProvider; ++ } ++ ++ @Override ++ public @NotNull Path getSource() { ++ return PaperPluginParent.this.path; ++ } ++ ++ @Override ++ public JarFile file() { ++ return PaperPluginParent.this.jarFile; ++ } ++ ++ @Override ++ public JavaPlugin createInstance() { ++ PluginBootstrap bootstrap = null; ++ if (this.bootstrapProvider != null && this.bootstrapProvider.getLastProvided() != null) { ++ bootstrap = this.bootstrapProvider.getLastProvided(); ++ } ++ ++ try { ++ JavaPlugin plugin; ++ if (bootstrap == null) { ++ plugin = ProviderUtil.loadClass(PaperPluginParent.this.description.getMainClass(), JavaPlugin.class, PaperPluginParent.this.classLoader); ++ } else { ++ plugin = bootstrap.createPlugin(PaperPluginParent.this.context); ++ } ++ ++ // Don't allow plugins to load plugins other than the one defined in main. This restriction might not be necessary. ++ if (!plugin.getClass().isAssignableFrom(Class.forName(PaperPluginParent.this.description.getMainClass(), true, plugin.getClass().getClassLoader()))) { ++ throw new IllegalArgumentException("Plugin provided must be the same type as main defined in plugin configuration!"); ++ } ++ ++ this.status = ProviderStatus.INITIALIZED; ++ return plugin; ++ } catch (Throwable throwable) { ++ this.status = ProviderStatus.ERRORED; ++ SneakyThrow.sneaky(throwable); ++ } ++ ++ throw new AssertionError(); // Impossible ++ } ++ ++ @Override ++ public PaperPluginMeta getMeta() { ++ return PaperPluginParent.this.description; ++ } ++ ++ @Override ++ public Logger getLogger() { ++ return PaperPluginParent.this.logger; ++ } ++ ++ @Override ++ public LoadOrderConfiguration createConfiguration(@NotNull Map> toLoad) { ++ return new PaperLoadOrderConfiguration(PaperPluginParent.this.description); ++ } ++ ++ @Override ++ public List validateDependencies(@NotNull Map> toLoad) { ++ return DependencyUtil.validateSimple(this.getMeta(), toLoad); ++ } ++ ++ @Override ++ public ProviderStatus getLastProvidedStatus() { ++ return this.status; ++ } ++ ++ @Override ++ public void setStatus(ProviderStatus status) { ++ this.status = status; ++ } ++ ++ public boolean shouldSkipCreation() { ++ if (this.bootstrapProvider == null) { ++ return false; ++ } ++ ++ return this.bootstrapProvider.getLastProvidedStatus() == ProviderStatus.ERRORED; ++ } ++ ++ /* ++ The plugin has to reuse the classloader in order to share the bootstrapper. ++ However, a plugin may have totally separate dependencies during bootstrapping. ++ This is a bit yuck, but in general we have to treat bootstrapping and normal game as connected. ++ */ ++ @Override ++ public void setContext(DependencyContext context) { ++ PaperPluginParent.this.classLoader.refreshClassloaderDependencyTree(context); ++ } ++ ++ @Override ++ public String toString() { ++ return "PaperServerPluginProvider{" + ++ "parent=" + PaperPluginParent.this + ++ "bootstrapProvider=" + bootstrapProvider + ++ ", status=" + status + ++ '}'; ++ } ++ } ++ ++ ++ @Override ++ public String toString() { ++ return "PaperPluginParent{" + ++ "path=" + path + ++ ", jarFile=" + jarFile + ++ ", description=" + description + ++ ", classLoader=" + classLoader + ++ '}'; ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/provider/type/paper/PaperPluginProviderFactory.java b/src/main/java/io/papermc/paper/plugin/provider/type/paper/PaperPluginProviderFactory.java +new file mode 100644 +index 0000000000000000000000000000000000000000..db343a2f482ac375078610f0875692861f412ee2 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/provider/type/paper/PaperPluginProviderFactory.java +@@ -0,0 +1,54 @@ ++package io.papermc.paper.plugin.provider.type.paper; ++ ++import com.destroystokyo.paper.utils.PaperPluginLogger; ++import io.papermc.paper.plugin.bootstrap.PluginProviderContext; ++import io.papermc.paper.plugin.bootstrap.PluginProviderContextImpl; ++import io.papermc.paper.plugin.entrypoint.classloader.PaperPluginClassLoader; ++import io.papermc.paper.plugin.entrypoint.classloader.PaperSimplePluginClassLoader; ++import io.papermc.paper.plugin.loader.PaperClasspathBuilder; ++import io.papermc.paper.plugin.loader.PluginLoader; ++import io.papermc.paper.plugin.provider.configuration.PaperPluginMeta; ++import io.papermc.paper.plugin.provider.type.PluginTypeFactory; ++import io.papermc.paper.plugin.provider.util.ProviderUtil; ++ ++import java.io.BufferedReader; ++import java.io.IOException; ++import java.io.InputStreamReader; ++import java.nio.file.Path; ++import java.util.jar.JarEntry; ++import java.util.jar.JarFile; ++import java.util.logging.Logger; ++ ++class PaperPluginProviderFactory implements PluginTypeFactory { ++ ++ @Override ++ public PaperPluginParent build(JarFile file, PaperPluginMeta configuration, Path source) throws Exception { ++ Logger logger = PaperPluginLogger.getLogger(configuration); ++ PluginProviderContext context = PluginProviderContextImpl.of(configuration, logger); ++ ++ PaperClasspathBuilder builder = new PaperClasspathBuilder(context); ++ ++ if (configuration.getLoader() != null) { ++ try ( ++ PaperSimplePluginClassLoader simplePluginClassLoader = new PaperSimplePluginClassLoader(source, file, configuration, this.getClass().getClassLoader()) ++ ) { ++ PluginLoader loader = ProviderUtil.loadClass(configuration.getLoader(), PluginLoader.class, simplePluginClassLoader); ++ loader.classloader(builder); ++ } catch (IOException e) { ++ throw new RuntimeException(e); ++ } ++ } ++ ++ PaperPluginClassLoader classLoader = builder.buildClassLoader(logger, source, file, configuration); ++ return new PaperPluginParent(source, file, configuration, classLoader, context); ++ } ++ ++ @Override ++ public PaperPluginMeta create(JarFile file, JarEntry config) throws Exception { ++ PaperPluginMeta configuration; ++ try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(file.getInputStream(config)))) { ++ configuration = PaperPluginMeta.create(bufferedReader); ++ } ++ return configuration; ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/provider/type/spigot/SpigotLoadOrderConfiguration.java b/src/main/java/io/papermc/paper/plugin/provider/type/spigot/SpigotLoadOrderConfiguration.java +new file mode 100644 +index 0000000000000000000000000000000000000000..b2a6544e321fa61c58bdf5684231de1020884fcc +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/provider/type/spigot/SpigotLoadOrderConfiguration.java +@@ -0,0 +1,72 @@ ++package io.papermc.paper.plugin.provider.type.spigot; ++ ++import io.papermc.paper.plugin.configuration.PluginMeta; ++import io.papermc.paper.plugin.provider.PluginProvider; ++import io.papermc.paper.plugin.provider.configuration.LoadOrderConfiguration; ++import org.bukkit.plugin.PluginDescriptionFile; ++import org.bukkit.plugin.java.JavaPlugin; ++import org.jetbrains.annotations.NotNull; ++ ++import java.util.ArrayList; ++import java.util.HashSet; ++import java.util.Iterator; ++import java.util.List; ++import java.util.Map; ++import java.util.Set; ++ ++public class SpigotLoadOrderConfiguration implements LoadOrderConfiguration { ++ ++ private final PluginDescriptionFile meta; ++ private final List loadBefore; ++ private final List loadAfter; ++ ++ public SpigotLoadOrderConfiguration(SpigotPluginProvider spigotPluginProvider, Map> toLoad) { ++ this.meta = spigotPluginProvider.getMeta(); ++ ++ this.loadBefore = meta.getLoadBeforePlugins(); ++ this.loadAfter = new ArrayList<>(); ++ this.loadAfter.addAll(meta.getDepend()); ++ this.loadAfter.addAll(meta.getSoftDepend()); ++ ++ // First: Remove as load after IF already in loadbefore ++ // Some plugins would put a plugin both in depends and in loadbefore, ++ // so in this case, we just ignore the effects of depend. ++ for (String loadBefore : this.loadBefore) { ++ this.loadAfter.remove(loadBefore); ++ } ++ ++ // Second: Do a basic check to see if any other dependencies refer back to this plugin. ++ Iterator iterators = this.loadAfter.iterator(); ++ while (iterators.hasNext()) { ++ String loadAfter = iterators.next(); ++ PluginProvider provider = toLoad.get(loadAfter); ++ if (provider != null) { ++ PluginMeta configuration = provider.getMeta(); ++ // Does a configuration refer back to this plugin? ++ Set dependencies = new HashSet<>(); ++ dependencies.addAll(configuration.getPluginDependencies()); ++ dependencies.addAll(configuration.getPluginSoftDependencies()); ++ ++ if (configuration.getName().equals(this.meta.getName()) || dependencies.contains(this.meta.getName())) { ++ iterators.remove(); // Let the other config deal with it ++ } ++ } ++ } ++ ++ } ++ ++ @Override ++ public @NotNull List getLoadBefore() { ++ return this.loadBefore; ++ } ++ ++ @Override ++ public @NotNull List getLoadAfter() { ++ return this.loadAfter; ++ } ++ ++ @Override ++ public @NotNull PluginMeta getMeta() { ++ return this.meta; ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/provider/type/spigot/SpigotPluginProvider.java b/src/main/java/io/papermc/paper/plugin/provider/type/spigot/SpigotPluginProvider.java +new file mode 100644 +index 0000000000000000000000000000000000000000..600023770e19f02258327816122298f58d73e4ab +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/provider/type/spigot/SpigotPluginProvider.java +@@ -0,0 +1,188 @@ ++package io.papermc.paper.plugin.provider.type.spigot; ++ ++import com.destroystokyo.paper.util.SneakyThrow; ++import com.destroystokyo.paper.utils.PaperPluginLogger; ++import io.papermc.paper.plugin.entrypoint.dependency.DependencyUtil; ++import io.papermc.paper.plugin.manager.PaperPluginManagerImpl; ++import io.papermc.paper.plugin.provider.configuration.LoadOrderConfiguration; ++import io.papermc.paper.plugin.provider.entrypoint.DependencyContext; ++import io.papermc.paper.plugin.entrypoint.dependency.DependencyContextHolder; ++import io.papermc.paper.plugin.provider.PluginProvider; ++import io.papermc.paper.plugin.provider.ProviderStatus; ++import io.papermc.paper.plugin.provider.ProviderStatusHolder; ++import io.papermc.paper.plugin.provider.type.PluginTypeFactory; ++import org.bukkit.Bukkit; ++import org.bukkit.Server; ++import org.bukkit.plugin.InvalidPluginException; ++import org.bukkit.plugin.PluginDescriptionFile; ++import org.bukkit.plugin.UnknownDependencyException; ++import org.bukkit.plugin.java.JavaPlugin; ++import org.bukkit.plugin.java.LibraryLoader; ++import org.bukkit.plugin.java.PluginClassLoader; ++import org.jetbrains.annotations.NotNull; ++ ++import java.io.File; ++import java.nio.file.Path; ++import java.util.HashSet; ++import java.util.List; ++import java.util.Map; ++import java.util.Set; ++import java.util.jar.JarFile; ++import java.util.logging.Level; ++import java.util.logging.Logger; ++ ++public class SpigotPluginProvider implements PluginProvider, ProviderStatusHolder, DependencyContextHolder { ++ ++ public static final PluginTypeFactory FACTORY = new SpigotPluginProviderFactory(); ++ private static final LibraryLoader LIBRARY_LOADER = new LibraryLoader(Logger.getLogger("SpigotLibraryLoader")); ++ private final Path path; ++ private final PluginDescriptionFile description; ++ private final JarFile jarFile; ++ private final Logger logger; ++ private ProviderStatus status; ++ private DependencyContext dependencyContext; ++ ++ SpigotPluginProvider(Path path, JarFile file, PluginDescriptionFile description) { ++ this.path = path; ++ this.jarFile = file; ++ this.description = description; ++ this.logger = PaperPluginLogger.getLogger(description); ++ } ++ ++ @Override ++ public @NotNull Path getSource() { ++ return this.path; ++ } ++ ++ @Override ++ public JarFile file() { ++ return this.jarFile; ++ } ++ ++ @Override ++ public JavaPlugin createInstance() { ++ Server server = Bukkit.getServer(); ++ try { ++ ++ final File parentFile = server.getPluginsFolder(); // Paper ++ final File dataFolder = new File(parentFile, this.description.getName()); ++ @SuppressWarnings("deprecation") final File oldDataFolder = new File(parentFile, this.description.getRawName()); ++ ++ // Found old data folder ++ if (dataFolder.equals(oldDataFolder)) { ++ // They are equal -- nothing needs to be done! ++ } else if (dataFolder.isDirectory() && oldDataFolder.isDirectory()) { ++ server.getLogger().warning(String.format( ++ "While loading %s (%s) found old-data folder: `%s' next to the new one `%s'", ++ this.description.getFullName(), ++ this.path, ++ oldDataFolder, ++ dataFolder ++ )); ++ } else if (oldDataFolder.isDirectory() && !dataFolder.exists()) { ++ if (!oldDataFolder.renameTo(dataFolder)) { ++ throw new InvalidPluginException("Unable to rename old data folder: `" + oldDataFolder + "' to: `" + dataFolder + "'"); ++ } ++ server.getLogger().log(Level.INFO, String.format( ++ "While loading %s (%s) renamed data folder: `%s' to `%s'", ++ this.description.getFullName(), ++ this.path, ++ oldDataFolder, ++ dataFolder ++ )); ++ } ++ ++ if (dataFolder.exists() && !dataFolder.isDirectory()) { ++ throw new InvalidPluginException(String.format( ++ "Projected datafolder: `%s' for %s (%s) exists and is not a directory", ++ dataFolder, ++ this.description.getFullName(), ++ this.path ++ )); ++ } ++ ++ Set missingHardDependencies = new HashSet<>(this.description.getDepend().size()); // Paper - list all missing hard depends ++ for (final String pluginName : this.description.getDepend()) { ++ if (!this.dependencyContext.hasDependency(pluginName)) { ++ missingHardDependencies.add(pluginName); // Paper - list all missing hard depends ++ } ++ } ++ // Paper start - list all missing hard depends ++ if (!missingHardDependencies.isEmpty()) { ++ throw new UnknownDependencyException(missingHardDependencies, this.description.getFullName()); ++ } ++ // Paper end ++ ++ server.getUnsafe().checkSupported(this.description); ++ ++ final PluginClassLoader loader; ++ try { ++ loader = new PluginClassLoader(this.getClass().getClassLoader(), this.description, dataFolder, this.path.toFile(), LIBRARY_LOADER.createLoader(this.description)); // Paper ++ } catch (InvalidPluginException ex) { ++ throw ex; ++ } catch (Throwable ex) { ++ throw new InvalidPluginException(ex); ++ } ++ ++ // Override dependency context. ++ // We must provide a temporary context in order to properly handle dependencies on the plugin classloader constructor. ++ // EDIT - Only re add if dependency checking is needed for spigot plugins, but not anymore. ++ // loader.dependencyContext = PaperPluginManagerImpl.getInstance(); ++ ++ ++ this.status = ProviderStatus.INITIALIZED; ++ return loader.getPlugin(); ++ } catch (Throwable ex) { ++ this.status = ProviderStatus.ERRORED; ++ SneakyThrow.sneaky(ex); ++ } ++ ++ throw new AssertionError(); // Shouldn't happen ++ } ++ ++ @Override ++ public PluginDescriptionFile getMeta() { ++ return this.description; ++ } ++ ++ @Override ++ public Logger getLogger() { ++ return this.logger; ++ } ++ ++ @Override ++ public LoadOrderConfiguration createConfiguration(@NotNull Map> toLoad) { ++ return new SpigotLoadOrderConfiguration(this, toLoad); ++ } ++ ++ @Override ++ public List validateDependencies(@NotNull Map> toLoad) { ++ return DependencyUtil.validateSimple(this.getMeta(), toLoad); ++ } ++ ++ @Override ++ public ProviderStatus getLastProvidedStatus() { ++ return this.status; ++ } ++ ++ @Override ++ public void setStatus(ProviderStatus status) { ++ this.status = status; ++ } ++ ++ @Override ++ public void setContext(DependencyContext context) { ++ this.dependencyContext = context; ++ } ++ ++ @Override ++ public String toString() { ++ return "SpigotPluginProvider{" + ++ "path=" + path + ++ ", description=" + description + ++ ", jarFile=" + jarFile + ++ ", status=" + status + ++ ", dependencyContext=" + dependencyContext + ++ '}'; ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/provider/type/spigot/SpigotPluginProviderFactory.java b/src/main/java/io/papermc/paper/plugin/provider/type/spigot/SpigotPluginProviderFactory.java +new file mode 100644 +index 0000000000000000000000000000000000000000..14ed05945ba5bfeb2b539d4786278b0e04130404 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/provider/type/spigot/SpigotPluginProviderFactory.java +@@ -0,0 +1,45 @@ ++package io.papermc.paper.plugin.provider.type.spigot; ++ ++import io.papermc.paper.plugin.provider.configuration.serializer.constraints.PluginConfigConstraints; ++import io.papermc.paper.plugin.provider.type.PluginTypeFactory; ++import org.bukkit.plugin.InvalidDescriptionException; ++import org.bukkit.plugin.PluginDescriptionFile; ++import org.yaml.snakeyaml.error.YAMLException; ++ ++import java.io.IOException; ++import java.io.InputStream; ++import java.nio.file.Path; ++import java.util.Locale; ++import java.util.jar.JarEntry; ++import java.util.jar.JarFile; ++ ++class SpigotPluginProviderFactory implements PluginTypeFactory { ++ ++ @Override ++ public SpigotPluginProvider build(JarFile file, PluginDescriptionFile configuration, Path source) throws Exception { ++ // Copied from SimplePluginManager#loadPlugins ++ // Spigot doesn't validate the name when the config is created, and instead when the plugin is loaded. ++ // Paper plugin configuration will do these checks in config serializer instead of when this is created. ++ String name = configuration.getRawName(); ++ if (PluginConfigConstraints.RESERVED_KEYS.contains(name.toLowerCase(Locale.ROOT))) { ++ throw new InvalidDescriptionException("Restricted name, cannot use %s as a plugin name.".formatted(name)); ++ } else if (name.indexOf(' ') != -1) { ++ throw new InvalidDescriptionException("Restricted name, cannot use 0x20 (space character) in a plugin name."); ++ } ++ ++ return new SpigotPluginProvider(source, file, configuration); ++ } ++ ++ @Override ++ public PluginDescriptionFile create(JarFile file, JarEntry config) throws Exception { ++ PluginDescriptionFile descriptionFile; ++ try (InputStream inputStream = file.getInputStream(config)) { ++ descriptionFile = new PluginDescriptionFile(inputStream); ++ } catch (IOException | YAMLException ex) { ++ throw new InvalidDescriptionException(ex); ++ } ++ ++ return descriptionFile; ++ } ++} ++ +diff --git a/src/main/java/io/papermc/paper/plugin/storage/BootstrapProviderStorage.java b/src/main/java/io/papermc/paper/plugin/storage/BootstrapProviderStorage.java +new file mode 100644 +index 0000000000000000000000000000000000000000..e5b70ff297febd936e64055b79f48712d65dbed9 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/storage/BootstrapProviderStorage.java +@@ -0,0 +1,57 @@ ++package io.papermc.paper.plugin.storage; ++ ++import com.mojang.logging.LogUtils; ++import io.papermc.paper.plugin.PluginInitializerManager; ++import io.papermc.paper.plugin.bootstrap.PluginBootstrap; ++import io.papermc.paper.plugin.bootstrap.PluginProviderContext; ++import io.papermc.paper.plugin.bootstrap.PluginProviderContextImpl; ++import io.papermc.paper.plugin.provider.entrypoint.DependencyContext; ++import io.papermc.paper.plugin.entrypoint.dependency.DependencyContextHolder; ++import io.papermc.paper.plugin.entrypoint.strategy.ModernPluginLoadingStrategy; ++import io.papermc.paper.plugin.entrypoint.strategy.PluginGraphCycleException; ++import io.papermc.paper.plugin.entrypoint.strategy.ProviderConfiguration; ++import io.papermc.paper.plugin.provider.PluginProvider; ++import io.papermc.paper.plugin.provider.ProviderStatus; ++import io.papermc.paper.plugin.provider.ProviderStatusHolder; ++import io.papermc.paper.plugin.provider.configuration.PaperPluginMeta; ++import io.papermc.paper.plugin.provider.configuration.type.DependencyConfiguration; ++import org.slf4j.Logger; ++ ++import java.util.ArrayList; ++import java.util.List; ++ ++public class BootstrapProviderStorage extends SimpleProviderStorage { ++ ++ private static final Logger LOGGER = LogUtils.getLogger(); ++ ++ public BootstrapProviderStorage() { ++ super(new ModernPluginLoadingStrategy<>(new ProviderConfiguration<>() { ++ @Override ++ public void applyContext(PluginProvider provider, DependencyContext dependencyContext) { ++ if (provider instanceof DependencyContextHolder contextHolder) { ++ contextHolder.setContext(dependencyContext); ++ } ++ } ++ ++ @Override ++ public boolean load(PluginProvider provider, PluginBootstrap provided) { ++ try { ++ PluginProviderContext context = PluginProviderContextImpl.of(provider, PluginInitializerManager.instance().pluginDirectoryPath()); ++ provided.bootstrap(context); ++ return true; ++ } catch (Exception e) { ++ LOGGER.error("Failed to run bootstrapper for %s. This plugin will not be loaded.".formatted(provider.getSource()), e); ++ if (provider instanceof ProviderStatusHolder statusHolder) { ++ statusHolder.setStatus(ProviderStatus.ERRORED); ++ } ++ return false; ++ } ++ } ++ })); ++ } ++ ++ @Override ++ public String toString() { ++ return "BOOTSTRAP:" + super.toString(); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/storage/ConfiguredProviderStorage.java b/src/main/java/io/papermc/paper/plugin/storage/ConfiguredProviderStorage.java +new file mode 100644 +index 0000000000000000000000000000000000000000..c49fd0d21f5c591fb2076ac87f158bca1a8e12b1 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/storage/ConfiguredProviderStorage.java +@@ -0,0 +1,17 @@ ++package io.papermc.paper.plugin.storage; ++ ++import io.papermc.paper.plugin.entrypoint.strategy.LegacyPluginLoadingStrategy; ++import io.papermc.paper.plugin.entrypoint.strategy.ModernPluginLoadingStrategy; ++import io.papermc.paper.plugin.entrypoint.strategy.ProviderConfiguration; ++ ++public abstract class ConfiguredProviderStorage extends SimpleProviderStorage { ++ ++ public static final boolean LEGACY_PLUGIN_LOADING = Boolean.getBoolean("paper.useLegacyPluginLoading"); ++ ++ protected ConfiguredProviderStorage(ProviderConfiguration onLoad) { ++ // This doesn't work with reloading. ++ // Should we care? ++ super(LEGACY_PLUGIN_LOADING ? new LegacyPluginLoadingStrategy<>(onLoad) : new ModernPluginLoadingStrategy<>(onLoad)); ++ } ++ ++} +diff --git a/src/main/java/io/papermc/paper/plugin/storage/ProviderStorage.java b/src/main/java/io/papermc/paper/plugin/storage/ProviderStorage.java +new file mode 100644 +index 0000000000000000000000000000000000000000..374e7d3d69fc8603ecf54999f173123d3a9fbf6e +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/storage/ProviderStorage.java +@@ -0,0 +1,18 @@ ++package io.papermc.paper.plugin.storage; ++ ++import io.papermc.paper.plugin.provider.PluginProvider; ++ ++/** ++ * A provider storage is meant to be a singleton that stores providers. ++ * ++ * @param provider type ++ */ ++public interface ProviderStorage { ++ ++ void register(PluginProvider provider); ++ ++ void enter(); ++ ++ Iterable> getRegisteredProviders(); ++ ++} +diff --git a/src/main/java/io/papermc/paper/plugin/storage/ServerPluginProviderStorage.java b/src/main/java/io/papermc/paper/plugin/storage/ServerPluginProviderStorage.java +new file mode 100644 +index 0000000000000000000000000000000000000000..fbe76a678f45bd3c55f25f2b6a4366efc0521cb8 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/storage/ServerPluginProviderStorage.java +@@ -0,0 +1,70 @@ ++package io.papermc.paper.plugin.storage; ++ ++import com.mojang.logging.LogUtils; ++import io.papermc.paper.plugin.provider.entrypoint.DependencyContext; ++import io.papermc.paper.plugin.entrypoint.dependency.DependencyContextHolder; ++import io.papermc.paper.plugin.entrypoint.strategy.ProviderConfiguration; ++import io.papermc.paper.plugin.manager.PaperPluginManagerImpl; ++import io.papermc.paper.plugin.provider.PluginProvider; ++import io.papermc.paper.plugin.provider.ProviderStatus; ++import io.papermc.paper.plugin.provider.ProviderStatusHolder; ++import io.papermc.paper.plugin.provider.type.paper.PaperPluginParent; ++import org.bukkit.plugin.Plugin; ++import org.bukkit.plugin.java.JavaPlugin; ++import org.slf4j.Logger; ++ ++import java.util.List; ++ ++public class ServerPluginProviderStorage extends ConfiguredProviderStorage { ++ ++ private static final Logger LOGGER = LogUtils.getLogger(); ++ ++ public ServerPluginProviderStorage() { ++ super(new ProviderConfiguration<>() { ++ @Override ++ public void applyContext(PluginProvider provider, DependencyContext dependencyContext) { ++ Plugin alreadyLoadedPlugin = PaperPluginManagerImpl.getInstance().getPlugin(provider.getMeta().getName()); ++ if (alreadyLoadedPlugin != null) { ++ throw new IllegalStateException("Provider " + provider + " attempted to add duplicate plugin identifier " + alreadyLoadedPlugin + " THIS WILL CREATE BUGS!!!"); ++ } ++ ++ if (provider instanceof DependencyContextHolder contextHolder) { ++ contextHolder.setContext(dependencyContext); ++ } ++ } ++ ++ @Override ++ public boolean load(PluginProvider provider, JavaPlugin provided) { ++ // Add it to the map here, we have to run the actual loading logic later. ++ PaperPluginManagerImpl.getInstance().loadPlugin(provided); ++ return true; ++ } ++ }); ++ } ++ ++ @Override ++ protected void filterLoadingProviders(List> pluginProviders) { ++ /* ++ Have to do this to prevent loading plugin providers that have failed initializers. ++ This is a hack and a better solution here would be to store failed plugin providers elsewhere. ++ */ ++ pluginProviders.removeIf((provider) -> (provider instanceof PaperPluginParent.PaperServerPluginProvider pluginProvider && pluginProvider.shouldSkipCreation())); ++ } ++ ++ // We need to call the load methods AFTER all plugins are constructed ++ @Override ++ public void processProvided(PluginProvider provider, JavaPlugin provided) { ++ try { ++ provided.getLogger().info(String.format("Loading server plugin %s", provided.getPluginMeta().getDisplayName())); ++ provided.onLoad(); ++ } catch (Throwable ex) { ++ // Don't mark that provider as ERRORED, as this apparently still needs to run the onEnable logic. ++ provided.getSLF4JLogger().error("Error initializing plugin '%s' in folder '%s' (Is it up to date?)".formatted(provider.getFileName(), provider.getParentSource()), ex); ++ } ++ } ++ ++ @Override ++ public String toString() { ++ return "PLUGIN:" + super.toString(); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/storage/SimpleProviderStorage.java b/src/main/java/io/papermc/paper/plugin/storage/SimpleProviderStorage.java +new file mode 100644 +index 0000000000000000000000000000000000000000..272b1d13a4925c92f39e02fc8360521a6b284727 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/storage/SimpleProviderStorage.java +@@ -0,0 +1,85 @@ ++package io.papermc.paper.plugin.storage; ++ ++import com.mojang.logging.LogUtils; ++import io.papermc.paper.plugin.entrypoint.strategy.PluginGraphCycleException; ++import io.papermc.paper.plugin.entrypoint.strategy.ProviderLoadingStrategy; ++import io.papermc.paper.plugin.provider.PluginProvider; ++import org.slf4j.Logger; ++ ++import java.util.ArrayList; ++import java.util.List; ++import java.util.stream.Collectors; ++ ++public abstract class SimpleProviderStorage implements ProviderStorage { ++ ++ private static final Logger LOGGER = LogUtils.getLogger(); ++ ++ protected final List> providers = new ArrayList<>(); ++ protected ProviderLoadingStrategy strategy; ++ ++ protected SimpleProviderStorage(ProviderLoadingStrategy strategy) { ++ this.strategy = strategy; ++ } ++ ++ @Override ++ public void register(PluginProvider provider) { ++ this.providers.add(provider); ++ } ++ ++ @Override ++ public void enter() { ++ List> providerList = new ArrayList<>(this.providers); ++ this.filterLoadingProviders(providerList); ++ ++ try { ++ for (ProviderLoadingStrategy.ProviderPair providerPair : this.strategy.loadProviders(providerList)) { ++ this.processProvided(providerPair.provider(), providerPair.provided()); ++ } ++ } catch (PluginGraphCycleException exception) { ++ this.handleCycle(exception); ++ } ++ } ++ ++ @Override ++ public Iterable> getRegisteredProviders() { ++ return this.providers; ++ } ++ ++ public void processProvided(PluginProvider provider, T provided) { ++ } ++ ++ // Mutable enter ++ protected void filterLoadingProviders(List> providers) { ++ } ++ ++ protected void handleCycle(PluginGraphCycleException exception) { ++ List logMessages = new ArrayList<>(); ++ for (List list : exception.getCycles()) { ++ logMessages.add(String.join(" -> ", list) + " -> " + list.get(0)); ++ } ++ ++ LOGGER.error("Circular plugin loading detected!"); ++ LOGGER.error("Circular load order:"); ++ for (String logMessage : logMessages) { ++ LOGGER.error(" " + logMessage); ++ } ++ LOGGER.error("Please report this to the plugin authors of the first plugin of each loop or join the PaperMC Discord server for further help."); ++ LOGGER.error("If you would like to still load these plugins, acknowledging that there may be unexpected plugin loading issues, run the server with -Dpaper.useLegacyPluginLoading=true"); ++ ++ if (this.throwOnCycle()) { ++ throw new IllegalStateException("Circular plugin loading from plugins " + exception.getCycles().stream().map(cycle -> cycle.get(0)).collect(Collectors.joining(", "))); ++ } ++ } ++ ++ public boolean throwOnCycle() { ++ return true; ++ } ++ ++ @Override ++ public String toString() { ++ return "SimpleProviderStorage{" + ++ "providers=" + this.providers + ++ ", strategy=" + this.strategy + ++ '}'; ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/storage/package-info.java b/src/main/java/io/papermc/paper/plugin/storage/package-info.java +new file mode 100644 +index 0000000000000000000000000000000000000000..c1114675137e862ac9682b635bfdbfbc1d7c6e67 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/storage/package-info.java +@@ -0,0 +1,5 @@ ++/** ++ * Classes in this package are supposed to connect components of {@link io.papermc.paper.plugin.entrypoint} and {@link io.papermc.paper.plugin.provider} packages. ++ * @see io.papermc.paper.plugin.entrypoint.Entrypoint ++ */ ++package io.papermc.paper.plugin.storage; +diff --git a/src/main/java/io/papermc/paper/plugin/util/EntrypointUtil.java b/src/main/java/io/papermc/paper/plugin/util/EntrypointUtil.java +new file mode 100644 +index 0000000000000000000000000000000000000000..98518351e616e536315cd89790b327d3bad33d0e +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/util/EntrypointUtil.java +@@ -0,0 +1,19 @@ ++package io.papermc.paper.plugin.util; ++ ++import com.mojang.logging.LogUtils; ++import io.papermc.paper.plugin.entrypoint.LaunchEntryPointHandler; ++import io.papermc.paper.plugin.provider.source.ProviderSource; ++import org.slf4j.Logger; ++ ++public class EntrypointUtil { ++ ++ private static final Logger LOGGER = LogUtils.getLogger(); ++ ++ public static void registerProvidersFromSource(ProviderSource source, C context) { ++ try { ++ source.registerProviders(LaunchEntryPointHandler.INSTANCE, context); ++ } catch (Throwable e) { ++ LOGGER.error(e.getMessage(), e); ++ } ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/util/NamespaceChecker.java b/src/main/java/io/papermc/paper/plugin/util/NamespaceChecker.java +new file mode 100644 +index 0000000000000000000000000000000000000000..fd55fd1d6518ebd1bc2513dd331f072018fd4782 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/util/NamespaceChecker.java +@@ -0,0 +1,37 @@ ++package io.papermc.paper.plugin.util; ++ ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++@ApiStatus.Internal ++public class NamespaceChecker { ++ ++ private static final String[] QUICK_INVALID_NAMESPACES = { ++ "net.minecraft.", ++ "org.bukkit.", ++ "io.papermc.paper.", ++ "com.destroystokoyo.paper." ++ }; ++ ++ /** ++ * Used for a variety of namespaces that shouldn't be resolved and should instead be moved to ++ * other classloaders. We can assume this because only plugins should be using this classloader. ++ * ++ * @param name namespace ++ */ ++ public static void validateNameSpaceForClassloading(@NotNull String name) throws ClassNotFoundException { ++ if (!isValidNameSpace(name)) { ++ throw new ClassNotFoundException(name); ++ } ++ } ++ ++ public static boolean isValidNameSpace(@NotNull String name) { ++ for (String string : QUICK_INVALID_NAMESPACES) { ++ if (name.startsWith(string)) { ++ return false; ++ } ++ } ++ ++ return true; ++ } ++} +diff --git a/src/main/java/io/papermc/paper/util/StackWalkerUtil.java b/src/main/java/io/papermc/paper/util/StackWalkerUtil.java +index f7114d5b8f2f93f62883e24da29afaf9f74ee1a6..8bf0630c0e06950cd99b7ae9898137f70c22063f 100644 +--- a/src/main/java/io/papermc/paper/util/StackWalkerUtil.java ++++ b/src/main/java/io/papermc/paper/util/StackWalkerUtil.java +@@ -1,9 +1,10 @@ + package io.papermc.paper.util; + ++import io.papermc.paper.plugin.provider.classloader.ConfiguredPluginClassLoader; + import org.bukkit.plugin.java.JavaPlugin; +-import org.bukkit.plugin.java.PluginClassLoader; + import org.jetbrains.annotations.Nullable; + ++import java.util.Objects; + import java.util.Optional; + + public class StackWalkerUtil { +@@ -12,11 +13,18 @@ public class StackWalkerUtil { + public static JavaPlugin getFirstPluginCaller() { + Optional foundFrame = StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE) + .walk(stream -> stream +- .filter(frame -> frame.getDeclaringClass().getClassLoader() instanceof PluginClassLoader) + .map((frame) -> { +- PluginClassLoader classLoader = (PluginClassLoader) frame.getDeclaringClass().getClassLoader(); +- return classLoader.getPlugin(); ++ ClassLoader classLoader = frame.getDeclaringClass().getClassLoader(); ++ JavaPlugin plugin; ++ if (classLoader instanceof ConfiguredPluginClassLoader configuredPluginClassLoader) { ++ plugin = configuredPluginClassLoader.getPlugin(); ++ } else { ++ plugin = null; ++ } ++ ++ return plugin; + }) ++ .filter(Objects::nonNull) + .findFirst()); + + return foundFrame.orElse(null); +diff --git a/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java b/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java +index 5b8ecf5b0165ed2cd4397cdee958e97c2e8f18d5..ad802eb211f05f646159d7fc53f8a9427b46cb89 100644 +--- a/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java ++++ b/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java +@@ -310,7 +310,13 @@ public class BuiltInRegistries { + } + + public static void bootStrap() { ++ // Paper start ++ bootStrap(() -> {}); ++ } ++ public static void bootStrap(Runnable runnable) { ++ // Paper end + createContents(); ++ runnable.run(); // Paper + freeze(); + validate(REGISTRY); + } +diff --git a/src/main/java/net/minecraft/server/Bootstrap.java b/src/main/java/net/minecraft/server/Bootstrap.java +index b5aa358638b9d0638dfe47f7ebac04cca1dd80b9..e43096e69a00f9ea96badd7c966443cfcf3e7b95 100644 +--- a/src/main/java/net/minecraft/server/Bootstrap.java ++++ b/src/main/java/net/minecraft/server/Bootstrap.java +@@ -69,7 +69,11 @@ public class Bootstrap { + EntitySelectorOptions.bootStrap(); + DispenseItemBehavior.bootStrap(); + CauldronInteraction.bootStrap(); +- BuiltInRegistries.bootStrap(); ++ // Paper start ++ BuiltInRegistries.bootStrap(() -> { ++ io.papermc.paper.plugin.entrypoint.LaunchEntryPointHandler.enterBootstrappers(); // Paper - Entrypoint for bootstrapping ++ }); ++ // Paper end + Bootstrap.wrapStreams(); + } + // CraftBukkit start - easier than fixing the decompile +diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java +index b7399e29094c66c88a6f4c0e996a906bcaa3b4ca..abf4c54eec6881d6e05893983f83f9eb4b249634 100644 +--- a/src/main/java/net/minecraft/server/Main.java ++++ b/src/main/java/net/minecraft/server/Main.java +@@ -110,6 +110,17 @@ public class Main { + JvmProfiler.INSTANCE.start(Environment.SERVER); + } + ++ // Paper start ++ ++ // We have to load the bukkit configuration inorder to get the update folder location. ++ io.papermc.paper.plugin.PluginInitializerManager pluginSystem = io.papermc.paper.plugin.PluginInitializerManager.init(optionset); ++ // Register the default plugin directory ++ io.papermc.paper.plugin.util.EntrypointUtil.registerProvidersFromSource(io.papermc.paper.plugin.provider.source.DirectoryProviderSource.INSTANCE, pluginSystem.pluginDirectoryPath()); ++ @SuppressWarnings("unchecked") ++ java.util.List files = (java.util.List) optionset.valuesOf("add-plugin"); ++ // Register plugins from the flag ++ io.papermc.paper.plugin.util.EntrypointUtil.registerProvidersFromSource(io.papermc.paper.plugin.provider.source.PluginFlagProviderSource.INSTANCE, files); ++ // Paper end + Bootstrap.bootStrap(); + Bootstrap.validate(); + Util.startTimerHackThread(); +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +index 26ca07b5e302cc4cc02e06f5d07f6d9eb541275e..17a6290969a63be85fa780e2cad4ce63790379b1 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +@@ -268,7 +268,8 @@ public final class CraftServer implements Server { + private final CraftCommandMap commandMap = new CraftCommandMap(this); + private final SimpleHelpMap helpMap = new SimpleHelpMap(this); + private final StandardMessenger messenger = new StandardMessenger(); +- private final SimplePluginManager pluginManager = new SimplePluginManager(this, this.commandMap); ++ private final SimplePluginManager pluginManager = new SimplePluginManager(this, commandMap); ++ public final io.papermc.paper.plugin.manager.PaperPluginManagerImpl paperPluginManager = new io.papermc.paper.plugin.manager.PaperPluginManagerImpl(this, this.commandMap, pluginManager); {this.pluginManager.paperPluginManager = this.paperPluginManager;} // Paper + private final StructureManager structureManager; + protected final DedicatedServer console; + protected final DedicatedPlayerList playerList; +@@ -416,24 +417,7 @@ public final class CraftServer implements Server { + } + + public void loadPlugins() { +- this.pluginManager.registerInterface(JavaPluginLoader.class); +- +- File pluginFolder = (File) console.options.valueOf("plugins"); +- +- if (pluginFolder.exists()) { +- Plugin[] plugins = this.pluginManager.loadPlugins(pluginFolder); +- for (Plugin plugin : plugins) { +- try { +- String message = String.format("Loading %s", plugin.getDescription().getFullName()); +- plugin.getLogger().info(message); +- plugin.onLoad(); +- } catch (Throwable ex) { +- Logger.getLogger(CraftServer.class.getName()).log(Level.SEVERE, ex.getMessage() + " initializing " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex); +- } +- } +- } else { +- pluginFolder.mkdir(); +- } ++ io.papermc.paper.plugin.entrypoint.LaunchEntryPointHandler.INSTANCE.enter(io.papermc.paper.plugin.entrypoint.Entrypoint.PLUGIN); // Paper - replace implementation + } + + public void enablePlugins(PluginLoadOrder type) { +@@ -522,15 +506,17 @@ public final class CraftServer implements Server { + private void enablePlugin(Plugin plugin) { + try { + List perms = plugin.getDescription().getPermissions(); +- ++ List permsToLoad = new ArrayList<>(); // Paper + for (Permission perm : perms) { +- try { +- this.pluginManager.addPermission(perm, false); +- } catch (IllegalArgumentException ex) { +- this.getLogger().log(Level.WARNING, "Plugin " + plugin.getDescription().getFullName() + " tried to register permission '" + perm.getName() + "' but it's already registered", ex); ++ // Paper start ++ if (this.paperPluginManager.getPermission(perm.getName()) == null) { ++ permsToLoad.add(perm); ++ } else { ++ this.getLogger().log(Level.WARNING, "Plugin " + plugin.getDescription().getFullName() + " tried to register permission '" + perm.getName() + "' but it's already registered"); ++ // Paper end + } + } +- this.pluginManager.dirtyPermissibles(); ++ this.paperPluginManager.addPermissions(permsToLoad); // Paper + + this.pluginManager.enablePlugin(plugin); + } catch (Throwable ex) { +diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/MinecraftInternalPlugin.java b/src/main/java/org/bukkit/craftbukkit/scheduler/MinecraftInternalPlugin.java +index 909b2c98e7a9117d2f737245e4661792ffafb744..d96399e9bf1a58db5a4a22e58abb99e7660e0694 100644 +--- a/src/main/java/org/bukkit/craftbukkit/scheduler/MinecraftInternalPlugin.java ++++ b/src/main/java/org/bukkit/craftbukkit/scheduler/MinecraftInternalPlugin.java +@@ -42,6 +42,12 @@ public class MinecraftInternalPlugin extends PluginBase { + public PluginDescriptionFile getDescription() { + return pdf; + } ++ // Paper start ++ @Override ++ public io.papermc.paper.plugin.configuration.PluginMeta getPluginMeta() { ++ return pdf; ++ } ++ // Paper end + + @Override + public FileConfiguration getConfig() { +diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +index 750f4b3930278c291f10015c7a8a8df57d04a286..3d2303dbd06a12968302cb100e36be9de28700f0 100644 +--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java ++++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +@@ -436,6 +436,12 @@ public final class CraftMagicNumbers implements UnsafeValues { + net.minecraft.world.item.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(itemStack); + return nmsItemStack.getItem().getDescriptionId(nmsItemStack); + } ++ // Paper start ++ @Override ++ public boolean isSupportedApiVersion(String apiVersion) { ++ return apiVersion != null && SUPPORTED_API.contains(apiVersion); ++ } ++ // Paper end + + /** + * This helper class represents the different NBT Tags. +diff --git a/src/main/resources/META-INF/services/io.papermc.paper.plugin.entrypoint.classloader.ClassloaderBytecodeModifier b/src/main/resources/META-INF/services/io.papermc.paper.plugin.entrypoint.classloader.ClassloaderBytecodeModifier +new file mode 100644 +index 0000000000000000000000000000000000000000..20dbe2775951bfcdb85c5d679ac86c77a93e0847 +--- /dev/null ++++ b/src/main/resources/META-INF/services/io.papermc.paper.plugin.entrypoint.classloader.ClassloaderBytecodeModifier +@@ -0,0 +1 @@ ++io.papermc.paper.plugin.entrypoint.classloader.PaperClassloaderBytecodeModifier +diff --git a/src/main/resources/META-INF/services/io.papermc.paper.plugin.provider.classloader.PaperClassLoaderStorage b/src/main/resources/META-INF/services/io.papermc.paper.plugin.provider.classloader.PaperClassLoaderStorage +new file mode 100644 +index 0000000000000000000000000000000000000000..a22647244037cd92262b3b5a6582f0a11172fdc8 +--- /dev/null ++++ b/src/main/resources/META-INF/services/io.papermc.paper.plugin.provider.classloader.PaperClassLoaderStorage +@@ -0,0 +1 @@ ++io.papermc.paper.plugin.entrypoint.classloader.group.PaperPluginClassLoaderStorage +diff --git a/src/main/resources/META-INF/services/org.bukkit.plugin.PluginLoader b/src/main/resources/META-INF/services/org.bukkit.plugin.PluginLoader +new file mode 100644 +index 0000000000000000000000000000000000000000..4f78bc62d03460463b9694de933e5b73da8df6e3 +--- /dev/null ++++ b/src/main/resources/META-INF/services/org.bukkit.plugin.PluginLoader +@@ -0,0 +1 @@ ++io.papermc.paper.plugin.manager.DummyBukkitPluginLoader +diff --git a/src/test/java/io/papermc/paper/plugin/PaperTestPlugin.java b/src/test/java/io/papermc/paper/plugin/PaperTestPlugin.java +new file mode 100644 +index 0000000000000000000000000000000000000000..1d14f530ef888102e47eeeaf0d1a6076e51871c4 +--- /dev/null ++++ b/src/test/java/io/papermc/paper/plugin/PaperTestPlugin.java +@@ -0,0 +1,146 @@ ++package io.papermc.paper.plugin; ++ ++import io.papermc.paper.plugin.configuration.PluginMeta; ++import org.bukkit.Server; ++import org.bukkit.command.Command; ++import org.bukkit.command.CommandSender; ++import org.bukkit.configuration.file.FileConfiguration; ++import org.bukkit.generator.BiomeProvider; ++import org.bukkit.generator.ChunkGenerator; ++import org.bukkit.plugin.PluginBase; ++import org.bukkit.plugin.PluginDescriptionFile; ++import org.bukkit.plugin.PluginLoader; ++import org.bukkit.plugin.PluginLogger; ++ ++import java.io.File; ++import java.io.InputStream; ++import java.util.List; ++ ++public class PaperTestPlugin extends PluginBase { ++ private final String pluginName; ++ private boolean enabled = true; ++ private final PluginMeta configuration; ++ ++ public PaperTestPlugin(String pluginName) { ++ this.pluginName = pluginName; ++ this.configuration = new TestPluginMeta(pluginName); ++ } ++ ++ public PaperTestPlugin(PluginMeta configuration) { ++ this.configuration = configuration; ++ this.pluginName = configuration.getName(); ++ } ++ ++ @Override ++ public File getDataFolder() { ++ throw new UnsupportedOperationException("Not supported."); ++ } ++ ++ @Override ++ public PluginDescriptionFile getDescription() { ++ throw new UnsupportedOperationException("Not supported."); ++ } ++ ++ @Override ++ public PluginMeta getPluginMeta() { ++ return this.configuration; ++ } ++ ++ @Override ++ public FileConfiguration getConfig() { ++ throw new UnsupportedOperationException("Not supported."); ++ } ++ ++ @Override ++ public InputStream getResource(String filename) { ++ throw new UnsupportedOperationException("Not supported."); ++ } ++ ++ @Override ++ public void saveConfig() { ++ throw new UnsupportedOperationException("Not supported."); ++ } ++ ++ @Override ++ public void saveDefaultConfig() { ++ throw new UnsupportedOperationException("Not supported."); ++ } ++ ++ @Override ++ public void saveResource(String resourcePath, boolean replace) { ++ throw new UnsupportedOperationException("Not supported."); ++ } ++ ++ @Override ++ public void reloadConfig() { ++ throw new UnsupportedOperationException("Not supported."); ++ } ++ ++ @Override ++ public PluginLogger getLogger() { ++ throw new UnsupportedOperationException("Not supported."); ++ } ++ ++ @Override ++ public PluginLoader getPluginLoader() { ++ throw new UnsupportedOperationException("Not supported."); ++ } ++ ++ @Override ++ public Server getServer() { ++ throw new UnsupportedOperationException("Not supported."); ++ } ++ ++ @Override ++ public boolean isEnabled() { ++ return enabled; ++ } ++ ++ public void setEnabled(boolean enabled) { ++ this.enabled = enabled; ++ } ++ ++ @Override ++ public void onDisable() { ++ throw new UnsupportedOperationException("Not supported."); ++ } ++ ++ @Override ++ public void onLoad() { ++ } ++ ++ @Override ++ public void onEnable() { ++ throw new UnsupportedOperationException("Not supported."); ++ } ++ ++ @Override ++ public boolean isNaggable() { ++ throw new UnsupportedOperationException("Not supported."); ++ } ++ ++ @Override ++ public void setNaggable(boolean canNag) { ++ throw new UnsupportedOperationException("Not supported."); ++ } ++ ++ @Override ++ public ChunkGenerator getDefaultWorldGenerator(String worldName, String id) { ++ throw new UnsupportedOperationException("Not supported."); ++ } ++ ++ @Override ++ public BiomeProvider getDefaultBiomeProvider(String worldName, String id) { ++ throw new UnsupportedOperationException("Not supported."); ++ } ++ ++ @Override ++ public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { ++ throw new UnsupportedOperationException("Not supported."); ++ } ++ ++ @Override ++ public List onTabComplete(CommandSender sender, Command command, String alias, String[] args) { ++ throw new UnsupportedOperationException("Not supported."); ++ } ++} +diff --git a/src/test/java/io/papermc/paper/plugin/PluginLoadOrderTest.java b/src/test/java/io/papermc/paper/plugin/PluginLoadOrderTest.java +new file mode 100644 +index 0000000000000000000000000000000000000000..d137461a3a1896a367c5245a99a9b30afd9f6ad5 +--- /dev/null ++++ b/src/test/java/io/papermc/paper/plugin/PluginLoadOrderTest.java +@@ -0,0 +1,146 @@ ++package io.papermc.paper.plugin; ++ ++import io.papermc.paper.plugin.provider.entrypoint.DependencyContext; ++import io.papermc.paper.plugin.entrypoint.strategy.ModernPluginLoadingStrategy; ++import io.papermc.paper.plugin.entrypoint.strategy.ProviderConfiguration; ++import io.papermc.paper.plugin.provider.PluginProvider; ++import org.junit.Assert; ++import org.junit.Before; ++import org.junit.Test; ++ ++import java.util.ArrayList; ++import java.util.HashMap; ++import java.util.List; ++import java.util.Map; ++import java.util.concurrent.atomic.AtomicInteger; ++ ++public class PluginLoadOrderTest { ++ ++ private static List> REGISTERED_PROVIDERS = new ArrayList<>(); ++ private static Map LOAD_ORDER = new HashMap<>(); ++ private static final String[] EMPTY = {}; ++ ++ static { ++ setup(); ++ } ++ ++ private static TestJavaPluginProvider setup(String identifier, String[] loadAfter, String[] loadAfterSoft, String[] before) { ++ TestPluginMeta configuration = new TestPluginMeta(identifier); ++ configuration.setHardDependencies(List.of(loadAfter)); ++ configuration.setSoftDependencies(List.of(loadAfterSoft)); ++ configuration.setLoadBefore(List.of(before)); ++ ++ TestJavaPluginProvider provider = new TestJavaPluginProvider(configuration); ++ REGISTERED_PROVIDERS.add(provider); ++ return provider; ++ } ++ ++ /** ++ * Obfuscated plugin names, this uses a real dependency tree... ++ */ ++ private static void setup() { ++ setup("RedAir", EMPTY, new String[]{"NightShovel", "EmeraldFire"}, new String[]{"GreenShovel", "IronSpork", "BrightBlueShovel", "WireDoor"}); ++ setup("BigGrass", EMPTY, new String[]{"IronEarth", "RedAir"}, new String[]{"BlueFire"}); ++ setup("BlueFire", EMPTY, EMPTY, EMPTY); ++ setup("BigPaper", EMPTY, new String[]{"BlueFire"}, EMPTY); ++ setup("EmeraldSpork", EMPTY, EMPTY, new String[]{"GoldPaper", "YellowSnow"}); ++ setup("GreenShovel", EMPTY, EMPTY, EMPTY); ++ setup("BrightBlueGrass", new String[]{"BigPaper"}, new String[]{"DarkSpork"}, EMPTY); ++ setup("GoldPaper", EMPTY, new String[]{"BlueFire"}, EMPTY); ++ setup("GreenGlass", EMPTY, EMPTY, EMPTY); ++ setup("GoldNeptune", EMPTY, new String[]{"GreenShovel", "GoldNeptuneVersioning"}, EMPTY); ++ setup("RedPaper", EMPTY, new String[]{"GoldPaper", "GoldFire", "EmeraldGrass", "BlueFire", "CopperSpork", "YellowDoor", "OrangeClam", "BlueSponge", "GoldNeptune", "BrightBlueGrass", "DarkSpoon", "BigShovel", "GreenGlass", "IronGlass"}, new String[]{"IronPaper", "YellowFire"}); ++ setup("YellowGrass", EMPTY, new String[]{"RedAir"}, EMPTY); ++ setup("WireFire", EMPTY, new String[]{"RedPaper", "WireGrass", "YellowSpork", "NightAir"}, EMPTY); ++ setup("OrangeNeptune", EMPTY, EMPTY, EMPTY); ++ setup("BigSpoon", new String[]{"YellowGrass", "GreenShovel"}, new String[]{"RedAir", "GoldNeptune", "BrightBlueGrass", "LightDoor", "LightSpork", "LightEarth", "NightDoor", "OrangeSpoon", "GoldSponge", "GoldDoor", "DarkPaper", "RedPaper", "GreenGlass", "IronGlass", "NightGlass", "BigGrass", "BlueFire", "YellowSpoon", "DiamondGrass", "DiamondShovel", "DarkSnow", "EmeraldGlass", "EmeraldSpoon", "LightFire", "WireGrass", "RedEarth", "WireFire"}, EMPTY); ++ setup("CopperSnow", EMPTY, new String[]{"RedSnow", "OrangeFire", "WireAir", "GreenGlass", "NightSpork", "EmeraldPaper"}, new String[]{"BlueGrass"}); ++ setup("BrightBluePaper", EMPTY, new String[]{"GoldEarth", "BrightBlueSpoon", "CopperGlass", "LightSporkChat", "DarkAir", "LightEarth", "DiamondDoor", "YellowShovel", "BlueAir", "DarkShovel", "GoldPaper", "BlueFire", "GreenGlass", "YellowSpork", "BigGrass", "OrangePaper", "DarkPaper"}, new String[]{"WireShovel"}); ++ setup("LightSponge", EMPTY, EMPTY, EMPTY); ++ setup("OrangeShovel", EMPTY, EMPTY, EMPTY); ++ setup("GoldGrass", EMPTY, new String[]{"GreenGlass", "BlueFire"}, EMPTY); ++ setup("IronSponge", EMPTY, new String[]{"DiamondEarth"}, EMPTY); ++ setup("EmeraldSnow", EMPTY, EMPTY, EMPTY); ++ setup("BlueSpoon", new String[]{"BigGrass"}, new String[]{"GreenGlass", "GoldPaper", "GreenShovel", "YellowClam"}, EMPTY); ++ setup("BigSpork", EMPTY, new String[]{"BigPaper"}, EMPTY); ++ setup("BluePaper", EMPTY, new String[]{"BigClam", "RedSpoon", "GreenFire", "WireSnow", "OrangeSnow", "BlueFire", "BrightBlueGrass", "YellowSpork", "GreenGlass"}, EMPTY); ++ setup("OrangeSpork", EMPTY, EMPTY, EMPTY); ++ setup("DiamondNeptune", EMPTY, new String[]{"GreenGlass", "GreenShovel", "YellowNeptune"}, EMPTY); ++ setup("BigFire", EMPTY, new String[]{"BlueFire", "BrightBlueDoor", "GreenGlass"}, EMPTY); ++ setup("NightNeptune", EMPTY, new String[]{"BlueFire", "DarkGlass", "GoldPaper", "YellowNeptune", "BlueShovel"}, EMPTY); ++ setup("YellowEarth", new String[]{"RedAir"}, EMPTY, EMPTY); ++ setup("DiamondClam", EMPTY, EMPTY, EMPTY); ++ setup("CopperAir", EMPTY, new String[]{"BigPaper"}, EMPTY); ++ setup("NightSpoon", new String[]{"OrangeNeptune"}, new String[]{"BlueFire", "GreenGlass", "RedSpork", "GoldPaper", "BigShovel", "YellowSponge", "EmeraldSpork"}, EMPTY); ++ setup("GreenClam", EMPTY, new String[]{"GreenShovel", "BrightBlueEarth", "BigSpoon", "RedPaper", "BlueFire", "GreenGlass", "WireFire", "GreenSnow"}, EMPTY); ++ setup("YellowPaper", EMPTY, EMPTY, EMPTY); ++ setup("WireGlass", new String[]{"YellowGrass"}, new String[]{"YellowGlass", "BigSpoon", "CopperSnow", "GreenGlass", "BlueEarth"}, EMPTY); ++ setup("BlueSpork", EMPTY, new String[]{"BrightBlueGrass"}, EMPTY); ++ setup("CopperShovel", EMPTY, new String[]{"GreenGlass"}, EMPTY); ++ setup("RedClam", EMPTY, EMPTY, EMPTY); ++ setup("EmeraldClam", EMPTY, new String[]{"BlueFire"}, EMPTY); ++ setup("DarkClam", EMPTY, new String[]{"GoldAir", "LightGlass"}, EMPTY); ++ setup("WireSpoon", EMPTY, new String[]{"GoldPaper", "LightSnow"}, EMPTY); ++ setup("CopperNeptune", EMPTY, new String[]{"GreenGlass", "BigGrass"}, EMPTY); ++ setup("RedNeptune", EMPTY, EMPTY, EMPTY); ++ setup("GreenAir", EMPTY, EMPTY, EMPTY); ++ setup("RedFire", new String[]{"BrightBlueGrass", "BigPaper"}, new String[]{"BlueFire", "GreenGlass", "BigGrass"}, EMPTY); ++ } ++ ++ @Before ++ public void loadProviders() { ++ AtomicInteger currentLoad = new AtomicInteger(); ++ ModernPluginLoadingStrategy modernPluginLoadingStrategy = new ModernPluginLoadingStrategy<>(new ProviderConfiguration<>() { ++ @Override ++ public void applyContext(PluginProvider provider, DependencyContext dependencyContext) { ++ } ++ ++ @Override ++ public boolean load(PluginProvider provider, PaperTestPlugin provided) { ++ LOAD_ORDER.put(provider.getMeta().getName(), currentLoad.getAndIncrement()); ++ return false; ++ } ++ ++ }); ++ ++ modernPluginLoadingStrategy.loadProviders(REGISTERED_PROVIDERS); ++ } ++ ++ @Test ++ public void testDependencies() { ++ for (PluginProvider provider : REGISTERED_PROVIDERS) { ++ TestPluginMeta pluginMeta = (TestPluginMeta) provider.getMeta(); ++ String identifier = pluginMeta.getName(); ++ Assert.assertTrue("Provider wasn't loaded! (%s)".formatted(identifier), LOAD_ORDER.containsKey(identifier)); ++ ++ int index = LOAD_ORDER.get(identifier); ++ ++ // Hard dependencies should be loaded BEFORE ++ for (String hardDependency : pluginMeta.getPluginDependencies()) { ++ Assert.assertTrue("Plugin (%s) is missing hard dependency (%s)".formatted(identifier, hardDependency), LOAD_ORDER.containsKey(hardDependency)); ++ ++ int dependencyIndex = LOAD_ORDER.get(hardDependency); ++ Assert.assertTrue("Plugin (%s) was not loaded BEFORE soft dependency. (%s)".formatted(identifier, hardDependency), index > dependencyIndex); ++ } ++ ++ for (String softDependency : pluginMeta.getPluginSoftDependencies()) { ++ if (!LOAD_ORDER.containsKey(softDependency)) { ++ continue; ++ } ++ ++ int dependencyIndex = LOAD_ORDER.get(softDependency); ++ ++ Assert.assertTrue("Plugin (%s) was not loaded BEFORE soft dependency. (%s)".formatted(identifier, softDependency), index > dependencyIndex); ++ } ++ ++ for (String loadBefore : pluginMeta.getLoadBeforePlugins()) { ++ if (!LOAD_ORDER.containsKey(loadBefore)) { ++ continue; ++ } ++ ++ int dependencyIndex = LOAD_ORDER.get(loadBefore); ++ Assert.assertTrue("Plugin (%s) was NOT loaded BEFORE loadbefore dependency. (%s)".formatted(identifier, loadBefore), index < dependencyIndex); ++ } ++ } ++ } ++} +diff --git a/src/test/java/io/papermc/paper/plugin/PluginManagerTest.java b/src/test/java/io/papermc/paper/plugin/PluginManagerTest.java +new file mode 100644 +index 0000000000000000000000000000000000000000..726eba26470e62b0e94a91418512e242464800ae +--- /dev/null ++++ b/src/test/java/io/papermc/paper/plugin/PluginManagerTest.java +@@ -0,0 +1,75 @@ ++package io.papermc.paper.plugin; ++ ++import org.bukkit.Bukkit; ++import org.bukkit.event.Event; ++import org.bukkit.permissions.Permission; ++import org.bukkit.plugin.PluginManager; ++import org.bukkit.support.AbstractTestingBase; ++import org.junit.After; ++import org.junit.Test; ++ ++import static org.hamcrest.MatcherAssert.assertThat; ++import static org.hamcrest.Matchers.*; ++ ++public class PluginManagerTest extends AbstractTestingBase { ++ ++ private static final PluginManager pm = Bukkit.getPluginManager(); ++ ++ @Test ++ public void testSyncSameThread() { ++ final Event event = new TestEvent(false); ++ pm.callEvent(event); ++ } ++ ++ @Test ++ public void testRemovePermissionByNameLower() { ++ this.testRemovePermissionByName("lower"); ++ } ++ ++ @Test ++ public void testRemovePermissionByNameUpper() { ++ this.testRemovePermissionByName("UPPER"); ++ } ++ ++ @Test ++ public void testRemovePermissionByNameCamel() { ++ this.testRemovePermissionByName("CaMeL"); ++ } ++ ++ @Test ++ public void testRemovePermissionByPermissionLower() { ++ this.testRemovePermissionByPermission("lower"); ++ } ++ ++ @Test ++ public void testRemovePermissionByPermissionUpper() { ++ this.testRemovePermissionByPermission("UPPER"); ++ } ++ ++ @Test ++ public void testRemovePermissionByPermissionCamel() { ++ this.testRemovePermissionByPermission("CaMeL"); ++ } ++ ++ private void testRemovePermissionByName(final String name) { ++ final Permission perm = new Permission(name); ++ pm.addPermission(perm); ++ assertThat("Permission \"" + name + "\" was not added", pm.getPermission(name), is(perm)); ++ pm.removePermission(name); ++ assertThat("Permission \"" + name + "\" was not removed", pm.getPermission(name), is(nullValue())); ++ } ++ ++ private void testRemovePermissionByPermission(final String name) { ++ final Permission perm = new Permission(name); ++ pm.addPermission(perm); ++ assertThat("Permission \"" + name + "\" was not added", pm.getPermission(name), is(perm)); ++ pm.removePermission(perm); ++ assertThat("Permission \"" + name + "\" was not removed", pm.getPermission(name), is(nullValue())); ++ } ++ ++ @After ++ public void tearDown() { ++ pm.clearPlugins(); ++ assertThat(pm.getPermissions(), is(empty())); ++ } ++} +diff --git a/src/test/java/io/papermc/paper/plugin/SyntheticEventTest.java b/src/test/java/io/papermc/paper/plugin/SyntheticEventTest.java +new file mode 100644 +index 0000000000000000000000000000000000000000..51c08740edffd152c8e2b6d3676ff7f1ce6090c6 +--- /dev/null ++++ b/src/test/java/io/papermc/paper/plugin/SyntheticEventTest.java +@@ -0,0 +1,42 @@ ++package io.papermc.paper.plugin; ++ ++import io.papermc.paper.plugin.manager.PaperPluginManagerImpl; ++import org.bukkit.Bukkit; ++import org.bukkit.event.Event; ++import org.bukkit.event.EventHandler; ++import org.bukkit.event.Listener; ++import org.junit.Assert; ++import org.junit.Test; ++ ++public class SyntheticEventTest { ++ ++ @Test ++ public void test() { ++ PaperTestPlugin paperTestPlugin = new PaperTestPlugin("synthetictest"); ++ PaperPluginManagerImpl paperPluginManager = new PaperPluginManagerImpl(Bukkit.getServer(), null, null); ++ ++ TestEvent event = new TestEvent(false); ++ Impl impl = new Impl(); ++ ++ paperPluginManager.registerEvents(impl, paperTestPlugin); ++ paperPluginManager.callEvent(event); ++ ++ Assert.assertEquals(1, impl.callCount); ++ } ++ ++ public abstract static class Base implements Listener { ++ int callCount = 0; ++ ++ public void accept(E evt) { ++ callCount++; ++ } ++ } ++ ++ public static class Impl extends Base { ++ @Override ++ @EventHandler ++ public void accept(TestEvent evt) { ++ super.accept(evt); ++ } ++ } ++} +diff --git a/src/test/java/io/papermc/paper/plugin/TestEvent.java b/src/test/java/io/papermc/paper/plugin/TestEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..04903794a8ee4dd73162ae240862ff6dc4cb4e24 +--- /dev/null ++++ b/src/test/java/io/papermc/paper/plugin/TestEvent.java +@@ -0,0 +1,22 @@ ++package io.papermc.paper.plugin; ++ ++ ++import org.bukkit.event.Event; ++import org.bukkit.event.HandlerList; ++ ++public class TestEvent extends Event { ++ private static final HandlerList handlers = new HandlerList(); ++ ++ public TestEvent(boolean async) { ++ super(async); ++ } ++ ++ @Override ++ public HandlerList getHandlers() { ++ return handlers; ++ } ++ ++ public static HandlerList getHandlerList() { ++ return handlers; ++ } ++} +diff --git a/src/test/java/io/papermc/paper/plugin/TestJavaPluginProvider.java b/src/test/java/io/papermc/paper/plugin/TestJavaPluginProvider.java +new file mode 100644 +index 0000000000000000000000000000000000000000..ea2854172968abea40c39eb05faf76ed1191c353 +--- /dev/null ++++ b/src/test/java/io/papermc/paper/plugin/TestJavaPluginProvider.java +@@ -0,0 +1,76 @@ ++package io.papermc.paper.plugin; ++ ++import io.papermc.paper.plugin.configuration.PluginMeta; ++import io.papermc.paper.plugin.entrypoint.dependency.DependencyUtil; ++import io.papermc.paper.plugin.provider.PluginProvider; ++import io.papermc.paper.plugin.provider.configuration.LoadOrderConfiguration; ++import org.jetbrains.annotations.NotNull; ++ ++import java.nio.file.Path; ++import java.util.ArrayList; ++import java.util.List; ++import java.util.Map; ++import java.util.jar.JarFile; ++import java.util.logging.Logger; ++ ++public class TestJavaPluginProvider implements PluginProvider { ++ ++ private final TestPluginMeta testPluginConfiguration; ++ ++ public TestJavaPluginProvider(TestPluginMeta testPluginConfiguration) { ++ this.testPluginConfiguration = testPluginConfiguration; ++ } ++ ++ @Override ++ public @NotNull Path getSource() { ++ return Path.of("dummy"); ++ } ++ ++ @Override ++ public JarFile file() { ++ throw new UnsupportedOperationException(); ++ } ++ ++ @Override ++ public PaperTestPlugin createInstance() { ++ return new PaperTestPlugin(this.testPluginConfiguration); ++ } ++ ++ @Override ++ public TestPluginMeta getMeta() { ++ return this.testPluginConfiguration; ++ } ++ ++ @Override ++ public Logger getLogger() { ++ return Logger.getLogger("TestPlugin"); ++ } ++ ++ @Override ++ public LoadOrderConfiguration createConfiguration(@NotNull Map> toLoad) { ++ return new LoadOrderConfiguration() { ++ @Override ++ public @NotNull List getLoadBefore() { ++ return TestJavaPluginProvider.this.testPluginConfiguration.getLoadBeforePlugins(); ++ } ++ ++ @Override ++ public @NotNull List getLoadAfter() { ++ List loadAfter = new ArrayList<>(); ++ loadAfter.addAll(TestJavaPluginProvider.this.testPluginConfiguration.getPluginDependencies()); ++ loadAfter.addAll(TestJavaPluginProvider.this.testPluginConfiguration.getPluginSoftDependencies()); ++ return loadAfter; ++ } ++ ++ @Override ++ public @NotNull PluginMeta getMeta() { ++ return TestJavaPluginProvider.this.testPluginConfiguration; ++ } ++ }; ++ } ++ ++ @Override ++ public List validateDependencies(@NotNull Map> toLoad) { ++ return DependencyUtil.validateSimple(this.getMeta(), toLoad); ++ } ++} +diff --git a/src/test/java/io/papermc/paper/plugin/TestPluginMeta.java b/src/test/java/io/papermc/paper/plugin/TestPluginMeta.java +new file mode 100644 +index 0000000000000000000000000000000000000000..ba271c35eb2804f94cfc893bf94affb9ae13d3ba +--- /dev/null ++++ b/src/test/java/io/papermc/paper/plugin/TestPluginMeta.java +@@ -0,0 +1,114 @@ ++package io.papermc.paper.plugin; ++ ++import io.papermc.paper.plugin.configuration.PluginMeta; ++import org.bukkit.permissions.Permission; ++import org.bukkit.permissions.PermissionDefault; ++import org.bukkit.plugin.PluginLoadOrder; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; ++ ++import java.util.List; ++ ++public class TestPluginMeta implements PluginMeta { ++ ++ private final String identifier; ++ private List hardDependencies = List.of(); ++ private List softDependencies = List.of(); ++ private List loadBefore = List.of(); ++ ++ public TestPluginMeta(String identifier) { ++ this.identifier = identifier; ++ } ++ ++ @Override ++ public @NotNull String getName() { ++ return this.identifier; ++ } ++ ++ @Override ++ public @NotNull String getMainClass() { ++ return "null"; ++ } ++ ++ @Override ++ public @NotNull PluginLoadOrder getLoadOrder() { ++ return PluginLoadOrder.POSTWORLD; ++ } ++ ++ @Override ++ public @NotNull String getVersion() { ++ return "1.0"; ++ } ++ ++ @Override ++ public @Nullable String getLoggerPrefix() { ++ return this.identifier; ++ } ++ ++ public void setHardDependencies(List hardDependencies) { ++ this.hardDependencies = hardDependencies; ++ } ++ ++ @Override ++ public @NotNull List getPluginDependencies() { ++ return this.hardDependencies; ++ } ++ ++ public void setSoftDependencies(List softDependencies) { ++ this.softDependencies = softDependencies; ++ } ++ ++ @Override ++ public @NotNull List getPluginSoftDependencies() { ++ return this.softDependencies; ++ } ++ ++ public void setLoadBefore(List loadBefore) { ++ this.loadBefore = loadBefore; ++ } ++ ++ @Override ++ public @NotNull List getLoadBeforePlugins() { ++ return this.loadBefore; ++ } ++ ++ @Override ++ public @NotNull List getProvidedPlugins() { ++ return List.of(); ++ } ++ ++ @Override ++ public @NotNull List getAuthors() { ++ return List.of(); ++ } ++ ++ @Override ++ public @NotNull List getContributors() { ++ return List.of(); ++ } ++ ++ @Override ++ public @Nullable String getDescription() { ++ return "null"; ++ } ++ ++ @Override ++ public @Nullable String getWebsite() { ++ return "null"; ++ } ++ ++ @Override ++ public @NotNull List getPermissions() { ++ return List.of(); ++ } ++ ++ @Override ++ public @NotNull PermissionDefault getPermissionDefault() { ++ return PermissionDefault.TRUE; ++ } ++ ++ @Override ++ public @NotNull String getAPIVersion() { ++ return "null"; ++ } ++} +diff --git a/src/test/java/io/papermc/paper/testing/DummyServer.java b/src/test/java/io/papermc/paper/testing/DummyServer.java +index c6503ff76f56bab5f383f0ca17d137155e9be447..f3db8d2875eaef86223da51b30e9dd722d417daa 100644 +--- a/src/test/java/io/papermc/paper/testing/DummyServer.java ++++ b/src/test/java/io/papermc/paper/testing/DummyServer.java +@@ -58,7 +58,7 @@ public final class DummyServer { + return new LazyRegistry(() -> CraftRegistry.createRegistry(invocation.getArgument(0, Class.class), AbstractTestingBase.REGISTRY_CUSTOM)); + }); + +- final PluginManager pluginManager = new SimplePluginManager(dummyServer, new SimpleCommandMap(dummyServer)); ++ final PluginManager pluginManager = new io.papermc.paper.plugin.manager.PaperPluginManagerImpl(dummyServer, new SimpleCommandMap(dummyServer), null); + when(dummyServer.getPluginManager()).thenReturn(pluginManager); + + Bukkit.setServer(dummyServer); diff --git a/patches/server/0012-Timings-v2.patch b/patches/server/0014-Timings-v2.patch similarity index 99% rename from patches/server/0012-Timings-v2.patch rename to patches/server/0014-Timings-v2.patch index 0f5f5e5a81..2729c186aa 100644 --- a/patches/server/0012-Timings-v2.patch +++ b/patches/server/0014-Timings-v2.patch @@ -1262,7 +1262,7 @@ index 8784b0702f10eb7582c309c15f18fe13eebd9c8e..6f81aa6b0a835bf10e0d5f2b32fe9fb2 this.entityManager.saveAll(); } else { diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index f4502ebedb31b101faa6c99c4fa51fb5b4fdf3f0..e4435962a60cf9c6d833183bd244a2758ff42808 100644 +index 032a21ffd22630c0d4d0456ac651b05105449350..fdb7314784a2232a96a9ccdb049bd240e1cc9b06 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -335,7 +335,6 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -1620,10 +1620,10 @@ index cf496b430bf3d7aab0b8e86c11e015583c1411a7..6fdd5c92ab069896e3921faa042cbdb3 }; } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 26ca07b5e302cc4cc02e06f5d07f6d9eb541275e..c684460c91ad41ba9741616c25dae5c3efede704 100644 +index 17a6290969a63be85fa780e2cad4ce63790379b1..83e0038b3c281c176463d33bacbcc1ca283e41dc 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2406,12 +2406,31 @@ public final class CraftServer implements Server { +@@ -2392,12 +2392,31 @@ public final class CraftServer implements Server { private final org.bukkit.Server.Spigot spigot = new org.bukkit.Server.Spigot() { @@ -1825,10 +1825,10 @@ index b0ffa23faf62629043dfd613315eaf9c5fcc2cfe..00000000000000000000000000000000 - } -} diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 6bf9efe1f6c06fd2adaf68cd360482f252903c8c..a7609957da493c5e79771f9ff48e94acadca8bfc 100644 +index 8a78d0bde6f833b745c8a125bc251eb13ab2bb50..b09d8420ffe3c7e2ba173ee98643bc17909db563 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -2382,6 +2382,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -2401,6 +2401,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player { CraftPlayer.this.getHandle().connection.send(new net.minecraft.network.protocol.game.ClientboundSystemChatPacket(components, position == net.md_5.bungee.api.ChatMessageType.ACTION_BAR)); } @@ -2021,10 +2021,10 @@ index e52ef47b783785dc214746b678e7b549aea9a274..3d90b3426873a3528af14f7f1ab0adae this.value = value; } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 92cf1be3a9e188307e6d4e8e710fa67af2bafa9d..c25f893ef1215a22c8bfa575e4711b9c92a25f0b 100644 +index 3d2303dbd06a12968302cb100e36be9de28700f0..8324787573510df3e23e6833f06aa1618336b7bb 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -221,6 +221,12 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -222,6 +222,12 @@ public final class CraftMagicNumbers implements UnsafeValues { } // Paper end // ======================================================================== @@ -2037,9 +2037,9 @@ index 92cf1be3a9e188307e6d4e8e710fa67af2bafa9d..c25f893ef1215a22c8bfa575e4711b9c public static byte toLegacyData(BlockState data) { return CraftLegacy.toLegacyData(data); -@@ -413,6 +419,13 @@ public final class CraftMagicNumbers implements UnsafeValues { - return CreativeCategory.BUILDING_BLOCKS; // TODO: Figure out what to do with this +@@ -443,6 +449,13 @@ public final class CraftMagicNumbers implements UnsafeValues { } + // Paper end + // Paper start + @Override diff --git a/patches/server/0013-Rewrite-dataconverter-system.patch b/patches/server/0015-Rewrite-dataconverter-system.patch similarity index 100% rename from patches/server/0013-Rewrite-dataconverter-system.patch rename to patches/server/0015-Rewrite-dataconverter-system.patch diff --git a/patches/server/0014-Starlight.patch b/patches/server/0016-Starlight.patch similarity index 99% rename from patches/server/0014-Starlight.patch rename to patches/server/0016-Starlight.patch index 39eeedccec..4eb2645ff7 100644 --- a/patches/server/0014-Starlight.patch +++ b/patches/server/0016-Starlight.patch @@ -4331,7 +4331,7 @@ index 0000000000000000000000000000000000000000..dd995e25ae620ae36cd5eecb2fe10ad0 + +} diff --git a/src/main/java/io/papermc/paper/command/PaperCommand.java b/src/main/java/io/papermc/paper/command/PaperCommand.java -index b3a58bf4b654e336826dc04da9e2f80ff8b9a9a7..c9a2ac696f7cefc8b0715f53db3fc541f26b62f6 100644 +index 156334e3876d966fedc91d18da29f562395ab182..268b243f76b632fc8eea08bba4657a5100b5dfc7 100644 --- a/src/main/java/io/papermc/paper/command/PaperCommand.java +++ b/src/main/java/io/papermc/paper/command/PaperCommand.java @@ -1,6 +1,7 @@ @@ -4342,10 +4342,10 @@ index b3a58bf4b654e336826dc04da9e2f80ff8b9a9a7..c9a2ac696f7cefc8b0715f53db3fc541 import io.papermc.paper.command.subcommands.HeapDumpCommand; import io.papermc.paper.command.subcommands.ReloadCommand; import io.papermc.paper.command.subcommands.VersionCommand; -@@ -40,6 +41,7 @@ public final class PaperCommand extends Command { - commands.put(Set.of("entity"), new EntityCommand()); +@@ -42,6 +43,7 @@ public final class PaperCommand extends Command { commands.put(Set.of("reload"), new ReloadCommand()); commands.put(Set.of("version"), new VersionCommand()); + commands.put(Set.of("dumpplugins"), new DumpPluginsCommand()); + commands.put(Set.of("fixlight"), new FixLightCommand()); return commands.entrySet().stream() @@ -4485,7 +4485,7 @@ index 74d1ae0104e8d0795df50f00317fd860de4f112e..a7feddc31da0870faa3d32a7108282e9 private final DebugBuffer chunkToSaveHistory; public int oldTicketLevel; diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 4aaea477933a89c0febdcfedeebeae609e61f73e..779783037d024792f8052fea0ea8dbe6f06bc181 100644 +index cb1387a18f4306829c75b07a73195b54dbe63ad0..a07c413f1ee1a1689ca8ca87137cf4992d85c7aa 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -131,7 +131,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -5059,7 +5059,7 @@ index 49f091183111958ebd3fb56964fc5d728c16755c..be181106a223f6bb824ddf5869067461 while (iterator.hasNext()) { diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java -index 7798cbbae6b72d64e6129cebf1f66696f21e15f9..e310b018004c8d7edbfec877f06671d17f7e47fd 100644 +index 240c19f4a7552a01b3c48f1f6413119e4cfc2b67..4843bd864deba357e0a4b2fd844324218af9774f 100644 --- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java +++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java @@ -142,7 +142,7 @@ public class PalettedContainer implements PaletteResize, PalettedContainer diff --git a/patches/server/0015-Add-TickThread.patch b/patches/server/0017-Add-TickThread.patch similarity index 100% rename from patches/server/0015-Add-TickThread.patch rename to patches/server/0017-Add-TickThread.patch diff --git a/patches/server/0016-Rewrite-chunk-system.patch b/patches/server/0018-Rewrite-chunk-system.patch similarity index 99% rename from patches/server/0016-Rewrite-chunk-system.patch rename to patches/server/0018-Rewrite-chunk-system.patch index 5b6209662c..4711d56525 100644 --- a/patches/server/0016-Rewrite-chunk-system.patch +++ b/patches/server/0018-Rewrite-chunk-system.patch @@ -1309,7 +1309,7 @@ index 0000000000000000000000000000000000000000..99f49b5625cf51d6c97640553cf5c420 +} diff --git a/src/main/java/io/papermc/paper/chunk/PlayerChunkLoader.java b/src/main/java/io/papermc/paper/chunk/PlayerChunkLoader.java new file mode 100644 -index 0000000000000000000000000000000000000000..0b060183429f4c72ec767075538477b4302bbf0d +index 0000000000000000000000000000000000000000..e77972c4c264100ffdd824bfa2dac58dbbc6d678 --- /dev/null +++ b/src/main/java/io/papermc/paper/chunk/PlayerChunkLoader.java @@ -0,0 +1,1128 @@ @@ -1404,7 +1404,7 @@ index 0000000000000000000000000000000000000000..0b060183429f4c72ec767075538477b4 + + final int priorityCompare = Double.compare(holder1 == null ? Double.MAX_VALUE : holder1.priority, holder2 == null ? Double.MAX_VALUE : holder2.priority); + -+ final int lastLoadTimeCompare = Long.compare(p1.lastChunkLoad, p2.lastChunkLoad); ++ final int lastLoadTimeCompare = Long.compare(p1.lastChunkLoad - p2.lastChunkLoad, 0); + + if ((holder1 == null || holder2 == null || lastLoadTimeCompare == 0 || holder1.priority < 0.0 || holder2.priority < 0.0) && priorityCompare != 0) { + return priorityCompare; @@ -1429,7 +1429,7 @@ index 0000000000000000000000000000000000000000..0b060183429f4c72ec767075538477b4 + return 0; + } + -+ final int timeCompare = Long.compare(p1.nextChunkSendTarget, p2.nextChunkSendTarget); ++ final int timeCompare = Long.compare(p1.nextChunkSendTarget - p2.nextChunkSendTarget, 0); + if (timeCompare != 0) { + return timeCompare; + } @@ -1835,14 +1835,14 @@ index 0000000000000000000000000000000000000000..0b060183429f4c72ec767075538477b4 + private static long nextChunkSend; + private void trySendChunks() { + final long time = System.nanoTime(); -+ if (time < nextChunkSend) { ++ if (nextChunkSend - time > 0) { + return; + } + // drain entries from wait queue + while (!this.chunkSendWaitQueue.isEmpty()) { + final PlayerLoaderData data = this.chunkSendWaitQueue.first(); + -+ if (data.nextChunkSendTarget > time) { ++ if (data.nextChunkSendTarget - time > 0) { + break; + } + @@ -1914,7 +1914,7 @@ index 0000000000000000000000000000000000000000..0b060183429f4c72ec767075538477b4 + }); + + nextChunkSend = this.getMaxSendAddend() + time; -+ if (time < nextChunkSend) { ++ if (nextChunkSend - time > 0) { + break; + } + } @@ -11555,7 +11555,7 @@ index 0000000000000000000000000000000000000000..b4c56bf12dc8dd17452210ece4fd6741 + protected abstract void raisePriorityScheduled(final PrioritisedExecutor.Priority priority); +} diff --git a/src/main/java/io/papermc/paper/command/PaperCommand.java b/src/main/java/io/papermc/paper/command/PaperCommand.java -index c9a2ac696f7cefc8b0715f53db3fc541f26b62f6..1e9105cf5ab2ff0ee847fafd00b41e1bd47f1d9e 100644 +index 268b243f76b632fc8eea08bba4657a5100b5dfc7..e202af893c7ec22bfc0b8dbeb8e1551db685d1d3 100644 --- a/src/main/java/io/papermc/paper/command/PaperCommand.java +++ b/src/main/java/io/papermc/paper/command/PaperCommand.java @@ -1,5 +1,6 @@ @@ -11565,9 +11565,9 @@ index c9a2ac696f7cefc8b0715f53db3fc541f26b62f6..1e9105cf5ab2ff0ee847fafd00b41e1b import io.papermc.paper.command.subcommands.EntityCommand; import io.papermc.paper.command.subcommands.FixLightCommand; import io.papermc.paper.command.subcommands.HeapDumpCommand; -@@ -42,6 +43,7 @@ public final class PaperCommand extends Command { - commands.put(Set.of("reload"), new ReloadCommand()); +@@ -44,6 +45,7 @@ public final class PaperCommand extends Command { commands.put(Set.of("version"), new VersionCommand()); + commands.put(Set.of("dumpplugins"), new DumpPluginsCommand()); commands.put(Set.of("fixlight"), new FixLightCommand()); + commands.put(Set.of("debug", "chunkinfo", "holderinfo"), new ChunkDebugCommand()); @@ -12718,10 +12718,10 @@ index a5e438a834826161c52ca9db57d234d9ff80a591..b8bc1b9b8e8a33df90a963f9f9769292 @Override diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java -index b7399e29094c66c88a6f4c0e996a906bcaa3b4ca..e600563a9d2ddbfa37c106481decb13e67f71524 100644 +index abf4c54eec6881d6e05893983f83f9eb4b249634..8d61e388bbdfd6097f914fc5f122fdf7f9b9ffe2 100644 --- a/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java -@@ -259,6 +259,7 @@ public class Main { +@@ -270,6 +270,7 @@ public class Main { convertable_conversionsession.saveDataTag(iregistrycustom_dimension, savedata); */ @@ -15922,7 +15922,7 @@ index e96a0ca47e4701ba187555bd92c968345bc85677..73b96f804079288e9c5fcc11da54e61e + // Paper end } diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index e4435962a60cf9c6d833183bd244a2758ff42808..b85545f997447875e737e4d22a8a8dbcf1f8e2c8 100644 +index fdb7314784a2232a96a9ccdb049bd240e1cc9b06..8ef64f5192500f87f514c42432c0d5c8361145a7 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -776,6 +776,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -17788,7 +17788,7 @@ index 9f6c2e5b5d9e8d714a47c770e255d06c0ef7c190..ac807277a6b26d140ea9873d17c7aa4f for(SavedTick savedTick : this.pendingTicks) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java -index d58f6b48befbc637a58e669c83e994bae8872adf..cda6277a3a8eefc80de00ffc98687ce0afca7bf2 100644 +index 738d3ce38a42ff8cd53eec042ef8bc74f2b8d059..a895c81ea6af0822c8371ae93cfe4b72d419439d 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java @@ -120,7 +120,7 @@ public class CraftChunk implements Chunk { @@ -17854,10 +17854,10 @@ index d58f6b48befbc637a58e669c83e994bae8872adf..cda6277a3a8eefc80de00ffc98687ce0 @Override diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index c684460c91ad41ba9741616c25dae5c3efede704..720a078acfe770dba76413a8cfa4ef15616ae292 100644 +index 83e0038b3c281c176463d33bacbcc1ca283e41dc..4b8178514bea3f53e1aeec266caa2ed19eb895b0 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1142,7 +1142,7 @@ public final class CraftServer implements Server { +@@ -1128,7 +1128,7 @@ public final class CraftServer implements Server { this.console.addLevel(internal); this.getServer().prepareLevels(internal.getChunkSource().chunkMap.progressListener, internal); @@ -17866,7 +17866,7 @@ index c684460c91ad41ba9741616c25dae5c3efede704..720a078acfe770dba76413a8cfa4ef15 this.pluginManager.callEvent(new WorldLoadEvent(internal.getWorld())); return internal.getWorld(); -@@ -1186,7 +1186,7 @@ public final class CraftServer implements Server { +@@ -1172,7 +1172,7 @@ public final class CraftServer implements Server { } handle.getChunkSource().close(save); @@ -17875,7 +17875,7 @@ index c684460c91ad41ba9741616c25dae5c3efede704..720a078acfe770dba76413a8cfa4ef15 handle.convertable.close(); } catch (Exception ex) { this.getLogger().log(Level.SEVERE, null, ex); -@@ -2001,7 +2001,7 @@ public final class CraftServer implements Server { +@@ -1987,7 +1987,7 @@ public final class CraftServer implements Server { @Override public boolean isPrimaryThread() { @@ -17885,7 +17885,7 @@ index c684460c91ad41ba9741616c25dae5c3efede704..720a078acfe770dba76413a8cfa4ef15 // Paper start diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index e91305263fcf6929fe62e5e8da46721707b51517..3ad15c0909d14c6f974e9bf82055c3c332577526 100644 +index fd1da8431578832bcd1f3ca7890dd2150b916ebd..958c5faeddd3ee54ac2880eb3eb9e4ab2bba2540 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -313,10 +313,14 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -17947,7 +17947,7 @@ index e91305263fcf6929fe62e5e8da46721707b51517..3ad15c0909d14c6f974e9bf82055c3c3 long chunkKey = chunkTickets.getLongKey(); SortedArraySet> tickets = chunkTickets.getValue(); -@@ -1904,14 +1894,53 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -1920,14 +1910,53 @@ public class CraftWorld extends CraftRegionAccessor implements World { // Spigot start @Override public int getViewDistance() { @@ -18004,7 +18004,7 @@ index e91305263fcf6929fe62e5e8da46721707b51517..3ad15c0909d14c6f974e9bf82055c3c3 // Spigot start private final org.bukkit.World.Spigot spigot = new org.bukkit.World.Spigot() diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index a7609957da493c5e79771f9ff48e94acadca8bfc..f3cc8a410616c33c0bcbbfeba698139130d5831f 100644 +index b09d8420ffe3c7e2ba173ee98643bc17909db563..9a6c9c42b162315115781246cdf91af816d93293 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -176,6 +176,81 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0017-Add-command-line-option-to-load-extra-plugin-jars-no.patch b/patches/server/0019-Add-command-line-option-to-load-extra-plugin-jars-no.patch similarity index 72% rename from patches/server/0017-Add-command-line-option-to-load-extra-plugin-jars-no.patch rename to patches/server/0019-Add-command-line-option-to-load-extra-plugin-jars-no.patch index 17dbe731e1..a49cc4a0cb 100644 --- a/patches/server/0017-Add-command-line-option-to-load-extra-plugin-jars-no.patch +++ b/patches/server/0019-Add-command-line-option-to-load-extra-plugin-jars-no.patch @@ -7,30 +7,11 @@ Subject: [PATCH] Add command line option to load extra plugin jars not in the ex: java -jar paperclip.jar nogui -add-plugin=/path/to/plugin.jar -add-plugin=/path/to/another/plugin_jar.jar diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 241e328dda2f9d32a16bbb47f4848af33d8d7b45..1e8f5b6b74c469a77238b2798fe1d0897a7c6fb3 100644 +index 4b8178514bea3f53e1aeec266caa2ed19eb895b0..d061919b93f131cb4d8132951775b044766edaf1 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -418,10 +418,15 @@ public final class CraftServer implements Server { - public void loadPlugins() { - this.pluginManager.registerInterface(JavaPluginLoader.class); - -- File pluginFolder = (File) console.options.valueOf("plugins"); -+ File pluginFolder = this.getPluginsFolder(); // Paper - -- if (pluginFolder.exists()) { -- Plugin[] plugins = this.pluginManager.loadPlugins(pluginFolder); -+ // Paper start -+ if (true || pluginFolder.exists()) { -+ if (!pluginFolder.exists()) { -+ pluginFolder.mkdirs(); -+ } -+ Plugin[] plugins = this.pluginManager.loadPlugins(pluginFolder, this.extraPluginJars()); -+ // Paper end - for (Plugin plugin : plugins) { - try { - String message = String.format("Loading %s", plugin.getDescription().getFullName()); -@@ -436,6 +441,35 @@ public final class CraftServer implements Server { - } +@@ -420,6 +420,35 @@ public final class CraftServer implements Server { + io.papermc.paper.plugin.entrypoint.LaunchEntryPointHandler.INSTANCE.enter(io.papermc.paper.plugin.entrypoint.Entrypoint.PLUGIN); // Paper - replace implementation } + // Paper start @@ -66,7 +47,7 @@ index 241e328dda2f9d32a16bbb47f4848af33d8d7b45..1e8f5b6b74c469a77238b2798fe1d089 if (type == PluginLoadOrder.STARTUP) { this.helpMap.clear(); diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index e2cf043fb35ae8474bf1f6ba2cc2505566973cfe..44b30d0f297af5eb4ace4160a0c601ff824632f6 100644 +index 5448d2a6fe8cace246b81742da19666ec24ca48c..a51581263f1c9d72aab7c9223a816d034630f702 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -149,6 +149,12 @@ public class Main { diff --git a/patches/server/0018-Configurable-cactus-bamboo-and-reed-growth-heights.patch b/patches/server/0020-Configurable-cactus-bamboo-and-reed-growth-heights.patch similarity index 100% rename from patches/server/0018-Configurable-cactus-bamboo-and-reed-growth-heights.patch rename to patches/server/0020-Configurable-cactus-bamboo-and-reed-growth-heights.patch diff --git a/patches/server/0019-Configurable-baby-zombie-movement-speed.patch b/patches/server/0021-Configurable-baby-zombie-movement-speed.patch similarity index 100% rename from patches/server/0019-Configurable-baby-zombie-movement-speed.patch rename to patches/server/0021-Configurable-baby-zombie-movement-speed.patch diff --git a/patches/server/0020-Configurable-fishing-time-ranges.patch b/patches/server/0022-Configurable-fishing-time-ranges.patch similarity index 94% rename from patches/server/0020-Configurable-fishing-time-ranges.patch rename to patches/server/0022-Configurable-fishing-time-ranges.patch index c3a9c76630..da1c2cc1a7 100644 --- a/patches/server/0020-Configurable-fishing-time-ranges.patch +++ b/patches/server/0022-Configurable-fishing-time-ranges.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Configurable fishing time ranges diff --git a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java -index 41a3e97cda5e12658c69fc8f097250d1f2f5fdea..354fed07a1c8d88c97350be11388925e5bf82f9e 100644 +index f0cb2fa768adf1ffe68a00457d39a7749899ac6b..9d0df8d64a2cfd2458295a214829f277798030f0 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java +++ b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java @@ -86,6 +86,10 @@ public class FishingHook extends Projectile { diff --git a/patches/server/0021-Allow-nerfed-mobs-to-jump-and-take-water-damage.patch b/patches/server/0023-Allow-nerfed-mobs-to-jump-and-take-water-damage.patch similarity index 100% rename from patches/server/0021-Allow-nerfed-mobs-to-jump-and-take-water-damage.patch rename to patches/server/0023-Allow-nerfed-mobs-to-jump-and-take-water-damage.patch diff --git a/patches/server/0022-Add-configurable-despawn-distances-for-living-entiti.patch b/patches/server/0024-Add-configurable-despawn-distances-for-living-entiti.patch similarity index 100% rename from patches/server/0022-Add-configurable-despawn-distances-for-living-entiti.patch rename to patches/server/0024-Add-configurable-despawn-distances-for-living-entiti.patch diff --git a/patches/server/0023-Allow-for-toggling-of-spawn-chunks.patch b/patches/server/0025-Allow-for-toggling-of-spawn-chunks.patch similarity index 100% rename from patches/server/0023-Allow-for-toggling-of-spawn-chunks.patch rename to patches/server/0025-Allow-for-toggling-of-spawn-chunks.patch diff --git a/patches/server/0024-Drop-falling-block-and-tnt-entities-at-the-specified.patch b/patches/server/0026-Drop-falling-block-and-tnt-entities-at-the-specified.patch similarity index 100% rename from patches/server/0024-Drop-falling-block-and-tnt-entities-at-the-specified.patch rename to patches/server/0026-Drop-falling-block-and-tnt-entities-at-the-specified.patch diff --git a/patches/server/0025-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch b/patches/server/0027-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch similarity index 98% rename from patches/server/0025-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch rename to patches/server/0027-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch index e111c858bf..abb5332603 100644 --- a/patches/server/0025-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch +++ b/patches/server/0027-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch @@ -19,7 +19,7 @@ index e9f4ffec4b659f3300daa0138f6e955a8d97786d..e2e66fd4bd34e0ceaab350214a50ddbb public SystemReport fillSystemReport(SystemReport details) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 82b267898f98b7e6c808a2377951106769a4a763..e609a52750fe6ca178ce2933510d000a11438270 100644 +index d061919b93f131cb4d8132951775b044766edaf1..ea16abd65ff909ad4644f7a98fd29d9c3c9f7ac7 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -259,7 +259,7 @@ import org.yaml.snakeyaml.error.MarkedYAMLException; diff --git a/patches/server/0026-Implement-Paper-VersionChecker.patch b/patches/server/0028-Implement-Paper-VersionChecker.patch similarity index 97% rename from patches/server/0026-Implement-Paper-VersionChecker.patch rename to patches/server/0028-Implement-Paper-VersionChecker.patch index cf9aa20c14..701eb0a55b 100644 --- a/patches/server/0026-Implement-Paper-VersionChecker.patch +++ b/patches/server/0028-Implement-Paper-VersionChecker.patch @@ -140,10 +140,10 @@ index 0000000000000000000000000000000000000000..351159bbdb0c8045f4983f54dee34430 + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index c25f893ef1215a22c8bfa575e4711b9c92a25f0b..176d5bdc5bf048940ceb46dd0a69d9fb7d39821f 100644 +index 8324787573510df3e23e6833f06aa1618336b7bb..0ee761fa0d42fd90e82f3284ee756ddd60c6178d 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -424,6 +424,11 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -454,6 +454,11 @@ public final class CraftMagicNumbers implements UnsafeValues { public String getTimingsServerName() { return io.papermc.paper.configuration.GlobalConfiguration.get().timings.serverName; } diff --git a/patches/server/0027-Add-version-history-to-version-command.patch b/patches/server/0029-Add-version-history-to-version-command.patch similarity index 100% rename from patches/server/0027-Add-version-history-to-version-command.patch rename to patches/server/0029-Add-version-history-to-version-command.patch diff --git a/patches/server/0028-Player-affects-spawning-API.patch b/patches/server/0030-Player-affects-spawning-API.patch similarity index 96% rename from patches/server/0028-Player-affects-spawning-API.patch rename to patches/server/0030-Player-affects-spawning-API.patch index a29b8baf79..da16ad1762 100644 --- a/patches/server/0028-Player-affects-spawning-API.patch +++ b/patches/server/0030-Player-affects-spawning-API.patch @@ -73,7 +73,7 @@ index 8ea60d388fff4a6368652ff96f648e5880053a2b..8ecbb64f9db9346757c5597404489496 entityzombie.finalizeSpawn(worldserver, this.level.getCurrentDifficultyAt(entityzombie.blockPosition()), MobSpawnType.REINFORCEMENT, (SpawnGroupData) null, (CompoundTag) null); worldserver.addFreshEntityWithPassengers(entityzombie, CreatureSpawnEvent.SpawnReason.REINFORCEMENTS); // CraftBukkit diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index dbe7588d4ea992155e3ff3b7d31af04181b01521..08c76c56e493f01bc159312aef512886631682f3 100644 +index 47b5ef810348f8c702acb09b280b41b6b7227b6f..60fb74537fdc96005cbf6aa1670e773c0faa2f26 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -179,6 +179,9 @@ public abstract class Player extends LivingEntity { @@ -87,7 +87,7 @@ index dbe7588d4ea992155e3ff3b7d31af04181b01521..08c76c56e493f01bc159312aef512886 // CraftBukkit start public boolean fauxSleeping; diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java -index 068d01c749a86954915fdad1b7499720613e5af3..d172f4e00b064c6c8fb5b1f6b0b68fd44a6efb62 100644 +index f035206f2f59cb293d503c638ff06333a797a7a9..3e83bff81a0656d5e1d079ad9e63c7d27561c8e3 100644 --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java @@ -54,7 +54,7 @@ public abstract class BaseSpawner { @@ -137,10 +137,10 @@ index be6e3e21ad62da01e5e2dd78e300cbc8efdbeb42..ea98625fe7c00743b8df74a24e6d4b75 for(Player player : this.players()) { if (EntitySelector.NO_SPECTATORS.test(player) && EntitySelector.LIVING_ENTITY_STILL_ALIVE.test(player)) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index af45674e2aff3756813834e866a0e4f9e4b361f5..524e57251951d719eed227d779e3c420a9f38787 100644 +index 9a6c9c42b162315115781246cdf91af816d93293..69e197c78b4e6265f61f42232ac2d06687b6ca5e 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -2086,8 +2086,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -2105,8 +2105,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override public String getLocale() { return this.getHandle().locale; diff --git a/patches/server/0029-Further-improve-server-tick-loop.patch b/patches/server/0031-Further-improve-server-tick-loop.patch similarity index 98% rename from patches/server/0029-Further-improve-server-tick-loop.patch rename to patches/server/0031-Further-improve-server-tick-loop.patch index 9f1bc03008..70439a74c2 100644 --- a/patches/server/0029-Further-improve-server-tick-loop.patch +++ b/patches/server/0031-Further-improve-server-tick-loop.patch @@ -145,10 +145,10 @@ index e2e66fd4bd34e0ceaab350214a50ddbb1dc76184..ac81428f19e2d445f315000d34173c2d this.startMetricsRecordingTick(); this.profiler.push("tick"); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index e609a52750fe6ca178ce2933510d000a11438270..ecc94c04ba83aff8f232467aef2def69065a1c1e 100644 +index ea16abd65ff909ad4644f7a98fd29d9c3c9f7ac7..710b06caa91d09f6e3d55f76162e60f41d0037e2 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2436,6 +2436,17 @@ public final class CraftServer implements Server { +@@ -2417,6 +2417,17 @@ public final class CraftServer implements Server { return CraftMagicNumbers.INSTANCE; } diff --git a/patches/server/0030-Only-refresh-abilities-if-needed.patch b/patches/server/0032-Only-refresh-abilities-if-needed.patch similarity index 87% rename from patches/server/0030-Only-refresh-abilities-if-needed.patch rename to patches/server/0032-Only-refresh-abilities-if-needed.patch index 7bc762b039..ab9f46dccf 100644 --- a/patches/server/0030-Only-refresh-abilities-if-needed.patch +++ b/patches/server/0032-Only-refresh-abilities-if-needed.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Only refresh abilities if needed diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 524e57251951d719eed227d779e3c420a9f38787..99b61f733551af788aaadd74dbcd4c40521e294e 100644 +index 69e197c78b4e6265f61f42232ac2d06687b6ca5e..a6b1cd3361018ce3c7e0760a101184e2d15b69bb 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1755,12 +1755,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1774,12 +1774,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override public void setFlying(boolean value) { diff --git a/patches/server/0031-Entity-Origin-API.patch b/patches/server/0033-Entity-Origin-API.patch similarity index 100% rename from patches/server/0031-Entity-Origin-API.patch rename to patches/server/0033-Entity-Origin-API.patch diff --git a/patches/server/0032-Prevent-tile-entity-and-entity-crashes.patch b/patches/server/0034-Prevent-tile-entity-and-entity-crashes.patch similarity index 97% rename from patches/server/0032-Prevent-tile-entity-and-entity-crashes.patch rename to patches/server/0034-Prevent-tile-entity-and-entity-crashes.patch index cc702a776e..b53d3c9fbf 100644 --- a/patches/server/0032-Prevent-tile-entity-and-entity-crashes.patch +++ b/patches/server/0034-Prevent-tile-entity-and-entity-crashes.patch @@ -44,7 +44,7 @@ index b300d12e9e00519028b53aca9c3fb01f589eaa91..63acd109a79ed752a05df3d4f1b99309 } } diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -index 652da141c3ae19c4de790dea1477f9c3f4c0dee1..d11a715dccaaf2a2faeef8af9ff6e5f1914416cb 100644 +index 8c2b562e46a35369389da453012b7af570145380..f21ae1ae8af79c1c0c6f2feaa933638add0aa065 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -1184,11 +1184,11 @@ public class LevelChunk extends ChunkAccess { diff --git a/patches/server/0033-Configurable-top-of-nether-void-damage.patch b/patches/server/0035-Configurable-top-of-nether-void-damage.patch similarity index 100% rename from patches/server/0033-Configurable-top-of-nether-void-damage.patch rename to patches/server/0035-Configurable-top-of-nether-void-damage.patch diff --git a/patches/server/0034-Check-online-mode-before-converting-and-renaming-pla.patch b/patches/server/0036-Check-online-mode-before-converting-and-renaming-pla.patch similarity index 100% rename from patches/server/0034-Check-online-mode-before-converting-and-renaming-pla.patch rename to patches/server/0036-Check-online-mode-before-converting-and-renaming-pla.patch diff --git a/patches/server/0035-Always-tick-falling-blocks.patch b/patches/server/0037-Always-tick-falling-blocks.patch similarity index 100% rename from patches/server/0035-Always-tick-falling-blocks.patch rename to patches/server/0037-Always-tick-falling-blocks.patch diff --git a/patches/server/0036-Configurable-end-credits.patch b/patches/server/0038-Configurable-end-credits.patch similarity index 91% rename from patches/server/0036-Configurable-end-credits.patch rename to patches/server/0038-Configurable-end-credits.patch index 1c6a3bf132..6037ece7eb 100644 --- a/patches/server/0036-Configurable-end-credits.patch +++ b/patches/server/0038-Configurable-end-credits.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Configurable end credits diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 72f9e0eedb142cb37f0cab85208d491c4918235e..38f40851a5927a2f71fb3126d554770ff6cb1107 100644 +index e06b2a8eece6f179e4a3f38754fd8d9e7b69bdc4..d7b581a34d95b038e548a7380ce00ebba9835606 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1011,6 +1011,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0037-Fix-lag-from-explosions-processing-dead-entities.patch b/patches/server/0039-Fix-lag-from-explosions-processing-dead-entities.patch similarity index 92% rename from patches/server/0037-Fix-lag-from-explosions-processing-dead-entities.patch rename to patches/server/0039-Fix-lag-from-explosions-processing-dead-entities.patch index e4dde9fb71..91ece8f728 100644 --- a/patches/server/0037-Fix-lag-from-explosions-processing-dead-entities.patch +++ b/patches/server/0039-Fix-lag-from-explosions-processing-dead-entities.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix lag from explosions processing dead entities diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java -index e0efb6ad5f25522bd395018b85df00dda33a443a..77dc0b310f48471c1ca1dc95bf01c5e24f1ed6d8 100644 +index 84b903ec43ce39ef530ecbcc65999df748f785af..735442e98fc9f5a182ff15a526d9601162c9418d 100644 --- a/src/main/java/net/minecraft/world/level/Explosion.java +++ b/src/main/java/net/minecraft/world/level/Explosion.java @@ -202,7 +202,7 @@ public class Explosion { diff --git a/patches/server/0038-Optimize-explosions.patch b/patches/server/0040-Optimize-explosions.patch similarity index 100% rename from patches/server/0038-Optimize-explosions.patch rename to patches/server/0040-Optimize-explosions.patch diff --git a/patches/server/0039-Disable-explosion-knockback.patch b/patches/server/0041-Disable-explosion-knockback.patch similarity index 100% rename from patches/server/0039-Disable-explosion-knockback.patch rename to patches/server/0041-Disable-explosion-knockback.patch diff --git a/patches/server/0040-Disable-thunder.patch b/patches/server/0042-Disable-thunder.patch similarity index 100% rename from patches/server/0040-Disable-thunder.patch rename to patches/server/0042-Disable-thunder.patch diff --git a/patches/server/0041-Disable-ice-and-snow.patch b/patches/server/0043-Disable-ice-and-snow.patch similarity index 100% rename from patches/server/0041-Disable-ice-and-snow.patch rename to patches/server/0043-Disable-ice-and-snow.patch diff --git a/patches/server/0042-Configurable-mob-spawner-tick-rate.patch b/patches/server/0044-Configurable-mob-spawner-tick-rate.patch similarity index 95% rename from patches/server/0042-Configurable-mob-spawner-tick-rate.patch rename to patches/server/0044-Configurable-mob-spawner-tick-rate.patch index 0681d9c8f6..784c0a8983 100644 --- a/patches/server/0042-Configurable-mob-spawner-tick-rate.patch +++ b/patches/server/0044-Configurable-mob-spawner-tick-rate.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Configurable mob spawner tick rate diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java -index d172f4e00b064c6c8fb5b1f6b0b68fd44a6efb62..cf9a0addcbec3f78a541fad85697961ed8ec884b 100644 +index 3e83bff81a0656d5e1d079ad9e63c7d27561c8e3..b214a79efc4f5279d3dd29feb1f79efc45788a8d 100644 --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java @@ -45,6 +45,7 @@ public abstract class BaseSpawner { diff --git a/patches/server/0043-Implement-PlayerLocaleChangeEvent.patch b/patches/server/0045-Implement-PlayerLocaleChangeEvent.patch similarity index 90% rename from patches/server/0043-Implement-PlayerLocaleChangeEvent.patch rename to patches/server/0045-Implement-PlayerLocaleChangeEvent.patch index cc64ae113a..d41f976a1e 100644 --- a/patches/server/0043-Implement-PlayerLocaleChangeEvent.patch +++ b/patches/server/0045-Implement-PlayerLocaleChangeEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Implement PlayerLocaleChangeEvent diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 38f40851a5927a2f71fb3126d554770ff6cb1107..fe1cf92644809b9aed5f74235166a21771893b72 100644 +index d7b581a34d95b038e548a7380ce00ebba9835606..a95e2e05db626edbedaa604f059e19a592a682a3 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1787,7 +1787,7 @@ public class ServerPlayer extends Player { @@ -30,10 +30,10 @@ index 38f40851a5927a2f71fb3126d554770ff6cb1107..fe1cf92644809b9aed5f74235166a217 this.locale = packet.language; // Paper start diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 99b61f733551af788aaadd74dbcd4c40521e294e..30bbfb2bf6aeaf311453ccdd72eeee43ae89b972 100644 +index a6b1cd3361018ce3c7e0760a101184e2d15b69bb..63e01d1380135072735444724a9b060be364cec4 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -2086,8 +2086,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -2105,8 +2105,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override public String getLocale() { diff --git a/patches/server/0044-Add-BeaconEffectEvent.patch b/patches/server/0046-Add-BeaconEffectEvent.patch similarity index 100% rename from patches/server/0044-Add-BeaconEffectEvent.patch rename to patches/server/0046-Add-BeaconEffectEvent.patch diff --git a/patches/server/0045-Configurable-container-update-tick-rate.patch b/patches/server/0047-Configurable-container-update-tick-rate.patch similarity index 93% rename from patches/server/0045-Configurable-container-update-tick-rate.patch rename to patches/server/0047-Configurable-container-update-tick-rate.patch index 91d1b053c2..72bb76e5ac 100644 --- a/patches/server/0045-Configurable-container-update-tick-rate.patch +++ b/patches/server/0047-Configurable-container-update-tick-rate.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Configurable container update tick rate diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index fe1cf92644809b9aed5f74235166a21771893b72..91380d37ddd0c03301618849ea8fd9a72c333ae5 100644 +index a95e2e05db626edbedaa604f059e19a592a682a3..c9e262967f040d224e284aa82256422db14aa9d5 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -233,6 +233,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0046-Use-UserCache-for-player-heads.patch b/patches/server/0048-Use-UserCache-for-player-heads.patch similarity index 100% rename from patches/server/0046-Use-UserCache-for-player-heads.patch rename to patches/server/0048-Use-UserCache-for-player-heads.patch diff --git a/patches/server/0047-Disable-spigot-tick-limiters.patch b/patches/server/0049-Disable-spigot-tick-limiters.patch similarity index 100% rename from patches/server/0047-Disable-spigot-tick-limiters.patch rename to patches/server/0049-Disable-spigot-tick-limiters.patch diff --git a/patches/server/0048-Add-PlayerInitialSpawnEvent.patch b/patches/server/0050-Add-PlayerInitialSpawnEvent.patch similarity index 95% rename from patches/server/0048-Add-PlayerInitialSpawnEvent.patch rename to patches/server/0050-Add-PlayerInitialSpawnEvent.patch index 6e87062ced..e4cab59acf 100644 --- a/patches/server/0048-Add-PlayerInitialSpawnEvent.patch +++ b/patches/server/0050-Add-PlayerInitialSpawnEvent.patch @@ -12,7 +12,7 @@ improve setPosition to use raw public net.minecraft.world.entity.Entity setRot(FF)V diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 5463b07b24a4572bd9e83b6694fa0162d4911f7b..ae492b5c184896864bb6cc7429dfd701d560ae06 100644 +index da36a7342c5ef34af9ea4330e6cee2880d8d4dc8..22b9f0b3764907fc3c3d8bf8d42ef84ff237cd71 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -229,7 +229,7 @@ public abstract class PlayerList { diff --git a/patches/server/0049-Configurable-Disabling-Cat-Chest-Detection.patch b/patches/server/0051-Configurable-Disabling-Cat-Chest-Detection.patch similarity index 100% rename from patches/server/0049-Configurable-Disabling-Cat-Chest-Detection.patch rename to patches/server/0051-Configurable-Disabling-Cat-Chest-Detection.patch diff --git a/patches/server/0050-Ensure-commands-are-not-ran-async.patch b/patches/server/0052-Ensure-commands-are-not-ran-async.patch similarity index 96% rename from patches/server/0050-Ensure-commands-are-not-ran-async.patch rename to patches/server/0052-Ensure-commands-are-not-ran-async.patch index 01bc09f9e6..060ec86489 100644 --- a/patches/server/0050-Ensure-commands-are-not-ran-async.patch +++ b/patches/server/0052-Ensure-commands-are-not-ran-async.patch @@ -21,7 +21,7 @@ character. Co-authored-by: Jake Potrebic diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index b85545f997447875e737e4d22a8a8dbcf1f8e2c8..4acffc3c509ca247a31a10099829a36a15d044a6 100644 +index 8ef64f5192500f87f514c42432c0d5c8361145a7..f9f18e263d29421bdc83993a6fd55f47cb7ab926 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -2040,7 +2040,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -74,10 +74,10 @@ index b85545f997447875e737e4d22a8a8dbcf1f8e2c8..4acffc3c509ca247a31a10099829a36a if ( org.spigotmc.SpigotConfig.logCommands ) // Spigot this.LOGGER.info(this.player.getScoreboardName() + " issued server command: " + s); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index ecc94c04ba83aff8f232467aef2def69065a1c1e..21479b83bbf8a3fd83d2c28626c70b7ee6e5da83 100644 +index 710b06caa91d09f6e3d55f76162e60f41d0037e2..6654764b00e2b1ff15d54aa94d16474660bc3f47 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -876,6 +876,28 @@ public final class CraftServer implements Server { +@@ -857,6 +857,28 @@ public final class CraftServer implements Server { Validate.notNull(commandLine, "CommandLine cannot be null"); org.spigotmc.AsyncCatcher.catchOp("command dispatch"); // Spigot @@ -107,7 +107,7 @@ index ecc94c04ba83aff8f232467aef2def69065a1c1e..21479b83bbf8a3fd83d2c28626c70b7e return true; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 2bd04b15330e436dad2bc5006406bf791200d8fd..18ca87ebdc58f1ed2c1dd37e91f7ab3d85f3d014 100644 +index 63e01d1380135072735444724a9b060be364cec4..b3fc0f67715707bf4ad6ff88fbf8dab1c830d74b 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -504,7 +504,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0051-All-chunks-are-slime-spawn-chunks-toggle.patch b/patches/server/0053-All-chunks-are-slime-spawn-chunks-toggle.patch similarity index 95% rename from patches/server/0051-All-chunks-are-slime-spawn-chunks-toggle.patch rename to patches/server/0053-All-chunks-are-slime-spawn-chunks-toggle.patch index a8f1031ff2..5551499519 100644 --- a/patches/server/0051-All-chunks-are-slime-spawn-chunks-toggle.patch +++ b/patches/server/0053-All-chunks-are-slime-spawn-chunks-toggle.patch @@ -18,7 +18,7 @@ index 64c4b88f0a64436c126cf32d6e289b3876af8dfb..85abd62434cbe3beb63f61262504372b if (random.nextInt(10) == 0 && flag && pos.getY() < 40) { return checkMobSpawnRules(type, world, spawnReason, pos, random); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java -index cda6277a3a8eefc80de00ffc98687ce0afca7bf2..46b1cce7d482adea911b71f3e3623ac0574a85ae 100644 +index a895c81ea6af0822c8371ae93cfe4b72d419439d..e4a533ace96829414844607a013831dba7a1e73e 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java @@ -177,7 +177,7 @@ public class CraftChunk implements Chunk { diff --git a/patches/server/0054-Ensure-inv-drag-is-in-bounds.patch b/patches/server/0054-Ensure-inv-drag-is-in-bounds.patch deleted file mode 100644 index 407fdbf4db..0000000000 --- a/patches/server/0054-Ensure-inv-drag-is-in-bounds.patch +++ /dev/null @@ -1,19 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Joseph Hirschfeld -Date: Thu, 3 Mar 2016 02:33:53 -0600 -Subject: [PATCH] Ensure inv drag is in bounds - - -diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java -index f15415ff5fb099a048fe0f898e15bc4303a47ef5..f7976bd9561601a6ce1d5b4874b08bba9754d753 100644 ---- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java -+++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java -@@ -417,7 +417,7 @@ public abstract class AbstractContainerMenu { - this.resetQuickCraft(); - } - } else if (this.quickcraftStatus == 1) { -- slot = (Slot) this.slots.get(slotIndex); -+ slot = slotIndex < this.slots.size() ? this.slots.get(slotIndex) : null; // Paper - Ensure drag in bounds - itemstack = this.getCarried(); - if (AbstractContainerMenu.canItemQuickReplace(slot, itemstack, true) && slot.mayPlace(itemstack) && (this.quickcraftType == 2 || itemstack.getCount() > this.quickcraftSlots.size()) && this.canDragTo(slot)) { - this.quickcraftSlots.add(slot); diff --git a/patches/server/0052-Expose-server-CommandMap.patch b/patches/server/0054-Expose-server-CommandMap.patch similarity index 78% rename from patches/server/0052-Expose-server-CommandMap.patch rename to patches/server/0054-Expose-server-CommandMap.patch index 0efe24c9a6..263fb6029b 100644 --- a/patches/server/0052-Expose-server-CommandMap.patch +++ b/patches/server/0054-Expose-server-CommandMap.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Expose server CommandMap diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 21479b83bbf8a3fd83d2c28626c70b7ee6e5da83..af723e317878e024abac59be8c1cc0a228a45980 100644 +index 6654764b00e2b1ff15d54aa94d16474660bc3f47..44cd9d5bccdc751dc9fb72a39f12e74a99133783 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2010,6 +2010,7 @@ public final class CraftServer implements Server { +@@ -1991,6 +1991,7 @@ public final class CraftServer implements Server { return this.helpMap; } diff --git a/patches/server/0053-Be-a-bit-more-informative-in-maxHealth-exception.patch b/patches/server/0055-Be-a-bit-more-informative-in-maxHealth-exception.patch similarity index 100% rename from patches/server/0053-Be-a-bit-more-informative-in-maxHealth-exception.patch rename to patches/server/0055-Be-a-bit-more-informative-in-maxHealth-exception.patch diff --git a/patches/server/0055-Player-Tab-List-and-Title-APIs.patch b/patches/server/0056-Player-Tab-List-and-Title-APIs.patch similarity index 98% rename from patches/server/0055-Player-Tab-List-and-Title-APIs.patch rename to patches/server/0056-Player-Tab-List-and-Title-APIs.patch index 30401cd7f8..da0ca18eab 100644 --- a/patches/server/0055-Player-Tab-List-and-Title-APIs.patch +++ b/patches/server/0056-Player-Tab-List-and-Title-APIs.patch @@ -63,7 +63,7 @@ index bd808eb312ade7122973a47f4b96505829511da5..bf0f9cab7c66c089f35b851e799ba4a4 // Paper end buf.writeComponent(this.text); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index e13af07709acdbe5060e2959f6762fcffa65fd05..d7177eb9c3cf65cacc90752215d591058b8106b8 100644 +index b3fc0f67715707bf4ad6ff88fbf8dab1c830d74b..8db291b3dceaa49f095cf7486e4b7f69209548b4 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1,5 +1,6 @@ diff --git a/patches/server/0056-Add-configurable-portal-search-radius.patch b/patches/server/0057-Add-configurable-portal-search-radius.patch similarity index 100% rename from patches/server/0056-Add-configurable-portal-search-radius.patch rename to patches/server/0057-Add-configurable-portal-search-radius.patch diff --git a/patches/server/0057-Add-velocity-warnings.patch b/patches/server/0058-Add-velocity-warnings.patch similarity index 96% rename from patches/server/0057-Add-velocity-warnings.patch rename to patches/server/0058-Add-velocity-warnings.patch index 2785feca89..488501294c 100644 --- a/patches/server/0057-Add-velocity-warnings.patch +++ b/patches/server/0058-Add-velocity-warnings.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add velocity warnings diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index d73c97e0d762e49b2ef757671cb52c68511f9ff6..37c1e4b31c06b9bf48325a7d5f293020b00445b1 100644 +index 44cd9d5bccdc751dc9fb72a39f12e74a99133783..a290b298e24e8c4be08e7c720c10c9a83115eebf 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -293,6 +293,7 @@ public final class CraftServer implements Server { +@@ -294,6 +294,7 @@ public final class CraftServer implements Server { public boolean ignoreVanillaPermissions = false; private final List playerView; public int reloadCount; diff --git a/patches/server/0058-Configurable-inter-world-teleportation-safety.patch b/patches/server/0059-Configurable-inter-world-teleportation-safety.patch similarity index 91% rename from patches/server/0058-Configurable-inter-world-teleportation-safety.patch rename to patches/server/0059-Configurable-inter-world-teleportation-safety.patch index 6ee3cd0a03..62705fa37c 100644 --- a/patches/server/0058-Configurable-inter-world-teleportation-safety.patch +++ b/patches/server/0059-Configurable-inter-world-teleportation-safety.patch @@ -16,10 +16,10 @@ The wanted destination was on top of the emerald block however the player ended This only is the case if the player is teleporting between worlds. diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 3a2fe558d04959dce225b889c0e700134bd677b6..854983a0bc0be2920aa22add675fef0ed507f0a2 100644 +index 8db291b3dceaa49f095cf7486e4b7f69209548b4..f552e14a3164c8b877c5017911eada24ed067e9c 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1132,7 +1132,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1145,7 +1145,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { if (fromWorld == toWorld) { entity.connection.teleport(to); } else { diff --git a/patches/server/0059-Add-exception-reporting-event.patch b/patches/server/0060-Add-exception-reporting-event.patch similarity index 99% rename from patches/server/0059-Add-exception-reporting-event.patch rename to patches/server/0060-Add-exception-reporting-event.patch index 935dd3e71d..b4edd3ff2c 100644 --- a/patches/server/0059-Add-exception-reporting-event.patch +++ b/patches/server/0060-Add-exception-reporting-event.patch @@ -131,7 +131,7 @@ index 0e4f6893a2fce69782c4246c52e03926fe2df26f..5c58031279c0b74d2061c802e60b7bed } diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -index d11a715dccaaf2a2faeef8af9ff6e5f1914416cb..b78e89eed44a06bb8c7a8a62e561574d4dc4b2de 100644 +index f21ae1ae8af79c1c0c6f2feaa933638add0aa065..ba24e32f96797ed8c8bd82391d1903f6ad2a9813 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -1,6 +1,7 @@ diff --git a/patches/server/0060-Don-t-nest-if-we-don-t-need-to-when-cerealising-text.patch b/patches/server/0061-Don-t-nest-if-we-don-t-need-to-when-cerealising-text.patch similarity index 100% rename from patches/server/0060-Don-t-nest-if-we-don-t-need-to-when-cerealising-text.patch rename to patches/server/0061-Don-t-nest-if-we-don-t-need-to-when-cerealising-text.patch diff --git a/patches/server/0062-Add-methods-for-working-with-arrows-stuck-in-living-.patch b/patches/server/0062-Add-methods-for-working-with-arrows-stuck-in-living-.patch deleted file mode 100644 index 4b1d9fd2cb..0000000000 --- a/patches/server/0062-Add-methods-for-working-with-arrows-stuck-in-living-.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: mrapple -Date: Sun, 25 Nov 2012 13:43:39 -0600 -Subject: [PATCH] Add methods for working with arrows stuck in living entities - - -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index c2407224e8bc5e872e153de14090d60e66bb07bc..4f4ee7071183e7eef918741e38c2bc2e522c72df 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -@@ -764,4 +764,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { - this.getHandle().persistentInvisibility = invisible; - this.getHandle().setSharedFlag(5, invisible); - } -+ -+ // Paper start -+ @Override -+ public int getArrowsStuck() { -+ return getHandle().getArrowCount(); -+ } -+ -+ @Override -+ public void setArrowsStuck(int arrows) { -+ getHandle().setArrowCount(arrows); -+ } -+ // Paper end - } diff --git a/patches/server/0061-Disable-Scoreboards-for-non-players-by-default.patch b/patches/server/0062-Disable-Scoreboards-for-non-players-by-default.patch similarity index 100% rename from patches/server/0061-Disable-Scoreboards-for-non-players-by-default.patch rename to patches/server/0062-Disable-Scoreboards-for-non-players-by-default.patch diff --git a/patches/server/0063-Add-methods-for-working-with-arrows-stuck-in-living-.patch b/patches/server/0063-Add-methods-for-working-with-arrows-stuck-in-living-.patch new file mode 100644 index 0000000000..37d747ca4a --- /dev/null +++ b/patches/server/0063-Add-methods-for-working-with-arrows-stuck-in-living-.patch @@ -0,0 +1,46 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: mrapple +Date: Sun, 25 Nov 2012 13:43:39 -0600 +Subject: [PATCH] Add methods for working with arrows stuck in living entities + +Upstream added methods for this, original methods are now +deprecated + +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +index c2407224e8bc5e872e153de14090d60e66bb07bc..3fae28c52f2aac63ac6a4e8eb6af2d7226e6bec6 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +@@ -266,9 +266,15 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { + } + + @Override +- public void setArrowsInBody(int count) { ++ public void setArrowsInBody(final int count, final boolean fireEvent) { // Paper + Preconditions.checkArgument(count >= 0, "New arrow amount must be >= 0"); ++ if (!fireEvent) { // Paper + this.getHandle().getEntityData().set(net.minecraft.world.entity.LivingEntity.DATA_ARROW_COUNT_ID, count); ++ // Paper start ++ } else { ++ this.getHandle().setArrowCount(count); ++ } ++ // Paper end + } + + @Override +@@ -764,4 +770,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { + this.getHandle().persistentInvisibility = invisible; + this.getHandle().setSharedFlag(5, invisible); + } ++ ++ // Paper start ++ @Override ++ public int getArrowsStuck() { ++ return this.getHandle().getArrowCount(); ++ } ++ ++ @Override ++ public void setArrowsStuck(final int arrows) { ++ this.getHandle().setArrowCount(arrows); ++ } ++ // Paper end + } diff --git a/patches/server/0063-Chunk-Save-Reattempt.patch b/patches/server/0064-Chunk-Save-Reattempt.patch similarity index 100% rename from patches/server/0063-Chunk-Save-Reattempt.patch rename to patches/server/0064-Chunk-Save-Reattempt.patch diff --git a/patches/server/0064-Complete-resource-pack-API.patch b/patches/server/0065-Complete-resource-pack-API.patch similarity index 94% rename from patches/server/0064-Complete-resource-pack-API.patch rename to patches/server/0065-Complete-resource-pack-API.patch index bf21a9fcc9..9e136e551d 100644 --- a/patches/server/0064-Complete-resource-pack-API.patch +++ b/patches/server/0065-Complete-resource-pack-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Complete resource pack API diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 4acffc3c509ca247a31a10099829a36a15d044a6..8bdf7adb60206a87216b503ead0758ca59a9b377 100644 +index f9f18e263d29421bdc83993a6fd55f47cb7ab926..f49a8a0f56bc3dd9e8a33cfefefed414e56153fd 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -1764,8 +1764,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -23,7 +23,7 @@ index 4acffc3c509ca247a31a10099829a36a15d044a6..8bdf7adb60206a87216b503ead0758ca @Override diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 854983a0bc0be2920aa22add675fef0ed507f0a2..79ade05094db16acc07bec28b6b0fd8038fc7a10 100644 +index f552e14a3164c8b877c5017911eada24ed067e9c..e4cbd5bee86f7ad26eb78b3c1d279a65b896fb77 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -152,6 +152,7 @@ import org.bukkit.plugin.Plugin; @@ -45,7 +45,7 @@ index 854983a0bc0be2920aa22add675fef0ed507f0a2..79ade05094db16acc07bec28b6b0fd80 public CraftPlayer(CraftServer server, ServerPlayer entity) { super(server, entity); -@@ -2209,6 +2214,45 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -2228,6 +2233,45 @@ public class CraftPlayer extends CraftHumanEntity implements Player { public boolean getAffectsSpawning() { return this.getHandle().affectsSpawning; } diff --git a/patches/server/0065-Default-loading-permissions.yml-before-plugins.patch b/patches/server/0066-Default-loading-permissions.yml-before-plugins.patch similarity index 89% rename from patches/server/0065-Default-loading-permissions.yml-before-plugins.patch rename to patches/server/0066-Default-loading-permissions.yml-before-plugins.patch index b9e9f452fd..bca8836919 100644 --- a/patches/server/0065-Default-loading-permissions.yml-before-plugins.patch +++ b/patches/server/0066-Default-loading-permissions.yml-before-plugins.patch @@ -16,10 +16,10 @@ modify that. Under the previous logic, plugins were unable (cleanly) override pe A config option has been added for those who depend on the previous behavior, but I don't expect that. diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 37c1e4b31c06b9bf48325a7d5f293020b00445b1..f2e27681e095439ff0df027ec16796a464e34239 100644 +index a290b298e24e8c4be08e7c720c10c9a83115eebf..2b0defa81e3a250119d8f4337bf75ee17b57b08e 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -475,6 +475,7 @@ public final class CraftServer implements Server { +@@ -454,6 +454,7 @@ public final class CraftServer implements Server { if (type == PluginLoadOrder.STARTUP) { this.helpMap.clear(); this.helpMap.initializeGeneralTopics(); @@ -27,7 +27,7 @@ index 37c1e4b31c06b9bf48325a7d5f293020b00445b1..f2e27681e095439ff0df027ec16796a4 } Plugin[] plugins = this.pluginManager.getPlugins(); -@@ -494,7 +495,7 @@ public final class CraftServer implements Server { +@@ -473,7 +474,7 @@ public final class CraftServer implements Server { this.commandMap.registerServerAliases(); DefaultPermissions.registerCorePermissions(); CraftDefaultPermissions.registerCorePermissions(); diff --git a/patches/server/0066-Allow-Reloading-of-Custom-Permissions.patch b/patches/server/0067-Allow-Reloading-of-Custom-Permissions.patch similarity index 90% rename from patches/server/0066-Allow-Reloading-of-Custom-Permissions.patch rename to patches/server/0067-Allow-Reloading-of-Custom-Permissions.patch index 5d9756be65..a48e9a9573 100644 --- a/patches/server/0066-Allow-Reloading-of-Custom-Permissions.patch +++ b/patches/server/0067-Allow-Reloading-of-Custom-Permissions.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Allow Reloading of Custom Permissions https://github.com/PaperMC/Paper/issues/49 diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index bf752e456f44a8be2344678b657b8d0869b75c23..93e98d43f71d376b28e566244bd650d22645e194 100644 +index 2b0defa81e3a250119d8f4337bf75ee17b57b08e..81982d554c53732621a01c14b565a03e2c623c28 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2564,5 +2564,23 @@ public final class CraftServer implements Server { +@@ -2545,5 +2545,23 @@ public final class CraftServer implements Server { } return this.adventure$audiences; } diff --git a/patches/server/0067-Remove-Metadata-on-reload.patch b/patches/server/0068-Remove-Metadata-on-reload.patch similarity index 88% rename from patches/server/0067-Remove-Metadata-on-reload.patch rename to patches/server/0068-Remove-Metadata-on-reload.patch index f400f87a2a..71aeeaa8e9 100644 --- a/patches/server/0067-Remove-Metadata-on-reload.patch +++ b/patches/server/0068-Remove-Metadata-on-reload.patch @@ -7,10 +7,10 @@ Metadata is not meant to persist reload as things break badly with non primitive This will remove metadata on reload so it does not crash everything if a plugin uses it. diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index c056df734deb0f9ad2e102075e941a7fdcd78195..0b8f2a747b0e869dfd62ef463261941988d8dd16 100644 +index 81982d554c53732621a01c14b565a03e2c623c28..620cce68ec6407d0777d3f6de4d7de308331df8a 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -963,8 +963,16 @@ public final class CraftServer implements Server { +@@ -944,8 +944,16 @@ public final class CraftServer implements Server { world.spigotConfig.init(); // Spigot } diff --git a/patches/server/0068-Handle-Item-Meta-Inconsistencies.patch b/patches/server/0069-Handle-Item-Meta-Inconsistencies.patch similarity index 99% rename from patches/server/0068-Handle-Item-Meta-Inconsistencies.patch rename to patches/server/0069-Handle-Item-Meta-Inconsistencies.patch index b71515e3ff..f559f9ab4a 100644 --- a/patches/server/0068-Handle-Item-Meta-Inconsistencies.patch +++ b/patches/server/0069-Handle-Item-Meta-Inconsistencies.patch @@ -18,7 +18,7 @@ For consistency, the old API methods now forward to use the ItemMeta API equivalents, and should deprecate the old API's. diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index 489cb50f70589c87dd8fb57087e5fa14fd5e1c43..d979c94861f0d38d55fc1ac0214b1313fe5f08f5 100644 +index cf810a1d645dd63595702a5f07456cd48393ee79..87031aa69148118d9f5bf16cb8a55cf72f9d0a1d 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java @@ -155,6 +155,23 @@ public final class ItemStack { diff --git a/patches/server/0069-Configurable-Non-Player-Arrow-Despawn-Rate.patch b/patches/server/0070-Configurable-Non-Player-Arrow-Despawn-Rate.patch similarity index 93% rename from patches/server/0069-Configurable-Non-Player-Arrow-Despawn-Rate.patch rename to patches/server/0070-Configurable-Non-Player-Arrow-Despawn-Rate.patch index d7f13032d9..6a09b0d45d 100644 --- a/patches/server/0069-Configurable-Non-Player-Arrow-Despawn-Rate.patch +++ b/patches/server/0070-Configurable-Non-Player-Arrow-Despawn-Rate.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Configurable Non Player Arrow Despawn Rate Can set a much shorter despawn rate for arrows that players can not pick up. diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java -index eff6a93af46476f173f13fc35ca6c8cec7de37c9..cfd202d32048abcd3e961d9f7f08c1bc6282e601 100644 +index 3e1f5fcf589ad7916adb44b53490ccac947a8799..d4b8364fd860ee2cc632d8c752435b9b311c7ece 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java +++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java @@ -312,7 +312,7 @@ public abstract class AbstractArrow extends Projectile { diff --git a/patches/server/0070-Add-World-Util-Methods.patch b/patches/server/0071-Add-World-Util-Methods.patch similarity index 96% rename from patches/server/0070-Add-World-Util-Methods.patch rename to patches/server/0071-Add-World-Util-Methods.patch index 7e3ff383eb..3302f66c6c 100644 --- a/patches/server/0070-Add-World-Util-Methods.patch +++ b/patches/server/0071-Add-World-Util-Methods.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Add World Util Methods Methods that can be used for other patches to help improve logic. diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 2ad216a533dedb180ea10d9072ce25ebe0283b1a..ad11ff50427177042b8f7331dddfc27f10657522 100644 +index 9c9c8178cd11e37aaef400e40092fb1095fa6c5f..d4b101d0f1835b57f34f68653d728df2bb78faa1 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -219,7 +219,7 @@ public class ServerLevel extends Level implements WorldGenLevel { diff --git a/patches/server/0071-Custom-replacement-for-eaten-items.patch b/patches/server/0072-Custom-replacement-for-eaten-items.patch similarity index 100% rename from patches/server/0071-Custom-replacement-for-eaten-items.patch rename to patches/server/0072-Custom-replacement-for-eaten-items.patch diff --git a/patches/server/0072-handle-NaN-health-absorb-values-and-repair-bad-data.patch b/patches/server/0073-handle-NaN-health-absorb-values-and-repair-bad-data.patch similarity index 94% rename from patches/server/0072-handle-NaN-health-absorb-values-and-repair-bad-data.patch rename to patches/server/0073-handle-NaN-health-absorb-values-and-repair-bad-data.patch index 1fecd6adc9..e01a3e800a 100644 --- a/patches/server/0072-handle-NaN-health-absorb-values-and-repair-bad-data.patch +++ b/patches/server/0073-handle-NaN-health-absorb-values-and-repair-bad-data.patch @@ -44,10 +44,10 @@ index 29495ff2d2c31f6b6ef6e2817662d143e538f926..b2871726eb4dd7f16d161097cbf0f287 } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 79ade05094db16acc07bec28b6b0fd8038fc7a10..2d6dc2dd74e8461bb379f64ebd40f2189844a8ec 100644 +index e4cbd5bee86f7ad26eb78b3c1d279a65b896fb77..2338f20c1af3b93cb6dd1a3c518499e6dd2130c3 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -2014,6 +2014,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -2033,6 +2033,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } public void setRealHealth(double health) { diff --git a/patches/server/0073-Use-a-Shared-Random-for-Entities.patch b/patches/server/0074-Use-a-Shared-Random-for-Entities.patch similarity index 100% rename from patches/server/0073-Use-a-Shared-Random-for-Entities.patch rename to patches/server/0074-Use-a-Shared-Random-for-Entities.patch diff --git a/patches/server/0074-Configurable-spawn-chances-for-skeleton-horses.patch b/patches/server/0075-Configurable-spawn-chances-for-skeleton-horses.patch similarity index 100% rename from patches/server/0074-Configurable-spawn-chances-for-skeleton-horses.patch rename to patches/server/0075-Configurable-spawn-chances-for-skeleton-horses.patch diff --git a/patches/server/0075-Optimize-isInWorldBounds-and-getBlockState-for-inlin.patch b/patches/server/0076-Optimize-isInWorldBounds-and-getBlockState-for-inlin.patch similarity index 98% rename from patches/server/0075-Optimize-isInWorldBounds-and-getBlockState-for-inlin.patch rename to patches/server/0076-Optimize-isInWorldBounds-and-getBlockState-for-inlin.patch index 36f12d3949..5daeba23f9 100644 --- a/patches/server/0075-Optimize-isInWorldBounds-and-getBlockState-for-inlin.patch +++ b/patches/server/0076-Optimize-isInWorldBounds-and-getBlockState-for-inlin.patch @@ -88,7 +88,7 @@ index 8033c8741a0f73919a357893652592b317bfb417..9a1cffd51aaf97f759a9057aefbf50bd @Override public FluidState getFluidState(BlockPos pos) { diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -index b78e89eed44a06bb8c7a8a62e561574d4dc4b2de..ac67a34bee88e502b88a7cb7413f4ab33c7458b4 100644 +index ba24e32f96797ed8c8bd82391d1903f6ad2a9813..2efeccb33d1d5fb148a12f71eae870fbdcb6e0fd 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -342,12 +342,29 @@ public class LevelChunk extends ChunkAccess { diff --git a/patches/server/0076-Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch b/patches/server/0077-Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch similarity index 96% rename from patches/server/0076-Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch rename to patches/server/0077-Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch index 691b792b9e..50d683d3fd 100644 --- a/patches/server/0076-Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch +++ b/patches/server/0077-Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Only process BlockPhysicsEvent if a plugin has a listener Saves on some object allocation and processing when no plugin listens to this diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 8989d13eb6ee94a1dbbe986cfcf0755faaa4e85c..f725fbb64b7d801e4e4c7a6d5e1be6dd96cab047 100644 +index 28d58f402f15ee37cc1bfa3114839db281fc5f57..e62aa86afb05d8f00d8dd2b676407bfa7d0ed9fb 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -1357,6 +1357,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { return worldserver + " " + worldserver.dimension().location(); diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index a99744982184649d927f72675f9cfd29e6909741..6f05f44f1123e1e152ec62d9c9f083c3d0046292 100644 +index 87a81cdd00b19ba020f6506eedd8ac4bf20d32ef..a487331d9df8fa0d58cfb0859c25a8fffe376ac2 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -218,6 +218,7 @@ public class ServerLevel extends Level implements WorldGenLevel { diff --git a/patches/server/0077-Entity-AddTo-RemoveFrom-World-Events.patch b/patches/server/0078-Entity-AddTo-RemoveFrom-World-Events.patch similarity index 100% rename from patches/server/0077-Entity-AddTo-RemoveFrom-World-Events.patch rename to patches/server/0078-Entity-AddTo-RemoveFrom-World-Events.patch diff --git a/patches/server/0078-Configurable-Chunk-Inhabited-Time.patch b/patches/server/0079-Configurable-Chunk-Inhabited-Time.patch similarity index 92% rename from patches/server/0078-Configurable-Chunk-Inhabited-Time.patch rename to patches/server/0079-Configurable-Chunk-Inhabited-Time.patch index 523e9bac95..83eb060041 100644 --- a/patches/server/0078-Configurable-Chunk-Inhabited-Time.patch +++ b/patches/server/0079-Configurable-Chunk-Inhabited-Time.patch @@ -11,7 +11,7 @@ For people who want all chunks to be treated equally, you can chose a fixed valu This allows to fine-tune vanilla gameplay. diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -index ac67a34bee88e502b88a7cb7413f4ab33c7458b4..ef0be4f5ce7f07e38dea9eb356e049bd121c82dd 100644 +index 2efeccb33d1d5fb148a12f71eae870fbdcb6e0fd..b4c76e53eef8dc0efec98848352a243931ffc1f3 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -327,6 +327,13 @@ public class LevelChunk extends ChunkAccess { diff --git a/patches/server/0079-EntityPathfindEvent.patch b/patches/server/0080-EntityPathfindEvent.patch similarity index 100% rename from patches/server/0079-EntityPathfindEvent.patch rename to patches/server/0080-EntityPathfindEvent.patch diff --git a/patches/server/0080-Sanitise-RegionFileCache-and-make-configurable.patch b/patches/server/0081-Sanitise-RegionFileCache-and-make-configurable.patch similarity index 100% rename from patches/server/0080-Sanitise-RegionFileCache-and-make-configurable.patch rename to patches/server/0081-Sanitise-RegionFileCache-and-make-configurable.patch diff --git a/patches/server/0081-Do-not-load-chunks-for-Pathfinding.patch b/patches/server/0082-Do-not-load-chunks-for-Pathfinding.patch similarity index 100% rename from patches/server/0081-Do-not-load-chunks-for-Pathfinding.patch rename to patches/server/0082-Do-not-load-chunks-for-Pathfinding.patch diff --git a/patches/server/0082-Add-PlayerUseUnknownEntityEvent.patch b/patches/server/0083-Add-PlayerUseUnknownEntityEvent.patch similarity index 95% rename from patches/server/0082-Add-PlayerUseUnknownEntityEvent.patch rename to patches/server/0083-Add-PlayerUseUnknownEntityEvent.patch index ca2265c4ab..251501fad1 100644 --- a/patches/server/0082-Add-PlayerUseUnknownEntityEvent.patch +++ b/patches/server/0083-Add-PlayerUseUnknownEntityEvent.patch @@ -22,10 +22,10 @@ index a5d57cc862036012d83b090bb1b3ccf4115a88b3..21068f766b75c414d5818073b7dca083 static final ServerboundInteractPacket.Action ATTACK_ACTION = new ServerboundInteractPacket.Action() { @Override diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 8f21a18d2ba6e9fc1c8d3076ca668c885a9ba19e..26652b91b03e1c94c05f61c99afc59ac0bb0243a 100644 +index f49a8a0f56bc3dd9e8a33cfefefed414e56153fd..8bed76ec7692a75f12e724a36f3dd9050760b7ea 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2519,8 +2519,37 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2525,8 +2525,37 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic }); } } diff --git a/patches/server/0083-Configurable-Grass-Spread-Tick-Rate.patch b/patches/server/0084-Configurable-Grass-Spread-Tick-Rate.patch similarity index 100% rename from patches/server/0083-Configurable-Grass-Spread-Tick-Rate.patch rename to patches/server/0084-Configurable-Grass-Spread-Tick-Rate.patch diff --git a/patches/server/0084-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch b/patches/server/0085-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch similarity index 100% rename from patches/server/0084-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch rename to patches/server/0085-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch diff --git a/patches/server/0085-Optimize-DataBits.patch b/patches/server/0086-Optimize-DataBits.patch similarity index 100% rename from patches/server/0085-Optimize-DataBits.patch rename to patches/server/0086-Optimize-DataBits.patch diff --git a/patches/server/0086-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch b/patches/server/0087-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch similarity index 100% rename from patches/server/0086-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch rename to patches/server/0087-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch diff --git a/patches/server/0087-Configurable-Player-Collision.patch b/patches/server/0088-Configurable-Player-Collision.patch similarity index 98% rename from patches/server/0087-Configurable-Player-Collision.patch rename to patches/server/0088-Configurable-Player-Collision.patch index f8398467c2..6d8be22412 100644 --- a/patches/server/0087-Configurable-Player-Collision.patch +++ b/patches/server/0088-Configurable-Player-Collision.patch @@ -43,7 +43,7 @@ index e62aa86afb05d8f00d8dd2b676407bfa7d0ed9fb..aab7ea2bbc9066b206b15cceb4db49aa this.server.getPluginManager().callEvent(new ServerLoadEvent(ServerLoadEvent.LoadType.STARTUP)); this.connection.acceptConnections(); diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index b33b5e731eaed8a3b42d4d318c41f8c6f1d6977c..0317839ee6f1bbfb20466334dd63ff0e7f7da5fb 100644 +index 22b9f0b3764907fc3c3d8bf8d42ef84ff237cd71..581cb78d5e96a6f34a16d4805410ca5ffc329068 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -98,6 +98,7 @@ import net.minecraft.world.level.storage.PlayerDataStorage; diff --git a/patches/server/0088-Add-handshake-event-to-allow-plugins-to-handle-clien.patch b/patches/server/0089-Add-handshake-event-to-allow-plugins-to-handle-clien.patch similarity index 100% rename from patches/server/0088-Add-handshake-event-to-allow-plugins-to-handle-clien.patch rename to patches/server/0089-Add-handshake-event-to-allow-plugins-to-handle-clien.patch diff --git a/patches/server/0089-Configurable-RCON-IP-address.patch b/patches/server/0090-Configurable-RCON-IP-address.patch similarity index 100% rename from patches/server/0089-Configurable-RCON-IP-address.patch rename to patches/server/0090-Configurable-RCON-IP-address.patch diff --git a/patches/server/0090-EntityRegainHealthEvent-isFastRegen-API.patch b/patches/server/0091-EntityRegainHealthEvent-isFastRegen-API.patch similarity index 100% rename from patches/server/0090-EntityRegainHealthEvent-isFastRegen-API.patch rename to patches/server/0091-EntityRegainHealthEvent-isFastRegen-API.patch diff --git a/patches/server/0091-Add-ability-to-configure-frosted_ice-properties.patch b/patches/server/0092-Add-ability-to-configure-frosted_ice-properties.patch similarity index 100% rename from patches/server/0091-Add-ability-to-configure-frosted_ice-properties.patch rename to patches/server/0092-Add-ability-to-configure-frosted_ice-properties.patch diff --git a/patches/server/0092-remove-null-possibility-for-getServer-singleton.patch b/patches/server/0093-remove-null-possibility-for-getServer-singleton.patch similarity index 95% rename from patches/server/0092-remove-null-possibility-for-getServer-singleton.patch rename to patches/server/0093-remove-null-possibility-for-getServer-singleton.patch index 9728fbb500..dde28793b1 100644 --- a/patches/server/0092-remove-null-possibility-for-getServer-singleton.patch +++ b/patches/server/0093-remove-null-possibility-for-getServer-singleton.patch @@ -6,7 +6,7 @@ Subject: [PATCH] remove null possibility for getServer singleton to stop IDE complaining about potential NPE diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index aa70fb1160e8d88739ea372832a69569199ab8ab..dfb9bcfebb064a8445b19d149edcef45334367c5 100644 +index aab7ea2bbc9066b206b15cceb4db49aa230ebafd..3ed50490121f34ab5b247565b9a4555bf6a46dff 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -193,6 +193,7 @@ import co.aikar.timings.MinecraftTimings; // Paper diff --git a/patches/server/0093-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch b/patches/server/0094-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch similarity index 98% rename from patches/server/0093-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch rename to patches/server/0094-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch index 01f53af301..c7288e0739 100644 --- a/patches/server/0093-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch +++ b/patches/server/0094-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch @@ -25,7 +25,7 @@ index 0d08690aade0e3334c583b62e0abf7bbab9a0c59..349a9f4596cd1411ec3a69cd7d6f5414 } } diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index 08c76c56e493f01bc159312aef512886631682f3..379834a8b197a2f32aaebf4ebed635e7eba84479 100644 +index 60fb74537fdc96005cbf6aa1670e773c0faa2f26..7322c15921e05aaf0dafed89e1d90f2748efb2a9 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -758,6 +758,14 @@ public abstract class Player extends LivingEntity { diff --git a/patches/server/0094-LootTable-API-Replenishable-Lootables-Feature.patch b/patches/server/0095-LootTable-API-Replenishable-Lootables-Feature.patch similarity index 100% rename from patches/server/0094-LootTable-API-Replenishable-Lootables-Feature.patch rename to patches/server/0095-LootTable-API-Replenishable-Lootables-Feature.patch diff --git a/patches/server/0095-Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch b/patches/server/0096-Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch similarity index 100% rename from patches/server/0095-Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch rename to patches/server/0096-Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch diff --git a/patches/server/0096-System-property-for-disabling-watchdoge.patch b/patches/server/0097-System-property-for-disabling-watchdoge.patch similarity index 100% rename from patches/server/0096-System-property-for-disabling-watchdoge.patch rename to patches/server/0097-System-property-for-disabling-watchdoge.patch diff --git a/patches/server/0097-Async-GameProfileCache-saving.patch b/patches/server/0098-Async-GameProfileCache-saving.patch similarity index 97% rename from patches/server/0097-Async-GameProfileCache-saving.patch rename to patches/server/0098-Async-GameProfileCache-saving.patch index b010e736f7..f7d915bad3 100644 --- a/patches/server/0097-Async-GameProfileCache-saving.patch +++ b/patches/server/0098-Async-GameProfileCache-saving.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Async GameProfileCache saving diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index dfb9bcfebb064a8445b19d149edcef45334367c5..1ba7fe6b51b5e1555617bc65619c4ff82fd564cb 100644 +index 3ed50490121f34ab5b247565b9a4555bf6a46dff..0a419ec121bbddffa0424147c642f79d4e5eb817 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -934,7 +934,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop pendingBlockEntityTickers = Lists.newArrayList(); private boolean tickingBlockEntities; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 3ad15c0909d14c6f974e9bf82055c3c332577526..5a17b0c2e185bd50201a5d954322e41d42e2dae3 100644 +index 958c5faeddd3ee54ac2880eb3eb9e4ab2bba2540..3f6e5e4d36e8170def4ce50e29cdfcc7e25f4f4d 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -151,6 +151,56 @@ public class CraftWorld extends CraftRegionAccessor implements World { diff --git a/patches/server/0126-Enforce-Sync-Player-Saves.patch b/patches/server/0127-Enforce-Sync-Player-Saves.patch similarity index 92% rename from patches/server/0126-Enforce-Sync-Player-Saves.patch rename to patches/server/0127-Enforce-Sync-Player-Saves.patch index 5cc43229a2..2275c61795 100644 --- a/patches/server/0126-Enforce-Sync-Player-Saves.patch +++ b/patches/server/0127-Enforce-Sync-Player-Saves.patch @@ -7,7 +7,7 @@ Saving players async is extremely dangerous. This will force it to main the same way we handle async chunk loads. diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 796e8d85093756deb4bc25eb2af9981944ba1bf4..70b19aeba089f48cf53e259fce1339c7b31cd133 100644 +index 581cb78d5e96a6f34a16d4805410ca5ffc329068..ea2a07bc3395c884feac7d05d3fd41b5e10dc270 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -1052,11 +1052,13 @@ public abstract class PlayerList { diff --git a/patches/server/0127-Don-t-allow-entities-to-ride-themselves-572.patch b/patches/server/0128-Don-t-allow-entities-to-ride-themselves-572.patch similarity index 100% rename from patches/server/0127-Don-t-allow-entities-to-ride-themselves-572.patch rename to patches/server/0128-Don-t-allow-entities-to-ride-themselves-572.patch diff --git a/patches/server/0128-ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch b/patches/server/0129-ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch similarity index 99% rename from patches/server/0128-ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch rename to patches/server/0129-ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch index 0d4027161e..9e41b0f23a 100644 --- a/patches/server/0128-ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch +++ b/patches/server/0129-ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch @@ -245,7 +245,7 @@ index 9bc9307966b77e34cb091fc895db3d3a66f7be82..e594cf4b8084b7448c29208a2070e766 } diff --git a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java -index 354fed07a1c8d88c97350be11388925e5bf82f9e..ff7b5fea13be9a64e5886f8fe337802cbc5d19b2 100644 +index 9d0df8d64a2cfd2458295a214829f277798030f0..75449d8575ac1b67aaa94d0f3fc08244728ec8a8 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java +++ b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java @@ -514,7 +514,7 @@ public class FishingHook extends Projectile { @@ -271,7 +271,7 @@ index db6b1a9804a6d75dce22b780044beb04ca69cc94..dcbbff3a8dfcac869f07025e0e8e3d9c } diff --git a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java -index ec7a95173a67052e841a3fe69a8d2621a1ccd2b9..9010656b7f013d50872017a298368ec8a3016e9c 100644 +index 3a4808cd669d68e030de081ba17e028cbb652386..e3c3d202a9852adf32d5e94c9011c3799668419b 100644 --- a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java +++ b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java @@ -97,7 +97,7 @@ public class GrindstoneMenu extends AbstractContainerMenu { diff --git a/patches/server/0129-Cap-Entity-Collisions.patch b/patches/server/0130-Cap-Entity-Collisions.patch similarity index 100% rename from patches/server/0129-Cap-Entity-Collisions.patch rename to patches/server/0130-Cap-Entity-Collisions.patch diff --git a/patches/server/0130-Remove-CraftScheduler-Async-Task-Debugger.patch b/patches/server/0131-Remove-CraftScheduler-Async-Task-Debugger.patch similarity index 100% rename from patches/server/0130-Remove-CraftScheduler-Async-Task-Debugger.patch rename to patches/server/0131-Remove-CraftScheduler-Async-Task-Debugger.patch diff --git a/patches/server/0131-Do-not-let-armorstands-drown.patch b/patches/server/0132-Do-not-let-armorstands-drown.patch similarity index 100% rename from patches/server/0131-Do-not-let-armorstands-drown.patch rename to patches/server/0132-Do-not-let-armorstands-drown.patch diff --git a/patches/server/0132-Properly-handle-async-calls-to-restart-the-server.patch b/patches/server/0133-Properly-handle-async-calls-to-restart-the-server.patch similarity index 99% rename from patches/server/0132-Properly-handle-async-calls-to-restart-the-server.patch rename to patches/server/0133-Properly-handle-async-calls-to-restart-the-server.patch index 4b031cd667..a71fecdc13 100644 --- a/patches/server/0132-Properly-handle-async-calls-to-restart-the-server.patch +++ b/patches/server/0133-Properly-handle-async-calls-to-restart-the-server.patch @@ -64,7 +64,7 @@ index 0a419ec121bbddffa0424147c642f79d4e5eb817..ddc446e54b69c79fa0153478bb859bf9 if (waitForShutdown) { try { diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index b2cd38950587f404a53b81e1434a2039aa7b2f15..951246fe30327ac54a8e3e3685ad75841421cbc4 100644 +index ea2a07bc3395c884feac7d05d3fd41b5e10dc270..e6a47361db762bd4b54e28d3665a4aee72f91c19 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -1164,8 +1164,15 @@ public abstract class PlayerList { diff --git a/patches/server/0133-Add-option-to-make-parrots-stay-on-shoulders-despite.patch b/patches/server/0134-Add-option-to-make-parrots-stay-on-shoulders-despite.patch similarity index 92% rename from patches/server/0133-Add-option-to-make-parrots-stay-on-shoulders-despite.patch rename to patches/server/0134-Add-option-to-make-parrots-stay-on-shoulders-despite.patch index f2bf5b5f78..de73ca1fc0 100644 --- a/patches/server/0133-Add-option-to-make-parrots-stay-on-shoulders-despite.patch +++ b/patches/server/0134-Add-option-to-make-parrots-stay-on-shoulders-despite.patch @@ -14,7 +14,7 @@ To be converted into a Paper-API event at some point in the future? public net.minecraft.world.entity.player.Player removeEntitiesOnShoulder()V diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index ad72e852e05c50effa195b112ff67b6d18a1eea2..ca894b92215f431a31b69ee2910ce023177f3e6e 100644 +index 15470487e8ea0dd36aa961e6f6ad124b3ba6dcc0..c2d6fa75164dd98ff012611d4da354a6b48cf058 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -2327,6 +2327,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -32,7 +32,7 @@ index ad72e852e05c50effa195b112ff67b6d18a1eea2..ca894b92215f431a31b69ee2910ce023 case RELEASE_SHIFT_KEY: this.player.setShiftKeyDown(false); diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index 379834a8b197a2f32aaebf4ebed635e7eba84479..a07ca7eca7ca38c47ae2c23f048c02a7869197aa 100644 +index 7322c15921e05aaf0dafed89e1d90f2748efb2a9..dbfb979a9ee826ed771da8d0593732ac74bc167b 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -583,7 +583,7 @@ public abstract class Player extends LivingEntity { diff --git a/patches/server/0134-Add-configuration-option-to-prevent-player-names-fro.patch b/patches/server/0135-Add-configuration-option-to-prevent-player-names-fro.patch similarity index 83% rename from patches/server/0134-Add-configuration-option-to-prevent-player-names-fro.patch rename to patches/server/0135-Add-configuration-option-to-prevent-player-names-fro.patch index 16726b815c..60d9853c8d 100644 --- a/patches/server/0134-Add-configuration-option-to-prevent-player-names-fro.patch +++ b/patches/server/0135-Add-configuration-option-to-prevent-player-names-fro.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Add configuration option to prevent player names from being diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 5cda3f24048fc734d727fd4ea07c676203b88f89..5e4bd49319c20461d5828489d0379601e0398005 100644 +index b1f7b5fe81fa179a6689422c4d3de5e2c8339552..6a0f2a8a12a4072d235c3d036ad253ba4a66fa6e 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2609,5 +2609,10 @@ public final class CraftServer implements Server { +@@ -2590,5 +2590,10 @@ public final class CraftServer implements Server { commandMap.registerServerAliases(); return true; } diff --git a/patches/server/0135-Use-TerminalConsoleAppender-for-console-improvements.patch b/patches/server/0136-Use-TerminalConsoleAppender-for-console-improvements.patch similarity index 98% rename from patches/server/0135-Use-TerminalConsoleAppender-for-console-improvements.patch rename to patches/server/0136-Use-TerminalConsoleAppender-for-console-improvements.patch index bb254a9186..4cbee2372e 100644 --- a/patches/server/0135-Use-TerminalConsoleAppender-for-console-improvements.patch +++ b/patches/server/0136-Use-TerminalConsoleAppender-for-console-improvements.patch @@ -19,7 +19,7 @@ Other changes: configuration diff --git a/build.gradle.kts b/build.gradle.kts -index ebf3d64afbb5679b97a7565a2f8e5490e4a38275..8407beb0c47660f7d310d27f3a47120b80c5b189 100644 +index 4ccaf2ac6f6ff3310ca2f0a0672875f2ab1f718f..568f18944cb229206c3db901d9bd7ce881983f88 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,17 @@ plugins { @@ -222,7 +222,7 @@ index 35904c69e14c4c0addda204d5e3788518c2e16c4..e6826cd0a596f063e8737dcde3c8c6c5 System.setOut(IoBuilder.forLogger(logger).setLevel(Level.INFO).buildPrintStream()); System.setErr(IoBuilder.forLogger(logger).setLevel(Level.WARN).buildPrintStream()); diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 67e13b8510eeecf16caae9fbbbeb463b794c460d..07be6f1e87b62772728abd2e48af91f1bd756a2e 100644 +index e6a47361db762bd4b54e28d3665a4aee72f91c19..30a017c54c334f0a8463186367c97c2cc5d06217 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -165,8 +165,7 @@ public abstract class PlayerList { @@ -236,7 +236,7 @@ index 67e13b8510eeecf16caae9fbbbeb463b794c460d..07be6f1e87b62772728abd2e48af91f1 this.bans = new UserBanList(PlayerList.USERBANLIST_FILE); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 5e4bd49319c20461d5828489d0379601e0398005..bc2bbddde33738db0e46f0dbe39fe62c6d34126b 100644 +index 6a0f2a8a12a4072d235c3d036ad253ba4a66fa6e..95e64a7f0ab010798571b0b6a86dfad43003af62 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -48,7 +48,6 @@ import java.util.logging.Level; @@ -247,7 +247,7 @@ index 5e4bd49319c20461d5828489d0379601e0398005..bc2bbddde33738db0e46f0dbe39fe62c import net.minecraft.advancements.Advancement; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; -@@ -1303,9 +1302,13 @@ public final class CraftServer implements Server { +@@ -1284,9 +1283,13 @@ public final class CraftServer implements Server { return this.logger; } @@ -262,7 +262,7 @@ index 5e4bd49319c20461d5828489d0379601e0398005..bc2bbddde33738db0e46f0dbe39fe62c @Override public PluginCommand getPluginCommand(String name) { diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 1cbea000018436fcbc343e7512a0700c776d6441..75f5a3eb8730af1fea5bedbe168dcffacdbc85ad 100644 +index 47c97c16eb23cdd485858c39c571a7ef5ac6d594..7004baa10a6df287239db868dce64d054105040c 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -12,7 +12,7 @@ import java.util.logging.Level; diff --git a/patches/server/0136-provide-a-configurable-option-to-disable-creeper-lin.patch b/patches/server/0137-provide-a-configurable-option-to-disable-creeper-lin.patch similarity index 100% rename from patches/server/0136-provide-a-configurable-option-to-disable-creeper-lin.patch rename to patches/server/0137-provide-a-configurable-option-to-disable-creeper-lin.patch diff --git a/patches/server/0137-Item-canEntityPickup.patch b/patches/server/0138-Item-canEntityPickup.patch similarity index 100% rename from patches/server/0137-Item-canEntityPickup.patch rename to patches/server/0138-Item-canEntityPickup.patch diff --git a/patches/server/0138-PlayerPickupItemEvent-setFlyAtPlayer.patch b/patches/server/0139-PlayerPickupItemEvent-setFlyAtPlayer.patch similarity index 100% rename from patches/server/0138-PlayerPickupItemEvent-setFlyAtPlayer.patch rename to patches/server/0139-PlayerPickupItemEvent-setFlyAtPlayer.patch diff --git a/patches/server/0139-PlayerAttemptPickupItemEvent.patch b/patches/server/0140-PlayerAttemptPickupItemEvent.patch similarity index 100% rename from patches/server/0139-PlayerAttemptPickupItemEvent.patch rename to patches/server/0140-PlayerAttemptPickupItemEvent.patch diff --git a/patches/server/0141-Add-UnknownCommandEvent.patch b/patches/server/0141-Add-UnknownCommandEvent.patch deleted file mode 100644 index 8d8c45d1f2..0000000000 --- a/patches/server/0141-Add-UnknownCommandEvent.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Sweepyoface -Date: Sat, 17 Jun 2017 18:48:21 -0400 -Subject: [PATCH] Add UnknownCommandEvent - - -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 565f9d18b529974c53e6aa8cefa5fc01ad7ad0fd..19386ae876637051f42567acc5749dc13b5e71f6 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -905,7 +905,13 @@ public final class CraftServer implements Server { - - // Spigot start - if (!org.spigotmc.SpigotConfig.unknownCommandMessage.isEmpty()) { -- sender.sendMessage(org.spigotmc.SpigotConfig.unknownCommandMessage); -+ // Paper start -+ org.bukkit.event.command.UnknownCommandEvent event = new org.bukkit.event.command.UnknownCommandEvent(sender, commandLine, org.spigotmc.SpigotConfig.unknownCommandMessage); -+ Bukkit.getServer().getPluginManager().callEvent(event); -+ if (event.message() != null) { -+ sender.sendMessage(event.message()); -+ } -+ // Paper end - } - // Spigot end - diff --git a/patches/server/0140-Do-not-submit-profile-lookups-to-worldgen-threads.patch b/patches/server/0141-Do-not-submit-profile-lookups-to-worldgen-threads.patch similarity index 100% rename from patches/server/0140-Do-not-submit-profile-lookups-to-worldgen-threads.patch rename to patches/server/0141-Do-not-submit-profile-lookups-to-worldgen-threads.patch diff --git a/patches/server/0142-Add-UnknownCommandEvent.patch b/patches/server/0142-Add-UnknownCommandEvent.patch new file mode 100644 index 0000000000..48b0b77034 --- /dev/null +++ b/patches/server/0142-Add-UnknownCommandEvent.patch @@ -0,0 +1,111 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Sweepyoface +Date: Sat, 17 Jun 2017 18:48:21 -0400 +Subject: [PATCH] Add UnknownCommandEvent + +Co-authored-by: Jake Potrebic + +diff --git a/src/main/java/net/minecraft/commands/CommandSourceStack.java b/src/main/java/net/minecraft/commands/CommandSourceStack.java +index 36bbe7d0b2089361beda89097c15eca9ab48a57d..65d8c7d5aab8c6afe3c5671a90ad0fbc03bedfdd 100644 +--- a/src/main/java/net/minecraft/commands/CommandSourceStack.java ++++ b/src/main/java/net/minecraft/commands/CommandSourceStack.java +@@ -328,8 +328,13 @@ public class CommandSourceStack implements SharedSuggestionProvider { + } + + public void sendFailure(Component message) { ++ // Paper start ++ this.sendFailure(message, true); ++ } ++ public void sendFailure(Component message, boolean withStyle) { ++ // Paper end + if (this.source.acceptsFailure() && !this.silent) { +- this.source.sendSystemMessage(Component.empty().append(message).withStyle(ChatFormatting.RED)); ++ this.source.sendSystemMessage(withStyle ? Component.empty().append(message).withStyle(ChatFormatting.RED) : message); // Paper + } + + } +diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java +index 9eaa7ad424252ea2e033d6041a14bf1ef7dd9fde..4cf76403098cc8565199b29757a29c80150bbaae 100644 +--- a/src/main/java/net/minecraft/commands/Commands.java ++++ b/src/main/java/net/minecraft/commands/Commands.java +@@ -133,6 +133,7 @@ public class Commands { + public static final int LEVEL_ADMINS = 3; + public static final int LEVEL_OWNERS = 4; + private final com.mojang.brigadier.CommandDispatcher dispatcher = new com.mojang.brigadier.CommandDispatcher(); ++ public final java.util.List> vanillaCommandNodes = new java.util.ArrayList<>(); // Paper + + public Commands(Commands.CommandSelection environment, CommandBuildContext commandRegistryAccess) { + this(); // CraftBukkit +@@ -220,6 +221,7 @@ public class Commands { + if (environment.includeIntegrated) { + PublishCommand.register(this.dispatcher); + } ++ this.vanillaCommandNodes.addAll(this.dispatcher.getRoot().getChildren()); // Paper + + // CraftBukkit start + } +@@ -311,7 +313,16 @@ public class Commands { + b1 = 0; + return b1; + } catch (CommandSyntaxException commandsyntaxexception) { +- commandlistenerwrapper.sendFailure(ComponentUtils.fromMessage(commandsyntaxexception.getRawMessage())); ++ // Paper start ++ final net.kyori.adventure.text.TextComponent.Builder builder = net.kyori.adventure.text.Component.text(); ++ if ((parseresults.getContext().getNodes().isEmpty() || !this.vanillaCommandNodes.contains(parseresults.getContext().getNodes().get(0).getNode()))) { ++ if (!org.spigotmc.SpigotConfig.unknownCommandMessage.isEmpty()) { ++ builder.append(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(org.spigotmc.SpigotConfig.unknownCommandMessage)); ++ } ++ } else { ++ // commandlistenerwrapper.sendFailure(ComponentUtils.fromMessage(commandsyntaxexception.getRawMessage())); ++ builder.color(net.kyori.adventure.text.format.NamedTextColor.RED).append(io.papermc.paper.brigadier.PaperBrigadier.componentFromMessage(commandsyntaxexception.getRawMessage())); ++ // Paper end + if (commandsyntaxexception.getInput() != null && commandsyntaxexception.getCursor() >= 0) { + int j = Math.min(commandsyntaxexception.getInput().length(), commandsyntaxexception.getCursor()); + MutableComponent ichatmutablecomponent = Component.empty().withStyle(ChatFormatting.GRAY).withStyle((chatmodifier) -> { +@@ -330,7 +341,18 @@ public class Commands { + } + + ichatmutablecomponent.append((Component) Component.translatable("command.context.here").withStyle(ChatFormatting.RED, ChatFormatting.ITALIC)); +- commandlistenerwrapper.sendFailure(ichatmutablecomponent); ++ // Paper start ++ // commandlistenerwrapper.sendFailure(ichatmutablecomponent); ++ builder ++ .append(net.kyori.adventure.text.Component.newline()) ++ .append(io.papermc.paper.adventure.PaperAdventure.asAdventure(ichatmutablecomponent)); ++ } ++ } ++ org.bukkit.event.command.UnknownCommandEvent event = new org.bukkit.event.command.UnknownCommandEvent(commandlistenerwrapper.getBukkitSender(), s, org.spigotmc.SpigotConfig.unknownCommandMessage.isEmpty() ? null : builder.build()); ++ org.bukkit.Bukkit.getServer().getPluginManager().callEvent(event); ++ if (event.message() != null) { ++ commandlistenerwrapper.sendFailure(io.papermc.paper.adventure.PaperAdventure.asVanilla(event.message()), false); ++ // Paper end + } + + b1 = 0; +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +index 95e64a7f0ab010798571b0b6a86dfad43003af62..e17507dfbf9dc9634a0839a045c741bd38ab45ad 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +@@ -512,6 +512,7 @@ public final class CraftServer implements Server { + + if (command instanceof VanillaCommandWrapper) { + LiteralCommandNode node = (LiteralCommandNode) ((VanillaCommandWrapper) command).vanillaCommand; ++ dispatcher.vanillaCommandNodes.add(node); // Paper + if (!node.getLiteral().equals(label)) { + LiteralCommandNode clone = new LiteralCommandNode(label, node.getCommand(), node.getRequirement(), node.getRedirect(), node.getRedirectModifier(), node.isFork()); + +@@ -886,7 +887,13 @@ public final class CraftServer implements Server { + + // Spigot start + if (!org.spigotmc.SpigotConfig.unknownCommandMessage.isEmpty()) { +- sender.sendMessage(org.spigotmc.SpigotConfig.unknownCommandMessage); ++ // Paper start ++ org.bukkit.event.command.UnknownCommandEvent event = new org.bukkit.event.command.UnknownCommandEvent(sender, commandLine, net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(org.spigotmc.SpigotConfig.unknownCommandMessage)); ++ Bukkit.getServer().getPluginManager().callEvent(event); ++ if (event.message() != null) { ++ sender.sendMessage(event.message()); ++ } ++ // Paper end + } + // Spigot end + diff --git a/patches/server/0142-Basic-PlayerProfile-API.patch b/patches/server/0143-Basic-PlayerProfile-API.patch similarity index 98% rename from patches/server/0142-Basic-PlayerProfile-API.patch rename to patches/server/0143-Basic-PlayerProfile-API.patch index d485577afa..c2e9ac174c 100644 --- a/patches/server/0142-Basic-PlayerProfile-API.patch +++ b/patches/server/0143-Basic-PlayerProfile-API.patch @@ -596,10 +596,10 @@ index cf3e083c2ada3275a52c303de16a62576696e83f..b19850ae31f6c796cb3491dd5070d28e * Calculates distance between 2 entities * @param e1 diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java -index e600563a9d2ddbfa37c106481decb13e67f71524..7c1ad1e39c3b3dfd476133ef4d938187b7a11f09 100644 +index 8d61e388bbdfd6097f914fc5f122fdf7f9b9ffe2..c364ff90ea72ba45bc453ea78ca08c1c3fbf35dd 100644 --- a/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java -@@ -158,7 +158,7 @@ public class Main { +@@ -169,7 +169,7 @@ public class Main { } File file = (File) optionset.valueOf("universe"); // CraftBukkit @@ -631,7 +631,7 @@ index 4038bb76339d43f18770624bd7fecc79b8d7f2a9..2456edc11b29a92b1648937cd3dd6a9a String s1 = name.toLowerCase(Locale.ROOT); GameProfileCache.GameProfileInfo usercache_usercacheentry = (GameProfileCache.GameProfileInfo) this.profilesByName.get(s1); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index d53d3a29ab58966dafae76c69d9a68dccbae4de6..bc8a2d9a4388887c8e49dd9e5ceebd0ca3b0e893 100644 +index e17507dfbf9dc9634a0839a045c741bd38ab45ad..dce99265f1a3ef2b54bab3f3bad431f3f8dde888 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -257,6 +257,9 @@ import org.yaml.snakeyaml.error.MarkedYAMLException; @@ -644,7 +644,7 @@ index d53d3a29ab58966dafae76c69d9a68dccbae4de6..bc8a2d9a4388887c8e49dd9e5ceebd0c public final class CraftServer implements Server { private final String serverName = "Paper"; // Paper private final String serverVersion; -@@ -297,6 +300,7 @@ public final class CraftServer implements Server { +@@ -298,6 +301,7 @@ public final class CraftServer implements Server { static { ConfigurationSerialization.registerClass(CraftOfflinePlayer.class); ConfigurationSerialization.registerClass(CraftPlayerProfile.class); @@ -652,7 +652,7 @@ index d53d3a29ab58966dafae76c69d9a68dccbae4de6..bc8a2d9a4388887c8e49dd9e5ceebd0c CraftItemFactory.instance(); } -@@ -2623,5 +2627,37 @@ public final class CraftServer implements Server { +@@ -2605,5 +2609,37 @@ public final class CraftServer implements Server { public boolean suggestPlayerNamesWhenNullTabCompletions() { return io.papermc.paper.configuration.GlobalConfiguration.get().commands.suggestPlayerNamesWhenNullTabCompletions; } diff --git a/patches/server/0143-Shoulder-Entities-Release-API.patch b/patches/server/0144-Shoulder-Entities-Release-API.patch similarity index 93% rename from patches/server/0143-Shoulder-Entities-Release-API.patch rename to patches/server/0144-Shoulder-Entities-Release-API.patch index ba498b66ee..f20c39ec01 100644 --- a/patches/server/0143-Shoulder-Entities-Release-API.patch +++ b/patches/server/0144-Shoulder-Entities-Release-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Shoulder Entities Release API diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index a07ca7eca7ca38c47ae2c23f048c02a7869197aa..05b32ac76dbc3c0a16380cab82415dac6aff25de 100644 +index dbfb979a9ee826ed771da8d0593732ac74bc167b..095d459962841f7247a9365aff3bdf83bc0b3589 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -2008,20 +2008,44 @@ public abstract class Player extends LivingEntity { @@ -58,10 +58,10 @@ index a07ca7eca7ca38c47ae2c23f048c02a7869197aa..05b32ac76dbc3c0a16380cab82415dac @Override public abstract boolean isSpectator(); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -index 19549dda26c24388bd13a5a2579789e2d1e3ad88..3ca0d08a9e6511b8a96abcf0807a77d52f303a44 100644 +index e38c32708ac7969dbc342989d2a5a767e26e4c3d..139c4310a31b6cc149de140751cb8bf3d8226010 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -@@ -507,6 +507,32 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { +@@ -517,6 +517,32 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { this.getHandle().getCooldowns().addCooldown(CraftMagicNumbers.getItem(material), ticks); } diff --git a/patches/server/0144-Profile-Lookup-Events.patch b/patches/server/0145-Profile-Lookup-Events.patch similarity index 100% rename from patches/server/0144-Profile-Lookup-Events.patch rename to patches/server/0145-Profile-Lookup-Events.patch diff --git a/patches/server/0145-Block-player-logins-during-server-shutdown.patch b/patches/server/0146-Block-player-logins-during-server-shutdown.patch similarity index 92% rename from patches/server/0145-Block-player-logins-during-server-shutdown.patch rename to patches/server/0146-Block-player-logins-during-server-shutdown.patch index 44f91d0f0d..d034ffd001 100644 --- a/patches/server/0145-Block-player-logins-during-server-shutdown.patch +++ b/patches/server/0146-Block-player-logins-during-server-shutdown.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Block player logins during server shutdown diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index d14b7265a075f883f39d078b0d57bccdd7b3ff41..0d55dc89e4577fb6804e08281aaa12ac783bbbe0 100644 +index 453a9dd794c39be5e7221b05fabb71b802691003..897b72d230976594c33cdb80706e9ce594d0b0f5 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java @@ -71,6 +71,12 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, diff --git a/patches/server/0146-Entity-fromMobSpawner.patch b/patches/server/0147-Entity-fromMobSpawner.patch similarity index 97% rename from patches/server/0146-Entity-fromMobSpawner.patch rename to patches/server/0147-Entity-fromMobSpawner.patch index 7e2129fe2d..a26f31e6ce 100644 --- a/patches/server/0146-Entity-fromMobSpawner.patch +++ b/patches/server/0147-Entity-fromMobSpawner.patch @@ -37,7 +37,7 @@ index 760596375e26b4cd73cc378758f4bf761c3352a5..66b727c533d3a2b7b5938ab9b9b7b4a7 } catch (Throwable throwable) { diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java -index cf9a0addcbec3f78a541fad85697961ed8ec884b..6b6f81f3e9e55c1f41599ccbf65e35d79749a77d 100644 +index b214a79efc4f5279d3dd29feb1f79efc45788a8d..7e436a2cbf1920c985cb9febf1839adc589c2619 100644 --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java @@ -163,6 +163,7 @@ public abstract class BaseSpawner { diff --git a/patches/server/0147-Improve-the-Saddle-API-for-Horses.patch b/patches/server/0148-Improve-the-Saddle-API-for-Horses.patch similarity index 100% rename from patches/server/0147-Improve-the-Saddle-API-for-Horses.patch rename to patches/server/0148-Improve-the-Saddle-API-for-Horses.patch diff --git a/patches/server/0148-Implement-ensureServerConversions-API.patch b/patches/server/0149-Implement-ensureServerConversions-API.patch similarity index 100% rename from patches/server/0148-Implement-ensureServerConversions-API.patch rename to patches/server/0149-Implement-ensureServerConversions-API.patch diff --git a/patches/server/0149-Implement-getI18NDisplayName.patch b/patches/server/0150-Implement-getI18NDisplayName.patch similarity index 100% rename from patches/server/0149-Implement-getI18NDisplayName.patch rename to patches/server/0150-Implement-getI18NDisplayName.patch diff --git a/patches/server/0150-ProfileWhitelistVerifyEvent.patch b/patches/server/0151-ProfileWhitelistVerifyEvent.patch similarity index 97% rename from patches/server/0150-ProfileWhitelistVerifyEvent.patch rename to patches/server/0151-ProfileWhitelistVerifyEvent.patch index cef6b13bc1..2d58743d63 100644 --- a/patches/server/0150-ProfileWhitelistVerifyEvent.patch +++ b/patches/server/0151-ProfileWhitelistVerifyEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] ProfileWhitelistVerifyEvent diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 07be6f1e87b62772728abd2e48af91f1bd756a2e..216ad4d729d8996bb4f5bc696fd168f65b076994 100644 +index 30a017c54c334f0a8463186367c97c2cc5d06217..5b5f7aefd2e2a7c977605c84a9c005eb4afe4ba3 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -629,9 +629,9 @@ public abstract class PlayerList { diff --git a/patches/server/0151-Fix-this-stupid-bullshit.patch b/patches/server/0152-Fix-this-stupid-bullshit.patch similarity index 96% rename from patches/server/0151-Fix-this-stupid-bullshit.patch rename to patches/server/0152-Fix-this-stupid-bullshit.patch index da40a6458f..c198fc05b3 100644 --- a/patches/server/0151-Fix-this-stupid-bullshit.patch +++ b/patches/server/0152-Fix-this-stupid-bullshit.patch @@ -9,7 +9,7 @@ modified in order to prevent merge conflicts when Spigot changes/disables the wa and to provide some level of hint without being disruptive. diff --git a/src/main/java/net/minecraft/server/Bootstrap.java b/src/main/java/net/minecraft/server/Bootstrap.java -index b5aa358638b9d0638dfe47f7ebac04cca1dd80b9..0d3a8f576c037886ccdd6068ce953c4ce010ae2f 100644 +index e43096e69a00f9ea96badd7c966443cfcf3e7b95..ac2b7b5161eaaca3620268ae865d6f2a80227fde 100644 --- a/src/main/java/net/minecraft/server/Bootstrap.java +++ b/src/main/java/net/minecraft/server/Bootstrap.java @@ -40,7 +40,7 @@ public class Bootstrap { diff --git a/patches/server/0152-LivingEntity-setKiller.patch b/patches/server/0153-LivingEntity-setKiller.patch similarity index 89% rename from patches/server/0152-LivingEntity-setKiller.patch rename to patches/server/0153-LivingEntity-setKiller.patch index 910efbf638..1f6e2fc934 100644 --- a/patches/server/0152-LivingEntity-setKiller.patch +++ b/patches/server/0153-LivingEntity-setKiller.patch @@ -7,10 +7,10 @@ Subject: [PATCH] LivingEntity#setKiller public net.minecraft.world.entity.LivingEntity lastHurtByPlayerTime diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index 4f4ee7071183e7eef918741e38c2bc2e522c72df..a08fd99fb97d8c880c855e6af2a99afcfa8098b5 100644 +index 3fae28c52f2aac63ac6a4e8eb6af2d7226e6bec6..cae153b184af9ef87ca2f335692b396800f00cf2 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -@@ -347,6 +347,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { +@@ -353,6 +353,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { return this.getHandle().lastHurtByPlayer == null ? null : (Player) this.getHandle().lastHurtByPlayer.getBukkitEntity(); } diff --git a/patches/server/0153-Ocelot-despawns-should-honor-nametags-and-leash.patch b/patches/server/0154-Ocelot-despawns-should-honor-nametags-and-leash.patch similarity index 100% rename from patches/server/0153-Ocelot-despawns-should-honor-nametags-and-leash.patch rename to patches/server/0154-Ocelot-despawns-should-honor-nametags-and-leash.patch diff --git a/patches/server/0154-Reset-spawner-timer-when-spawner-event-is-cancelled.patch b/patches/server/0155-Reset-spawner-timer-when-spawner-event-is-cancelled.patch similarity index 92% rename from patches/server/0154-Reset-spawner-timer-when-spawner-event-is-cancelled.patch rename to patches/server/0155-Reset-spawner-timer-when-spawner-event-is-cancelled.patch index 60b98d70d9..eac12bfb53 100644 --- a/patches/server/0154-Reset-spawner-timer-when-spawner-event-is-cancelled.patch +++ b/patches/server/0155-Reset-spawner-timer-when-spawner-event-is-cancelled.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Reset spawner timer when spawner event is cancelled diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java -index 6b6f81f3e9e55c1f41599ccbf65e35d79749a77d..e9e0286083337ccd027e01ec80125fc69550ad07 100644 +index 7e436a2cbf1920c985cb9febf1839adc589c2619..b3df6184b1b7f7e3b5cf87c76acb7f103e0dc1db 100644 --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java @@ -164,6 +164,7 @@ public abstract class BaseSpawner { diff --git a/patches/server/0155-Allow-specifying-a-custom-authentication-servers-dow.patch b/patches/server/0156-Allow-specifying-a-custom-authentication-servers-dow.patch similarity index 93% rename from patches/server/0155-Allow-specifying-a-custom-authentication-servers-dow.patch rename to patches/server/0156-Allow-specifying-a-custom-authentication-servers-dow.patch index dbab45944c..0093a6dd86 100644 --- a/patches/server/0155-Allow-specifying-a-custom-authentication-servers-dow.patch +++ b/patches/server/0156-Allow-specifying-a-custom-authentication-servers-dow.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Allow specifying a custom "authentication servers down" kick diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index 0d55dc89e4577fb6804e08281aaa12ac783bbbe0..9cbd0174ca4cd4a74a04295d34217c1581ca3912 100644 +index 897b72d230976594c33cdb80706e9ce594d0b0f5..3813f62907e6582b5fa310d3df750f4a460188d4 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java @@ -294,7 +294,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, diff --git a/patches/server/0156-Handle-plugin-prefixes-using-Log4J-configuration.patch b/patches/server/0157-Handle-plugin-prefixes-using-Log4J-configuration.patch similarity index 97% rename from patches/server/0156-Handle-plugin-prefixes-using-Log4J-configuration.patch rename to patches/server/0157-Handle-plugin-prefixes-using-Log4J-configuration.patch index c66caac139..cac5a765c4 100644 --- a/patches/server/0156-Handle-plugin-prefixes-using-Log4J-configuration.patch +++ b/patches/server/0157-Handle-plugin-prefixes-using-Log4J-configuration.patch @@ -15,7 +15,7 @@ This may cause additional prefixes to be disabled for plugins bypassing the plugin logger. diff --git a/build.gradle.kts b/build.gradle.kts -index 8407beb0c47660f7d310d27f3a47120b80c5b189..8f8e6dea5f5f2a537a753efcc38484e3cd6a888f 100644 +index 568f18944cb229206c3db901d9bd7ce881983f88..c6148b8521dd6a619f375fc641d5a2ce74234fc2 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -17,7 +17,7 @@ dependencies { diff --git a/patches/server/0157-Improve-Log4J-Configuration-Plugin-Loggers.patch b/patches/server/0158-Improve-Log4J-Configuration-Plugin-Loggers.patch similarity index 100% rename from patches/server/0157-Improve-Log4J-Configuration-Plugin-Loggers.patch rename to patches/server/0158-Improve-Log4J-Configuration-Plugin-Loggers.patch diff --git a/patches/server/0158-Add-PlayerJumpEvent.patch b/patches/server/0159-Add-PlayerJumpEvent.patch similarity index 96% rename from patches/server/0158-Add-PlayerJumpEvent.patch rename to patches/server/0159-Add-PlayerJumpEvent.patch index 4e519fc404..a2c0798ac2 100644 --- a/patches/server/0158-Add-PlayerJumpEvent.patch +++ b/patches/server/0159-Add-PlayerJumpEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerJumpEvent diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index ca894b92215f431a31b69ee2910ce023177f3e6e..f4f7d9947edc35e02739adc06a8f3c3c2a431771 100644 +index c2d6fa75164dd98ff012611d4da354a6b48cf058..4d768673a70a1b7008572a9bc331e4d7de6990d8 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -1285,7 +1285,34 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic diff --git a/patches/server/0159-handle-ServerboundKeepAlivePacket-async.patch b/patches/server/0160-handle-ServerboundKeepAlivePacket-async.patch similarity index 92% rename from patches/server/0159-handle-ServerboundKeepAlivePacket-async.patch rename to patches/server/0160-handle-ServerboundKeepAlivePacket-async.patch index 66b78853d3..3513a766e1 100644 --- a/patches/server/0159-handle-ServerboundKeepAlivePacket-async.patch +++ b/patches/server/0160-handle-ServerboundKeepAlivePacket-async.patch @@ -15,10 +15,10 @@ also adding some additional logging in order to help work out what is causing random disconnections for clients. diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index f4f7d9947edc35e02739adc06a8f3c3c2a431771..f774583cce32d70f32ed7dd0ec1b45b8f00b029a 100644 +index 4d768673a70a1b7008572a9bc331e4d7de6990d8..12e3f10ff7134191c50faa0b84578546399d1b56 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -3122,14 +3122,18 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3128,14 +3128,18 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @Override public void handleKeepAlive(ServerboundKeepAlivePacket packet) { diff --git a/patches/server/0160-Expose-client-protocol-version-and-virtual-host.patch b/patches/server/0161-Expose-client-protocol-version-and-virtual-host.patch similarity index 97% rename from patches/server/0160-Expose-client-protocol-version-and-virtual-host.patch rename to patches/server/0161-Expose-client-protocol-version-and-virtual-host.patch index 55365ed44a..cb5c14c4b7 100644 --- a/patches/server/0160-Expose-client-protocol-version-and-virtual-host.patch +++ b/patches/server/0161-Expose-client-protocol-version-and-virtual-host.patch @@ -90,7 +90,7 @@ index 8284d49c8e30645d00be952c847bab7ce5753d78..a738b79e775a0a4abed1a05e12495d85 @Override diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 98d8585a8bc2acbb8d98c73e3aca404f0ebe66d3..70e5ef461f02e6aa8a73363753687d0cf5e7c4fb 100644 +index 3f1ed61a120f7adebfba2741a8c671a1e464471b..dfabf22bb14bbbd6b2d2b9beafa3815303f32f7f 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -301,6 +301,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0161-revert-serverside-behavior-of-keepalives.patch b/patches/server/0162-revert-serverside-behavior-of-keepalives.patch similarity index 97% rename from patches/server/0161-revert-serverside-behavior-of-keepalives.patch rename to patches/server/0162-revert-serverside-behavior-of-keepalives.patch index 94afb41c3e..01e66ffdcb 100644 --- a/patches/server/0161-revert-serverside-behavior-of-keepalives.patch +++ b/patches/server/0162-revert-serverside-behavior-of-keepalives.patch @@ -17,7 +17,7 @@ from networking or during connections flood of chunk packets on slower clients, at the cost of dead connections being kept open for longer. diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index f774583cce32d70f32ed7dd0ec1b45b8f00b029a..0e4691ab7ad4459282398e4c2160df4e442fdcb4 100644 +index 12e3f10ff7134191c50faa0b84578546399d1b56..66436cd5b6b14914919a1eb612ca133ee4ffef05 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -255,7 +255,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic diff --git a/patches/server/0162-Send-attack-SoundEffects-only-to-players-who-can-see.patch b/patches/server/0163-Send-attack-SoundEffects-only-to-players-who-can-see.patch similarity index 98% rename from patches/server/0162-Send-attack-SoundEffects-only-to-players-who-can-see.patch rename to patches/server/0163-Send-attack-SoundEffects-only-to-players-who-can-see.patch index c704b3d731..340f596b6f 100644 --- a/patches/server/0162-Send-attack-SoundEffects-only-to-players-who-can-see.patch +++ b/patches/server/0163-Send-attack-SoundEffects-only-to-players-who-can-see.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Send attack SoundEffects only to players who can see the diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index 05b32ac76dbc3c0a16380cab82415dac6aff25de..3cdc77d9dbc39a99a7f47aad03e8ab0d05270d61 100644 +index 095d459962841f7247a9365aff3bdf83bc0b3589..4066cde038732fadad753b0b5a1ca14d95aee0b0 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -1228,7 +1228,7 @@ public abstract class Player extends LivingEntity { diff --git a/patches/server/0163-Add-PlayerArmorChangeEvent.patch b/patches/server/0164-Add-PlayerArmorChangeEvent.patch similarity index 100% rename from patches/server/0163-Add-PlayerArmorChangeEvent.patch rename to patches/server/0164-Add-PlayerArmorChangeEvent.patch diff --git a/patches/server/0164-Prevent-logins-from-being-processed-when-the-player-.patch b/patches/server/0165-Prevent-logins-from-being-processed-when-the-player-.patch similarity index 92% rename from patches/server/0164-Prevent-logins-from-being-processed-when-the-player-.patch rename to patches/server/0165-Prevent-logins-from-being-processed-when-the-player-.patch index ea3917b242..6e007eef98 100644 --- a/patches/server/0164-Prevent-logins-from-being-processed-when-the-player-.patch +++ b/patches/server/0165-Prevent-logins-from-being-processed-when-the-player-.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Prevent logins from being processed when the player has diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index 9cbd0174ca4cd4a74a04295d34217c1581ca3912..b2a7fc9bc4a168304f83411559558e3a218934a4 100644 +index 3813f62907e6582b5fa310d3df750f4a460188d4..82b1bdc0e4bce2762fa226fb54d9945dc1e5c736 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java @@ -78,7 +78,11 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, diff --git a/patches/server/0165-Fix-MC-117075-TE-Unload-Lag-Spike.patch b/patches/server/0166-Fix-MC-117075-TE-Unload-Lag-Spike.patch similarity index 100% rename from patches/server/0165-Fix-MC-117075-TE-Unload-Lag-Spike.patch rename to patches/server/0166-Fix-MC-117075-TE-Unload-Lag-Spike.patch diff --git a/patches/server/0166-use-CB-BlockState-implementations-for-captured-block.patch b/patches/server/0167-use-CB-BlockState-implementations-for-captured-block.patch similarity index 100% rename from patches/server/0166-use-CB-BlockState-implementations-for-captured-block.patch rename to patches/server/0167-use-CB-BlockState-implementations-for-captured-block.patch diff --git a/patches/server/0167-API-to-get-a-BlockState-without-a-snapshot.patch b/patches/server/0168-API-to-get-a-BlockState-without-a-snapshot.patch similarity index 98% rename from patches/server/0167-API-to-get-a-BlockState-without-a-snapshot.patch rename to patches/server/0168-API-to-get-a-BlockState-without-a-snapshot.patch index 53edd2717b..9d98e1c68d 100644 --- a/patches/server/0167-API-to-get-a-BlockState-without-a-snapshot.patch +++ b/patches/server/0168-API-to-get-a-BlockState-without-a-snapshot.patch @@ -51,7 +51,7 @@ index b701a1344db066b9368841f2377ee493514bf282..5768ff2c3e15c038d132c7ad391332fb return null; } diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -index 14e1c7c40761b1bd8123b4b351d5d77d7c1c52c2..13da02b84d7e748d61fdf5db01d92a8d8cd5c799 100644 +index 0e96f8d01b0499a4d4a8e9e11c2d94f54022bb6b..0951e0836ef16c99505c884ea80e5bd23873b7e6 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java @@ -331,6 +331,13 @@ public class CraftBlock implements Block { diff --git a/patches/server/0168-AsyncTabCompleteEvent.patch b/patches/server/0169-AsyncTabCompleteEvent.patch similarity index 97% rename from patches/server/0168-AsyncTabCompleteEvent.patch rename to patches/server/0169-AsyncTabCompleteEvent.patch index 6e3ae3d384..aeb19e57b5 100644 --- a/patches/server/0168-AsyncTabCompleteEvent.patch +++ b/patches/server/0169-AsyncTabCompleteEvent.patch @@ -16,7 +16,7 @@ Also adds isCommand and getLocation to the sync TabCompleteEvent Co-authored-by: Aikar diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index fb2918f3f99bae7b549412712adeeb55a45c9e9b..c8193e4fc77612f4535f360777dbe93f75b5be4e 100644 +index 66436cd5b6b14914919a1eb612ca133ee4ffef05..43748cb2ee5840ee82d5ab6337a72c863fe06d3d 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -776,12 +776,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -91,10 +91,10 @@ index fb2918f3f99bae7b549412712adeeb55a45c9e9b..c8193e4fc77612f4535f360777dbe93f @Override diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index bc8a2d9a4388887c8e49dd9e5ceebd0ca3b0e893..06a962ac9644df033b95f3bed3ee96a8fc00edb0 100644 +index dce99265f1a3ef2b54bab3f3bad431f3f8dde888..87b29d0965b460706385aa4e28931f5ddd4a33a7 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2113,7 +2113,7 @@ public final class CraftServer implements Server { +@@ -2095,7 +2095,7 @@ public final class CraftServer implements Server { offers = this.tabCompleteChat(player, message); } diff --git a/patches/server/0169-PlayerPickupExperienceEvent.patch b/patches/server/0170-PlayerPickupExperienceEvent.patch similarity index 100% rename from patches/server/0169-PlayerPickupExperienceEvent.patch rename to patches/server/0170-PlayerPickupExperienceEvent.patch diff --git a/patches/server/0170-Ability-to-apply-mending-to-XP-API.patch b/patches/server/0171-Ability-to-apply-mending-to-XP-API.patch similarity index 94% rename from patches/server/0170-Ability-to-apply-mending-to-XP-API.patch rename to patches/server/0171-Ability-to-apply-mending-to-XP-API.patch index 6c92cd787b..89bd767245 100644 --- a/patches/server/0170-Ability-to-apply-mending-to-XP-API.patch +++ b/patches/server/0171-Ability-to-apply-mending-to-XP-API.patch @@ -14,10 +14,10 @@ public net.minecraft.world.entity.ExperienceOrb durabilityToXp(I)I public net.minecraft.world.entity.ExperienceOrb xpToDurability(I)I diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 0cac7dea99a60bf393b8e41f0c05ec79d4b7c658..d2803455c9456523f8cc324e79c692595fa2420e 100644 +index dfabf22bb14bbbd6b2d2b9beafa3815303f32f7f..d7d47a3dce2c15d39531344a9eaac3990dc1dfc2 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1447,7 +1447,37 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1460,7 +1460,37 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } @Override diff --git a/patches/server/0171-PlayerNaturallySpawnCreaturesEvent.patch b/patches/server/0172-PlayerNaturallySpawnCreaturesEvent.patch similarity index 96% rename from patches/server/0171-PlayerNaturallySpawnCreaturesEvent.patch rename to patches/server/0172-PlayerNaturallySpawnCreaturesEvent.patch index efa1b7fa0a..a9085cc493 100644 --- a/patches/server/0171-PlayerNaturallySpawnCreaturesEvent.patch +++ b/patches/server/0172-PlayerNaturallySpawnCreaturesEvent.patch @@ -9,7 +9,7 @@ from triggering monster spawns on a server. Also a highly more effecient way to blanket block spawns in a world diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 159269d15c95261bddd410e337132c67d13c273c..c6706c3d7841869134be89dd09ea723820d306a2 100644 +index 3c5b6231dc6f3dcc275e032d03989ed638fb03a9..61039a4b61317e293ea054a6a2c0e849e5a302f0 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -692,7 +692,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -60,7 +60,7 @@ index 80d108ae7faf3fdcb024931e93032215935fe70b..c021733342c09adb04ce3f675209543f while (iterator1.hasNext()) { diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 1d04f135f33e9db68153f5db19360f30aa0113eb..6460e922056b2f349bdc9299920dc7236c4cb695 100644 +index dc0c89e39f291e735fc1dbf3ccf262a5b4f22459..673252f54103a7ab34650db85d6200953755c745 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1,5 +1,6 @@ diff --git a/patches/server/0172-Add-setPlayerProfile-API-for-Skulls.patch b/patches/server/0173-Add-setPlayerProfile-API-for-Skulls.patch similarity index 100% rename from patches/server/0172-Add-setPlayerProfile-API-for-Skulls.patch rename to patches/server/0173-Add-setPlayerProfile-API-for-Skulls.patch diff --git a/patches/server/0173-PreCreatureSpawnEvent.patch b/patches/server/0174-PreCreatureSpawnEvent.patch similarity index 98% rename from patches/server/0173-PreCreatureSpawnEvent.patch rename to patches/server/0174-PreCreatureSpawnEvent.patch index 0ae3bab044..f5379c5ec4 100644 --- a/patches/server/0173-PreCreatureSpawnEvent.patch +++ b/patches/server/0174-PreCreatureSpawnEvent.patch @@ -59,7 +59,7 @@ index 1b3c7b3fb869215badacdb604199d5b96f74e384..83ef8cb27db685cceb5c2b7c9674e17b if (t0 != null) { diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java -index 2e392630d3b4b08ff8ab82b7f8b32b7fbf21570d..cb1fe497477d6850260b09dcfbf290119ff6ab49 100644 +index a2c4267f0001b276d848377e4dbcc407ee8d1ff9..c33550137ea83f23885341545c4a7f4985e07cfc 100644 --- a/src/main/java/net/minecraft/world/entity/EntityType.java +++ b/src/main/java/net/minecraft/world/entity/EntityType.java @@ -405,6 +405,20 @@ public class EntityType implements FeatureElement, EntityTypeT @@ -97,7 +97,7 @@ index bbbb26550b0c5b36d9c7204f075aa90b79b85ff0..bc778aadb2604756b783d4d024e31545 } } diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java -index e9e0286083337ccd027e01ec80125fc69550ad07..23cecd12f064f70d314393971312d881cace043a 100644 +index b3df6184b1b7f7e3b5cf87c76acb7f103e0dc1db..64d1f0ed579ef6f6f2e24e795d8dd0e1bdb5f39d 100644 --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java @@ -128,6 +128,27 @@ public abstract class BaseSpawner { diff --git a/patches/server/0174-Fill-Profile-Property-Events.patch b/patches/server/0175-Fill-Profile-Property-Events.patch similarity index 100% rename from patches/server/0174-Fill-Profile-Property-Events.patch rename to patches/server/0175-Fill-Profile-Property-Events.patch diff --git a/patches/server/0175-PlayerAdvancementCriterionGrantEvent.patch b/patches/server/0176-PlayerAdvancementCriterionGrantEvent.patch similarity index 100% rename from patches/server/0175-PlayerAdvancementCriterionGrantEvent.patch rename to patches/server/0176-PlayerAdvancementCriterionGrantEvent.patch diff --git a/patches/server/0176-Add-ArmorStand-Item-Meta.patch b/patches/server/0177-Add-ArmorStand-Item-Meta.patch similarity index 100% rename from patches/server/0176-Add-ArmorStand-Item-Meta.patch rename to patches/server/0177-Add-ArmorStand-Item-Meta.patch diff --git a/patches/server/0177-Extend-Player-Interact-cancellation.patch b/patches/server/0178-Extend-Player-Interact-cancellation.patch similarity index 100% rename from patches/server/0177-Extend-Player-Interact-cancellation.patch rename to patches/server/0178-Extend-Player-Interact-cancellation.patch diff --git a/patches/server/0178-Tameable-getOwnerUniqueId-API.patch b/patches/server/0179-Tameable-getOwnerUniqueId-API.patch similarity index 100% rename from patches/server/0178-Tameable-getOwnerUniqueId-API.patch rename to patches/server/0179-Tameable-getOwnerUniqueId-API.patch diff --git a/patches/server/0179-Toggleable-player-crits-helps-mitigate-hacked-client.patch b/patches/server/0180-Toggleable-player-crits-helps-mitigate-hacked-client.patch similarity index 91% rename from patches/server/0179-Toggleable-player-crits-helps-mitigate-hacked-client.patch rename to patches/server/0180-Toggleable-player-crits-helps-mitigate-hacked-client.patch index eeb0dc7e22..59a00b028b 100644 --- a/patches/server/0179-Toggleable-player-crits-helps-mitigate-hacked-client.patch +++ b/patches/server/0180-Toggleable-player-crits-helps-mitigate-hacked-client.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Toggleable player crits, helps mitigate hacked clients. diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index acd84748204bad0dbfc59fbd516f873e0aa16a40..2e547db9c4c06a22406495fda83def1c275c0944 100644 +index 4066cde038732fadad753b0b5a1ca14d95aee0b0..8fc8e7a6fff002a6022f5a4579a229238af08348 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -1235,6 +1235,7 @@ public abstract class Player extends LivingEntity { diff --git a/patches/server/0180-Disable-Explicit-Network-Manager-Flushing.patch b/patches/server/0181-Disable-Explicit-Network-Manager-Flushing.patch similarity index 100% rename from patches/server/0180-Disable-Explicit-Network-Manager-Flushing.patch rename to patches/server/0181-Disable-Explicit-Network-Manager-Flushing.patch diff --git a/patches/server/0181-Implement-extended-PaperServerListPingEvent.patch b/patches/server/0182-Implement-extended-PaperServerListPingEvent.patch similarity index 99% rename from patches/server/0181-Implement-extended-PaperServerListPingEvent.patch rename to patches/server/0182-Implement-extended-PaperServerListPingEvent.patch index bfc5e21dcc..3279220072 100644 --- a/patches/server/0181-Implement-extended-PaperServerListPingEvent.patch +++ b/patches/server/0182-Implement-extended-PaperServerListPingEvent.patch @@ -190,7 +190,7 @@ index 67455a5ba75c9b816213e44d6872c5ddf8e27e98..23efad80934930beadf15e65781551d4 public ClientboundStatusResponsePacket(ServerStatus metadata) { diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index ece65ae90a71517a374a3ebbe0cb0ba514b44e2f..2b55df58684a19519335666858bc79de8067faf7 100644 +index fc040a4424144ecae03a039899f53227777cce05..bb7da8b167b72f2b1fec2be8838545ae4ed71eb3 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -2,6 +2,9 @@ package net.minecraft.server; diff --git a/patches/server/0182-Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch b/patches/server/0183-Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch similarity index 95% rename from patches/server/0182-Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch rename to patches/server/0183-Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch index 5d1a658e63..6cc179b1ca 100644 --- a/patches/server/0182-Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch +++ b/patches/server/0183-Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Ability to change PlayerProfile in AsyncPreLoginEvent This will allow you to change the players name or skin on login. diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index b2a7fc9bc4a168304f83411559558e3a218934a4..bb5c4ecd43aa344dfe9cca8ab7c2ebf9760e94cf 100644 +index 82b1bdc0e4bce2762fa226fb54d9945dc1e5c736..b1fa2b95e161996cb62f05b67d710c0f9a98b1b2 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java @@ -329,8 +329,16 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, diff --git a/patches/server/0183-Player.setPlayerProfile-API.patch b/patches/server/0184-Player.setPlayerProfile-API.patch similarity index 95% rename from patches/server/0183-Player.setPlayerProfile-API.patch rename to patches/server/0184-Player.setPlayerProfile-API.patch index 1ddfc47237..389f3b8dc7 100644 --- a/patches/server/0183-Player.setPlayerProfile-API.patch +++ b/patches/server/0184-Player.setPlayerProfile-API.patch @@ -9,7 +9,7 @@ This can be useful for changing name or skins after a player has logged in. public-f net.minecraft.world.entity.player.Player gameProfile diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index bb5c4ecd43aa344dfe9cca8ab7c2ebf9760e94cf..203786383387765d1f5a2d2ccce79d792fd5b187 100644 +index b1fa2b95e161996cb62f05b67d710c0f9a98b1b2..9d3ea20adba300a38a544c3454eff2edd9b4bbb9 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java @@ -330,11 +330,11 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, @@ -42,7 +42,7 @@ index e7442952ef1f03969949014492a7ddc6d0796ba5..69a1852905dd4724c30ac8ab88c14251 public Server getServer() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index fb157165d46f2f2d9bbaa6f7c8199885051060a8..c9a016af654fb73bd95c1f2d5704c12dcd62241b 100644 +index d7d47a3dce2c15d39531344a9eaac3990dc1dfc2..19a440e12248b4f52c2ae2401d6ae4eb39ac4379 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -81,6 +81,7 @@ import net.minecraft.world.entity.ai.attributes.Attributes; @@ -65,7 +65,7 @@ index fb157165d46f2f2d9bbaa6f7c8199885051060a8..c9a016af654fb73bd95c1f2d5704c12d @Override public InetSocketAddress getAddress() { if (this.getHandle().connection == null) return null; -@@ -1580,8 +1576,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1593,8 +1589,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { this.hiddenEntities.put(entity.getUniqueId(), hidingPlugins); // Remove this entity from the hidden player's EntityTrackerEntry @@ -82,7 +82,7 @@ index fb157165d46f2f2d9bbaa6f7c8199885051060a8..c9a016af654fb73bd95c1f2d5704c12d ChunkMap.TrackedEntity entry = tracker.entityMap.get(other.getId()); if (entry != null) { entry.removePlayer(this.getHandle()); -@@ -1594,8 +1597,6 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1607,8 +1610,6 @@ public class CraftPlayer extends CraftHumanEntity implements Player { this.getHandle().connection.send(new ClientboundPlayerInfoRemovePacket(List.of(otherPlayer.getUUID()))); } } @@ -91,7 +91,7 @@ index fb157165d46f2f2d9bbaa6f7c8199885051060a8..c9a016af654fb73bd95c1f2d5704c12d } @Override -@@ -1632,8 +1633,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1645,8 +1646,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } this.hiddenEntities.remove(entity.getUniqueId()); @@ -108,7 +108,7 @@ index fb157165d46f2f2d9bbaa6f7c8199885051060a8..c9a016af654fb73bd95c1f2d5704c12d if (other instanceof ServerPlayer) { ServerPlayer otherPlayer = (ServerPlayer) other; -@@ -1644,9 +1652,51 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1657,9 +1665,51 @@ public class CraftPlayer extends CraftHumanEntity implements Player { if (entry != null && !entry.seenBy.contains(this.getHandle().connection)) { entry.updatePlayer(this.getHandle()); } diff --git a/patches/server/0184-getPlayerUniqueId-API.patch b/patches/server/0185-getPlayerUniqueId-API.patch similarity index 90% rename from patches/server/0184-getPlayerUniqueId-API.patch rename to patches/server/0185-getPlayerUniqueId-API.patch index 8cf38938d2..bd42c0e0fb 100644 --- a/patches/server/0184-getPlayerUniqueId-API.patch +++ b/patches/server/0185-getPlayerUniqueId-API.patch @@ -9,10 +9,10 @@ In Offline Mode, will return an Offline UUID This is a more performant way to obtain a UUID for a name than loading an OfflinePlayer diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 06a962ac9644df033b95f3bed3ee96a8fc00edb0..02b2452fa5bdcd667f8c0be97f425310975c9312 100644 +index 87b29d0965b460706385aa4e28931f5ddd4a33a7..86d8e08b19316bb202b62bd7ac1187eb4827e5c5 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1735,6 +1735,25 @@ public final class CraftServer implements Server { +@@ -1717,6 +1717,25 @@ public final class CraftServer implements Server { return recipients.size(); } diff --git a/patches/server/0185-Improved-Async-Task-Scheduler.patch b/patches/server/0186-Improved-Async-Task-Scheduler.patch similarity index 100% rename from patches/server/0185-Improved-Async-Task-Scheduler.patch rename to patches/server/0186-Improved-Async-Task-Scheduler.patch diff --git a/patches/server/0186-Make-legacy-ping-handler-more-reliable.patch b/patches/server/0187-Make-legacy-ping-handler-more-reliable.patch similarity index 100% rename from patches/server/0186-Make-legacy-ping-handler-more-reliable.patch rename to patches/server/0187-Make-legacy-ping-handler-more-reliable.patch diff --git a/patches/server/0187-Call-PaperServerListPingEvent-for-legacy-pings.patch b/patches/server/0188-Call-PaperServerListPingEvent-for-legacy-pings.patch similarity index 100% rename from patches/server/0187-Call-PaperServerListPingEvent-for-legacy-pings.patch rename to patches/server/0188-Call-PaperServerListPingEvent-for-legacy-pings.patch diff --git a/patches/server/0188-Flag-to-disable-the-channel-limit.patch b/patches/server/0189-Flag-to-disable-the-channel-limit.patch similarity index 91% rename from patches/server/0188-Flag-to-disable-the-channel-limit.patch rename to patches/server/0189-Flag-to-disable-the-channel-limit.patch index ee83cbbeed..7e568a58af 100644 --- a/patches/server/0188-Flag-to-disable-the-channel-limit.patch +++ b/patches/server/0189-Flag-to-disable-the-channel-limit.patch @@ -9,7 +9,7 @@ e.g. servers which allow and support the usage of mod packs. provide an optional flag to disable this check, at your own risk. diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index afa2e62732ba7b9c08fc24bc95b81b0f30d0ad05..bc8738811465d61e41580c5718d85c34e11b609b 100644 +index 19a440e12248b4f52c2ae2401d6ae4eb39ac4379..38abee17ad6db9f593cca06efb1d14049b3307e6 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -175,6 +175,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -20,7 +20,7 @@ index afa2e62732ba7b9c08fc24bc95b81b0f30d0ad05..bc8738811465d61e41580c5718d85c34 // Paper end public CraftPlayer(CraftServer server, ServerPlayer entity) { -@@ -1896,7 +1897,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1915,7 +1916,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { // Paper end public void addChannel(String channel) { diff --git a/patches/server/0189-Add-openSign-method-to-HumanEntity.patch b/patches/server/0190-Add-openSign-method-to-HumanEntity.patch similarity index 93% rename from patches/server/0189-Add-openSign-method-to-HumanEntity.patch rename to patches/server/0190-Add-openSign-method-to-HumanEntity.patch index 22941024b7..579b73b9c6 100644 --- a/patches/server/0189-Add-openSign-method-to-HumanEntity.patch +++ b/patches/server/0190-Add-openSign-method-to-HumanEntity.patch @@ -28,10 +28,10 @@ index 749f8c6eb39e9cedeec472fc176b6a2a17900201..cdc9474d37028324d39037a456be07fd // Paper start diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -index 3ca0d08a9e6511b8a96abcf0807a77d52f303a44..7ea4a2d4e691e0a0a4d9ef3189a29a4a4ca4374b 100644 +index 139c4310a31b6cc149de140751cb8bf3d8226010..787ccb37a39bb506cf9fd8d54cf772b346981f85 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -@@ -617,6 +617,12 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { +@@ -627,6 +627,12 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { } } diff --git a/patches/server/0190-Configurable-sprint-interruption-on-attack.patch b/patches/server/0191-Configurable-sprint-interruption-on-attack.patch similarity index 92% rename from patches/server/0190-Configurable-sprint-interruption-on-attack.patch rename to patches/server/0191-Configurable-sprint-interruption-on-attack.patch index fde468df9e..3fc16e4732 100644 --- a/patches/server/0190-Configurable-sprint-interruption-on-attack.patch +++ b/patches/server/0191-Configurable-sprint-interruption-on-attack.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Configurable sprint interruption on attack If the sprint interruption is disabled players continue sprinting when they attack entities. diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index 2e547db9c4c06a22406495fda83def1c275c0944..e088e5174a4666130cd1f66c751e7ab83d9f7a65 100644 +index 8fc8e7a6fff002a6022f5a4579a229238af08348..3bdd77d2e91be5182c32761f736e7cccccb08978 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -1284,7 +1284,11 @@ public abstract class Player extends LivingEntity { diff --git a/patches/server/0191-Fix-exploit-that-allowed-colored-signs-to-be-created.patch b/patches/server/0192-Fix-exploit-that-allowed-colored-signs-to-be-created.patch similarity index 90% rename from patches/server/0191-Fix-exploit-that-allowed-colored-signs-to-be-created.patch rename to patches/server/0192-Fix-exploit-that-allowed-colored-signs-to-be-created.patch index 84a2838268..91158da2e6 100644 --- a/patches/server/0191-Fix-exploit-that-allowed-colored-signs-to-be-created.patch +++ b/patches/server/0192-Fix-exploit-that-allowed-colored-signs-to-be-created.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix exploit that allowed colored signs to be created diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index d30876c2a7f3871fb4c035d9cbe920f18ac7b05e..d1adb186bf9c79b99967da9c7d9aa20ba85c64e2 100644 +index 43748cb2ee5840ee82d5ab6337a72c863fe06d3d..b11f6e5c55e4eeeac82b1567a27b013867a570e3 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -3136,9 +3136,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3142,9 +3142,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic FilteredText filteredtext = (FilteredText) signText.get(i); if (this.player.isTextFilteringEnabled()) { diff --git a/patches/server/0192-EndermanEscapeEvent.patch b/patches/server/0193-EndermanEscapeEvent.patch similarity index 100% rename from patches/server/0192-EndermanEscapeEvent.patch rename to patches/server/0193-EndermanEscapeEvent.patch diff --git a/patches/server/0193-Enderman.teleportRandomly.patch b/patches/server/0194-Enderman.teleportRandomly.patch similarity index 100% rename from patches/server/0193-Enderman.teleportRandomly.patch rename to patches/server/0194-Enderman.teleportRandomly.patch diff --git a/patches/server/0194-Block-Enderpearl-Travel-Exploit.patch b/patches/server/0195-Block-Enderpearl-Travel-Exploit.patch similarity index 96% rename from patches/server/0194-Block-Enderpearl-Travel-Exploit.patch rename to patches/server/0195-Block-Enderpearl-Travel-Exploit.patch index 118b98f199..639481f1b7 100644 --- a/patches/server/0194-Block-Enderpearl-Travel-Exploit.patch +++ b/patches/server/0195-Block-Enderpearl-Travel-Exploit.patch @@ -33,7 +33,7 @@ index 349a9f4596cd1411ec3a69cd7d6f5414971b74ef..45485383943f1ae0d4c5b5064cbaa8f5 public void onTrackingStart(Entity entity) { diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java -index a5f018514d08f2563d5f18f4d787181e83c7cbef..d8760dd282221fa10b486f1ec4634c1aafd9c26e 100644 +index e19251bc9cb18ea3c37628b55ae73bb2e5ba69bd..95ee8f85dd7e6c32f751f5c754a351cc7bcd6245 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java +++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java @@ -89,6 +89,7 @@ public abstract class Projectile extends Entity { diff --git a/patches/server/0195-Expand-World.spawnParticle-API-and-add-Builder.patch b/patches/server/0196-Expand-World.spawnParticle-API-and-add-Builder.patch similarity index 96% rename from patches/server/0195-Expand-World.spawnParticle-API-and-add-Builder.patch rename to patches/server/0196-Expand-World.spawnParticle-API-and-add-Builder.patch index c7c7d7c202..bf6a558cc9 100644 --- a/patches/server/0195-Expand-World.spawnParticle-API-and-add-Builder.patch +++ b/patches/server/0196-Expand-World.spawnParticle-API-and-add-Builder.patch @@ -34,10 +34,10 @@ index 45485383943f1ae0d4c5b5064cbaa8f56181dad3..d17808f6c565712dac31b0db7a4b6bae if (this.sendParticles(entityplayer, force, d0, d1, d2, packetplayoutworldparticles)) { // CraftBukkit diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 5a17b0c2e185bd50201a5d954322e41d42e2dae3..164b54410ecfe68a6d6239baf6e0e3699fbafbde 100644 +index 3f6e5e4d36e8170def4ce50e29cdfcc7e25f4f4d..68e3a09bf4adb4fe9fc3c32fdec85d90af4354bc 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -1808,11 +1808,17 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -1824,11 +1824,17 @@ public class CraftWorld extends CraftRegionAccessor implements World { @Override public void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data, boolean force) { diff --git a/patches/server/0196-Prevent-Frosted-Ice-from-loading-holding-chunks.patch b/patches/server/0197-Prevent-Frosted-Ice-from-loading-holding-chunks.patch similarity index 100% rename from patches/server/0196-Prevent-Frosted-Ice-from-loading-holding-chunks.patch rename to patches/server/0197-Prevent-Frosted-Ice-from-loading-holding-chunks.patch diff --git a/patches/server/0197-EndermanAttackPlayerEvent.patch b/patches/server/0198-EndermanAttackPlayerEvent.patch similarity index 100% rename from patches/server/0197-EndermanAttackPlayerEvent.patch rename to patches/server/0198-EndermanAttackPlayerEvent.patch diff --git a/patches/server/0198-WitchConsumePotionEvent.patch b/patches/server/0199-WitchConsumePotionEvent.patch similarity index 100% rename from patches/server/0198-WitchConsumePotionEvent.patch rename to patches/server/0199-WitchConsumePotionEvent.patch diff --git a/patches/server/0199-WitchThrowPotionEvent.patch b/patches/server/0200-WitchThrowPotionEvent.patch similarity index 100% rename from patches/server/0199-WitchThrowPotionEvent.patch rename to patches/server/0200-WitchThrowPotionEvent.patch diff --git a/patches/server/0200-Allow-spawning-Item-entities-with-World.spawnEntity.patch b/patches/server/0201-Allow-spawning-Item-entities-with-World.spawnEntity.patch similarity index 100% rename from patches/server/0200-Allow-spawning-Item-entities-with-World.spawnEntity.patch rename to patches/server/0201-Allow-spawning-Item-entities-with-World.spawnEntity.patch diff --git a/patches/server/0201-WitchReadyPotionEvent.patch b/patches/server/0202-WitchReadyPotionEvent.patch similarity index 100% rename from patches/server/0201-WitchReadyPotionEvent.patch rename to patches/server/0202-WitchReadyPotionEvent.patch diff --git a/patches/server/0202-ItemStack-getMaxItemUseDuration.patch b/patches/server/0203-ItemStack-getMaxItemUseDuration.patch similarity index 91% rename from patches/server/0202-ItemStack-getMaxItemUseDuration.patch rename to patches/server/0203-ItemStack-getMaxItemUseDuration.patch index 2969876aa2..c2d2d5a50d 100644 --- a/patches/server/0202-ItemStack-getMaxItemUseDuration.patch +++ b/patches/server/0203-ItemStack-getMaxItemUseDuration.patch @@ -6,7 +6,7 @@ Subject: [PATCH] ItemStack#getMaxItemUseDuration Allows you to determine how long it takes to use a usable/consumable item diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java -index be2e114ed21344c9336b920238d0ee575b8d342b..6f1bc67038fd6d8c3c31ef33ae19a014d0976bf6 100644 +index 3c3f5a4b7109ec8b47b550f9e766556f8d1546ec..8b3cc7b9ea8ef3ddd619bc4a6affb5bb38cad8c3 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java @@ -173,6 +173,13 @@ public final class CraftItemStack extends ItemStack { diff --git a/patches/server/0203-Implement-EntityTeleportEndGatewayEvent.patch b/patches/server/0204-Implement-EntityTeleportEndGatewayEvent.patch similarity index 100% rename from patches/server/0203-Implement-EntityTeleportEndGatewayEvent.patch rename to patches/server/0204-Implement-EntityTeleportEndGatewayEvent.patch diff --git a/patches/server/0204-Unset-Ignited-flag-on-cancel-of-Explosion-Event.patch b/patches/server/0205-Unset-Ignited-flag-on-cancel-of-Explosion-Event.patch similarity index 100% rename from patches/server/0204-Unset-Ignited-flag-on-cancel-of-Explosion-Event.patch rename to patches/server/0205-Unset-Ignited-flag-on-cancel-of-Explosion-Event.patch diff --git a/patches/server/0205-Fix-CraftEntity-hashCode.patch b/patches/server/0206-Fix-CraftEntity-hashCode.patch similarity index 100% rename from patches/server/0205-Fix-CraftEntity-hashCode.patch rename to patches/server/0206-Fix-CraftEntity-hashCode.patch diff --git a/patches/server/0206-Configurable-Alternative-LootPool-Luck-Formula.patch b/patches/server/0207-Configurable-Alternative-LootPool-Luck-Formula.patch similarity index 100% rename from patches/server/0206-Configurable-Alternative-LootPool-Luck-Formula.patch rename to patches/server/0207-Configurable-Alternative-LootPool-Luck-Formula.patch diff --git a/patches/server/0207-Print-Error-details-when-failing-to-save-player-data.patch b/patches/server/0208-Print-Error-details-when-failing-to-save-player-data.patch similarity index 100% rename from patches/server/0207-Print-Error-details-when-failing-to-save-player-data.patch rename to patches/server/0208-Print-Error-details-when-failing-to-save-player-data.patch diff --git a/patches/server/0208-Make-shield-blocking-delay-configurable.patch b/patches/server/0209-Make-shield-blocking-delay-configurable.patch similarity index 89% rename from patches/server/0208-Make-shield-blocking-delay-configurable.patch rename to patches/server/0209-Make-shield-blocking-delay-configurable.patch index 9851831a19..364bf7c1e5 100644 --- a/patches/server/0208-Make-shield-blocking-delay-configurable.patch +++ b/patches/server/0209-Make-shield-blocking-delay-configurable.patch @@ -35,12 +35,12 @@ index 6d599fb38607cf841eef6d48bcaad81b378f667e..4ebdf94833062cde6882f09f1d687806 return this.isShiftKeyDown(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index a08fd99fb97d8c880c855e6af2a99afcfa8098b5..80efb900e37069f4ff39c35d39456959ca24bfe8 100644 +index cae153b184af9ef87ca2f335692b396800f00cf2..b9657abde59bdf3b2a464466f1a251a2c5f226e1 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -@@ -785,5 +785,15 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { - public void setArrowsStuck(int arrows) { - getHandle().setArrowCount(arrows); +@@ -791,5 +791,15 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { + public void setArrowsStuck(final int arrows) { + this.getHandle().setArrowCount(arrows); } + + @Override diff --git a/patches/server/0209-Improve-EntityShootBowEvent.patch b/patches/server/0210-Improve-EntityShootBowEvent.patch similarity index 100% rename from patches/server/0209-Improve-EntityShootBowEvent.patch rename to patches/server/0210-Improve-EntityShootBowEvent.patch diff --git a/patches/server/0210-PlayerReadyArrowEvent.patch b/patches/server/0211-PlayerReadyArrowEvent.patch similarity index 61% rename from patches/server/0210-PlayerReadyArrowEvent.patch rename to patches/server/0211-PlayerReadyArrowEvent.patch index 435a381ae4..cc676ff6a6 100644 --- a/patches/server/0210-PlayerReadyArrowEvent.patch +++ b/patches/server/0211-PlayerReadyArrowEvent.patch @@ -7,10 +7,10 @@ Called when a player is firing a bow and the server is choosing an arrow to use. Plugins can skip selection of certain arrows and control which is used. diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index e088e5174a4666130cd1f66c751e7ab83d9f7a65..8aa5f8bacb868a3b04af6e696f9eed89463ecaf3 100644 +index 3bdd77d2e91be5182c32761f736e7cccccb08978..2010e93da4e56a6a22a8e6f8c42a799eeba62acc 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java -@@ -2226,6 +2226,17 @@ public abstract class Player extends LivingEntity { +@@ -2226,18 +2226,29 @@ public abstract class Player extends LivingEntity { return ImmutableList.of(Pose.STANDING, Pose.CROUCHING, Pose.SWIMMING); } @@ -28,12 +28,17 @@ index e088e5174a4666130cd1f66c751e7ab83d9f7a65..8aa5f8bacb868a3b04af6e696f9eed89 @Override public ItemStack getProjectile(ItemStack stack) { if (!(stack.getItem() instanceof ProjectileWeaponItem)) { -@@ -2242,7 +2253,7 @@ public abstract class Player extends LivingEntity { + return ItemStack.EMPTY; + } else { +- Predicate predicate = ((ProjectileWeaponItem) stack.getItem()).getSupportedHeldProjectiles(); ++ Predicate predicate = ((ProjectileWeaponItem) stack.getItem()).getSupportedHeldProjectiles().and(item -> tryReadyArrow(stack, item)); // Paper + ItemStack itemstack1 = ProjectileWeaponItem.getHeldProjectile(this, predicate); + + if (!itemstack1.isEmpty()) { + return itemstack1; + } else { +- predicate = ((ProjectileWeaponItem) stack.getItem()).getAllSupportedProjectiles(); ++ predicate = ((ProjectileWeaponItem) stack.getItem()).getAllSupportedProjectiles().and(item -> tryReadyArrow(stack, item)); // Paper + for (int i = 0; i < this.inventory.getContainerSize(); ++i) { ItemStack itemstack2 = this.inventory.getItem(i); - -- if (predicate.test(itemstack2)) { -+ if (predicate.test(itemstack2) && tryReadyArrow(stack, itemstack2)) { // Paper - return itemstack2; - } - } diff --git a/patches/server/0211-Implement-EntityKnockbackByEntityEvent-and-EntityPus.patch b/patches/server/0212-Implement-EntityKnockbackByEntityEvent-and-EntityPus.patch similarity index 98% rename from patches/server/0211-Implement-EntityKnockbackByEntityEvent-and-EntityPus.patch rename to patches/server/0212-Implement-EntityKnockbackByEntityEvent-and-EntityPus.patch index 8255ea5bd9..d414ead935 100644 --- a/patches/server/0211-Implement-EntityKnockbackByEntityEvent-and-EntityPus.patch +++ b/patches/server/0212-Implement-EntityKnockbackByEntityEvent-and-EntityPus.patch @@ -161,7 +161,7 @@ index 127948e7c8620de1f4fabce0d654fbb502510156..191f7afcb23b5ee58df9dd6bd8c78ac9 } } diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index b6027f4f5f747b81062d83ef7a3f62d420832729..811ab2a967db7a6767c98869034ea75bd443f301 100644 +index 2010e93da4e56a6a22a8e6f8c42a799eeba62acc..67da749cef5241d6cbe02a494e43ae8fb24bb56d 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -1278,9 +1278,9 @@ public abstract class Player extends LivingEntity { @@ -186,7 +186,7 @@ index b6027f4f5f747b81062d83ef7a3f62d420832729..811ab2a967db7a6767c98869034ea75b // CraftBukkit end } diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java -index cfd202d32048abcd3e961d9f7f08c1bc6282e601..0057c96609bf657ff1282a0a6cc78bdc4bc68f92 100644 +index d4b8364fd860ee2cc632d8c752435b9b311c7ece..915c15faa510f4bdd3a96d8ba83280f08b12dec6 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java +++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java @@ -401,7 +401,7 @@ public abstract class AbstractArrow extends Projectile { diff --git a/patches/server/0212-Expand-Explosions-API.patch b/patches/server/0213-Expand-Explosions-API.patch similarity index 94% rename from patches/server/0212-Expand-Explosions-API.patch rename to patches/server/0213-Expand-Explosions-API.patch index 73ea8df568..666ee81c29 100644 --- a/patches/server/0212-Expand-Explosions-API.patch +++ b/patches/server/0213-Expand-Explosions-API.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Expand Explosions API Add Entity as a Source capability, and add more API choices, and on Location. diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 164b54410ecfe68a6d6239baf6e0e3699fbafbde..8cbc73148f9d5fc4a76637812b448c3e09ba430c 100644 +index 68e3a09bf4adb4fe9fc3c32fdec85d90af4354bc..51689ecd87a4afcc24786f3feb82b4d0c23b2732 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -702,6 +702,12 @@ public class CraftWorld extends CraftRegionAccessor implements World { diff --git a/patches/server/0213-LivingEntity-Hand-Raised-Item-Use-API.patch b/patches/server/0214-LivingEntity-Hand-Raised-Item-Use-API.patch similarity index 90% rename from patches/server/0213-LivingEntity-Hand-Raised-Item-Use-API.patch rename to patches/server/0214-LivingEntity-Hand-Raised-Item-Use-API.patch index d429d4ce3a..13931afa3c 100644 --- a/patches/server/0213-LivingEntity-Hand-Raised-Item-Use-API.patch +++ b/patches/server/0214-LivingEntity-Hand-Raised-Item-Use-API.patch @@ -6,10 +6,10 @@ Subject: [PATCH] LivingEntity Hand Raised/Item Use API How long an entity has raised hands to charge an attack or use an item diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index 80efb900e37069f4ff39c35d39456959ca24bfe8..04829ced2048b07aa4b2dcf98a601d1fdd9431fb 100644 +index b9657abde59bdf3b2a464466f1a251a2c5f226e1..235e360df71b796a39d6c85530157097fd0c7b79 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -@@ -795,5 +795,30 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { +@@ -801,5 +801,30 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { public void setShieldBlockingDelay(int delay) { getHandle().setShieldBlockingDelay(delay); } diff --git a/patches/server/0214-RangedEntity-API.patch b/patches/server/0215-RangedEntity-API.patch similarity index 100% rename from patches/server/0214-RangedEntity-API.patch rename to patches/server/0215-RangedEntity-API.patch diff --git a/patches/server/0215-Add-config-to-disable-ender-dragon-legacy-check.patch b/patches/server/0216-Add-config-to-disable-ender-dragon-legacy-check.patch similarity index 100% rename from patches/server/0215-Add-config-to-disable-ender-dragon-legacy-check.patch rename to patches/server/0216-Add-config-to-disable-ender-dragon-legacy-check.patch diff --git a/patches/server/0216-Implement-World.getEntity-UUID-API.patch b/patches/server/0217-Implement-World.getEntity-UUID-API.patch similarity index 91% rename from patches/server/0216-Implement-World.getEntity-UUID-API.patch rename to patches/server/0217-Implement-World.getEntity-UUID-API.patch index 3071dcd6fc..c8a4dc7d20 100644 --- a/patches/server/0216-Implement-World.getEntity-UUID-API.patch +++ b/patches/server/0217-Implement-World.getEntity-UUID-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Implement World.getEntity(UUID) API diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 776bbbbeae53cc6a89546f571b07b0c13376f29a..b10f4e4bb39f4de1aba4f6949843fa3786cedc62 100644 +index 51689ecd87a4afcc24786f3feb82b4d0c23b2732..78ca1045257fa0771ddea44629e09cfac8f88ca3 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -1036,6 +1036,15 @@ public class CraftWorld extends CraftRegionAccessor implements World { diff --git a/patches/server/0217-InventoryCloseEvent-Reason-API.patch b/patches/server/0218-InventoryCloseEvent-Reason-API.patch similarity index 94% rename from patches/server/0217-InventoryCloseEvent-Reason-API.patch rename to patches/server/0218-InventoryCloseEvent-Reason-API.patch index e72831e1c2..8af8925945 100644 --- a/patches/server/0217-InventoryCloseEvent-Reason-API.patch +++ b/patches/server/0218-InventoryCloseEvent-Reason-API.patch @@ -29,7 +29,7 @@ index d17808f6c565712dac31b0db7a4b6baed2dbdf21..8b28de5755ad4fe50903837700feed32 } // Spigot End diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 0e64cb9969453832c5d08b112cafb9ef835f9a2a..cd392d316f35ac488c49ad8c34c0273bbccc6a1c 100644 +index 673252f54103a7ab34650db85d6200953755c745..ab71db25415e87e2ebd299e4d491be5e08820c21 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -633,7 +633,7 @@ public class ServerPlayer extends Player { @@ -75,7 +75,7 @@ index 0e64cb9969453832c5d08b112cafb9ef835f9a2a..cd392d316f35ac488c49ad8c34c0273b this.doCloseContainer(); } diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 217961627f32d19e1b4ebe56d7132613fa613fe4..6c74c37f396459d25672b6ad7574393d8cc7c292 100644 +index b11f6e5c55e4eeeac82b1567a27b013867a570e3..0a4c9fa74b294e9aa15658b7e6a36603f3c55516 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -217,6 +217,7 @@ import org.bukkit.event.inventory.ClickType; @@ -86,7 +86,7 @@ index 217961627f32d19e1b4ebe56d7132613fa613fe4..6c74c37f396459d25672b6ad7574393d import org.bukkit.event.inventory.InventoryCreativeEvent; import org.bukkit.event.inventory.InventoryType.SlotType; import org.bukkit.event.inventory.SmithItemEvent; -@@ -2657,10 +2658,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2663,10 +2664,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @Override public void handleContainerClose(ServerboundContainerClosePacket packet) { @@ -104,7 +104,7 @@ index 217961627f32d19e1b4ebe56d7132613fa613fe4..6c74c37f396459d25672b6ad7574393d this.player.doCloseContainer(); } diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 591cf187fb23bb2319e89b5ad0021aa9ec2af012..195f7969e9fbe2469701cf127219e8f6145e6f40 100644 +index 5b5f7aefd2e2a7c977605c84a9c005eb4afe4ba3..590cffbbccb1f6ce4bd9abfe036c081972b31086 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -516,7 +516,7 @@ public abstract class PlayerList { @@ -117,7 +117,7 @@ index 591cf187fb23bb2319e89b5ad0021aa9ec2af012..195f7969e9fbe2469701cf127219e8f6 PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(entityplayer.getBukkitEntity(), net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? entityplayer.getBukkitEntity().displayName() : PaperAdventure.asAdventure(entityplayer.getDisplayName()))); // Paper - Adventure diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index 26709e64ffbe1a41516908e4b3fc9d21d4c0dff0..a46a6b76b6821be9d8983633cd0c6b9fa3aa349c 100644 +index 67da749cef5241d6cbe02a494e43ae8fb24bb56d..48b18b824935ef922fe9f7e5860f923688a0ccc0 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -265,7 +265,7 @@ public abstract class Player extends LivingEntity { @@ -144,7 +144,7 @@ index 26709e64ffbe1a41516908e4b3fc9d21d4c0dff0..a46a6b76b6821be9d8983633cd0c6b9f this.containerMenu = this.inventoryMenu; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -index 7ea4a2d4e691e0a0a4d9ef3189a29a4a4ca4374b..883b6245f44f3fb82d7678e1092177ca646d484a 100644 +index 787ccb37a39bb506cf9fd8d54cf772b346981f85..f5b3190ffb9e9f92977afc9e40ddfa155d054865 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java @@ -377,7 +377,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { @@ -173,10 +173,10 @@ index 7ea4a2d4e691e0a0a4d9ef3189a29a4a4ca4374b..883b6245f44f3fb82d7678e1092177ca @Override public boolean isBlocking() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 4bd0bf1afef245976082287b7e3a5b758fefdcf4..e9c8148495dcea8c6ba143ee2d5bd0430a5c94dd 100644 +index 38abee17ad6db9f593cca06efb1d14049b3307e6..6bec3eb7180ef24c5c1480acd35ca43fdd4e6c3e 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1161,7 +1161,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1174,7 +1174,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { // Close any foreign inventory if (this.getHandle().containerMenu != this.getHandle().inventoryMenu) { diff --git a/patches/server/0218-Vex-get-setSummoner-API.patch b/patches/server/0219-Vex-get-setSummoner-API.patch similarity index 100% rename from patches/server/0218-Vex-get-setSummoner-API.patch rename to patches/server/0219-Vex-get-setSummoner-API.patch diff --git a/patches/server/0219-Refresh-player-inventory-when-cancelling-PlayerInter.patch b/patches/server/0220-Refresh-player-inventory-when-cancelling-PlayerInter.patch similarity index 90% rename from patches/server/0219-Refresh-player-inventory-when-cancelling-PlayerInter.patch rename to patches/server/0220-Refresh-player-inventory-when-cancelling-PlayerInter.patch index c093cf82b7..94b94b8fe3 100644 --- a/patches/server/0219-Refresh-player-inventory-when-cancelling-PlayerInter.patch +++ b/patches/server/0220-Refresh-player-inventory-when-cancelling-PlayerInter.patch @@ -16,10 +16,10 @@ Refresh the player inventory when PlayerInteractEntityEvent is cancelled to avoid this problem. diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index a646264c34592f3a7512e94399ba15490381095d..867478671d3223338bf01a36da0361a5ae1f38be 100644 +index 0a4c9fa74b294e9aa15658b7e6a36603f3c55516..dd08e74a2741c89e00fe1487f90834dfbbd92ce2 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2539,6 +2539,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2545,6 +2545,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic } if (event.isCancelled()) { diff --git a/patches/server/0220-Use-AsyncAppender-to-keep-logging-IO-off-main-thread.patch b/patches/server/0221-Use-AsyncAppender-to-keep-logging-IO-off-main-thread.patch similarity index 93% rename from patches/server/0220-Use-AsyncAppender-to-keep-logging-IO-off-main-thread.patch rename to patches/server/0221-Use-AsyncAppender-to-keep-logging-IO-off-main-thread.patch index 81095bd2eb..bdc1affbf2 100644 --- a/patches/server/0220-Use-AsyncAppender-to-keep-logging-IO-off-main-thread.patch +++ b/patches/server/0221-Use-AsyncAppender-to-keep-logging-IO-off-main-thread.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Use AsyncAppender to keep logging IO off main thread diff --git a/build.gradle.kts b/build.gradle.kts -index 8f8e6dea5f5f2a537a753efcc38484e3cd6a888f..28ca89a36d9cf9b7aca51a21be89e220c8e07589 100644 +index c6148b8521dd6a619f375fc641d5a2ce74234fc2..9c5f8c592ceed46e02c5193559677110485f084d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts -@@ -26,6 +26,7 @@ dependencies { +@@ -27,6 +27,7 @@ dependencies { implementation("commons-lang:commons-lang:2.6") runtimeOnly("org.xerial:sqlite-jdbc:3.36.0.3") runtimeOnly("mysql:mysql-connector-java:8.0.29") diff --git a/patches/server/0221-add-more-information-to-Entity.toString.patch b/patches/server/0222-add-more-information-to-Entity.toString.patch similarity index 100% rename from patches/server/0221-add-more-information-to-Entity.toString.patch rename to patches/server/0222-add-more-information-to-Entity.toString.patch diff --git a/patches/server/0228-Vanished-players-don-t-have-rights.patch b/patches/server/0228-Vanished-players-don-t-have-rights.patch index 28dcf50d54..3aed2f330a 100644 --- a/patches/server/0228-Vanished-players-don-t-have-rights.patch +++ b/patches/server/0228-Vanished-players-don-t-have-rights.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Vanished players don't have rights diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java -index d8760dd282221fa10b486f1ec4634c1aafd9c26e..11cfe63c101f5d76d3481a3163dbaec22685ccce 100644 +index 95ee8f85dd7e6c32f751f5c754a351cc7bcd6245..ec5fc3293097b364b5f6d8acc756aa8adde15215 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java +++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java @@ -212,7 +212,14 @@ public abstract class Projectile extends Entity { diff --git a/patches/server/0234-Add-TNTPrimeEvent.patch b/patches/server/0234-Add-TNTPrimeEvent.patch index 55aa436662..580d91bcd1 100644 --- a/patches/server/0234-Add-TNTPrimeEvent.patch +++ b/patches/server/0234-Add-TNTPrimeEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add TNTPrimeEvent diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java -index a889be9dd2a94b531a227ff69a5e761e103067be..3b14fd5d67716a5b3610c10e8105d29f93a1d7a9 100644 +index 7bf3ad1ccef09b697655dc949abab9ab006a95a9..c9051e80d329f1b10fa04d21f8891e85c44b5200 100644 --- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java +++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java @@ -532,6 +532,11 @@ public class EnderDragon extends Mob implements Enemy { diff --git a/patches/server/0235-Break-up-and-make-tab-spam-limits-configurable.patch b/patches/server/0235-Break-up-and-make-tab-spam-limits-configurable.patch index fd3ca17b01..8f182e4bc9 100644 --- a/patches/server/0235-Break-up-and-make-tab-spam-limits-configurable.patch +++ b/patches/server/0235-Break-up-and-make-tab-spam-limits-configurable.patch @@ -22,7 +22,7 @@ to take the burden of this into their own hand without having to rely on plugins doing unsafe things. diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 867478671d3223338bf01a36da0361a5ae1f38be..c5ad4d8a08f03a6f75241f4e4913d84bcb0fdf0b 100644 +index dd08e74a2741c89e00fe1487f90834dfbbd92ce2..34c635da9ff7aee5105f9a6d7661eb13df0b98a3 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -261,6 +261,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic diff --git a/patches/server/0238-Add-Debug-Entities-option-to-debug-dupe-uuid-issues.patch b/patches/server/0238-Add-Debug-Entities-option-to-debug-dupe-uuid-issues.patch index 5d888284af..84da150642 100644 --- a/patches/server/0238-Add-Debug-Entities-option-to-debug-dupe-uuid-issues.patch +++ b/patches/server/0238-Add-Debug-Entities-option-to-debug-dupe-uuid-issues.patch @@ -8,7 +8,7 @@ Add -Ddebug.entities=true to your JVM flags to gain more information 1.17: Needs to be reworked for new entity storage system diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 3e1b2d2cedd44112a6c100ddfffe842d3be8b703..e76241660aaefa1736565515b98f7d33f86e10b3 100644 +index 61039a4b61317e293ea054a6a2c0e849e5a302f0..7b8a5efc73a7a0bfb51af7299341b0e2e988d4c1 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -896,6 +896,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -72,7 +72,7 @@ index 8b28de5755ad4fe50903837700feed32e4530afd..2daa8e2e64829df838bde981a56d6e40 return false; } else { diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index ac6bd21798192c4c07737a2320c3626caebc7e22..b8257959acd2b38243fd259f367564080aff951e 100644 +index 0ae266bea5be068ece32a5a2f9b677117680e67b..5116be3075c1249254524bf6a5b6bc28c61400e6 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -235,6 +235,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { diff --git a/patches/server/0239-Add-Early-Warning-Feature-to-WatchDog.patch b/patches/server/0239-Add-Early-Warning-Feature-to-WatchDog.patch index 5f69ea0c9a..66d6dc4bf8 100644 --- a/patches/server/0239-Add-Early-Warning-Feature-to-WatchDog.patch +++ b/patches/server/0239-Add-Early-Warning-Feature-to-WatchDog.patch @@ -9,7 +9,7 @@ thread dumps at an interval until the point of crash. This will help diagnose what was going on in that time before the crash. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 2b55df58684a19519335666858bc79de8067faf7..6026a2da9645a5f22aa18c74e35d8b76a3f29352 100644 +index bb7da8b167b72f2b1fec2be8838545ae4ed71eb3..eef3b01d1304e06d0c9971df82af54d90676957a 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -1051,6 +1051,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop collection, boolean force) { diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index b653121dc16ce4ab3f32456e0c8690e022aa263c..2d55260f4c753bfdd9f7fca69f1a9a1df0d28d1c 100644 +index 67d820fb9aa00a3275cc3e23461864b496d738aa..6e533fdcd0671892a0e9dbfc99662feb433a5cf8 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -807,9 +807,16 @@ public class CraftEventFactory { diff --git a/patches/server/0256-Allow-chests-to-be-placed-with-NBT-data.patch b/patches/server/0256-Allow-chests-to-be-placed-with-NBT-data.patch index 9e6fd9e505..cd457379f2 100644 --- a/patches/server/0256-Allow-chests-to-be-placed-with-NBT-data.patch +++ b/patches/server/0256-Allow-chests-to-be-placed-with-NBT-data.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Allow chests to be placed with NBT data diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index f7b7a6a2327dd863390432679519caebac6dd567..9a3cc9af85b1f1d4d9ecb093f874f03d9bfde342 100644 +index cf47b0bed013b3242b516198ff7006aab5452d7e..00c438de76577e7b869270df16915d1ade088c9f 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java @@ -369,6 +369,7 @@ public final class ItemStack { diff --git a/patches/server/0267-PreSpawnerSpawnEvent.patch b/patches/server/0267-PreSpawnerSpawnEvent.patch index 72f2f7c8ff..f70637147e 100644 --- a/patches/server/0267-PreSpawnerSpawnEvent.patch +++ b/patches/server/0267-PreSpawnerSpawnEvent.patch @@ -9,7 +9,7 @@ SpawnerSpawnEvent gets called instead of the CreatureSpawnEvent for spawners. diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java -index 23cecd12f064f70d314393971312d881cace043a..a985364e5dd4a592e282ad16f0555f842a1d5048 100644 +index 64d1f0ed579ef6f6f2e24e795d8dd0e1bdb5f39d..eab8634dbf5bbb7eaa65e7e9a3d4a94a2d45ea2a 100644 --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java @@ -134,11 +134,11 @@ public abstract class BaseSpawner { diff --git a/patches/server/0268-Add-LivingEntity-getTargetEntity.patch b/patches/server/0268-Add-LivingEntity-getTargetEntity.patch index 7865c98d08..1d8fa881b4 100644 --- a/patches/server/0268-Add-LivingEntity-getTargetEntity.patch +++ b/patches/server/0268-Add-LivingEntity-getTargetEntity.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add LivingEntity#getTargetEntity diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index d9b2f2e230abd3ee5b7d77c76472a86cb38255a4..03004dbb8ab4cdb982ea2f6d7464258d025ff411 100644 +index 24a07ef9f5cbed34d1aefccda9fe655b7dfef7ec..3cb7bca86c6b0696db7ad156d09e29e9da8cc7e7 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -117,6 +117,7 @@ import net.minecraft.world.level.storage.loot.LootTable; @@ -56,7 +56,7 @@ index d9b2f2e230abd3ee5b7d77c76472a86cb38255a4..03004dbb8ab4cdb982ea2f6d7464258d public int getShieldBlockingDelay() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index 76c66e3533779a966d164637bac0c66415605b2c..0bdb8a887ac159c58ec39d4aaa56cef404eaa6b2 100644 +index 8c6592f989f982cf418690e2633bfba568f22227..0541d68f6fc758ce5915fe906f7a44814c33b2d6 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -1,5 +1,6 @@ diff --git a/patches/server/0269-Add-sun-related-API.patch b/patches/server/0269-Add-sun-related-API.patch index 3b9ff0bb75..1ddddab912 100644 --- a/patches/server/0269-Add-sun-related-API.patch +++ b/patches/server/0269-Add-sun-related-API.patch @@ -7,7 +7,7 @@ Subject: [PATCH] Add sun related API public net.minecraft.world.entity.Mob isSunBurnTick()Z diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index a21797af9f90235835919c395d2ea77a980b2768..00cfc9abb31c7fada8a7e4a99850d5c9f5b71c96 100644 +index a6989383126d52f339917905b58c2afe943b4e7d..019bb773ced8f0a79611602906bad2366926d5ed 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -678,6 +678,13 @@ public class CraftWorld extends CraftRegionAccessor implements World { diff --git a/patches/server/0271-Call-player-spectator-target-events-and-improve-impl.patch b/patches/server/0271-Call-player-spectator-target-events-and-improve-impl.patch index 691257a062..a56ac11bfd 100644 --- a/patches/server/0271-Call-player-spectator-target-events-and-improve-impl.patch +++ b/patches/server/0271-Call-player-spectator-target-events-and-improve-impl.patch @@ -19,7 +19,7 @@ spectate the target entity. Co-authored-by: Spottedleaf diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 05e72945da26295fbc5f0d243ba48a8649244b3b..572dc30729a4511dcc7002434017edf8b0ce5a89 100644 +index 117d4d39bd8ad01207f7056f1d82681568de5b38..202be4c0a143a14f99890426c8525484a7e0d6fd 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1908,15 +1908,59 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0272-MC-50319-Check-other-worlds-for-shooter-of-projectil.patch b/patches/server/0272-MC-50319-Check-other-worlds-for-shooter-of-projectil.patch index 6b8c4ac1f9..ae8f72f216 100644 --- a/patches/server/0272-MC-50319-Check-other-worlds-for-shooter-of-projectil.patch +++ b/patches/server/0272-MC-50319-Check-other-worlds-for-shooter-of-projectil.patch @@ -11,7 +11,7 @@ If the projectile fails to find the shooter in the current world, check other worlds. diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java -index 11cfe63c101f5d76d3481a3163dbaec22685ccce..b0caf14a196cd8c3a02d8e931a08857173ffb4da 100644 +index ec5fc3293097b364b5f6d8acc756aa8adde15215..a904507707475e95b6389ccc437bd234b97c10cc 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java +++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java @@ -58,6 +58,18 @@ public abstract class Projectile extends Entity { diff --git a/patches/server/0275-Add-option-to-prevent-players-from-moving-into-unloa.patch b/patches/server/0275-Add-option-to-prevent-players-from-moving-into-unloa.patch index 595d71acf8..45f1c1f4a3 100644 --- a/patches/server/0275-Add-option-to-prevent-players-from-moving-into-unloa.patch +++ b/patches/server/0275-Add-option-to-prevent-players-from-moving-into-unloa.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Add option to prevent players from moving into unloaded diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index c5ad4d8a08f03a6f75241f4e4913d84bcb0fdf0b..9843684ab5cf21bfc4fe30f3528dc75475b4dcd1 100644 +index 34c635da9ff7aee5105f9a6d7661eb13df0b98a3..a0c18ab3411272229d9c3ce2a8faf4812f8cf60f 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -563,9 +563,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic diff --git a/patches/server/0276-Reset-players-airTicks-on-respawn.patch b/patches/server/0276-Reset-players-airTicks-on-respawn.patch index 34f1b4bbfb..21f3bd2920 100644 --- a/patches/server/0276-Reset-players-airTicks-on-respawn.patch +++ b/patches/server/0276-Reset-players-airTicks-on-respawn.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Reset players airTicks on respawn diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 572dc30729a4511dcc7002434017edf8b0ce5a89..15d4ad53cca71272e491bea31d83e8c8e697dac0 100644 +index 202be4c0a143a14f99890426c8525484a7e0d6fd..3f9f7faeaa33a4f5d55812d6964496c0b9c8abb4 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -2337,6 +2337,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0278-Improve-Server-Thread-Pool-and-Thread-Priorities.patch b/patches/server/0278-Improve-Server-Thread-Pool-and-Thread-Priorities.patch index eea41e9ee0..2b1e9c0b9a 100644 --- a/patches/server/0278-Improve-Server-Thread-Pool-and-Thread-Priorities.patch +++ b/patches/server/0278-Improve-Server-Thread-Pool-and-Thread-Priorities.patch @@ -81,7 +81,7 @@ index c085ed233eb4d1f2100ec23a77447ef799ecdf1f..8120739e2a7c4c86ecb7058f08bd8179 return executorService; } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 6026a2da9645a5f22aa18c74e35d8b76a3f29352..45f3035be38571088edf293070b8d84b19a4101a 100644 +index eef3b01d1304e06d0c9971df82af54d90676957a..2459fc1699582410b1fca4d787c6115563a575ba 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -317,6 +317,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop optional = usercache.get(gameprofile.getId()); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java -index e7442952ef1f03969949014492a7ddc6d0796ba5..d7823d7dc88cfba6f6ac9dae220e03dea4a0bcdd 100644 +index 69a1852905dd4724c30ac8ab88c14251eee2c371..17b3d5de58a9ef3acc67624c46cd6bbd96394f87 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java @@ -250,6 +250,61 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa @@ -106,7 +106,7 @@ index e7442952ef1f03969949014492a7ddc6d0796ba5..d7823d7dc88cfba6f6ac9dae220e03de public Location getLastDeathLocation() { if (this.getData().contains("LastDeathLocation", 10)) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 03f9d58fa5158b50e12edd6a91ff263e08555870..e693b7c94bd0c35260969266a7fa9c606d91f5b4 100644 +index 819f496d8c3599c16dfa8eaf95578cf53827f2bb..0e7cbe117b758a1f9f67320e9d985f58078b49db 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -176,6 +176,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -117,7 +117,7 @@ index 03f9d58fa5158b50e12edd6a91ff263e08555870..e693b7c94bd0c35260969266a7fa9c60 // Paper end public CraftPlayer(CraftServer server, ServerPlayer entity) { -@@ -1768,6 +1769,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1787,6 +1788,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player { this.firstPlayed = firstPlayed; } @@ -136,7 +136,7 @@ index 03f9d58fa5158b50e12edd6a91ff263e08555870..e693b7c94bd0c35260969266a7fa9c60 public void readExtraData(CompoundTag nbttagcompound) { this.hasPlayedBefore = true; if (nbttagcompound.contains("bukkit")) { -@@ -1790,6 +1803,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1809,6 +1822,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } public void setExtraData(CompoundTag nbttagcompound) { @@ -145,7 +145,7 @@ index 03f9d58fa5158b50e12edd6a91ff263e08555870..e693b7c94bd0c35260969266a7fa9c60 if (!nbttagcompound.contains("bukkit")) { nbttagcompound.put("bukkit", new CompoundTag()); } -@@ -1804,6 +1819,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1823,6 +1838,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player { data.putLong("firstPlayed", this.getFirstPlayed()); data.putLong("lastPlayed", System.currentTimeMillis()); data.putString("lastKnownName", handle.getScoreboardName()); diff --git a/patches/server/0293-Workaround-for-vehicle-tracking-issue-on-disconnect.patch b/patches/server/0293-Workaround-for-vehicle-tracking-issue-on-disconnect.patch index 75eb434a84..8c70f3d476 100644 --- a/patches/server/0293-Workaround-for-vehicle-tracking-issue-on-disconnect.patch +++ b/patches/server/0293-Workaround-for-vehicle-tracking-issue-on-disconnect.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Workaround for vehicle tracking issue on disconnect diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 8aac8dd53b171f05559fb233d47bf1c9e5815a03..6092167b282a99799c27937dfa1bef424a7e2a9e 100644 +index 4680b02295eb231ac90b84734c8d6989f29fa16c..8a1014490ae4ddf24010b2efae8051277e64b849 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1609,6 +1609,13 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0294-Block-Entity-remove-from-being-called-on-Players.patch b/patches/server/0294-Block-Entity-remove-from-being-called-on-Players.patch index dc2ea9101d..39a5bca7c2 100644 --- a/patches/server/0294-Block-Entity-remove-from-being-called-on-Players.patch +++ b/patches/server/0294-Block-Entity-remove-from-being-called-on-Players.patch @@ -12,10 +12,10 @@ Player we will look at limiting the scope of this change. It appears to be unintentional in the few cases we've seen so far. diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 9c8b9829ab06c45ae8fdd921118ed20077a9655b..77a68059288835619ce78ada0cdadc3d6bd761f4 100644 +index 0e7cbe117b758a1f9f67320e9d985f58078b49db..727ed31aefa4e0893a03afd4b90b01ad6ed51ce4 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -2700,6 +2700,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -2719,6 +2719,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { public void resetCooldown() { getHandle().resetAttackStrengthTicker(); } diff --git a/patches/server/0296-Async-command-map-building.patch b/patches/server/0296-Async-command-map-building.patch index c326cc955a..ec27e4685d 100644 --- a/patches/server/0296-Async-command-map-building.patch +++ b/patches/server/0296-Async-command-map-building.patch @@ -9,10 +9,10 @@ commands if the server is restarting. Using the default async pool caused issues due to the shutdown logic generally being much later. diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java -index 9eaa7ad424252ea2e033d6041a14bf1ef7dd9fde..6e931aa7220180336b64fbb3b4090df278fca0fa 100644 +index 4cf76403098cc8565199b29757a29c80150bbaae..b21bcb046ec801a4cb5395034be60d0eb19888eb 100644 --- a/src/main/java/net/minecraft/commands/Commands.java +++ b/src/main/java/net/minecraft/commands/Commands.java -@@ -368,6 +368,24 @@ public class Commands { +@@ -390,6 +390,24 @@ public class Commands { if ( org.spigotmc.SpigotConfig.tabComplete < 0 ) return; // Spigot // CraftBukkit start // Register Vanilla commands into builtRoot as before @@ -37,7 +37,7 @@ index 9eaa7ad424252ea2e033d6041a14bf1ef7dd9fde..6e931aa7220180336b64fbb3b4090df2 Map, CommandNode> map = Maps.newIdentityHashMap(); // Use identity to prevent aliasing issues RootCommandNode vanillaRoot = new RootCommandNode(); -@@ -385,7 +403,14 @@ public class Commands { +@@ -407,7 +425,14 @@ public class Commands { for (CommandNode node : rootcommandnode.getChildren()) { bukkit.add(node.getName()); } @@ -53,7 +53,7 @@ index 9eaa7ad424252ea2e033d6041a14bf1ef7dd9fde..6e931aa7220180336b64fbb3b4090df2 event.getPlayer().getServer().getPluginManager().callEvent(event); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index f9007905422f7a6eac7c78fd5bdb17cb4da96712..1685f92acdf63decc6cd6b37957ca61212b43bbc 100644 +index 18ff46d66b1ffd6871fc2b16314d1b3383eb5cdd..038e98c708f9fac8ab6109d02b0297a1d008710c 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -897,6 +897,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { runSync(player, bukkit, rootcommandnode); }); -@@ -411,6 +412,7 @@ public class Commands { +@@ -433,6 +434,7 @@ public class Commands { private void runSync(ServerPlayer player, Collection bukkit, RootCommandNode rootcommandnode) { // Paper end - Async command map building @@ -118,7 +118,7 @@ index 6e931aa7220180336b64fbb3b4090df278fca0fa..feb9e827357b3ffb76dfff90350e5135 PlayerCommandSendEvent event = new PlayerCommandSendEvent(player.getBukkitEntity(), new LinkedHashSet<>(bukkit)); event.getPlayer().getServer().getPluginManager().callEvent(event); -@@ -429,6 +431,11 @@ public class Commands { +@@ -451,6 +453,11 @@ public class Commands { while (iterator.hasNext()) { CommandNode commandnode2 = (CommandNode) iterator.next(); @@ -131,7 +131,7 @@ index 6e931aa7220180336b64fbb3b4090df278fca0fa..feb9e827357b3ffb76dfff90350e5135 if (commandnode2.canUse(source)) { diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 60c9b8d45ae4884883fce1b402bf9ed2906aff79..428f300a33589910eae058b77bb7aa611f2578e7 100644 +index e6b1df963db0f5022e57dfc4179389b010cebe5c..9ebe4ccd3ac092a945024fe69e4e48413809c7b4 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -828,8 +828,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic diff --git a/patches/server/0299-Limit-Client-Sign-length-more.patch b/patches/server/0299-Limit-Client-Sign-length-more.patch index 5822014fb8..b9a6fbf37d 100644 --- a/patches/server/0299-Limit-Client-Sign-length-more.patch +++ b/patches/server/0299-Limit-Client-Sign-length-more.patch @@ -22,7 +22,7 @@ it only impacts data sent from the client. Set -DPaper.maxSignLength=XX to change limit or -1 to disable diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 428f300a33589910eae058b77bb7aa611f2578e7..a1e75d2c44e854fd7976caa58c8beb618f92e0a0 100644 +index 9ebe4ccd3ac092a945024fe69e4e48413809c7b4..f18c32e5f100bebbc404f2326f53d906305fc223 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -296,6 +296,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -33,7 +33,7 @@ index 428f300a33589910eae058b77bb7aa611f2578e7..a1e75d2c44e854fd7976caa58c8beb61 public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player) { this.lastChatTimeStamp = new AtomicReference(Instant.EPOCH); -@@ -3176,7 +3177,19 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3182,7 +3183,19 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @Override public void handleSignUpdate(ServerboundSignUpdatePacket packet) { diff --git a/patches/server/0303-Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch b/patches/server/0303-Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch index f4ee66bb3f..dbab15c227 100644 --- a/patches/server/0303-Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch +++ b/patches/server/0303-Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Call WhitelistToggleEvent when whitelist is toggled diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 452bceba9d35cf3bbfaa1ee4e156095eb65fbb01..b8423aa64b6b1dd48772efdd33ed5f36dd9ea005 100644 +index e0edee2d769b9fa0caa5f6ced7852560d4e01ba9..deca1b45ca55f80228e71e981f5ea5c3495923b3 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -1140,6 +1140,7 @@ public abstract class PlayerList { diff --git a/patches/server/0304-Entity-getEntitySpawnReason.patch b/patches/server/0304-Entity-getEntitySpawnReason.patch index b82b4a1266..39343b2004 100644 --- a/patches/server/0304-Entity-getEntitySpawnReason.patch +++ b/patches/server/0304-Entity-getEntitySpawnReason.patch @@ -22,7 +22,7 @@ index 2daa8e2e64829df838bde981a56d6e407b8ee004..04826a7684940558368e95d4cfd7f90e // Paper start if (DEBUG_ENTITIES) { diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index bd880228aaaefb2299b09ce91a58b2da1f04d953..01cfa93571effead5498e766f6c7e254a5b13479 100644 +index deca1b45ca55f80228e71e981f5ea5c3495923b3..4d4afdd79957500df7637f8b0afd1aa596adadc3 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -356,7 +356,7 @@ public abstract class PlayerList { diff --git a/patches/server/0306-Implement-PlayerPostRespawnEvent.patch b/patches/server/0306-Implement-PlayerPostRespawnEvent.patch index 81b6221a0f..f7a36b9ddf 100644 --- a/patches/server/0306-Implement-PlayerPostRespawnEvent.patch +++ b/patches/server/0306-Implement-PlayerPostRespawnEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Implement PlayerPostRespawnEvent diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 01cfa93571effead5498e766f6c7e254a5b13479..8e8a4ab377e3d42ba2927745aa903861549de10e 100644 +index 4d4afdd79957500df7637f8b0afd1aa596adadc3..19e83c82f987f76c7a869b096ab702499d5876ec 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -736,9 +736,14 @@ public abstract class PlayerList { diff --git a/patches/server/0308-Server-Tick-Events.patch b/patches/server/0308-Server-Tick-Events.patch index b79a81acd2..f2e4cc5413 100644 --- a/patches/server/0308-Server-Tick-Events.patch +++ b/patches/server/0308-Server-Tick-Events.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Server Tick Events Fires event at start and end of a server tick diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 1685f92acdf63decc6cd6b37957ca61212b43bbc..e56a03b04e510a510d9deb2a013900241471ac0f 100644 +index 038e98c708f9fac8ab6109d02b0297a1d008710c..0f824428003776128f5d92c735df06cd30a8666b 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -1309,6 +1309,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop -diff --git a/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java b/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java -index 5b8ecf5b0165ed2cd4397cdee958e97c2e8f18d5..ad802eb211f05f646159d7fc53f8a9427b46cb89 100644 ---- a/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java -+++ b/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java -@@ -310,7 +310,13 @@ public class BuiltInRegistries { - } - - public static void bootStrap() { -+ // Paper start -+ bootStrap(() -> {}); -+ } -+ public static void bootStrap(Runnable runnable) { -+ // Paper end - createContents(); -+ runnable.run(); // Paper - freeze(); - validate(REGISTRY); - } diff --git a/src/main/java/net/minecraft/data/worldgen/SurfaceRuleData.java b/src/main/java/net/minecraft/data/worldgen/SurfaceRuleData.java index 06e1774dfbb667aca69bc30c9675ed472cb5728c..1d5bc86516df3781aea894c3afd340421ba51a17 100644 --- a/src/main/java/net/minecraft/data/worldgen/SurfaceRuleData.java @@ -132,22 +114,17 @@ index 06e1774dfbb667aca69bc30c9675ed472cb5728c..1d5bc86516df3781aea894c3afd34042 public static SurfaceRules.RuleSource end() { diff --git a/src/main/java/net/minecraft/server/Bootstrap.java b/src/main/java/net/minecraft/server/Bootstrap.java -index 0d3a8f576c037886ccdd6068ce953c4ce010ae2f..d0ee6523477309bc984869774533ee1941ed0cb0 100644 +index ac2b7b5161eaaca3620268ae865d6f2a80227fde..a1192d1f6b99669f843e8d9a8928ff0e8c030559 100644 --- a/src/main/java/net/minecraft/server/Bootstrap.java +++ b/src/main/java/net/minecraft/server/Bootstrap.java -@@ -69,7 +69,11 @@ public class Bootstrap { - EntitySelectorOptions.bootStrap(); - DispenseItemBehavior.bootStrap(); +@@ -71,6 +71,7 @@ public class Bootstrap { CauldronInteraction.bootStrap(); -- BuiltInRegistries.bootStrap(); -+ // Paper start - register custom flat bedrock -+ BuiltInRegistries.bootStrap(() -> { + // Paper start + BuiltInRegistries.bootStrap(() -> { + net.minecraft.core.Registry.register(net.minecraft.core.registries.BuiltInRegistries.MATERIAL_CONDITION, new net.minecraft.resources.ResourceLocation("paper", "bedrock_condition_source"), net.minecraft.data.worldgen.SurfaceRuleData.PaperBedrockConditionSource.CODEC.codec()); -+ }); -+ // Paper end - Bootstrap.wrapStreams(); - } - // CraftBukkit start - easier than fixing the decompile + io.papermc.paper.plugin.entrypoint.LaunchEntryPointHandler.enterBootstrappers(); // Paper - Entrypoint for bootstrapping + }); + // Paper end diff --git a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java index cdc87f14e5d6336856c74d5089e50ae5ebad9923..6b84633bf6956406d2e2c5dd32fa358f41ccc890 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java diff --git a/patches/server/0331-Duplicate-UUID-Resolve-Option.patch b/patches/server/0331-Duplicate-UUID-Resolve-Option.patch index 1e11ee3a84..93315feb85 100644 --- a/patches/server/0331-Duplicate-UUID-Resolve-Option.patch +++ b/patches/server/0331-Duplicate-UUID-Resolve-Option.patch @@ -56,7 +56,7 @@ index 0dc94dec1317b3f86d38074c6cbe41ab828cab1d..0e45a340ae534caf676b7f9d0adcbcee public static void onChunkHolderCreate(final ServerLevel level, final ChunkHolder holder) { diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 7c9b73136b4fc5fda96317001eb8a32245b9768a..512e8ace73635e5494ec09bee29148617d45b460 100644 +index ae97f0c4b39d838ab321743a048de53cbc83de5d..4b05139db6628808128337dbf817712e339c17d0 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -534,6 +534,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider diff --git a/patches/server/0332-Optimize-Hoppers.patch b/patches/server/0332-Optimize-Hoppers.patch index e1deb2df41..bc12f227a9 100644 --- a/patches/server/0332-Optimize-Hoppers.patch +++ b/patches/server/0332-Optimize-Hoppers.patch @@ -25,7 +25,7 @@ index 80519ddf6302bf0aa8a186bd03aaa6e518e19adc..c277ccc012bd5011e31d746b08ace1ae this.profiler.push(() -> { return worldserver + " " + worldserver.dimension().location(); diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index 9a3cc9af85b1f1d4d9ecb093f874f03d9bfde342..da74c2f131f74b830c616baed5b932466a009e91 100644 +index 00c438de76577e7b869270df16915d1ade088c9f..79023dace09c99587b5100de29b5b0ed3ba3fc57 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java @@ -634,11 +634,12 @@ public final class ItemStack { diff --git a/patches/server/0333-PlayerDeathEvent-shouldDropExperience.patch b/patches/server/0333-PlayerDeathEvent-shouldDropExperience.patch index e77ab4925b..0bc11f1314 100644 --- a/patches/server/0333-PlayerDeathEvent-shouldDropExperience.patch +++ b/patches/server/0333-PlayerDeathEvent-shouldDropExperience.patch @@ -5,7 +5,7 @@ Subject: [PATCH] PlayerDeathEvent#shouldDropExperience diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 5eafbf1fd9b0f54819c9b2d99803c07a1708ce02..ecb81ad7ab281eaad7d5b3f9dc30082595824408 100644 +index b8fba7ed700b53ef14747fa61c1c367ec98a6328..9265ef8bc10f29410b78ea2555107800c5566cbf 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -918,7 +918,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0337-Optimise-EntityGetter-getPlayerByUUID.patch b/patches/server/0337-Optimise-EntityGetter-getPlayerByUUID.patch index 8105dcf3fc..80e187d970 100644 --- a/patches/server/0337-Optimise-EntityGetter-getPlayerByUUID.patch +++ b/patches/server/0337-Optimise-EntityGetter-getPlayerByUUID.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Optimise EntityGetter#getPlayerByUUID Use the PlayerList map instead of iterating over all players diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 0635f84d062872a9a6e38a9ba3fe71026661e651..79f09d83e10e3d357cfe1537ab7cdde8b494d9d2 100644 +index b287df21d9671963257f04e9ee75a1468bbc12e0..f85cbcd0ba398bdd2622a2e1aaba7de24d53038a 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -426,6 +426,15 @@ public class ServerLevel extends Level implements WorldGenLevel { diff --git a/patches/server/0339-Lag-compensate-eating.patch b/patches/server/0339-Lag-compensate-eating.patch index 5226762366..0e2c67e8b1 100644 --- a/patches/server/0339-Lag-compensate-eating.patch +++ b/patches/server/0339-Lag-compensate-eating.patch @@ -7,7 +7,7 @@ When the server is lagging, players will wait longer when eating. Change to also use a time check instead if it passes. diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 399c34b2837f2b54b452c866c524c51ba813fcc0..840fb46729b940b6d4d7adb4d0545b5a8508e11b 100644 +index ba4e0bac019b68da166b277028015999139d2981..b448a7b6318311ce3542e49a2f1670ccac77c215 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3592,6 +3592,11 @@ public abstract class LivingEntity extends Entity { diff --git a/patches/server/0340-Optimize-call-to-getFluid-for-explosions.patch b/patches/server/0340-Optimize-call-to-getFluid-for-explosions.patch index 0d341fc2ce..85405d5c01 100644 --- a/patches/server/0340-Optimize-call-to-getFluid-for-explosions.patch +++ b/patches/server/0340-Optimize-call-to-getFluid-for-explosions.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Optimize call to getFluid for explosions diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java -index 9f7a35e00b5edca6b2d99d3ed60cde8e1aeac4eb..2dc93845749951cd51a19fd9ee515cebcba5d731 100644 +index c4f1b98de5b7db95ca886c0f8b7b893428e1b460..cc8dcb77f2b6d447c0e8d769a3d233dc2eb64efa 100644 --- a/src/main/java/net/minecraft/world/level/Explosion.java +++ b/src/main/java/net/minecraft/world/level/Explosion.java @@ -168,7 +168,7 @@ public class Explosion { diff --git a/patches/server/0344-Anti-Xray.patch b/patches/server/0344-Anti-Xray.patch index cd81e41f75..9e34f06782 100644 --- a/patches/server/0344-Anti-Xray.patch +++ b/patches/server/0344-Anti-Xray.patch @@ -199,10 +199,10 @@ index 0000000000000000000000000000000000000000..bd86dc2ad2f87969da4add06de2a629f +} diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java new file mode 100644 -index 0000000000000000000000000000000000000000..4f3670b2bdb8b1b252e9f074a6af56a018a8c465 +index 0000000000000000000000000000000000000000..cab91880a08c6fdc545804911d295e0f24f4d983 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java -@@ -0,0 +1,636 @@ +@@ -0,0 +1,670 @@ +package com.destroystokyo.paper.antixray; + +import io.papermc.paper.configuration.WorldConfiguration; @@ -428,7 +428,31 @@ index 0000000000000000000000000000000000000000..4f3670b2bdb8b1b252e9f074a6af56a0 + bitStorageWriter.setBuffer(chunkPacketInfoAntiXray.getBuffer()); + int numberOfBlocks = presetBlockStateBits.length; + // Keep the lambda expressions as simple as possible. They are used very frequently. -+ IntSupplier random = numberOfBlocks == 1 ? (() -> 0) : new IntSupplier() { ++ LayeredIntSupplier random = numberOfBlocks == 1 ? (() -> 0) : engineMode == EngineMode.OBFUSCATE_LAYER ? new LayeredIntSupplier() { ++ // engine-mode: 3 ++ private int state; ++ private int next; ++ ++ { ++ while ((state = ThreadLocalRandom.current().nextInt()) == 0) ; ++ } ++ ++ @Override ++ public void nextLayer() { ++ // https://en.wikipedia.org/wiki/Xorshift ++ state ^= state << 13; ++ state ^= state >>> 17; ++ state ^= state << 5; ++ // https://www.pcg-random.org/posts/bounded-rands.html ++ next = (int) ((Integer.toUnsignedLong(state) * numberOfBlocks) >>> 32); ++ } ++ ++ @Override ++ public int getAsInt() { ++ return next; ++ } ++ } : new LayeredIntSupplier() { ++ // engine-mode: 2 + private int state; + + { @@ -509,6 +533,7 @@ index 0000000000000000000000000000000000000000..4f3670b2bdb8b1b252e9f074a6af56a0 + current = next; + next = nextNext; + nextNext = temp; ++ random.nextLayer(); + obfuscateLayer(y, bitStorageReader, bitStorageWriter, solidTemp, obfuscateTemp, presetBlockStateBitsTemp, current, next, nextNext, nearbyChunkSections, random); + } + @@ -534,6 +559,7 @@ index 0000000000000000000000000000000000000000..4f3670b2bdb8b1b252e9f074a6af56a0 + // There is nothing to read anymore + bitStorageReader.setBits(0); + solid[0] = true; ++ random.nextLayer(); + obfuscateLayer(15, bitStorageReader, bitStorageWriter, solid, obfuscateTemp, presetBlockStateBitsTemp, current, next, nextNext, nearbyChunkSections, random); + } + } else { @@ -546,6 +572,7 @@ index 0000000000000000000000000000000000000000..4f3670b2bdb8b1b252e9f074a6af56a0 + current = next; + next = nextNext; + nextNext = temp; ++ random.nextLayer(); + obfuscateLayer(15, bitStorageReader, bitStorageWriter, solidTemp, obfuscateTemp, presetBlockStateBitsTemp, current, next, nextNext, nearbyChunkSections, random); + } + @@ -838,6 +865,13 @@ index 0000000000000000000000000000000000000000..4f3670b2bdb8b1b252e9f074a6af56a0 + ((ServerLevel) level).getChunkSource().blockChanged(blockPos); + } + } ++ ++ @FunctionalInterface ++ private interface LayeredIntSupplier extends IntSupplier { ++ default void nextLayer() { ++ ++ } ++ } +} diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketInfo.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketInfo.java new file mode 100644 @@ -1524,7 +1558,7 @@ index b8f5ad1130b125f71a1feb1083120fb700b9bea1..f6d1eac46c619831e146c62a9c08d330 // CraftBukkit end diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java -index 6772b7e6ebded67f656dfb1af99e4d516aca67c5..1ac0778fba70ba9f09487c76e086b5a873c6c12a 100644 +index 832c6d92daaa96210a9c7edbd357ca824a60a4a5..0fadc763fb482cf9f3b51ed44427029bec9f7f63 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java @@ -55,7 +55,7 @@ public class CraftChunk implements Chunk { @@ -1537,10 +1571,10 @@ index 6772b7e6ebded67f656dfb1af99e4d516aca67c5..1ac0778fba70ba9f09487c76e086b5a8 public CraftChunk(net.minecraft.world.level.chunk.LevelChunk chunk) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 7bc16e221b37629708299773519da60a1d9930ac..3106711ef8034077cd54e40dc2e8fa003101db26 100644 +index 3369e749610fca12aa7dc5b514ffbab9ec40e43c..d312d6c543f0e09e40c232032c09caae35c8891a 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2262,7 +2262,7 @@ public final class CraftServer implements Server { +@@ -2244,7 +2244,7 @@ public final class CraftServer implements Server { public ChunkGenerator.ChunkData createChunkData(World world) { Validate.notNull(world, "World cannot be null"); ServerLevel handle = ((CraftWorld) world).getHandle(); @@ -1550,7 +1584,7 @@ index 7bc16e221b37629708299773519da60a1d9930ac..3106711ef8034077cd54e40dc2e8fa00 @Override diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 0c1c0fdfc6b1ab305b560d272efde4565922eac5..caacf6dbe6c4fd461624ea421d08a18222fc2a6e 100644 +index dd12b13bc8e8f0a7791f6204c25461758d6d0d07..2d21aeceea5a91930fb80ae838d04e5accc63391 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -409,11 +409,16 @@ public class CraftWorld extends CraftRegionAccessor implements World { diff --git a/patches/server/0348-implement-optional-per-player-mob-spawns.patch b/patches/server/0348-implement-optional-per-player-mob-spawns.patch index 257f0c8a51..116511d3b1 100644 --- a/patches/server/0348-implement-optional-per-player-mob-spawns.patch +++ b/patches/server/0348-implement-optional-per-player-mob-spawns.patch @@ -362,7 +362,7 @@ index c021733342c09adb04ce3f675209543f84ac4bda..d137aa95f670aab516e9e08272f33b21 this.lastSpawnState = spawnercreature_d; diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 20861571e8026c3c4fa40b7f8f14a2df0ebcc208..5da6530580c1d0ce298498782e8e7eb8bbf3cb3c 100644 +index 9265ef8bc10f29410b78ea2555107800c5566cbf..4a25bd069bdfc6bd35e05cc86a392edad902ab11 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -240,6 +240,11 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0350-Improve-Block-breakNaturally-API.patch b/patches/server/0350-Improve-Block-breakNaturally-API.patch index 8dd927a9b1..1c815426c2 100644 --- a/patches/server/0350-Improve-Block-breakNaturally-API.patch +++ b/patches/server/0350-Improve-Block-breakNaturally-API.patch @@ -34,7 +34,7 @@ index 0afadbc8515d448b0ef817f4f0f53b1bb0abde43..64206d94a5bf210116d208f9678618b9 if (world.dimensionType().ultraWarm()) { world.removeBlock(pos, false); diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -index 2e3b675dca8cec906d533141e158e5db6ae87042..3123a8d52236757c3e7ca3b099cc664485cb3c72 100644 +index ee8315595faae22c63c97748d8047038a671263e..ac543a4c6bc21435de3c6721af37fd5f554e403e 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java @@ -477,6 +477,18 @@ public class CraftBlock implements Block { diff --git a/patches/server/0352-Add-debug-for-sync-chunk-loads.patch b/patches/server/0352-Add-debug-for-sync-chunk-loads.patch index 039de5d5a0..9d9c319a68 100644 --- a/patches/server/0352-Add-debug-for-sync-chunk-loads.patch +++ b/patches/server/0352-Add-debug-for-sync-chunk-loads.patch @@ -194,7 +194,7 @@ index 0000000000000000000000000000000000000000..0bb4aaa546939b67a5d22865190f3047 + } +} diff --git a/src/main/java/io/papermc/paper/command/PaperCommand.java b/src/main/java/io/papermc/paper/command/PaperCommand.java -index 65ee888280f917ccd11146505b7389513280a863..04bf08cbe45763f1338390c5ab4b0dcb334bd07a 100644 +index 32b84c59722970218a1515e21c6454d0ea4f781d..8f35943e71911b6d49b4cf210e56f5e11c5753e8 100644 --- a/src/main/java/io/papermc/paper/command/PaperCommand.java +++ b/src/main/java/io/papermc/paper/command/PaperCommand.java @@ -5,6 +5,7 @@ import io.papermc.paper.command.subcommands.EntityCommand; @@ -203,10 +203,10 @@ index 65ee888280f917ccd11146505b7389513280a863..04bf08cbe45763f1338390c5ab4b0dcb import io.papermc.paper.command.subcommands.ReloadCommand; +import io.papermc.paper.command.subcommands.SyncLoadInfoCommand; import io.papermc.paper.command.subcommands.VersionCommand; + import io.papermc.paper.command.subcommands.DumpPluginsCommand; import it.unimi.dsi.fastutil.Pair; - import java.util.ArrayList; -@@ -44,6 +45,7 @@ public final class PaperCommand extends Command { - commands.put(Set.of("version"), new VersionCommand()); +@@ -46,6 +47,7 @@ public final class PaperCommand extends Command { + commands.put(Set.of("dumpplugins"), new DumpPluginsCommand()); commands.put(Set.of("fixlight"), new FixLightCommand()); commands.put(Set.of("debug", "chunkinfo", "holderinfo"), new ChunkDebugCommand()); + commands.put(Set.of("syncloadinfo"), new SyncLoadInfoCommand()); @@ -320,7 +320,7 @@ index f838a921a08981bac0d0c0a68e334ba06d11cb18..665e088cb0b73f6a0c62f29c56da462b chunkproviderserver_b.managedBlock(completablefuture::isDone); io.papermc.paper.chunk.system.scheduling.ChunkTaskScheduler.popChunkWait(); // Paper - async chunk debug // Paper - rewrite chunk system diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index a94c43386b372cdff0b207bebbf8d5b29b5fd022..a2bba2678a56c5ea197e8b18c4a96e0833121fbe 100644 +index 76c388347ebbff2d50a975b40dbe93cc2760f6bb..52a514b657485246827bf9c153303b8b5229bf5b 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -424,6 +424,12 @@ public class ServerLevel extends Level implements WorldGenLevel { diff --git a/patches/server/0353-Remove-garbage-Java-version-check.patch b/patches/server/0353-Remove-garbage-Java-version-check.patch index 7c9466a2ac..56a2300cea 100644 --- a/patches/server/0353-Remove-garbage-Java-version-check.patch +++ b/patches/server/0353-Remove-garbage-Java-version-check.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Remove garbage Java version check diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index d4f6d7fee1012adaef516f283ef8d12b5804af46..0e59dd7c30159856a72be04c56a7031ace5dd738 100644 +index 127b05c44aa1e20ce097f1c1fe6b6ca2b32226c0..4f666a16a46d86cd0919bbe8f8b918a7f451d254 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -196,10 +196,6 @@ public class Main { diff --git a/patches/server/0355-Entity-Jump-API.patch b/patches/server/0355-Entity-Jump-API.patch index 744b9c2264..ccab888881 100644 --- a/patches/server/0355-Entity-Jump-API.patch +++ b/patches/server/0355-Entity-Jump-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Entity Jump API diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index dbc412d7ea8c7e22557e4e03520ec89994a42e26..8b7a9a607b3919543a47a14147bfbfad250d4b46 100644 +index b448a7b6318311ce3542e49a2f1670ccac77c215..9621438358c85cf66c756f0d53bcd89f4f0ec933 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3264,8 +3264,10 @@ public abstract class LivingEntity extends Entity { @@ -34,7 +34,7 @@ index e98849c103e7409f70e73a30c6713c644155b284..2db5d8a937c841718e7b568c215109c3 } diff --git a/src/main/java/net/minecraft/world/entity/monster/Ravager.java b/src/main/java/net/minecraft/world/entity/monster/Ravager.java -index 8517fd004727b083545082a5de26b11cb2a93623..23cd2e1faf0d7b59885e194fc0f0adc558e4921b 100644 +index 01dfe3e29ea55b9e839a4db027fdd6a1dbb5ca23..6a0b4f86e5157494a917cf5efecb730081bae628 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Ravager.java +++ b/src/main/java/net/minecraft/world/entity/monster/Ravager.java @@ -177,7 +177,9 @@ public class Ravager extends Raider { @@ -48,10 +48,10 @@ index 8517fd004727b083545082a5de26b11cb2a93623..23cd2e1faf0d7b59885e194fc0f0adc5 } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index 0bdb8a887ac159c58ec39d4aaa56cef404eaa6b2..194c6a9accc21bfb2f446b2a2c3a8a4ee7c3a479 100644 +index 0541d68f6fc758ce5915fe906f7a44814c33b2d6..c7cc9408f961aa804af9548d8c8fee46631421cf 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -@@ -881,5 +881,19 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { +@@ -887,5 +887,19 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { public org.bukkit.inventory.EquipmentSlot getHandRaised() { return getHandle().getUsedItemHand() == net.minecraft.world.InteractionHand.MAIN_HAND ? org.bukkit.inventory.EquipmentSlot.HAND : org.bukkit.inventory.EquipmentSlot.OFF_HAND; } diff --git a/patches/server/0358-add-hand-to-BlockMultiPlaceEvent.patch b/patches/server/0358-add-hand-to-BlockMultiPlaceEvent.patch index 31af0eff86..82d0a1f49e 100644 --- a/patches/server/0358-add-hand-to-BlockMultiPlaceEvent.patch +++ b/patches/server/0358-add-hand-to-BlockMultiPlaceEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] add hand to BlockMultiPlaceEvent diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 2d55260f4c753bfdd9f7fca69f1a9a1df0d28d1c..417ae46d36690f7f7c72fb85331f8d5ff21ab937 100644 +index 6e533fdcd0671892a0e9dbfc99662feb433a5cf8..24f1be1dcf2156fe17fec1c66529514b50925e2b 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -349,13 +349,18 @@ public class CraftEventFactory { diff --git a/patches/server/0364-Add-tick-times-API-and-mspt-command.patch b/patches/server/0364-Add-tick-times-API-and-mspt-command.patch index c0024357ca..8c31978826 100644 --- a/patches/server/0364-Add-tick-times-API-and-mspt-command.patch +++ b/patches/server/0364-Add-tick-times-API-and-mspt-command.patch @@ -113,7 +113,7 @@ index 0000000000000000000000000000000000000000..8b5293b0c696ef21d0101493ffa41b60 + } +} diff --git a/src/main/java/io/papermc/paper/command/PaperCommands.java b/src/main/java/io/papermc/paper/command/PaperCommands.java -index 6a00f3d38da8107825ab1d405f337fd077b09f72..d31b5ed47cffc61c90c926a0cd2005b72ebddfc5 100644 +index d44d0074446c1c54e87dc8078dff7fef1d92f343..bbb8b1933ef33a3b91f69545f69dd3cfb84b27f5 100644 --- a/src/main/java/io/papermc/paper/command/PaperCommands.java +++ b/src/main/java/io/papermc/paper/command/PaperCommands.java @@ -17,6 +17,7 @@ public final class PaperCommands { @@ -185,10 +185,10 @@ index 023119624c0534bedb248099d0e12c76622a363a..8dcbeeae50afe23aa7e2a083239f0a31 + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 3106711ef8034077cd54e40dc2e8fa003101db26..fd327209b29d812195a454aca2c71fd8ba197ebc 100644 +index d312d6c543f0e09e40c232032c09caae35c8891a..99e0aca5f57516ef09fe0bb57c6b991934bb5cc8 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2512,6 +2512,16 @@ public final class CraftServer implements Server { +@@ -2494,6 +2494,16 @@ public final class CraftServer implements Server { net.minecraft.server.MinecraftServer.getServer().tps15.getAverage() }; } diff --git a/patches/server/0365-Expose-MinecraftServer-isRunning.patch b/patches/server/0365-Expose-MinecraftServer-isRunning.patch index 8b675fc011..9ca22e4d6a 100644 --- a/patches/server/0365-Expose-MinecraftServer-isRunning.patch +++ b/patches/server/0365-Expose-MinecraftServer-isRunning.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Expose MinecraftServer#isRunning This allows for plugins to detect if the server is actually turning off in onDisable rather than just plugins reloading. diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index fd327209b29d812195a454aca2c71fd8ba197ebc..3ba07a7ba5300ac2b087c563355b4795ae33e27e 100644 +index 99e0aca5f57516ef09fe0bb57c6b991934bb5cc8..dac4dd74f75a9ea5fcd19dc65e958d933ba7560d 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2705,5 +2705,10 @@ public final class CraftServer implements Server { +@@ -2687,5 +2687,10 @@ public final class CraftServer implements Server { public int getCurrentTick() { return net.minecraft.server.MinecraftServer.currentTick; } diff --git a/patches/server/0366-Add-Raw-Byte-ItemStack-Serialization.patch b/patches/server/0366-Add-Raw-Byte-ItemStack-Serialization.patch index a6b7853876..f371e21c28 100644 --- a/patches/server/0366-Add-Raw-Byte-ItemStack-Serialization.patch +++ b/patches/server/0366-Add-Raw-Byte-ItemStack-Serialization.patch @@ -6,12 +6,12 @@ Subject: [PATCH] Add Raw Byte ItemStack Serialization Serializes using NBT which is safer for server data migrations than bukkits format. diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 9c189cc0596301c16e84f7df39b983a4392583d2..7a017d69bec0fb1e17c47d7edcfce4b1c6836693 100644 +index 0ee761fa0d42fd90e82f3284ee756ddd60c6178d..70c4eb21b3730a6bb7c44671eaaba9a7bc3ee5a3 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -434,6 +434,52 @@ public final class CraftMagicNumbers implements UnsafeValues { - public boolean isSupportedApiVersion(String apiVersion) { - return apiVersion != null && SUPPORTED_API.contains(apiVersion); +@@ -459,6 +459,52 @@ public final class CraftMagicNumbers implements UnsafeValues { + public com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() { + return new com.destroystokyo.paper.PaperVersionFetcher(); } + + @Override diff --git a/patches/server/0367-Pillager-patrol-spawn-settings-and-per-player-option.patch b/patches/server/0367-Pillager-patrol-spawn-settings-and-per-player-option.patch index be7b6a44fd..a238fa8613 100644 --- a/patches/server/0367-Pillager-patrol-spawn-settings-and-per-player-option.patch +++ b/patches/server/0367-Pillager-patrol-spawn-settings-and-per-player-option.patch @@ -10,7 +10,7 @@ When not per player it will use the Vanilla mechanic of one delay per world and the world age for the start day. diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 33fee57bcd3d82bed27f5e42e2e0f4b0299a1790..a43d7c3de254f47f1b460604d0b5c0d4fd6f5d6e 100644 +index 4a25bd069bdfc6bd35e05cc86a392edad902ab11..d8bdd5e66d8019ec2a318141eb135a2028682624 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -236,6 +236,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0370-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch b/patches/server/0370-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch index 086c88c829..b1531fa1aa 100644 --- a/patches/server/0370-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch +++ b/patches/server/0370-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch @@ -7,7 +7,7 @@ Suspected case would be around the technique used in .stopRiding Stack will identify any causer of this and warn instead of crashing. diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index a7a3e163cc93d71c843c75f93b78573fe8118613..fc561ba1a8df5fe87b69d7e2ff18ebca04933bfe 100644 +index fcdd8a8570d07e8bd3339275c7b6999be3f726b3..b2e95249ee5aa37d5e41679a7cb94e01c1b41494 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -1030,6 +1030,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider diff --git a/patches/server/0371-Don-t-tick-dead-players.patch b/patches/server/0371-Don-t-tick-dead-players.patch index f33f0cd629..208efe70c7 100644 --- a/patches/server/0371-Don-t-tick-dead-players.patch +++ b/patches/server/0371-Don-t-tick-dead-players.patch @@ -7,7 +7,7 @@ Causes sync chunk loads and who knows what all else. This is safe because Spectators are skipped in unloaded chunks too in vanilla. diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index a43d7c3de254f47f1b460604d0b5c0d4fd6f5d6e..8bb61bf4f27ad9dac6d129dc7f8154eb2e608d82 100644 +index d8bdd5e66d8019ec2a318141eb135a2028682624..155dcb0f100d847e8d0ebd219747d3fb30dc9999 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -675,7 +675,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0372-Dead-Player-s-shouldn-t-be-able-to-move.patch b/patches/server/0372-Dead-Player-s-shouldn-t-be-able-to-move.patch index 48076cac63..de159bd74a 100644 --- a/patches/server/0372-Dead-Player-s-shouldn-t-be-able-to-move.patch +++ b/patches/server/0372-Dead-Player-s-shouldn-t-be-able-to-move.patch @@ -7,7 +7,7 @@ This fixes a lot of game state issues where packets were delayed for processing due to 1.15's new queue but processed while dead. diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index ba8b6d3fbc10eb9f02d3409eb2038827c47ca14d..3563f5d893fb650892ca7231767d505b7a17c8c0 100644 +index 6f3d06b929e9b5c22b3090683d5eb90bc3c98421..deb67acf5a60ea8a3cec866cd75ac036257ef0b5 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -1154,7 +1154,7 @@ public abstract class Player extends LivingEntity { diff --git a/patches/server/0373-Optimize-Collision-to-not-load-chunks.patch b/patches/server/0373-Optimize-Collision-to-not-load-chunks.patch index b3c9eb774d..3f2d84aa56 100644 --- a/patches/server/0373-Optimize-Collision-to-not-load-chunks.patch +++ b/patches/server/0373-Optimize-Collision-to-not-load-chunks.patch @@ -14,7 +14,7 @@ movement will load only the chunk the player enters anyways and avoids loading massive amounts of surrounding chunks due to large AABB lookups. diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 4b1a900ce1531526b91b01217f291bc10526956b..a5e485742b10419a031b3cc48591a0bbbcab4fb5 100644 +index 614ee0c22fcb2f909c53e2deff03f6343b2ad803..3b7db01c51868c8a820b87cd13f69cd2bbce3e85 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -805,6 +805,7 @@ public abstract class PlayerList { @@ -26,7 +26,7 @@ index 4b1a900ce1531526b91b01217f291bc10526956b..a5e485742b10419a031b3cc48591a0bb entityplayer1.setPos(entityplayer1.getX(), entityplayer1.getY() + 1.0D, entityplayer1.getZ()); } diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index f0c7c31c2646c2b26a3f98e5b5c822712696d960..fada693b270d0954f6bbc5965fb3af82a8bd524e 100644 +index 6b19894c4353cf96d853d00128614b6d49c7a3c1..1e4699372b22c3fe3eed6859c3f15f9b70a537c0 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -236,6 +236,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { diff --git a/patches/server/0374-Don-t-move-existing-players-to-world-spawn.patch b/patches/server/0374-Don-t-move-existing-players-to-world-spawn.patch index 2a6ce8dd99..8d68f0972e 100644 --- a/patches/server/0374-Don-t-move-existing-players-to-world-spawn.patch +++ b/patches/server/0374-Don-t-move-existing-players-to-world-spawn.patch @@ -13,7 +13,7 @@ By skipping this, we avoid potential for a large spike on server start. public net.minecraft.server.level.ServerPlayer fudgeSpawnLocation(Lnet/minecraft/server/level/ServerLevel;)V diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 8bb61bf4f27ad9dac6d129dc7f8154eb2e608d82..300658b41ed77c5f9403c260b6cdc62f3a323a35 100644 +index 155dcb0f100d847e8d0ebd219747d3fb30dc9999..318bbc94726456049336aeba0a048c577eaa0614 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -328,7 +328,7 @@ public class ServerPlayer extends Player { @@ -35,7 +35,7 @@ index 8bb61bf4f27ad9dac6d129dc7f8154eb2e608d82..300658b41ed77c5f9403c260b6cdc62f this.gameMode.setLevel((ServerLevel) world); } diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index a5e485742b10419a031b3cc48591a0bbbcab4fb5..ba0df02c2b3387b7e7698e59ce3021f1019b9a8a 100644 +index 3b7db01c51868c8a820b87cd13f69cd2bbce3e85..1051e81a0fb9f0a590e92b0d1fa27cb7afcae06f 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -222,6 +222,8 @@ public abstract class PlayerList { diff --git a/patches/server/0376-Improved-Watchdog-Support.patch b/patches/server/0376-Improved-Watchdog-Support.patch index 18a36f5752..aeab4e8bc7 100644 --- a/patches/server/0376-Improved-Watchdog-Support.patch +++ b/patches/server/0376-Improved-Watchdog-Support.patch @@ -41,7 +41,7 @@ This also moves all plugins who register "delayed init" tasks to occur just befo are properly accounted for and wont trip watchdog on init. diff --git a/src/main/java/com/destroystokyo/paper/Metrics.java b/src/main/java/com/destroystokyo/paper/Metrics.java -index 5a19e30a9b7e65a70f68a429b8ca741f788a303b..7b1843e16745ca8db2244e17490d291401f22679 100644 +index 6aaed8e8bf8c721fc834da5c76ac72a4c3e92458..4b002e8b75d117b726b0de274a76d3596fce015b 100644 --- a/src/main/java/com/destroystokyo/paper/Metrics.java +++ b/src/main/java/com/destroystokyo/paper/Metrics.java @@ -92,7 +92,12 @@ public class Metrics { @@ -71,7 +71,7 @@ index 336795dff742b7c6957fbd3476aff31d25a5e659..30a58229aa6dac5039511d0c0df5f291 cause = cause.getCause(); } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 8ea5d3cb180b403f68d95ad6428dcad91b88ba2c..e09ed2ebd1c2a837978c804ced0fe6e79018b588 100644 +index 8dcbeeae50afe23aa7e2a083239f0a315424574f..d406df9626d29ee257b8eedcbea2af09ed4b6baf 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -295,7 +295,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 37b1354edb2974e82eaa5c859f58c588df70c575..c5a11e22c44d5adb55844bde964ca43acbc03fdf 100644 +index 9621438358c85cf66c756f0d53bcd89f4f0ec933..ba11b19658cc1112de7c784637d053b68177b269 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3364,10 +3364,24 @@ public abstract class LivingEntity extends Entity { diff --git a/patches/server/0382-Implement-Player-Client-Options-API.patch b/patches/server/0382-Implement-Player-Client-Options-API.patch index 707a2c77e3..6920828cfe 100644 --- a/patches/server/0382-Implement-Player-Client-Options-API.patch +++ b/patches/server/0382-Implement-Player-Client-Options-API.patch @@ -87,7 +87,7 @@ index 0000000000000000000000000000000000000000..b6f4400df3d8ec7e06a996de54f8cabb + } +} diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 21b5f0742f16409ace4fabf44f04d5964d486aeb..9ec157712b9c891067507f9a308428cee2895fed 100644 +index af55a0cc48e505ac55445ef8cc6495c68d0757c8..4a4f829e9cf984a6f129548cdf1316823ce146cb 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1885,9 +1885,24 @@ public class ServerPlayer extends Player { @@ -116,7 +116,7 @@ index 21b5f0742f16409ace4fabf44f04d5964d486aeb..9ec157712b9c891067507f9a308428ce if (getMainArm() != packet.mainHand()) { PlayerChangedMainHandEvent event = new PlayerChangedMainHandEvent(this.getBukkitEntity(), getMainArm() == HumanoidArm.LEFT ? MainHand.LEFT : MainHand.RIGHT); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index b9e484ec8173be94fae307830e87a9205e56a11e..d9e278d2f7f4bc767c0211736817748d4ca6dae0 100644 +index 727ed31aefa4e0893a03afd4b90b01ad6ed51ce4..4592cac06c8e96d4677ba315f70d5336fcdd0558 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -617,6 +617,28 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0384-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch b/patches/server/0384-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch index 79caa4f853..52f67578d2 100644 --- a/patches/server/0384-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch +++ b/patches/server/0384-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch @@ -31,7 +31,7 @@ delays anymore. public net.minecraft.server.level.ChunkMap addEntity(Lnet/minecraft/world/entity/Entity;)V diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index e8a52daa2ff7782fa39862e97580234058b8766e..6b01d5b5535887eef0ac7b8a5e0a669a2700e83f 100644 +index b2e95249ee5aa37d5e41679a7cb94e01c1b41494..11a4ba46869e3073375d85820426f0662bd2caf7 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -1036,6 +1036,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -43,7 +43,7 @@ index e8a52daa2ff7782fa39862e97580234058b8766e..6b01d5b5535887eef0ac7b8a5e0a669a if (!(entity instanceof EnderDragonPart)) { EntityType entitytypes = entity.getType(); diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 9ec157712b9c891067507f9a308428cee2895fed..ecaf03a72caac6e7866094bae7256f5447a962e4 100644 +index 4a4f829e9cf984a6f129548cdf1316823ce146cb..33b6f23f483535714fc020da47c79fca33271c62 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -259,6 +259,7 @@ public class ServerPlayer extends Player { @@ -55,7 +55,7 @@ index 9ec157712b9c891067507f9a308428cee2895fed..ecaf03a72caac6e7866094bae7256f54 public String kickLeaveMessage = null; // SPIGOT-3034: Forward leave message to PlayerQuitEvent // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 6c5c00e2fb29b5bdd73540badd159778eb1c1ff6..cfc497822e4e1dfc21807ec93bcfabb215cdbb95 100644 +index 3cc7ef57fa5bf43ae5de25b69e2b73e56c4bb703..c2e7192e6b35900c400e4541425baf6cdaf94b83 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -291,6 +291,12 @@ public abstract class PlayerList { diff --git a/patches/server/0386-Add-PlayerAttackEntityCooldownResetEvent.patch b/patches/server/0386-Add-PlayerAttackEntityCooldownResetEvent.patch index bcaa5ef25b..8e233aa04a 100644 --- a/patches/server/0386-Add-PlayerAttackEntityCooldownResetEvent.patch +++ b/patches/server/0386-Add-PlayerAttackEntityCooldownResetEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerAttackEntityCooldownResetEvent diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index a49717ebf2b2d961b7f57dade57105bc9f16639c..e118a4a41c4c11c53b5a1783113f096bdb4a9f2d 100644 +index ba11b19658cc1112de7c784637d053b68177b269..8371e37705c871f3b4bef0ffcf0a0bbb50a1c783 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -2128,7 +2128,16 @@ public abstract class LivingEntity extends Entity { diff --git a/patches/server/0389-Fix-numerous-item-duplication-issues-and-teleport-is.patch b/patches/server/0389-Fix-numerous-item-duplication-issues-and-teleport-is.patch index 41704f2b8a..fe7ad6c372 100644 --- a/patches/server/0389-Fix-numerous-item-duplication-issues-and-teleport-is.patch +++ b/patches/server/0389-Fix-numerous-item-duplication-issues-and-teleport-is.patch @@ -80,7 +80,7 @@ index 7e8d434944596b4d82675448ddff4046a1b0b4b4..462159a70eb92f463b25ef840656a8f8 public float getBlockExplosionResistance(Explosion explosion, BlockGetter world, BlockPos pos, BlockState blockState, FluidState fluidState, float max) { diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index e118a4a41c4c11c53b5a1783113f096bdb4a9f2d..f0c37129240fadac40fec607afda1ccef446caa0 100644 +index 8371e37705c871f3b4bef0ffcf0a0bbb50a1c783..b26b598678ea474b3abc67acebdbed9b278e89bc 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -1647,9 +1647,9 @@ public abstract class LivingEntity extends Entity { diff --git a/patches/server/0391-Validate-PickItem-Packet-and-kick-for-invalid.patch b/patches/server/0391-Validate-PickItem-Packet-and-kick-for-invalid.patch index 11fa856076..9d8cd57f8a 100644 --- a/patches/server/0391-Validate-PickItem-Packet-and-kick-for-invalid.patch +++ b/patches/server/0391-Validate-PickItem-Packet-and-kick-for-invalid.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Validate PickItem Packet and kick for invalid diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index b42ef07a2653b62cf6ba44172e5a919be3de964f..792fdd57c0d31e5de4f5819d40677a53a84773d1 100644 +index 65a928907c7a5df39d2596286860c6798c13910a..069d5ee0aa0921240d85fa0fc12e9e355dbf21e9 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -955,7 +955,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic diff --git a/patches/server/0392-Expose-game-version.patch b/patches/server/0392-Expose-game-version.patch index ce846dd3ce..23d67857c3 100644 --- a/patches/server/0392-Expose-game-version.patch +++ b/patches/server/0392-Expose-game-version.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Expose game version diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 3ba07a7ba5300ac2b087c563355b4795ae33e27e..760f42c620033aef43e4a7765dd7ba0b743a6ad4 100644 +index dac4dd74f75a9ea5fcd19dc65e958d933ba7560d..422d6b39337c3a774dfddcee877dc8281c5d7774 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -592,6 +592,13 @@ public final class CraftServer implements Server { +@@ -574,6 +574,13 @@ public final class CraftServer implements Server { return this.bukkitVersion; } diff --git a/patches/server/0394-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch b/patches/server/0394-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch index bcdd9a4e15..dd28cd0b5d 100644 --- a/patches/server/0394-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch +++ b/patches/server/0394-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch @@ -17,7 +17,7 @@ keeping long lived large direct buffers in cache. Set system properly at server startup if not set already to help protect from this. diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 2451084f0d0bad43b7cf5c89f5590098f89b32a5..1176f77c79c2cbd727f1f6867e956fb698936349 100644 +index f7c8d25830ed701e72f828fa73066a6e9188253b..4714e0199987d864b37aaec94ffa885a5b76b437 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -28,6 +28,7 @@ public class Main { diff --git a/patches/server/0395-misc-debugging-dumps.patch b/patches/server/0395-misc-debugging-dumps.patch index e40916f2df..79a6949953 100644 --- a/patches/server/0395-misc-debugging-dumps.patch +++ b/patches/server/0395-misc-debugging-dumps.patch @@ -58,7 +58,7 @@ index d406df9626d29ee257b8eedcbea2af09ed4b6baf..366959f9841eb0ef3669b3b3b069d767 this.running = false; if (waitForShutdown) { diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index 203786383387765d1f5a2d2ccce79d792fd5b187..8044885a91b316b2e5e92dd6260b8e515dcea5a9 100644 +index 9d3ea20adba300a38a544c3454eff2edd9b4bbb9..3e6ec2cef2b5b058f240dd471d5c7a22d362e067 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java @@ -183,6 +183,11 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, @@ -74,10 +74,10 @@ index 203786383387765d1f5a2d2ccce79d792fd5b187..8044885a91b316b2e5e92dd6260b8e51 this.connection.send(new ClientboundDisconnectPacket(ichatmutablecomponent)); this.connection.disconnect(ichatmutablecomponent); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 760f42c620033aef43e4a7765dd7ba0b743a6ad4..ae5d775c00b377aa5be383874b4af61a5951186b 100644 +index 422d6b39337c3a774dfddcee877dc8281c5d7774..222095ad4cc055565c1a166d21714f7b1140815f 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1015,6 +1015,7 @@ public final class CraftServer implements Server { +@@ -997,6 +997,7 @@ public final class CraftServer implements Server { plugin.getDescription().getFullName(), "This plugin is not properly shutting down its async tasks when it is being reloaded. This may cause conflicts with the newly loaded version of the plugin" )); diff --git a/patches/server/0396-Prevent-teleporting-dead-entities.patch b/patches/server/0396-Prevent-teleporting-dead-entities.patch index 8eea504603..ea72094b65 100644 --- a/patches/server/0396-Prevent-teleporting-dead-entities.patch +++ b/patches/server/0396-Prevent-teleporting-dead-entities.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Prevent teleporting dead entities diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 792fdd57c0d31e5de4f5819d40677a53a84773d1..c5d1fc2e7c8090ed91cb6ca24135c5aaa2172fa9 100644 +index 069d5ee0aa0921240d85fa0fc12e9e355dbf21e9..d95b9f70a365e7bfa9b36738dd56dcad891b0525 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -1621,6 +1621,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic diff --git a/patches/server/0397-Deobfuscate-stacktraces-in-log-messages-crash-report.patch b/patches/server/0397-Deobfuscate-stacktraces-in-log-messages-crash-report.patch index f0e3104e62..168ef1375f 100644 --- a/patches/server/0397-Deobfuscate-stacktraces-in-log-messages-crash-report.patch +++ b/patches/server/0397-Deobfuscate-stacktraces-in-log-messages-crash-report.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Deobfuscate stacktraces in log messages, crash reports, and diff --git a/build.gradle.kts b/build.gradle.kts -index a4b47b69e14643cd82d71d18941144ecbf50db8b..ce7a583355a6f4ce98c571fa7b60d9034f51bd3c 100644 +index 241613c4effdde09270177c25a5f563261b22871..6d0c0fab461a8b27704c9298a631d557d985652f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts -@@ -19,12 +19,14 @@ dependencies { +@@ -19,6 +19,7 @@ dependencies { Scanning takes about 1-2 seconds so adding this speeds up the server start. */ implementation("org.apache.logging.log4j:log4j-core:2.14.1") // Paper - implementation @@ -17,14 +17,15 @@ index a4b47b69e14643cd82d71d18941144ecbf50db8b..ce7a583355a6f4ce98c571fa7b60d903 // Paper end implementation("org.apache.logging.log4j:log4j-iostreams:2.19.0") // Paper - remove exclusion implementation("org.ow2.asm:asm:9.3") - implementation("org.ow2.asm:asm-commons:9.3") // Paper - ASM event executor generation +@@ -26,6 +27,7 @@ dependencies { + testImplementation("org.mockito:mockito-core:4.9.0") // Paper - switch to mockito implementation("org.spongepowered:configurate-yaml:4.1.2") // Paper - config files implementation("commons-lang:commons-lang:2.6") + implementation("net.fabricmc:mapping-io:0.3.0") // Paper - needed to read mappings for stacktrace deobfuscation runtimeOnly("org.xerial:sqlite-jdbc:3.36.0.3") runtimeOnly("mysql:mysql-connector-java:8.0.29") runtimeOnly("com.lmax:disruptor:3.4.4") // Paper -@@ -104,6 +106,18 @@ tasks.check { +@@ -105,6 +107,18 @@ tasks.check { } // Paper end @@ -556,7 +557,7 @@ index a24ef433d0c9d06b86fd612978cfd6d877036791..1b38326c9a709536dc4cccf9af93aede final MinecraftServer server; public volatile boolean running; diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index 8044885a91b316b2e5e92dd6260b8e515dcea5a9..75a32d33518023cb24ba639751631bfad3563bd5 100644 +index 3e6ec2cef2b5b058f240dd471d5c7a22d362e067..b09069196fbcba32bdd6ea67718ea4c3086fb318 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java @@ -185,7 +185,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, diff --git a/patches/server/0398-Implement-Mob-Goal-API.patch b/patches/server/0398-Implement-Mob-Goal-API.patch index a42997ed42..05001e984f 100644 --- a/patches/server/0398-Implement-Mob-Goal-API.patch +++ b/patches/server/0398-Implement-Mob-Goal-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Implement Mob Goal API diff --git a/build.gradle.kts b/build.gradle.kts -index ce7a583355a6f4ce98c571fa7b60d9034f51bd3c..8f32e0c3078366f4b07a499b1838929564a05b76 100644 +index 6d0c0fab461a8b27704c9298a631d557d985652f..5f9823714a0e7d1d4a73861996c4db03c8a0b99b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts -@@ -35,6 +35,7 @@ dependencies { +@@ -36,6 +36,7 @@ dependencies { runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.7.3") runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.7.3") @@ -791,10 +791,10 @@ index 4379b9948f1eecfe6fd7dea98e298ad5f761019a..3f081183521603824430709886a9cc31 LOOK, JUMP, diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index ae5d775c00b377aa5be383874b4af61a5951186b..73bcba84979ba2d8f3ab2f2aa1d4294fe792f53a 100644 +index 222095ad4cc055565c1a166d21714f7b1140815f..52e852c43556d00ecb2fd0971189de64e0268620 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2718,5 +2718,11 @@ public final class CraftServer implements Server { +@@ -2700,5 +2700,11 @@ public final class CraftServer implements Server { public boolean isStopping() { return net.minecraft.server.MinecraftServer.getServer().hasStopped(); } diff --git a/patches/server/0400-Option-for-maximum-exp-value-when-merging-orbs.patch b/patches/server/0400-Option-for-maximum-exp-value-when-merging-orbs.patch index 6e847de4a8..bebb912713 100644 --- a/patches/server/0400-Option-for-maximum-exp-value-when-merging-orbs.patch +++ b/patches/server/0400-Option-for-maximum-exp-value-when-merging-orbs.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Option for maximum exp value when merging orbs diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 7069b447c12c170683dee7052327a55c29af83c4..a8d9ad5eba330c23d2cc745242977f4fb1b4c674 100644 +index cd6e0904dbdac5d7e1630e59d6ffa2ba0a5b3b2f..4db162f13a0a9b4afacbdb30326e6d18529d5382 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -631,16 +631,30 @@ public class CraftEventFactory { diff --git a/patches/server/0401-ExperienceOrbMergeEvent.patch b/patches/server/0401-ExperienceOrbMergeEvent.patch index e71bdda1e5..46ab102e0f 100644 --- a/patches/server/0401-ExperienceOrbMergeEvent.patch +++ b/patches/server/0401-ExperienceOrbMergeEvent.patch @@ -9,7 +9,7 @@ Plugins can cancel this if they want to ensure experience orbs do not lose impor metadata such as spawn reason, or conditionally move data from source to target. diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index a8d9ad5eba330c23d2cc745242977f4fb1b4c674..4610d7d329c9c8bf3cbe8c203fe8c89413717df2 100644 +index 4db162f13a0a9b4afacbdb30326e6d18529d5382..4a260923efd062ccd72bf9c0c93255c9af73ab47 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -641,7 +641,7 @@ public class CraftEventFactory { diff --git a/patches/server/0402-Fix-PotionEffect-ignores-icon-flag.patch b/patches/server/0402-Fix-PotionEffect-ignores-icon-flag.patch index 199682a783..85a337e651 100644 --- a/patches/server/0402-Fix-PotionEffect-ignores-icon-flag.patch +++ b/patches/server/0402-Fix-PotionEffect-ignores-icon-flag.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix PotionEffect ignores icon flag diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index 194c6a9accc21bfb2f446b2a2c3a8a4ee7c3a479..57e839a5582d3d0219fcf670afbb3e4b36dcd19c 100644 +index c7cc9408f961aa804af9548d8c8fee46631421cf..b543619e50196f82e55dd7e648e5f8c580658dbe 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -@@ -425,7 +425,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { +@@ -431,7 +431,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { @Override public boolean addPotionEffect(PotionEffect effect, boolean force) { diff --git a/patches/server/0404-Potential-bed-API.patch b/patches/server/0404-Potential-bed-API.patch index 633d9baf8a..9725646220 100644 --- a/patches/server/0404-Potential-bed-API.patch +++ b/patches/server/0404-Potential-bed-API.patch @@ -8,7 +8,7 @@ Adds a new method to fetch the location of a player's bed without generating any getPotentialBedLocation - Gets the last known location of a player's bed. This does not preform any check if the bed is still valid and does not load any chunks. diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -index f5f30e1408892b4e728053bc5005e551396583a5..15f6e1c04fefa1334301534646b8ed2535d16fa9 100644 +index b3307db9a0707dd0883d04637eb553995190ca1c..728fc30046de534748e2379e8cb371cc2e51f9d3 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java @@ -12,6 +12,7 @@ import net.minecraft.nbt.CompoundTag; diff --git a/patches/server/0405-Wait-for-Async-Tasks-during-shutdown.patch b/patches/server/0405-Wait-for-Async-Tasks-during-shutdown.patch index 94329ef3ff..c7d2e9343c 100644 --- a/patches/server/0405-Wait-for-Async-Tasks-during-shutdown.patch +++ b/patches/server/0405-Wait-for-Async-Tasks-during-shutdown.patch @@ -22,10 +22,10 @@ index 366959f9841eb0ef3669b3b3b069d7670f0ba7e6..93c1a1bf602af1e73202590e78dac833 // CraftBukkit end if (this.getConnection() != null) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 73bcba84979ba2d8f3ab2f2aa1d4294fe792f53a..f6bc55e326f9076ac5df9decd7e501bee9346f67 100644 +index 52e852c43556d00ecb2fd0971189de64e0268620..39e5b52d1495b7a0f5f451543ad0329fab0fe27d 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1024,6 +1024,35 @@ public final class CraftServer implements Server { +@@ -1006,6 +1006,35 @@ public final class CraftServer implements Server { org.spigotmc.WatchdogThread.hasStarted = true; // Paper - Disable watchdog early timeout on reload } diff --git a/patches/server/0412-Optimize-anyPlayerCloseEnoughForSpawning-to-use-dist.patch b/patches/server/0412-Optimize-anyPlayerCloseEnoughForSpawning-to-use-dist.patch index 6bf9ef4965..6f37414684 100644 --- a/patches/server/0412-Optimize-anyPlayerCloseEnoughForSpawning-to-use-dist.patch +++ b/patches/server/0412-Optimize-anyPlayerCloseEnoughForSpawning-to-use-dist.patch @@ -333,7 +333,7 @@ index 665e088cb0b73f6a0c62f29c56da462bab7c927e..298e4468f7b5346733257f7117f76c66 } diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 78913368d8fa74273126a1245d2faf55242fccdd..3fecc0c587de51c683a362a1a44fe3d5eed60979 100644 +index 33b6f23f483535714fc020da47c79fca33271c62..35d28066295bfbdac3f35b0565ea658bd20de892 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -264,6 +264,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0413-Use-distance-map-to-optimise-entity-tracker.patch b/patches/server/0413-Use-distance-map-to-optimise-entity-tracker.patch index bcc36d1ae5..6a4c3270a5 100644 --- a/patches/server/0413-Use-distance-map-to-optimise-entity-tracker.patch +++ b/patches/server/0413-Use-distance-map-to-optimise-entity-tracker.patch @@ -287,7 +287,7 @@ index e87ade8697a33b9ea23dce59838a9ccd02ab09f6..81870f23ae70db3a1290428df6a47d76 return object instanceof ChunkMap.TrackedEntity ? ((ChunkMap.TrackedEntity) object).entity.getId() == this.entity.getId() : false; } diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 19218e993052d44a830f825f9a0eb695635861c1..2609bdb3f051e449f9a2e760e9c4d38f85855cf6 100644 +index 462159a70eb92f463b25ef840656a8f8594d8b9d..016cfb63f686352db750065938894df9bc0ee233 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -57,6 +57,7 @@ import net.minecraft.network.syncher.EntityDataSerializers; diff --git a/patches/server/0419-Fix-sand-duping.patch b/patches/server/0419-Fix-sand-duping.patch index 8f832a7d15..f9661aee55 100644 --- a/patches/server/0419-Fix-sand-duping.patch +++ b/patches/server/0419-Fix-sand-duping.patch @@ -7,7 +7,7 @@ If the falling block dies during teleportation (entity#move), then we need to detect that by placing a check after the move. diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java -index e7404619877099aa2223da349e15090d2c9be1d0..23bd2a9af71b63bf463c7091ac261b033e9ce9af 100644 +index 97b2d12713d2245f1621d3ade5b5655b5897cbf4..06f6fe4d1be4b14c45d2576561201c9386988dc1 100644 --- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java @@ -128,6 +128,11 @@ public class FallingBlockEntity extends Entity { diff --git a/patches/server/0421-Prevent-position-desync-in-playerconnection-causing-.patch b/patches/server/0421-Prevent-position-desync-in-playerconnection-causing-.patch index e424ed2736..e0e651415c 100644 --- a/patches/server/0421-Prevent-position-desync-in-playerconnection-causing-.patch +++ b/patches/server/0421-Prevent-position-desync-in-playerconnection-causing-.patch @@ -14,7 +14,7 @@ behaviour, we need to move all of this dangerous logic outside of the move call and into an appropriate place in the tick method. diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index c5d1fc2e7c8090ed91cb6ca24135c5aaa2172fa9..fd3e8c2d3a415a6a3370784ec3c0d46d3c1122b7 100644 +index d95b9f70a365e7bfa9b36738dd56dcad891b0525..700dcbfb114b147c22a44b9960728c9f68db0a70 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -1434,6 +1434,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic diff --git a/patches/server/0424-Add-and-implement-PlayerRecipeBookClickEvent.patch b/patches/server/0424-Add-and-implement-PlayerRecipeBookClickEvent.patch index 7b71283491..af928b76fd 100644 --- a/patches/server/0424-Add-and-implement-PlayerRecipeBookClickEvent.patch +++ b/patches/server/0424-Add-and-implement-PlayerRecipeBookClickEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add and implement PlayerRecipeBookClickEvent diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index fd3e8c2d3a415a6a3370784ec3c0d46d3c1122b7..8d8a42003ac6de567db8c2e052d43d698879b535 100644 +index 700dcbfb114b147c22a44b9960728c9f68db0a70..fab792e1c8285248c23f5ffed1e0dbe80671608d 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -3092,9 +3092,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3098,9 +3098,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic if (!this.player.containerMenu.stillValid(this.player)) { ServerGamePacketListenerImpl.LOGGER.debug("Player {} interacted with invalid menu {}", this.player, this.player.containerMenu); } else { diff --git a/patches/server/0426-Add-permission-for-command-blocks.patch b/patches/server/0426-Add-permission-for-command-blocks.patch index 0b1fec8754..ac7eaab661 100644 --- a/patches/server/0426-Add-permission-for-command-blocks.patch +++ b/patches/server/0426-Add-permission-for-command-blocks.patch @@ -18,7 +18,7 @@ index aee5144bdc5bd9f7b07ce3b72331bcfd42663ec9..a98254e38076e82f94db7b2f2112500e return false; } else if (this.player.blockActionRestricted(this.level, pos, this.gameModeForPlayer)) { diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 8d8a42003ac6de567db8c2e052d43d698879b535..30bb23dc4d190c00ced761ed3c8ab1e2620d3a0a 100644 +index fab792e1c8285248c23f5ffed1e0dbe80671608d..fa06f9be742103e65aa90dfb9d21a93c119bf0c0 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -866,7 +866,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic diff --git a/patches/server/0428-Fix-Per-World-Difficulty-Remembering-Difficulty.patch b/patches/server/0428-Fix-Per-World-Difficulty-Remembering-Difficulty.patch index 417848e469..683319b41c 100644 --- a/patches/server/0428-Fix-Per-World-Difficulty-Remembering-Difficulty.patch +++ b/patches/server/0428-Fix-Per-World-Difficulty-Remembering-Difficulty.patch @@ -76,7 +76,7 @@ index 771677c0e1cd7bfe089b9a5bb9095650216ff588..520cd1a6b347687b2ec6d13f034be391 @Override diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 3fecc0c587de51c683a362a1a44fe3d5eed60979..ca08f04aed8296437eafee93093f96c03c1d418f 100644 +index 35d28066295bfbdac3f35b0565ea658bd20de892..fcd3f4259989a004fcfc5270b2b95c81454ed01b 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1149,7 +1149,7 @@ public class ServerPlayer extends Player { @@ -89,10 +89,10 @@ index 3fecc0c587de51c683a362a1a44fe3d5eed60979..ca08f04aed8296437eafee93093f96c0 playerlist.sendPlayerPermissionLevel(this); diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 30bb23dc4d190c00ced761ed3c8ab1e2620d3a0a..f07b584d1d7a97e242c7699fa277d0c642da1857 100644 +index fa06f9be742103e65aa90dfb9d21a93c119bf0c0..d5f879303080dadf0fbd5d15840c2536942c6d0b 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -3367,7 +3367,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3373,7 +3373,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic public void handleChangeDifficulty(ServerboundChangeDifficultyPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); if (this.player.hasPermissions(2) || this.isSingleplayerOwner()) { @@ -102,10 +102,10 @@ index 30bb23dc4d190c00ced761ed3c8ab1e2620d3a0a..f07b584d1d7a97e242c7699fa277d0c6 } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index f6bc55e326f9076ac5df9decd7e501bee9346f67..a67e158bad42086aec237a822ec252fd26f80e3c 100644 +index 39e5b52d1495b7a0f5f451543ad0329fab0fe27d..76b0423c71875a3e30d6cc613ebdb1cca4b9bbd5 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -964,8 +964,8 @@ public final class CraftServer implements Server { +@@ -946,8 +946,8 @@ public final class CraftServer implements Server { org.spigotmc.SpigotConfig.init((File) console.options.valueOf("spigot-settings")); // Spigot this.console.paperConfigurations.reloadConfigs(this.console); for (ServerLevel world : this.console.getAllLevels()) { @@ -117,7 +117,7 @@ index f6bc55e326f9076ac5df9decd7e501bee9346f67..a67e158bad42086aec237a822ec252fd for (SpawnCategory spawnCategory : SpawnCategory.values()) { if (CraftSpawnCategory.isValidForLimits(spawnCategory)) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index caacf6dbe6c4fd461624ea421d08a18222fc2a6e..bc083d58f670f2a0c6e621da5e2258f7be5680b8 100644 +index 2d21aeceea5a91930fb80ae838d04e5accc63391..d294af725e4df2109e486cee6a38f4872064bc7f 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -1146,7 +1146,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { diff --git a/patches/server/0429-Paper-dumpitem-command.patch b/patches/server/0429-Paper-dumpitem-command.patch index 1f5d0868be..52da5fa920 100644 --- a/patches/server/0429-Paper-dumpitem-command.patch +++ b/patches/server/0429-Paper-dumpitem-command.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Paper dumpitem command Let's you quickly view the item in your hands NBT data diff --git a/src/main/java/io/papermc/paper/command/PaperCommand.java b/src/main/java/io/papermc/paper/command/PaperCommand.java -index 04bf08cbe45763f1338390c5ab4b0dcb334bd07a..a7b78508ef78229835805300e62a306a3f1ddf6d 100644 +index 8f35943e71911b6d49b4cf210e56f5e11c5753e8..312c0e42643355183ea3346a69fe9b5a5624bf1d 100644 --- a/src/main/java/io/papermc/paper/command/PaperCommand.java +++ b/src/main/java/io/papermc/paper/command/PaperCommand.java @@ -1,6 +1,7 @@ @@ -17,7 +17,7 @@ index 04bf08cbe45763f1338390c5ab4b0dcb334bd07a..a7b78508ef78229835805300e62a306a import io.papermc.paper.command.subcommands.EntityCommand; import io.papermc.paper.command.subcommands.FixLightCommand; import io.papermc.paper.command.subcommands.HeapDumpCommand; -@@ -46,6 +47,7 @@ public final class PaperCommand extends Command { +@@ -48,6 +49,7 @@ public final class PaperCommand extends Command { commands.put(Set.of("fixlight"), new FixLightCommand()); commands.put(Set.of("debug", "chunkinfo", "holderinfo"), new ChunkDebugCommand()); commands.put(Set.of("syncloadinfo"), new SyncLoadInfoCommand()); diff --git a/patches/server/0432-Add-Plugin-Tickets-to-API-Chunk-Methods.patch b/patches/server/0432-Add-Plugin-Tickets-to-API-Chunk-Methods.patch index cb982c6bd0..0627b61c96 100644 --- a/patches/server/0432-Add-Plugin-Tickets-to-API-Chunk-Methods.patch +++ b/patches/server/0432-Add-Plugin-Tickets-to-API-Chunk-Methods.patch @@ -22,10 +22,10 @@ wants it to collect even faster, they can restore that setting back to 1 instead Not adding it to .getType() though to keep behavior consistent with vanilla for performance reasons. diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index a67e158bad42086aec237a822ec252fd26f80e3c..829105771a06deca2a85e2f27b68d96c28c1218b 100644 +index 76b0423c71875a3e30d6cc613ebdb1cca4b9bbd5..796f0f96811534895623a0a3de04ea33f276ce47 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -373,7 +373,7 @@ public final class CraftServer implements Server { +@@ -374,7 +374,7 @@ public final class CraftServer implements Server { this.overrideSpawnLimits(); console.autosavePeriod = this.configuration.getInt("ticks-per.autosave"); this.warningState = WarningState.value(this.configuration.getString("settings.deprecated-verbose")); @@ -34,7 +34,7 @@ index a67e158bad42086aec237a822ec252fd26f80e3c..829105771a06deca2a85e2f27b68d96c this.minimumAPI = this.configuration.getString("settings.minimum-api"); this.loadIcon(); -@@ -944,7 +944,7 @@ public final class CraftServer implements Server { +@@ -926,7 +926,7 @@ public final class CraftServer implements Server { this.console.setMotd(config.motd); this.overrideSpawnLimits(); this.warningState = WarningState.value(this.configuration.getString("settings.deprecated-verbose")); @@ -44,7 +44,7 @@ index a67e158bad42086aec237a822ec252fd26f80e3c..829105771a06deca2a85e2f27b68d96c this.printSaveWarning = false; console.autosavePeriod = this.configuration.getInt("ticks-per.autosave"); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index b6c66b8ee015847c962eb504bf4a88a5331e0944..21051093bc65d30f32c6a5ea3ee07086e10d57c1 100644 +index d294af725e4df2109e486cee6a38f4872064bc7f..a25dbc2bd3005cb3d1aee61fb48522b13e7c4922 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -281,8 +281,21 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -111,7 +111,7 @@ index b6c66b8ee015847c962eb504bf4a88a5331e0944..21051093bc65d30f32c6a5ea3ee07086 world.getChunkSource().getChunk(x, z, ChunkStatus.FULL, true); return true; // Paper end -@@ -2148,6 +2164,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -2164,6 +2180,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { io.papermc.paper.chunk.system.ChunkSystem.scheduleChunkLoad(this.getHandle(), x, z, gen, ChunkStatus.FULL, true, priority, (c) -> { net.minecraft.server.MinecraftServer.getServer().scheduleOnMain(() -> { net.minecraft.world.level.chunk.LevelChunk chunk = (net.minecraft.world.level.chunk.LevelChunk)c; diff --git a/patches/server/0433-incremental-chunk-and-player-saving.patch b/patches/server/0433-incremental-chunk-and-player-saving.patch index 3b5d3070b2..5d17e6192b 100644 --- a/patches/server/0433-incremental-chunk-and-player-saving.patch +++ b/patches/server/0433-incremental-chunk-and-player-saving.patch @@ -115,7 +115,7 @@ index 44ca46e7dff19ae99ff6cf0d82269c5f7ad7274a..95c53189e32aec6aca254fa3b157df7b // Paper start - rewrite chunk system - add close param this.save(progressListener, flush, savingDisabled, false); diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index ca08f04aed8296437eafee93093f96c03c1d418f..bb939f3312eb5a5740b445cfd268f1902955d4e8 100644 +index fcd3f4259989a004fcfc5270b2b95c81454ed01b..e6b175a62f2b151068fc7b28685b64afea1ebbc3 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -181,6 +181,7 @@ import org.bukkit.inventory.MainHand; @@ -127,7 +127,7 @@ index ca08f04aed8296437eafee93093f96c03c1d418f..bb939f3312eb5a5740b445cfd268f190 private static final int NEUTRAL_MOB_DEATH_NOTIFICATION_RADII_Y = 10; public ServerGamePacketListenerImpl connection; diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index cfc497822e4e1dfc21807ec93bcfabb215cdbb95..c6b76049c70bf42c216d833b6dc33254c24b2253 100644 +index c2e7192e6b35900c400e4541425baf6cdaf94b83..e1a92fb2bbc7258b714268298e1214fd5d6fe904 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -514,6 +514,7 @@ public abstract class PlayerList { diff --git a/patches/server/0443-Update-itemstack-legacy-name-and-lore.patch b/patches/server/0443-Update-itemstack-legacy-name-and-lore.patch index dc2f3d4011..5a47f65a58 100644 --- a/patches/server/0443-Update-itemstack-legacy-name-and-lore.patch +++ b/patches/server/0443-Update-itemstack-legacy-name-and-lore.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Update itemstack legacy name and lore diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index 29c605ff88956435752412847734992fe6bcd55d..36107f22914ec47212e41c17852fb486c67e5c52 100644 +index 79023dace09c99587b5100de29b5b0ed3ba3fc57..ae4c8eb5c06a877c24b22e3ce15b2751449102fd 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java @@ -170,6 +170,44 @@ public final class ItemStack { diff --git a/patches/server/0444-Spawn-player-in-correct-world-on-login.patch b/patches/server/0444-Spawn-player-in-correct-world-on-login.patch index a07a3e270c..3ed3c21c06 100644 --- a/patches/server/0444-Spawn-player-in-correct-world-on-login.patch +++ b/patches/server/0444-Spawn-player-in-correct-world-on-login.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Spawn player in correct world on login diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index c6b76049c70bf42c216d833b6dc33254c24b2253..b6bdbe4033b0252d61e8a0affd011475e700cb59 100644 +index e1a92fb2bbc7258b714268298e1214fd5d6fe904..290052c0c004047e26870365ca5eeb75eaff6371 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -201,7 +201,18 @@ public abstract class PlayerList { diff --git a/patches/server/0445-Add-PrepareResultEvent.patch b/patches/server/0445-Add-PrepareResultEvent.patch index 7622a9c508..62ca3c6a39 100644 --- a/patches/server/0445-Add-PrepareResultEvent.patch +++ b/patches/server/0445-Add-PrepareResultEvent.patch @@ -94,7 +94,7 @@ index 78c1bd1c709ef29ccfa75fa87d8af1217cc57b59..4ee54e3a61588e5574e3f7ba06a73bbd private void setupRecipeList(Container input, ItemStack stack) { diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 985a5c5f01d54674f7bcb77e07f8890e81113418..856242121e5102dbc88080e8a611ae64348ba86e 100644 +index 4a260923efd062ccd72bf9c0c93255c9af73ab47..be1b4a27ccb4c7519ba9213267ab461304090b87 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -1593,26 +1593,53 @@ public class CraftEventFactory { diff --git a/patches/server/0446-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch b/patches/server/0446-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch index 5e3cb7002a..e9b0665218 100644 --- a/patches/server/0446-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch +++ b/patches/server/0446-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Don't check chunk for portal on world gen entity add diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index f0c37129240fadac40fec607afda1ccef446caa0..745797f1110db582cdac83c423b4cae78928ffe2 100644 +index b26b598678ea474b3abc67acebdbed9b278e89bc..2ce769b00798f35095f50380083c7cbf4de462ef 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3471,7 +3471,7 @@ public abstract class LivingEntity extends Entity { diff --git a/patches/server/0449-Fix-arrows-never-despawning-MC-125757.patch b/patches/server/0449-Fix-arrows-never-despawning-MC-125757.patch index c04bb2c0b4..18bb8a0b53 100644 --- a/patches/server/0449-Fix-arrows-never-despawning-MC-125757.patch +++ b/patches/server/0449-Fix-arrows-never-despawning-MC-125757.patch @@ -9,7 +9,7 @@ instead of getting stuck in a never despawn state (bubble columns, etc). diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java -index f268fc2914996698490b84c4a30bac819c581d05..61d4a58ab25ce3bdf7ced426d2f92bc75ef02f7d 100644 +index 915c15faa510f4bdd3a96d8ba83280f08b12dec6..f427ad266a1e00adb661b9e4bc7cfe2a7ec52caa 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java +++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java @@ -200,6 +200,7 @@ public abstract class AbstractArrow extends Projectile { diff --git a/patches/server/0450-Thread-Safe-Vanilla-Command-permission-checking.patch b/patches/server/0450-Thread-Safe-Vanilla-Command-permission-checking.patch index aed58b8511..41ee49df99 100644 --- a/patches/server/0450-Thread-Safe-Vanilla-Command-permission-checking.patch +++ b/patches/server/0450-Thread-Safe-Vanilla-Command-permission-checking.patch @@ -26,7 +26,7 @@ index 20a7cdf87f307878d66922aaac0c60cff218e46c..39844531b03eb8a6c70700b4ecbf0ff1 } // CraftBukkit end diff --git a/src/main/java/net/minecraft/commands/CommandSourceStack.java b/src/main/java/net/minecraft/commands/CommandSourceStack.java -index b8f5b5895bf75aa8e08b2b0431ef6fdacd235430..c2af60bdb755034e46b85143826a29c4482d58f5 100644 +index efad6dc30ff2731fdaed9c7f8d974aba8d8a4bcf..24172c3b7b1d2faa13b18bedf89ad051267feb6c 100644 --- a/src/main/java/net/minecraft/commands/CommandSourceStack.java +++ b/src/main/java/net/minecraft/commands/CommandSourceStack.java @@ -61,7 +61,7 @@ public class CommandSourceStack implements SharedSuggestionProvider, com.destroy diff --git a/patches/server/0451-Fix-SPIGOT-5989.patch b/patches/server/0451-Fix-SPIGOT-5989.patch index 0af182680c..12e8ee03d6 100644 --- a/patches/server/0451-Fix-SPIGOT-5989.patch +++ b/patches/server/0451-Fix-SPIGOT-5989.patch @@ -10,7 +10,7 @@ This fixes that by checking if the modified spawn location is still at a respawn anchor. diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index b6bdbe4033b0252d61e8a0affd011475e700cb59..c618388599c5b56320c526e71613f8434a0e2c47 100644 +index 290052c0c004047e26870365ca5eeb75eaff6371..5d6128932e1af0445cf928fac6d6b91226a18de6 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -773,6 +773,7 @@ public abstract class PlayerList { diff --git a/patches/server/0452-Fix-SPIGOT-5824-Bukkit-world-container-is-not-used.patch b/patches/server/0452-Fix-SPIGOT-5824-Bukkit-world-container-is-not-used.patch index b880f8bef6..4e73a907d9 100644 --- a/patches/server/0452-Fix-SPIGOT-5824-Bukkit-world-container-is-not-used.patch +++ b/patches/server/0452-Fix-SPIGOT-5824-Bukkit-world-container-is-not-used.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix SPIGOT-5824 Bukkit world-container is not used diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java -index 7c1ad1e39c3b3dfd476133ef4d938187b7a11f09..9b1ec0186e7dfa1591532fa887f27fa378fb1d95 100644 +index c364ff90ea72ba45bc453ea78ca08c1c3fbf35dd..66eab856e7aac5eb9e7db9236ad7ca3cc370060b 100644 --- a/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java -@@ -157,8 +157,17 @@ public class Main { +@@ -168,8 +168,17 @@ public class Main { return; } diff --git a/patches/server/0453-Fix-SPIGOT-5885-Unable-to-disable-advancements.patch b/patches/server/0453-Fix-SPIGOT-5885-Unable-to-disable-advancements.patch index 50c2c1fab5..c1f23f7b9b 100644 --- a/patches/server/0453-Fix-SPIGOT-5885-Unable-to-disable-advancements.patch +++ b/patches/server/0453-Fix-SPIGOT-5885-Unable-to-disable-advancements.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix SPIGOT-5885 Unable to disable advancements diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java -index 9b1ec0186e7dfa1591532fa887f27fa378fb1d95..727efbe152dccabf130a6871e3d2582a5a733016 100644 +index 66eab856e7aac5eb9e7db9236ad7ca3cc370060b..7989b5bf002ba0995c32fb77498c7f50b34e6150 100644 --- a/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java -@@ -157,6 +157,7 @@ public class Main { +@@ -168,6 +168,7 @@ public class Main { return; } diff --git a/patches/server/0458-Brand-support.patch b/patches/server/0458-Brand-support.patch index da35073674..92f0e6197b 100644 --- a/patches/server/0458-Brand-support.patch +++ b/patches/server/0458-Brand-support.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Brand support diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index f07b584d1d7a97e242c7699fa277d0c642da1857..d06d1e00b42dd9474ec834e0bafa94329b90cb75 100644 +index d5f879303080dadf0fbd5d15840c2536942c6d0b..473944ad4f317dcb8d0a0ec9dcc736dfc04ae382 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -298,6 +298,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -17,7 +17,7 @@ index f07b584d1d7a97e242c7699fa277d0c642da1857..d06d1e00b42dd9474ec834e0bafa9432 public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player) { this.lastChatTimeStamp = new AtomicReference(Instant.EPOCH); this.lastSeenMessages = new LastSeenMessagesValidator(20); -@@ -3322,6 +3324,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3328,6 +3330,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic private static final ResourceLocation CUSTOM_REGISTER = new ResourceLocation("register"); private static final ResourceLocation CUSTOM_UNREGISTER = new ResourceLocation("unregister"); @@ -26,7 +26,7 @@ index f07b584d1d7a97e242c7699fa277d0c642da1857..d06d1e00b42dd9474ec834e0bafa9432 @Override public void handleCustomPayload(ServerboundCustomPayloadPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); -@@ -3349,6 +3353,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3355,6 +3359,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic try { byte[] data = new byte[packet.data.readableBytes()]; packet.data.readBytes(data); @@ -42,7 +42,7 @@ index f07b584d1d7a97e242c7699fa277d0c642da1857..d06d1e00b42dd9474ec834e0bafa9432 this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), packet.identifier.toString(), data); } catch (Exception ex) { ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex); -@@ -3358,6 +3371,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3364,6 +3377,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic } @@ -56,10 +56,10 @@ index f07b584d1d7a97e242c7699fa277d0c642da1857..d06d1e00b42dd9474ec834e0bafa9432 return (!this.player.joining && !this.connection.isConnected()) || this.processedDisconnect; // Paper } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 7c9c31073c052df76d5f209a23896c4b020413ff..e807cfbeecce04e87d30652a58e9eba372b9d8aa 100644 +index 4592cac06c8e96d4677ba315f70d5336fcdd0558..b098fcdcadcbf3dac5942a451a16e24b137fa08d 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -2828,6 +2828,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -2847,6 +2847,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { // Paper end }; diff --git a/patches/server/0459-Add-setMaxPlayers-API.patch b/patches/server/0459-Add-setMaxPlayers-API.patch index 7c98ab0ad9..6408a7ca14 100644 --- a/patches/server/0459-Add-setMaxPlayers-API.patch +++ b/patches/server/0459-Add-setMaxPlayers-API.patch @@ -18,10 +18,10 @@ index 5d6128932e1af0445cf928fac6d6b91226a18de6..fdd7f80fe912d4f75e7c42a2dd971600 private int simulationDistance; private boolean allowCheatsForAllPlayers; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 829105771a06deca2a85e2f27b68d96c28c1218b..3eac1b8e1fa4ce5fb30321498a0fa9c10d62c579 100644 +index 796f0f96811534895623a0a3de04ea33f276ce47..facd84b0a2a6dcde32ca47fc5a1b9058c41c5ec4 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -687,6 +687,13 @@ public final class CraftServer implements Server { +@@ -669,6 +669,13 @@ public final class CraftServer implements Server { return this.playerList.getMaxPlayers(); } diff --git a/patches/server/0460-Add-playPickupItemAnimation-to-LivingEntity.patch b/patches/server/0460-Add-playPickupItemAnimation-to-LivingEntity.patch index 0cafdd8194..f9af77f96c 100644 --- a/patches/server/0460-Add-playPickupItemAnimation-to-LivingEntity.patch +++ b/patches/server/0460-Add-playPickupItemAnimation-to-LivingEntity.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add playPickupItemAnimation to LivingEntity diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index 57e839a5582d3d0219fcf670afbb3e4b36dcd19c..c5657b6f8c7a9f6605d22bed0a5faec288eb8d6d 100644 +index b543619e50196f82e55dd7e648e5f8c580658dbe..ec57e0323f7b38828dd989244905025f973028f3 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -@@ -895,5 +895,10 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { +@@ -901,5 +901,10 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { ((Mob) getHandle()).getJumpControl().jump(); } } diff --git a/patches/server/0462-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch b/patches/server/0462-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch index 223fe0dca6..d2318fd46c 100644 --- a/patches/server/0462-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch +++ b/patches/server/0462-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch @@ -17,7 +17,7 @@ index 95c53189e32aec6aca254fa3b157df7bc68d4d1a..0637fd424e98175f864f15c8bfa8bf69 // if this keepSpawnInMemory is false a plugin has already removed our tickets, do not re-add this.removeTicketsForSpawn(this.paperConfig().spawn.keepSpawnLoadedRange * 16, prevSpawn); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 21051093bc65d30f32c6a5ea3ee07086e10d57c1..05599db0ed0da4d5055188722b9d15adfe4e4dec 100644 +index a25dbc2bd3005cb3d1aee61fb48522b13e7c4922..b3c28849841a0dd661ce81235914670ce6cbbfef 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -262,11 +262,13 @@ public class CraftWorld extends CraftRegionAccessor implements World { diff --git a/patches/server/0470-PortalCreateEvent-needs-to-know-its-entity.patch b/patches/server/0470-PortalCreateEvent-needs-to-know-its-entity.patch index acfc64af77..bbd4eb9d53 100644 --- a/patches/server/0470-PortalCreateEvent-needs-to-know-its-entity.patch +++ b/patches/server/0470-PortalCreateEvent-needs-to-know-its-entity.patch @@ -5,7 +5,7 @@ Subject: [PATCH] PortalCreateEvent needs to know its entity diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index 9816d5767d808f6259b516602bc96078fd94793f..40395738e41575a5b2b1b4020c1c60707ceac9ad 100644 +index ae4c8eb5c06a877c24b22e3ce15b2751449102fd..d16fbd7817e71f50e35bc84eb889444e35eab415 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java @@ -440,7 +440,7 @@ public final class ItemStack { diff --git a/patches/server/0473-Add-methods-to-get-translation-keys.patch b/patches/server/0473-Add-methods-to-get-translation-keys.patch index 83fd650c84..7816dbd087 100644 --- a/patches/server/0473-Add-methods-to-get-translation-keys.patch +++ b/patches/server/0473-Add-methods-to-get-translation-keys.patch @@ -10,22 +10,17 @@ public org.bukkit.craftbukkit.inventory.CraftMetaFirework getNBT(Lorg/bukkit/Fir Co-authored-by: MeFisto94 diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -index 3123a8d52236757c3e7ca3b099cc664485cb3c72..eba015c33dcf63ff85569eb7ee7e6b3def2b05ac 100644 +index ac543a4c6bc21435de3c6721af37fd5f554e403e..1f780a326f4982d4be1855516fb1461b4d90bcc6 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -@@ -693,5 +693,15 @@ public class CraftBlock implements Block { +@@ -694,5 +694,10 @@ public class CraftBlock implements Block { public org.bukkit.SoundGroup getBlockSoundGroup() { return org.bukkit.craftbukkit.CraftSoundGroup.getSoundGroup(this.getNMS().getSoundType()); } + + @Override -+ public String getTranslationKey() { -+ return this.translationKey(); -+ } -+ -+ @Override + public String translationKey() { -+ return org.bukkit.Bukkit.getUnsafe().getTranslationKey(this); ++ return this.getNMS().getBlock().getDescriptionId(); + } // Paper end } @@ -45,41 +40,6 @@ index e8334e2264510f5101e80b4f130e7ae1442560d7..57decf4156f176ebcc988478c17856cb // Paper end public net.minecraft.world.item.enchantment.Enchantment getHandle() { -diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 7a017d69bec0fb1e17c47d7edcfce4b1c6836693..d85526b8ddd26b2113dd8df7bf2d58ff432d86bc 100644 ---- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -480,6 +480,30 @@ public final class CraftMagicNumbers implements UnsafeValues { - Preconditions.checkArgument(dataVersion <= getDataVersion(), "Newer version! Server downgrades are not supported!"); - return compound; - } -+ -+ @Override -+ public String getTranslationKey(Material mat) { -+ if (mat.isBlock()) { -+ return getBlock(mat).getDescriptionId(); -+ } -+ return getItem(mat).getDescriptionId(); -+ } -+ -+ @Override -+ public String getTranslationKey(org.bukkit.block.Block block) { -+ return ((org.bukkit.craftbukkit.block.CraftBlock)block).getNMS().getBlock().getDescriptionId(); -+ } -+ -+ @Override -+ public String getTranslationKey(org.bukkit.entity.EntityType type) { -+ return net.minecraft.world.entity.EntityType.byString(type.getName()).map(net.minecraft.world.entity.EntityType::getDescriptionId).orElse(null); -+ } -+ -+ @Override -+ public String getTranslationKey(org.bukkit.inventory.ItemStack itemStack) { -+ net.minecraft.world.item.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(itemStack); -+ return nmsItemStack.getItem().getDescriptionId(nmsItemStack); -+ } - // Paper end - - /** diff --git a/src/test/java/io/papermc/paper/world/TranslationKeyTest.java b/src/test/java/io/papermc/paper/world/TranslationKeyTest.java index fab3063fffa959ac7f0eb5937f2fae94d11b6591..4cc8ca5dd95e9cccd08ada057a9592a1421f434a 100644 --- a/src/test/java/io/papermc/paper/world/TranslationKeyTest.java diff --git a/patches/server/0475-Cache-block-data-strings.patch b/patches/server/0475-Cache-block-data-strings.patch index a3a8b3d59a..3191156197 100644 --- a/patches/server/0475-Cache-block-data-strings.patch +++ b/patches/server/0475-Cache-block-data-strings.patch @@ -17,10 +17,10 @@ index 8e101269ca2edf5f3cc9c1ccedd03afaf1392d19..8ce413404930cca3a470bb58d73b9bd0 if (this.isSameThread()) { diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java -index 6182ce8c32a334d3488c03f42bf3befcc0b80503..45c90505c778bfdebf0884190a422d12a0673d71 100644 +index 198a3f04ad6864460b9e7dd42444fab423a4ad8f..14b8d0754955747d5a755eaf628e861929f5f47f 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java +++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java -@@ -509,9 +509,39 @@ public class CraftBlockData implements BlockData { +@@ -512,9 +512,39 @@ public class CraftBlockData implements BlockData { Preconditions.checkState(CraftBlockData.MAP.put(nms, bukkit) == null, "Duplicate mapping %s->%s", nms, bukkit); } diff --git a/patches/server/0476-Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch b/patches/server/0476-Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch index 9f51c53888..288d3d614e 100644 --- a/patches/server/0476-Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch +++ b/patches/server/0476-Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch @@ -9,7 +9,7 @@ as this is how Vanilla teleports entities. Cancel any pending motion when teleported. diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index d06d1e00b42dd9474ec834e0bafa94329b90cb75..15b16d37928eca9f8da026df0c76a1f7cd43ba70 100644 +index 473944ad4f317dcb8d0a0ec9dcc736dfc04ae382..f365eaa38b9aa2331ab51374886021bc3c2f28c2 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -748,7 +748,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic diff --git a/patches/server/0477-Add-additional-open-container-api-to-HumanEntity.patch b/patches/server/0477-Add-additional-open-container-api-to-HumanEntity.patch index 1c28c3f9cd..d4149ca464 100644 --- a/patches/server/0477-Add-additional-open-container-api-to-HumanEntity.patch +++ b/patches/server/0477-Add-additional-open-container-api-to-HumanEntity.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add additional open container api to HumanEntity diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -index 15f6e1c04fefa1334301534646b8ed2535d16fa9..b8ba4e278de5c9a591789928c21bff26dcec2fb7 100644 +index 728fc30046de534748e2379e8cb371cc2e51f9d3..0117277db8402a1673c317673811c17d02edc4c9 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java @@ -462,6 +462,70 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { diff --git a/patches/server/0480-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch b/patches/server/0480-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch index b1c0921595..4f8b381046 100644 --- a/patches/server/0480-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch +++ b/patches/server/0480-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch @@ -21,14 +21,15 @@ index 873206bb65b2412d3066a0f7e35fe0684e29661a..d170254265a789998be96ce1dcaf71c9 + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index d85526b8ddd26b2113dd8df7bf2d58ff432d86bc..0fc844b717a466e7ac0438bbf04371bba6a19ee2 100644 +index 70c4eb21b3730a6bb7c44671eaaba9a7bc3ee5a3..26e6fab362db3f5880bb5daddd4795465e969c27 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -504,6 +504,10 @@ public final class CraftMagicNumbers implements UnsafeValues { - net.minecraft.world.item.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(itemStack); - return nmsItemStack.getItem().getDescriptionId(nmsItemStack); +@@ -505,6 +505,11 @@ public final class CraftMagicNumbers implements UnsafeValues { + Preconditions.checkArgument(dataVersion <= getDataVersion(), "Newer version! Server downgrades are not supported!"); + return compound; } + ++ @Override + public int nextEntityId() { + return net.minecraft.world.entity.Entity.nextEntityId(); + } diff --git a/patches/server/0486-Fix-for-large-move-vectors-crashing-server.patch b/patches/server/0486-Fix-for-large-move-vectors-crashing-server.patch index ce95a77747..1ab85dbdea 100644 --- a/patches/server/0486-Fix-for-large-move-vectors-crashing-server.patch +++ b/patches/server/0486-Fix-for-large-move-vectors-crashing-server.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Fix for large move vectors crashing server Check movement distance also based on current position. diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 15b16d37928eca9f8da026df0c76a1f7cd43ba70..ebce5372a4961b8518b3c5ee1f727705c8b68152 100644 +index f365eaa38b9aa2331ab51374886021bc3c2f28c2..aabfccdd94d5934716a706c9189391177ff07d57 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -563,9 +563,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic diff --git a/patches/server/0487-Optimise-getType-calls.patch b/patches/server/0487-Optimise-getType-calls.patch index aed2530314..1bf130189f 100644 --- a/patches/server/0487-Optimise-getType-calls.patch +++ b/patches/server/0487-Optimise-getType-calls.patch @@ -28,10 +28,10 @@ index da878e180c6b94f98dc82c6e8395f63ecc9b2c1e..a9b0f5950b6f97ea4c2a1075946b9200 super(block, propertyMap, codec); } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java b/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java -index 0511ac55c4e6d9736ec12e94c9899eb04d5cd2e3..75193684a71d694736087d1a368b8fb6a8c8363b 100644 +index 484e5d5a2793d18eb49b73898d944776a1ec48e8..05512cc19eb213b6be5c869e133376ee42827806 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java -@@ -84,7 +84,7 @@ public class CraftChunkSnapshot implements ChunkSnapshot { +@@ -98,7 +98,7 @@ public class CraftChunkSnapshot implements ChunkSnapshot { public Material getBlockType(int x, int y, int z) { this.validateChunkCoordinates(x, y, z); @@ -41,7 +41,7 @@ index 0511ac55c4e6d9736ec12e94c9899eb04d5cd2e3..75193684a71d694736087d1a368b8fb6 @Override diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -index eba015c33dcf63ff85569eb7ee7e6b3def2b05ac..01827f2398cec6e18ab490e664360beed9dbca83 100644 +index 1f780a326f4982d4be1855516fb1461b4d90bcc6..998cb47c4d3d1c67467469e661f80d231d17c04a 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java @@ -226,7 +226,7 @@ public class CraftBlock implements Block { @@ -67,10 +67,10 @@ index 0a755f38fae9dc84440f43113920c5b4c6d8218b..7b9e943b391c061782fccd2b8d705cee public void setFlag(int flag) { diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java -index 45c90505c778bfdebf0884190a422d12a0673d71..3399e8cdf2230bd71444abb43829c54d7277ce36 100644 +index 14b8d0754955747d5a755eaf628e861929f5f47f..7acf213194f61d04cffabaaee6c1372bfa2e1933 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java +++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java -@@ -50,7 +50,7 @@ public class CraftBlockData implements BlockData { +@@ -53,7 +53,7 @@ public class CraftBlockData implements BlockData { @Override public Material getMaterial() { diff --git a/patches/server/0491-Fix-item-locations-dropped-from-campfires.patch b/patches/server/0491-Fix-item-locations-dropped-from-campfires.patch index ec0156c522..db503bc46a 100644 --- a/patches/server/0491-Fix-item-locations-dropped-from-campfires.patch +++ b/patches/server/0491-Fix-item-locations-dropped-from-campfires.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Fix item locations dropped from campfires Fixes #4259 by not flooring the blockposition among other weirdness diff --git a/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java -index 9ef6b391268a99303aa853623d43c96073a13c9e..c6ae14009463b2d64acd4d3beb86d3233bcbae66 100644 +index 683958d65e4b926231b68c68744af13ef18fba8a..b07b83f4c16e85304b5da7a245810dd2741398e7 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java -@@ -79,7 +79,11 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable { +@@ -81,7 +81,11 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable { result = blockCookEvent.getResult(); itemstack1 = CraftItemStack.asNMSCopy(result); // CraftBukkit end diff --git a/patches/server/0492-Player-elytra-boost-API.patch b/patches/server/0492-Player-elytra-boost-API.patch index 4ce8f6a2d3..d6f552f6a8 100644 --- a/patches/server/0492-Player-elytra-boost-API.patch +++ b/patches/server/0492-Player-elytra-boost-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Player elytra boost API diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index e807cfbeecce04e87d30652a58e9eba372b9d8aa..d1d4b656ec2decef8ce4ab5344af75b59c62a0e7 100644 +index b098fcdcadcbf3dac5942a451a16e24b137fa08d..1360082426086a61a657c0cefc7bbc1a7df5f2ec 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -639,6 +639,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0494-Avoid-error-bubbling-up-when-item-stack-is-empty-in-.patch b/patches/server/0494-Avoid-error-bubbling-up-when-item-stack-is-empty-in-.patch index fa266bb273..d2796ab1d2 100644 --- a/patches/server/0494-Avoid-error-bubbling-up-when-item-stack-is-empty-in-.patch +++ b/patches/server/0494-Avoid-error-bubbling-up-when-item-stack-is-empty-in-.patch @@ -8,7 +8,7 @@ This can realistically only happen if there's custom loot active on fishing which can return 0 items. This would disconnect the player who's fishing. diff --git a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java -index ff7b5fea13be9a64e5886f8fe337802cbc5d19b2..7f3a7a769afec8449547c26453112064b9bcb04a 100644 +index 75449d8575ac1b67aaa94d0f3fc08244728ec8a8..15fb5ee374b19366ebb23181896fb943e95819f0 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java +++ b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java @@ -495,9 +495,15 @@ public class FishingHook extends Projectile { diff --git a/patches/server/0495-Add-getOfflinePlayerIfCached-String.patch b/patches/server/0495-Add-getOfflinePlayerIfCached-String.patch index 915b2363b0..ccdacc2684 100644 --- a/patches/server/0495-Add-getOfflinePlayerIfCached-String.patch +++ b/patches/server/0495-Add-getOfflinePlayerIfCached-String.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add getOfflinePlayerIfCached(String) diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 3eac1b8e1fa4ce5fb30321498a0fa9c10d62c579..6c2ea3e0cf385d6893faf5430b29dbe2589786b0 100644 +index facd84b0a2a6dcde32ca47fc5a1b9058c41c5ec4..fed01c7ed32a0207216fd902976902b223cc3518 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1830,6 +1830,28 @@ public final class CraftServer implements Server { +@@ -1812,6 +1812,28 @@ public final class CraftServer implements Server { return result; } diff --git a/patches/server/0498-Fix-client-lag-on-advancement-loading.patch b/patches/server/0498-Fix-client-lag-on-advancement-loading.patch index 6702720a1d..fe628e7903 100644 --- a/patches/server/0498-Fix-client-lag-on-advancement-loading.patch +++ b/patches/server/0498-Fix-client-lag-on-advancement-loading.patch @@ -15,10 +15,10 @@ manually reload the advancement data for all players, which normally takes place as a part of the datapack reloading. diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 0fc844b717a466e7ac0438bbf04371bba6a19ee2..00cffc8666cc5e0694da2a3d2a2efab457781374 100644 +index 15b09e538675791ab19dc7c678208ee93f51f184..14e50807bf4f337a33ea54578fe5fadeb59e3ae4 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -344,7 +344,13 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -345,7 +345,13 @@ public final class CraftMagicNumbers implements UnsafeValues { Bukkit.getLogger().log(Level.SEVERE, "Error saving advancement " + key, ex); } diff --git a/patches/server/0502-Add-API-for-quit-reason.patch b/patches/server/0502-Add-API-for-quit-reason.patch index 107b7f2ebb..0f1779a761 100644 --- a/patches/server/0502-Add-API-for-quit-reason.patch +++ b/patches/server/0502-Add-API-for-quit-reason.patch @@ -25,7 +25,7 @@ index 501d17ba798c5928279a93c45de3eb6e8a3f99d6..5fa1b0d609ffc43b03f66d710a2702c2 Connection.LOGGER.debug("Failed to sent packet", throwable); ConnectionProtocol enumprotocol = this.getCurrentProtocol(); diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index bb939f3312eb5a5740b445cfd268f1902955d4e8..da380d88953cd1fc289f972813187a0ddedd9d36 100644 +index e6b175a62f2b151068fc7b28685b64afea1ebbc3..a56dd127776be6de0e88a356b917488f7b20d39c 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -268,6 +268,7 @@ public class ServerPlayer extends Player { @@ -37,7 +37,7 @@ index bb939f3312eb5a5740b445cfd268f1902955d4e8..da380d88953cd1fc289f972813187a0d public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile) { super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile); diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index ebce5372a4961b8518b3c5ee1f727705c8b68152..4e9ae442a838e685e96d436e0f14ff2d1f5e81f4 100644 +index aabfccdd94d5934716a706c9189391177ff07d57..51ae3c2facb7a1dbdbc47cd681aeb6a6beb4ed72 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -503,6 +503,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic diff --git a/patches/server/0505-Add-Destroy-Speed-API.patch b/patches/server/0505-Add-Destroy-Speed-API.patch index 503c7fb25f..92681b95f5 100644 --- a/patches/server/0505-Add-Destroy-Speed-API.patch +++ b/patches/server/0505-Add-Destroy-Speed-API.patch @@ -6,12 +6,12 @@ Subject: [PATCH] Add Destroy Speed API Co-authored-by: Jake Potrebic diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -index 01827f2398cec6e18ab490e664360beed9dbca83..ac831b22930ad02951186b6326b0c542de4c9881 100644 +index 998cb47c4d3d1c67467469e661f80d231d17c04a..c3ab1a60f60806e2b91b633bf89389cf434443ce 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -@@ -703,5 +703,26 @@ public class CraftBlock implements Block { +@@ -699,5 +699,26 @@ public class CraftBlock implements Block { public String translationKey() { - return org.bukkit.Bukkit.getUnsafe().getTranslationKey(this); + return this.getNMS().getBlock().getDescriptionId(); } + + @Override diff --git a/patches/server/0506-Fix-Player-spawnParticle-x-y-z-precision-loss.patch b/patches/server/0506-Fix-Player-spawnParticle-x-y-z-precision-loss.patch index ba6264a3b8..f10e9d0cc4 100644 --- a/patches/server/0506-Fix-Player-spawnParticle-x-y-z-precision-loss.patch +++ b/patches/server/0506-Fix-Player-spawnParticle-x-y-z-precision-loss.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix Player spawnParticle x/y/z precision loss diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index d1d4b656ec2decef8ce4ab5344af75b59c62a0e7..a70f67b791218f9460acb7e0f42b64905e8deb99 100644 +index 1360082426086a61a657c0cefc7bbc1a7df5f2ec..943cfb59907cb519b2f324a9e9185723ebead60d 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -2349,7 +2349,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -2368,7 +2368,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { if (data != null && !particle.getDataType().isInstance(data)) { throw new IllegalArgumentException("data should be " + particle.getDataType() + " got " + data.getClass()); } diff --git a/patches/server/0507-Add-LivingEntity-clearActiveItem.patch b/patches/server/0507-Add-LivingEntity-clearActiveItem.patch index 48220e8bf7..0a6b3d563f 100644 --- a/patches/server/0507-Add-LivingEntity-clearActiveItem.patch +++ b/patches/server/0507-Add-LivingEntity-clearActiveItem.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add LivingEntity#clearActiveItem diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index c5657b6f8c7a9f6605d22bed0a5faec288eb8d6d..c789cefb61270c7e52ddea7efd433fa6c0e63fda 100644 +index ec57e0323f7b38828dd989244905025f973028f3..8409087a5977a6ba0cd948c51f3f7ae59a041f5c 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -@@ -862,6 +862,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { +@@ -868,6 +868,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { return getHandle().getUseItem().asBukkitMirror(); } diff --git a/patches/server/0512-Added-missing-default-perms-for-commands.patch b/patches/server/0512-Added-missing-default-perms-for-commands.patch index 75e57c96f1..b10824a5aa 100644 --- a/patches/server/0512-Added-missing-default-perms-for-commands.patch +++ b/patches/server/0512-Added-missing-default-perms-for-commands.patch @@ -170,38 +170,3 @@ index 0000000000000000000000000000000000000000..8665e2740aedcc2895b0e2c44ebaba53 + } + } +} -diff --git a/src/test/java/org/bukkit/support/DummyServer.java b/src/test/java/org/bukkit/support/DummyServer.java -index 946497353a64421592d2bae012c9a3cb874dd5b8..2ddceb709291d3bd713621ffa4020c02ec26bb21 100644 ---- a/src/test/java/org/bukkit/support/DummyServer.java -+++ b/src/test/java/org/bukkit/support/DummyServer.java -@@ -106,7 +106,21 @@ public final class DummyServer implements InvocationHandler { - } - } - ); -- Bukkit.setServer(Proxy.getProxyClass(Server.class.getClassLoader(), Server.class).asSubclass(Server.class).getConstructor(InvocationHandler.class).newInstance(new DummyServer())); -+ // Paper start - modeled off of TestServer in the API tests module -+ methods.put( -+ Server.class.getMethod("getPluginManager"), -+ new MethodHandler() { -+ @Override -+ public Object handle(DummyServer server, Object[] args) { -+ return server.pluginManager; -+ } -+ } -+ ); -+ DummyServer server = new DummyServer(); -+ Server instance = Proxy.getProxyClass(Server.class.getClassLoader(), Server.class).asSubclass(Server.class).getConstructor(InvocationHandler.class).newInstance(server); -+ Bukkit.setServer(instance); -+ server.pluginManager = new org.bukkit.plugin.SimplePluginManager(instance, new org.bukkit.command.SimpleCommandMap(instance)); -+ // Paper end - } catch (Throwable t) { - throw new Error(t); - } -@@ -116,6 +130,7 @@ public final class DummyServer implements InvocationHandler { - - private DummyServer() {}; - -+ private org.bukkit.plugin.PluginManager pluginManager; // Paper - @Override - public Object invoke(Object proxy, Method method, Object[] args) { - MethodHandler handler = DummyServer.methods.get(method); diff --git a/patches/server/0515-Limit-recipe-packets.patch b/patches/server/0515-Limit-recipe-packets.patch index fb517d7de6..f5719a6e61 100644 --- a/patches/server/0515-Limit-recipe-packets.patch +++ b/patches/server/0515-Limit-recipe-packets.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Limit recipe packets diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 4e9ae442a838e685e96d436e0f14ff2d1f5e81f4..ba07a2c243f833aa4e0370993cac25bdd13d53d4 100644 +index 51ae3c2facb7a1dbdbc47cd681aeb6a6beb4ed72..56e386dcc7239aecc2f86d7c3db1e42c12f430ba 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -262,6 +262,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -24,7 +24,7 @@ index 4e9ae442a838e685e96d436e0f14ff2d1f5e81f4..ba07a2c243f833aa4e0370993cac25bd /* Use thread-safe field access instead if (this.chatSpamTickCount > 0) { --this.chatSpamTickCount; -@@ -3111,6 +3113,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3117,6 +3119,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @Override public void handlePlaceRecipe(ServerboundPlaceRecipePacket packet) { diff --git a/patches/server/0517-Player-Chunk-Load-Unload-Events.patch b/patches/server/0517-Player-Chunk-Load-Unload-Events.patch index 19258dae5c..e040bb583c 100644 --- a/patches/server/0517-Player-Chunk-Load-Unload-Events.patch +++ b/patches/server/0517-Player-Chunk-Load-Unload-Events.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Player Chunk Load/Unload Events diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index da380d88953cd1fc289f972813187a0ddedd9d36..de10fe199af11525116081618609f7bfbc7b1006 100644 +index a56dd127776be6de0e88a356b917488f7b20d39c..33f8af6f2e0f3b6f456d2742bebf81f820db4832 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -2164,11 +2164,21 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0519-Expose-LivingEntity-hurt-direction.patch b/patches/server/0519-Expose-LivingEntity-hurt-direction.patch index 880a9b598c..3a105e9ccd 100644 --- a/patches/server/0519-Expose-LivingEntity-hurt-direction.patch +++ b/patches/server/0519-Expose-LivingEntity-hurt-direction.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Expose LivingEntity hurt direction diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index c789cefb61270c7e52ddea7efd433fa6c0e63fda..8c15517e3602f815819c44136adec3c09d70a71b 100644 +index 8409087a5977a6ba0cd948c51f3f7ae59a041f5c..dfc5317ab5c50c240a4f0806aba6cec7852092cf 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -@@ -907,5 +907,15 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { +@@ -913,5 +913,15 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { public void playPickupItemAnimation(org.bukkit.entity.Item item, int quantity) { getHandle().take(((CraftItem) item).getHandle(), quantity); } diff --git a/patches/server/0522-Add-PlayerTradeEvent-and-PlayerPurchaseEvent.patch b/patches/server/0522-Add-PlayerTradeEvent-and-PlayerPurchaseEvent.patch index f8d0afea2f..bfe4561949 100644 --- a/patches/server/0522-Add-PlayerTradeEvent-and-PlayerPurchaseEvent.patch +++ b/patches/server/0522-Add-PlayerTradeEvent-and-PlayerPurchaseEvent.patch @@ -37,7 +37,7 @@ index e7dda8959eb92c069af001126aafc759e7e7d2de..ca96b893e22de3ae7c11d5cded51edf7 CriteriaTriggers.TRADE.trigger((ServerPlayer) this.tradingPlayer, this, offer.getResult()); } diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java -index f7976bd9561601a6ce1d5b4874b08bba9754d753..6f9d59256d34446c48e4df9dbc9351856101caa2 100644 +index f15415ff5fb099a048fe0f898e15bc4303a47ef5..428bdd3183e0085368956a5abc8e9f97fbf3e478 100644 --- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java +++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java @@ -758,6 +758,14 @@ public abstract class AbstractContainerMenu { diff --git a/patches/server/0525-Additional-Block-Material-API-s.patch b/patches/server/0525-Additional-Block-Material-API-s.patch index 0d852337ea..3a8a041708 100644 --- a/patches/server/0525-Additional-Block-Material-API-s.patch +++ b/patches/server/0525-Additional-Block-Material-API-s.patch @@ -9,7 +9,7 @@ process to do this in the Bukkit API Adds API for buildable, replaceable, burnable too. diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -index ac831b22930ad02951186b6326b0c542de4c9881..30b5a78a93405f3a03624ed1331670770aaa3765 100644 +index c3ab1a60f60806e2b91b633bf89389cf434443ce..23a9469ff63f1be7ab0091b2c86a614eaeba9f55 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java @@ -465,6 +465,25 @@ public class CraftBlock implements Block { diff --git a/patches/server/0532-Fix-interact-event-not-being-called-in-adventure.patch b/patches/server/0532-Fix-interact-event-not-being-called-in-adventure.patch index 193208a872..cb0bbcceec 100644 --- a/patches/server/0532-Fix-interact-event-not-being-called-in-adventure.patch +++ b/patches/server/0532-Fix-interact-event-not-being-called-in-adventure.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Fix interact event not being called in adventure Call PlayerInteractEvent when left-clicking on a block in adventure mode diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index ba07a2c243f833aa4e0370993cac25bdd13d53d4..23560d8fac37296dd1194996bc1f4b3babcde9cc 100644 +index 56e386dcc7239aecc2f86d7c3db1e42c12f430ba..ba7c390c523f83a43d62deb1ca69c0552d233c8c 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -1843,7 +1843,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic diff --git a/patches/server/0536-Added-WorldGameRuleChangeEvent.patch b/patches/server/0536-Added-WorldGameRuleChangeEvent.patch index 9b22f164a0..5d45d328aa 100644 --- a/patches/server/0536-Added-WorldGameRuleChangeEvent.patch +++ b/patches/server/0536-Added-WorldGameRuleChangeEvent.patch @@ -64,10 +64,10 @@ index 694a2f685cb46a5391da012f4d7e3bd3e6e88f4c..fa8cd4438c19a262272da47985a57f7e public int get() { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 05599db0ed0da4d5055188722b9d15adfe4e4dec..f3d78ba340d92a482fd3d54cbe16983ec9766eed 100644 +index b3c28849841a0dd661ce81235914670ce6cbbfef..b0935a5ddb0e3b0105fbfb946076248c3bfaccf6 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -1792,8 +1792,13 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -1808,8 +1808,13 @@ public class CraftWorld extends CraftRegionAccessor implements World { if (!this.isGameRule(rule)) return false; @@ -82,7 +82,7 @@ index 05599db0ed0da4d5055188722b9d15adfe4e4dec..f3d78ba340d92a482fd3d54cbe16983e handle.onChanged(this.getHandle().getServer()); return true; } -@@ -1828,8 +1833,12 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -1844,8 +1849,12 @@ public class CraftWorld extends CraftRegionAccessor implements World { if (!this.isGameRule(rule.getName())) return false; diff --git a/patches/server/0543-Empty-commands-shall-not-be-dispatched.patch b/patches/server/0543-Empty-commands-shall-not-be-dispatched.patch index a03ff3d97a..e365b45432 100644 --- a/patches/server/0543-Empty-commands-shall-not-be-dispatched.patch +++ b/patches/server/0543-Empty-commands-shall-not-be-dispatched.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Empty commands shall not be dispatched diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java -index feb9e827357b3ffb76dfff90350e513592441d8e..03a926990ecfa97d8fbc20a15ffb7fcb48fed06a 100644 +index 2f256d0452617c8f2630f0dd8f16025c9b2e0cae..da7503dca8ab4f7234bf296dfacf39e466de700a 100644 --- a/src/main/java/net/minecraft/commands/Commands.java +++ b/src/main/java/net/minecraft/commands/Commands.java -@@ -253,6 +253,7 @@ public class Commands { +@@ -255,6 +255,7 @@ public class Commands { command = event.getCommand(); String[] args = command.split(" "); diff --git a/patches/server/0547-Add-sendOpLevel-API.patch b/patches/server/0547-Add-sendOpLevel-API.patch index 9b83aa61b7..a95ab6bbe7 100644 --- a/patches/server/0547-Add-sendOpLevel-API.patch +++ b/patches/server/0547-Add-sendOpLevel-API.patch @@ -32,7 +32,7 @@ index 3d05b2f37b192bf707414f4a574f79423b0f0be1..ad6a9e238d21a821e7d5c3634fbc8fc9 public boolean isWhiteListed(GameProfile profile) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index a70f67b791218f9460acb7e0f42b64905e8deb99..55c206d2bff70fd7febd5f635ea0d7a5e779a058 100644 +index 943cfb59907cb519b2f324a9e9185723ebead60d..69cfbe2c3ba14d7ebf4b29a89161b6d1d00ebc91 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -653,6 +653,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0548-Add-PaperRegistry.patch b/patches/server/0548-Add-PaperRegistry.patch index ae11b89e19..b5474d9bb7 100644 --- a/patches/server/0548-Add-PaperRegistry.patch +++ b/patches/server/0548-Add-PaperRegistry.patch @@ -205,10 +205,10 @@ index 04137173ca7034b9dff37a68518e8b6fb0330188..9b1bde95e8303e5d4adfe92f09240df8 // Paper start if (Thread.currentThread() != this.serverThread) { diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 00cffc8666cc5e0694da2a3d2a2efab457781374..2ba9cac66413ddc0a830dbb2b2644ed9d40c9c99 100644 +index 1caee283ae73943f936eddd822fbe64dc7815fdf..611cf30d17e110ff7b38219053919b52a86dfb19 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -514,6 +514,11 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -516,6 +516,11 @@ public final class CraftMagicNumbers implements UnsafeValues { public int nextEntityId() { return net.minecraft.world.entity.Entity.nextEntityId(); } @@ -221,13 +221,13 @@ index 00cffc8666cc5e0694da2a3d2a2efab457781374..2ba9cac66413ddc0a830dbb2b2644ed9 /** diff --git a/src/test/java/org/bukkit/support/AbstractTestingBase.java b/src/test/java/org/bukkit/support/AbstractTestingBase.java -index abf31f0fc3e68f3702f0500dbff7bb9d8be26887..084c48ffabac2cd753609add745203e8a55bc09e 100644 +index 1caa4ce02cd396160f0d9d5461de8290e7c078bb..a19c1e8253b0dd0da77008f892b68187acd17c4a 100644 --- a/src/test/java/org/bukkit/support/AbstractTestingBase.java +++ b/src/test/java/org/bukkit/support/AbstractTestingBase.java @@ -49,6 +49,15 @@ public abstract class AbstractTestingBase { - LayeredRegistryAccess layers = RegistryLayer.createRegistryAccess(); layers = WorldLoader.loadAndReplaceLayer(resourceManager, layers, RegistryLayer.WORLDGEN, RegistryDataLoader.WORLDGEN_REGISTRIES); REGISTRY_CUSTOM = layers.compositeAccess().freeze(); + io.papermc.paper.testing.DummyServer.setup(); // Paper + // Paper start + try { + java.lang.reflect.Field field = io.papermc.paper.registry.PaperRegistry.class.getDeclaredField("REGISTRY_ACCESS"); diff --git a/patches/server/0549-Add-StructuresLocateEvent.patch b/patches/server/0549-Add-StructuresLocateEvent.patch index e7f6799caa..92bb68348d 100644 --- a/patches/server/0549-Add-StructuresLocateEvent.patch +++ b/patches/server/0549-Add-StructuresLocateEvent.patch @@ -105,18 +105,18 @@ index b6df6077107759963ee8205dddb90501d5ccb4d6..29032374f0e71a41a2de260d402b6fbf ChunkGeneratorStructureState chunkgeneratorstructurestate = world.getChunkSource().getGeneratorState(); Map>> map = new Object2ObjectArrayMap(); Iterator iterator = structures.iterator(); -diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/Structure.java b/src/main/java/net/minecraft/world/level/levelgen/structure/Structure.java -index 8eaa1a57e904fe7e540b311c6c5c36b755f021fc..92730afcda6f779d0c440c7a8d50bb792b57d2d3 100644 ---- a/src/main/java/net/minecraft/world/level/levelgen/structure/Structure.java -+++ b/src/main/java/net/minecraft/world/level/levelgen/structure/Structure.java -@@ -42,6 +42,7 @@ public abstract class Structure { - public static final Codec DIRECT_CODEC = BuiltInRegistries.STRUCTURE_TYPE.byNameCodec().dispatch(Structure::type, StructureType::codec); - public static final Codec> CODEC = RegistryFileCodec.create(Registries.STRUCTURE, DIRECT_CODEC); - protected final Structure.StructureSettings settings; -+ static { io.papermc.paper.world.structure.PaperConfiguredStructure.init(); } // Paper +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +index fed01c7ed32a0207216fd902976902b223cc3518..5b48102ad1c9940a5f41ba8084be0804b7536d30 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +@@ -318,6 +318,7 @@ public final class CraftServer implements Server { + this.structureManager = new CraftStructureManager(console.getStructureManager()); - public static RecordCodecBuilder settingsCodec(RecordCodecBuilder.Instance instance) { - return Structure.StructureSettings.CODEC.forGetter((feature) -> { + Bukkit.setServer(this); ++ io.papermc.paper.world.structure.PaperConfiguredStructure.init(); // Paper + + // Register all the Enchantments and PotionTypes now so we can stop new registration immediately after + Enchantments.SHARPNESS.getClass(); diff --git a/src/test/java/io/papermc/paper/world/structure/ConfiguredStructureTest.java b/src/test/java/io/papermc/paper/world/structure/ConfiguredStructureTest.java new file mode 100644 index 0000000000000000000000000000000000000000..cb077ac5e24d6632c46927fef8ecd20f150d3596 diff --git a/patches/server/0551-Remove-ProjectileHitEvent-call-when-fireballs-dead.patch b/patches/server/0551-Remove-ProjectileHitEvent-call-when-fireballs-dead.patch index c8da02b504..1eb191cb45 100644 --- a/patches/server/0551-Remove-ProjectileHitEvent-call-when-fireballs-dead.patch +++ b/patches/server/0551-Remove-ProjectileHitEvent-call-when-fireballs-dead.patch @@ -7,7 +7,7 @@ The duplicate ProjectileHitEvent in EntityFireball was removed. The event was always called before the duplicate call. diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java -index edc9f3450b56e0c5c12387b6fd51b9628732c372..97231f7328f0eebffcacdae5469027be8aeec3ae 100644 +index cf87b51d1914274bd3e32a387629be7b04cf1734..2096e8a0bdbcfc865f175f3a01ab688542481531 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java +++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java @@ -88,7 +88,7 @@ public abstract class AbstractHurtingProjectile extends Projectile { diff --git a/patches/server/0552-Return-chat-component-with-empty-text-instead-of-thr.patch b/patches/server/0552-Return-chat-component-with-empty-text-instead-of-thr.patch index 53bdf6212b..8626428239 100644 --- a/patches/server/0552-Return-chat-component-with-empty-text-instead-of-thr.patch +++ b/patches/server/0552-Return-chat-component-with-empty-text-instead-of-thr.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Return chat component with empty text instead of throwing diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java -index 6f9d59256d34446c48e4df9dbc9351856101caa2..495c605b36e2e1430988030d6c44675e0aaffd2f 100644 +index 428bdd3183e0085368956a5abc8e9f97fbf3e478..f7bce1cdad50aec0f8df9d996de7dbec38baec69 100644 --- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java +++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java @@ -89,7 +89,12 @@ public abstract class AbstractContainerMenu { diff --git a/patches/server/0560-Reset-shield-blocking-on-dimension-change.patch b/patches/server/0560-Reset-shield-blocking-on-dimension-change.patch index 63623c4968..ac11e8ba6f 100644 --- a/patches/server/0560-Reset-shield-blocking-on-dimension-change.patch +++ b/patches/server/0560-Reset-shield-blocking-on-dimension-change.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Reset shield blocking on dimension change diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index de10fe199af11525116081618609f7bfbc7b1006..5cc7edca158fed862d0dd18c6d2754de6df0ec4c 100644 +index 33f8af6f2e0f3b6f456d2742bebf81f820db4832..b04c39543ea3cddf479807f93734ab727f320de4 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1186,6 +1186,11 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0567-living-entity-allow-attribute-registration.patch b/patches/server/0567-living-entity-allow-attribute-registration.patch index efaed6e667..e21088f871 100644 --- a/patches/server/0567-living-entity-allow-attribute-registration.patch +++ b/patches/server/0567-living-entity-allow-attribute-registration.patch @@ -41,10 +41,10 @@ index 233e372ba5d785352c9ac12dac37395bac63315c..0e61caa5c9f21788fbeaa90ed75d23e1 return BuiltInRegistries.ATTRIBUTE.get(CraftNamespacedKey.toMinecraft(attribute.getKey())); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index 8c15517e3602f815819c44136adec3c09d70a71b..3f349f3ac972c90412cd20a30ccb55598c8cf7ba 100644 +index dfc5317ab5c50c240a4f0806aba6cec7852092cf..fb74a06e73765a82d936975f4070093e35e2dade 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -@@ -699,6 +699,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { +@@ -705,6 +705,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { return this.getHandle().craftAttributes.getAttribute(attribute); } diff --git a/patches/server/0580-Add-recipe-to-cook-events.patch b/patches/server/0580-Add-recipe-to-cook-events.patch index 71eccd16a2..c031ab7d5e 100644 --- a/patches/server/0580-Add-recipe-to-cook-events.patch +++ b/patches/server/0580-Add-recipe-to-cook-events.patch @@ -18,10 +18,10 @@ index 34e375ab81b539ece769c943768342dbb542d0bb..0aa436da54050db81bdcb9f447660a88 if (furnaceSmeltEvent.isCancelled()) { diff --git a/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java -index c6ae14009463b2d64acd4d3beb86d3233bcbae66..06df710f58ca7d55b19c0db9d393a73ca6e5aa79 100644 +index b07b83f4c16e85304b5da7a245810dd2741398e7..0f7e765263a09a3f8b021bbac8d062c72ab3bdc0 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java -@@ -60,7 +60,9 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable { +@@ -62,7 +62,9 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable { if (campfire.cookingProgress[i] >= campfire.cookingTime[i]) { SimpleContainer inventorysubcontainer = new SimpleContainer(new ItemStack[]{itemstack}); @@ -32,7 +32,7 @@ index c6ae14009463b2d64acd4d3beb86d3233bcbae66..06df710f58ca7d55b19c0db9d393a73c return recipecampfire.assemble(inventorysubcontainer); }).orElse(itemstack); -@@ -69,7 +71,7 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable { +@@ -71,7 +73,7 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable { CraftItemStack source = CraftItemStack.asCraftMirror(itemstack); org.bukkit.inventory.ItemStack result = CraftItemStack.asBukkitCopy(itemstack1); diff --git a/patches/server/0581-Add-Block-isValidTool.patch b/patches/server/0581-Add-Block-isValidTool.patch index 7ec4cf1dcf..eb96ef70ea 100644 --- a/patches/server/0581-Add-Block-isValidTool.patch +++ b/patches/server/0581-Add-Block-isValidTool.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add Block#isValidTool diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -index 30b5a78a93405f3a03624ed1331670770aaa3765..974ab329f92f488aba0999cef25e3b8e7e062209 100644 +index 23a9469ff63f1be7ab0091b2c86a614eaeba9f55..e8d96c1e5dde67436fba1bfc6585c3e4a5c1a63c 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -@@ -743,5 +743,9 @@ public class CraftBlock implements Block { +@@ -739,5 +739,9 @@ public class CraftBlock implements Block { } return speed; } diff --git a/patches/server/0582-Allow-using-signs-inside-spawn-protection.patch b/patches/server/0582-Allow-using-signs-inside-spawn-protection.patch index 59bf996fdf..c9ebb6780f 100644 --- a/patches/server/0582-Allow-using-signs-inside-spawn-protection.patch +++ b/patches/server/0582-Allow-using-signs-inside-spawn-protection.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Allow using signs inside spawn protection diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 23560d8fac37296dd1194996bc1f4b3babcde9cc..a089c23c8df93eaf10d21d550ab5129a43ad38ea 100644 +index ba7c390c523f83a43d62deb1ca69c0552d233c8c..5e87d8080da346f82431fcff34416773e0844fcf 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -1835,7 +1835,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic diff --git a/patches/server/0583-Expand-world-key-API.patch b/patches/server/0583-Expand-world-key-API.patch index a4b749f3c2..4a5675fda5 100644 --- a/patches/server/0583-Expand-world-key-API.patch +++ b/patches/server/0583-Expand-world-key-API.patch @@ -20,10 +20,10 @@ index 3e4ac4020c9f51e634eadd43243d34267bea4b22..ce52ae980309ecddf597e14b759b77ea // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 6c2ea3e0cf385d6893faf5430b29dbe2589786b0..2dbfd750088dbf7a15fc147d9f215c19e505c96b 100644 +index 5b48102ad1c9940a5f41ba8084be0804b7536d30..8592f56bdaaabc3c263c3ce6cf122c13a6b9f2de 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1156,9 +1156,15 @@ public final class CraftServer implements Server { +@@ -1139,9 +1139,15 @@ public final class CraftServer implements Server { File folder = new File(this.getWorldContainer(), name); World world = this.getWorld(name); @@ -41,7 +41,7 @@ index 6c2ea3e0cf385d6893faf5430b29dbe2589786b0..2dbfd750088dbf7a15fc147d9f215c19 if ((folder.exists()) && (!folder.isDirectory())) { throw new IllegalArgumentException("File exists with the name '" + name + "' and isn't a folder"); -@@ -1247,7 +1253,7 @@ public final class CraftServer implements Server { +@@ -1230,7 +1236,7 @@ public final class CraftServer implements Server { } else if (name.equals(levelName + "_the_end")) { worldKey = net.minecraft.world.level.Level.END; } else { @@ -50,7 +50,7 @@ index 6c2ea3e0cf385d6893faf5430b29dbe2589786b0..2dbfd750088dbf7a15fc147d9f215c19 } ServerLevel internal = (ServerLevel) new ServerLevel(this.console, console.executor, worldSession, worlddata, worldKey, worlddimension, this.getServer().progressListenerFactory.create(11), -@@ -1339,6 +1345,15 @@ public final class CraftServer implements Server { +@@ -1322,6 +1328,15 @@ public final class CraftServer implements Server { return null; } @@ -67,10 +67,10 @@ index 6c2ea3e0cf385d6893faf5430b29dbe2589786b0..2dbfd750088dbf7a15fc147d9f215c19 // Check if a World already exists with the UID. if (this.getWorld(world.getUID()) != null) { diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 2ba9cac66413ddc0a830dbb2b2644ed9d40c9c99..4b8642d20341067ee149fbe9a23e64042127a2b2 100644 +index 611cf30d17e110ff7b38219053919b52a86dfb19..73334710407574124ad289bbd3379dccb3417755 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -519,6 +519,11 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -521,6 +521,11 @@ public final class CraftMagicNumbers implements UnsafeValues { public Registry registryFor(Class classOfT) { return io.papermc.paper.registry.PaperRegistry.getRegistry(classOfT); } diff --git a/patches/server/0585-Item-Rarity-API.patch b/patches/server/0585-Item-Rarity-API.patch index a67daea35e..fe64a97d4d 100644 --- a/patches/server/0585-Item-Rarity-API.patch +++ b/patches/server/0585-Item-Rarity-API.patch @@ -7,10 +7,10 @@ Subject: [PATCH] Item Rarity API public net.minecraft.world.item.Item rarity diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 4b8642d20341067ee149fbe9a23e64042127a2b2..f31723187a7189cf1c9213f74f094ad196421a80 100644 +index 73334710407574124ad289bbd3379dccb3417755..f8bf5b0770e1e6b54d50e8063208083ea0b953a9 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -524,6 +524,20 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -526,6 +526,20 @@ public final class CraftMagicNumbers implements UnsafeValues { public String getMainLevelName() { return ((net.minecraft.server.dedicated.DedicatedServer) net.minecraft.server.MinecraftServer.getServer()).getProperties().levelName; } diff --git a/patches/server/0589-Don-t-ignore-result-of-PlayerEditBookEvent.patch b/patches/server/0589-Don-t-ignore-result-of-PlayerEditBookEvent.patch index e985a81464..e5bd1a4a2b 100644 --- a/patches/server/0589-Don-t-ignore-result-of-PlayerEditBookEvent.patch +++ b/patches/server/0589-Don-t-ignore-result-of-PlayerEditBookEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Don't ignore result of PlayerEditBookEvent diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index a089c23c8df93eaf10d21d550ab5129a43ad38ea..b40a95dbc6b06998e3fb6f675a6ac3d5b7a9c2a4 100644 +index 5e87d8080da346f82431fcff34416773e0844fcf..af5fe9d98db344113410689a5d0c9e4bffc589dc 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -1282,7 +1282,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic diff --git a/patches/server/0591-Expose-protocol-version.patch b/patches/server/0591-Expose-protocol-version.patch index 59694eb52c..627aa92478 100644 --- a/patches/server/0591-Expose-protocol-version.patch +++ b/patches/server/0591-Expose-protocol-version.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Expose protocol version diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index f31723187a7189cf1c9213f74f094ad196421a80..46be2c75d68abaccc78e2120a0f45d344050c76d 100644 +index f8bf5b0770e1e6b54d50e8063208083ea0b953a9..21648628856e425dd68d44bd81ac17ce4b4bff47 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -538,6 +538,11 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -540,6 +540,11 @@ public final class CraftMagicNumbers implements UnsafeValues { public io.papermc.paper.inventory.ItemRarity getItemStackRarity(org.bukkit.inventory.ItemStack itemStack) { return io.papermc.paper.inventory.ItemRarity.values()[getItem(itemStack.getType()).getRarity(CraftItemStack.asNMSCopy(itemStack)).ordinal()]; } diff --git a/patches/server/0596-add-isDeeplySleeping-to-HumanEntity.patch b/patches/server/0596-add-isDeeplySleeping-to-HumanEntity.patch index 23d24c3698..8235d20096 100644 --- a/patches/server/0596-add-isDeeplySleeping-to-HumanEntity.patch +++ b/patches/server/0596-add-isDeeplySleeping-to-HumanEntity.patch @@ -5,7 +5,7 @@ Subject: [PATCH] add isDeeplySleeping to HumanEntity diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -index b8ba4e278de5c9a591789928c21bff26dcec2fb7..44dab523264c594aa9c619e3ee2e0d7f93982ddc 100644 +index 0117277db8402a1673c317673811c17d02edc4c9..73d8f4af09689eb549047bf1fa79254cc7736158 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java @@ -125,6 +125,13 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { diff --git a/patches/server/0600-Fix-checkReach-check-for-Shulker-boxes.patch b/patches/server/0600-Fix-checkReach-check-for-Shulker-boxes.patch deleted file mode 100644 index aff97b0125..0000000000 --- a/patches/server/0600-Fix-checkReach-check-for-Shulker-boxes.patch +++ /dev/null @@ -1,18 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> -Date: Sun, 4 Apr 2021 14:25:04 -0400 -Subject: [PATCH] Fix checkReach check for Shulker boxes - - -diff --git a/src/main/java/net/minecraft/world/inventory/ShulkerBoxMenu.java b/src/main/java/net/minecraft/world/inventory/ShulkerBoxMenu.java -index 9923bc95e2268ea4af3d4e8b75fbb83195012ea1..8d18f6debb694962f3ea8056a7563f71e8684afa 100644 ---- a/src/main/java/net/minecraft/world/inventory/ShulkerBoxMenu.java -+++ b/src/main/java/net/minecraft/world/inventory/ShulkerBoxMenu.java -@@ -66,6 +66,7 @@ public class ShulkerBoxMenu extends AbstractContainerMenu { - - @Override - public boolean stillValid(Player player) { -+ if (!this.checkReachable) return true; // Paper - Add reachable override for ContainerShulkerBox - return this.container.stillValid(player); - } - diff --git a/patches/server/0601-fix-PlayerItemHeldEvent-firing-twice.patch b/patches/server/0600-fix-PlayerItemHeldEvent-firing-twice.patch similarity index 93% rename from patches/server/0601-fix-PlayerItemHeldEvent-firing-twice.patch rename to patches/server/0600-fix-PlayerItemHeldEvent-firing-twice.patch index 909f0b488f..d19bb1f54d 100644 --- a/patches/server/0601-fix-PlayerItemHeldEvent-firing-twice.patch +++ b/patches/server/0600-fix-PlayerItemHeldEvent-firing-twice.patch @@ -5,7 +5,7 @@ Subject: [PATCH] fix PlayerItemHeldEvent firing twice diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index b40a95dbc6b06998e3fb6f675a6ac3d5b7a9c2a4..b25509b00569ae8b612841b94ab243be194cb08a 100644 +index af5fe9d98db344113410689a5d0c9e4bffc589dc..908bf489f064780e6751de2762cb94668ae16d7e 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -2047,6 +2047,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic diff --git a/patches/server/0602-Added-PlayerDeepSleepEvent.patch b/patches/server/0601-Added-PlayerDeepSleepEvent.patch similarity index 91% rename from patches/server/0602-Added-PlayerDeepSleepEvent.patch rename to patches/server/0601-Added-PlayerDeepSleepEvent.patch index f9da9ab71d..e8d164faf5 100644 --- a/patches/server/0602-Added-PlayerDeepSleepEvent.patch +++ b/patches/server/0601-Added-PlayerDeepSleepEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Added PlayerDeepSleepEvent diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index 3de169fea4121804de381ee7fa96b36c174c599d..f018533ecfd662532cf2658701be6d452ba774f4 100644 +index deb67acf5a60ea8a3cec866cd75ac036257ef0b5..c3aa6382cf2a45479d581b3957a972f814070387 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -248,6 +248,11 @@ public abstract class Player extends LivingEntity { diff --git a/patches/server/0603-More-World-API.patch b/patches/server/0602-More-World-API.patch similarity index 96% rename from patches/server/0603-More-World-API.patch rename to patches/server/0602-More-World-API.patch index 8f7bc53890..10973dc80b 100644 --- a/patches/server/0603-More-World-API.patch +++ b/patches/server/0602-More-World-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] More World API diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index f3d78ba340d92a482fd3d54cbe16983ec9766eed..6ef1abea28f67704a308282b4addf645245e2595 100644 +index b0935a5ddb0e3b0105fbfb946076248c3bfaccf6..066130e1651d05018e4e73e5b9879187e80e01e4 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -2034,6 +2034,69 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -2050,6 +2050,69 @@ public class CraftWorld extends CraftRegionAccessor implements World { return new CraftStructureSearchResult(CraftStructure.minecraftToBukkit(found.getSecond().value(), this.getHandle().registryAccess()), new Location(this, found.getFirst().getX(), found.getFirst().getY(), found.getFirst().getZ())); } diff --git a/patches/server/0604-Added-PlayerBedFailEnterEvent.patch b/patches/server/0603-Added-PlayerBedFailEnterEvent.patch similarity index 100% rename from patches/server/0604-Added-PlayerBedFailEnterEvent.patch rename to patches/server/0603-Added-PlayerBedFailEnterEvent.patch diff --git a/patches/server/0605-Implement-methods-to-convert-between-Component-and-B.patch b/patches/server/0604-Implement-methods-to-convert-between-Component-and-B.patch similarity index 100% rename from patches/server/0605-Implement-methods-to-convert-between-Component-and-B.patch rename to patches/server/0604-Implement-methods-to-convert-between-Component-and-B.patch diff --git a/patches/server/0606-Fix-anchor-respawn-acting-as-a-bed-respawn-from-the-.patch b/patches/server/0605-Fix-anchor-respawn-acting-as-a-bed-respawn-from-the-.patch similarity index 100% rename from patches/server/0606-Fix-anchor-respawn-acting-as-a-bed-respawn-from-the-.patch rename to patches/server/0605-Fix-anchor-respawn-acting-as-a-bed-respawn-from-the-.patch diff --git a/patches/server/0607-Introduce-beacon-activation-deactivation-events.patch b/patches/server/0606-Introduce-beacon-activation-deactivation-events.patch similarity index 100% rename from patches/server/0607-Introduce-beacon-activation-deactivation-events.patch rename to patches/server/0606-Introduce-beacon-activation-deactivation-events.patch diff --git a/patches/server/0608-add-RespawnFlags-to-PlayerRespawnEvent.patch b/patches/server/0607-add-RespawnFlags-to-PlayerRespawnEvent.patch similarity index 95% rename from patches/server/0608-add-RespawnFlags-to-PlayerRespawnEvent.patch rename to patches/server/0607-add-RespawnFlags-to-PlayerRespawnEvent.patch index 225cb1efaa..12d168d7cb 100644 --- a/patches/server/0608-add-RespawnFlags-to-PlayerRespawnEvent.patch +++ b/patches/server/0607-add-RespawnFlags-to-PlayerRespawnEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] add RespawnFlags to PlayerRespawnEvent diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index b25509b00569ae8b612841b94ab243be194cb08a..7dd27fc7a539ab0cbf06936ba4daa37ea607845d 100644 +index 908bf489f064780e6751de2762cb94668ae16d7e..7794964b08ac64e87fe83ebf7d7d483316172246 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2758,7 +2758,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2764,7 +2764,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic case PERFORM_RESPAWN: if (this.player.wonGame) { this.player.wonGame = false; diff --git a/patches/server/0609-Add-Channel-initialization-listeners.patch b/patches/server/0608-Add-Channel-initialization-listeners.patch similarity index 100% rename from patches/server/0609-Add-Channel-initialization-listeners.patch rename to patches/server/0608-Add-Channel-initialization-listeners.patch diff --git a/patches/server/0610-Send-empty-commands-if-tab-completion-is-disabled.patch b/patches/server/0609-Send-empty-commands-if-tab-completion-is-disabled.patch similarity index 88% rename from patches/server/0610-Send-empty-commands-if-tab-completion-is-disabled.patch rename to patches/server/0609-Send-empty-commands-if-tab-completion-is-disabled.patch index a526cb6034..a7b651cd56 100644 --- a/patches/server/0610-Send-empty-commands-if-tab-completion-is-disabled.patch +++ b/patches/server/0609-Send-empty-commands-if-tab-completion-is-disabled.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Send empty commands if tab completion is disabled diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java -index 03a926990ecfa97d8fbc20a15ffb7fcb48fed06a..7e61f0cb96c7697fc3487fd941cacc15d78a14dc 100644 +index da7503dca8ab4f7234bf296dfacf39e466de700a..7ebe1c200c26c66b293b245d7f470bf4f81f3eea 100644 --- a/src/main/java/net/minecraft/commands/Commands.java +++ b/src/main/java/net/minecraft/commands/Commands.java -@@ -366,7 +366,12 @@ public class Commands { +@@ -388,7 +388,12 @@ public class Commands { } public void sendCommands(ServerPlayer player) { diff --git a/patches/server/0611-Add-more-WanderingTrader-API.patch b/patches/server/0610-Add-more-WanderingTrader-API.patch similarity index 100% rename from patches/server/0611-Add-more-WanderingTrader-API.patch rename to patches/server/0610-Add-more-WanderingTrader-API.patch diff --git a/patches/server/0612-Add-EntityBlockStorage-clearEntities.patch b/patches/server/0611-Add-EntityBlockStorage-clearEntities.patch similarity index 100% rename from patches/server/0612-Add-EntityBlockStorage-clearEntities.patch rename to patches/server/0611-Add-EntityBlockStorage-clearEntities.patch diff --git a/patches/server/0613-Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch b/patches/server/0612-Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch similarity index 100% rename from patches/server/0613-Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch rename to patches/server/0612-Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch diff --git a/patches/server/0614-Add-raw-address-to-AsyncPlayerPreLoginEvent.patch b/patches/server/0613-Add-raw-address-to-AsyncPlayerPreLoginEvent.patch similarity index 100% rename from patches/server/0614-Add-raw-address-to-AsyncPlayerPreLoginEvent.patch rename to patches/server/0613-Add-raw-address-to-AsyncPlayerPreLoginEvent.patch diff --git a/patches/server/0615-Inventory-close.patch b/patches/server/0614-Inventory-close.patch similarity index 100% rename from patches/server/0615-Inventory-close.patch rename to patches/server/0614-Inventory-close.patch diff --git a/patches/server/0616-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch b/patches/server/0615-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch similarity index 100% rename from patches/server/0616-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch rename to patches/server/0615-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch diff --git a/patches/server/0617-Fix-CraftPotionBrewer-cache.patch b/patches/server/0616-Fix-CraftPotionBrewer-cache.patch similarity index 100% rename from patches/server/0617-Fix-CraftPotionBrewer-cache.patch rename to patches/server/0616-Fix-CraftPotionBrewer-cache.patch diff --git a/patches/server/0618-Add-basic-Datapack-API.patch b/patches/server/0617-Add-basic-Datapack-API.patch similarity index 94% rename from patches/server/0618-Add-basic-Datapack-API.patch rename to patches/server/0617-Add-basic-Datapack-API.patch index cbb3458c60..ef076cd5b5 100644 --- a/patches/server/0618-Add-basic-Datapack-API.patch +++ b/patches/server/0617-Add-basic-Datapack-API.patch @@ -92,10 +92,10 @@ index 0000000000000000000000000000000000000000..cf4374493c11057451a62a655514415c + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 2dbfd750088dbf7a15fc147d9f215c19e505c96b..f28e588489088e948e70f87951e07728e600f737 100644 +index 8592f56bdaaabc3c263c3ce6cf122c13a6b9f2de..86dda69e39f08de98faba44f4ee7725665f8df68 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -295,6 +295,7 @@ public final class CraftServer implements Server { +@@ -296,6 +296,7 @@ public final class CraftServer implements Server { public boolean ignoreVanillaPermissions = false; private final List playerView; public int reloadCount; @@ -103,7 +103,7 @@ index 2dbfd750088dbf7a15fc147d9f215c19e505c96b..f28e588489088e948e70f87951e07728 public static Exception excessiveVelEx; // Paper - Velocity warnings static { -@@ -381,6 +382,7 @@ public final class CraftServer implements Server { +@@ -383,6 +384,7 @@ public final class CraftServer implements Server { if (this.configuration.getBoolean("settings.use-map-color-cache")) { MapPalette.setMapColorCache(new CraftMapColorCache(this.logger)); } @@ -111,7 +111,7 @@ index 2dbfd750088dbf7a15fc147d9f215c19e505c96b..f28e588489088e948e70f87951e07728 } public boolean getCommandBlockOverride(String command) { -@@ -2797,5 +2799,11 @@ public final class CraftServer implements Server { +@@ -2780,5 +2782,11 @@ public final class CraftServer implements Server { public com.destroystokyo.paper.entity.ai.MobGoals getMobGoals() { return mobGoals; } diff --git a/patches/server/0619-Add-environment-variable-to-disable-server-gui.patch b/patches/server/0618-Add-environment-variable-to-disable-server-gui.patch similarity index 85% rename from patches/server/0619-Add-environment-variable-to-disable-server-gui.patch rename to patches/server/0618-Add-environment-variable-to-disable-server-gui.patch index 7606f71f2d..35291abf67 100644 --- a/patches/server/0619-Add-environment-variable-to-disable-server-gui.patch +++ b/patches/server/0618-Add-environment-variable-to-disable-server-gui.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add environment variable to disable server gui diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java -index 727efbe152dccabf130a6871e3d2582a5a733016..2dba2853764ca1cff114d3130672fbd596604ea3 100644 +index 7989b5bf002ba0995c32fb77498c7f50b34e6150..814a4823ab55d09172b2b699d303ced8bec21b47 100644 --- a/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java -@@ -281,6 +281,7 @@ public class Main { +@@ -292,6 +292,7 @@ public class Main { */ boolean flag1 = !optionset.has("nogui") && !optionset.nonOptionArguments().contains("nogui"); diff --git a/patches/server/0620-additions-to-PlayerGameModeChangeEvent.patch b/patches/server/0619-additions-to-PlayerGameModeChangeEvent.patch similarity index 95% rename from patches/server/0620-additions-to-PlayerGameModeChangeEvent.patch rename to patches/server/0619-additions-to-PlayerGameModeChangeEvent.patch index 98aefb6b29..d5f9198d1d 100644 --- a/patches/server/0620-additions-to-PlayerGameModeChangeEvent.patch +++ b/patches/server/0619-additions-to-PlayerGameModeChangeEvent.patch @@ -45,7 +45,7 @@ index d47f3d255eddd652fedb4aa55286b756fe962995..27c0aaf123c3e945eb24e8a3892bd8ac } diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 5cc7edca158fed862d0dd18c6d2754de6df0ec4c..5428a5ee4097e29922d48564714998604ba07dbb 100644 +index b04c39543ea3cddf479807f93734ab727f320de4..1669d91153cef50f45f61b7cb2351ac854cb035b 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1826,8 +1826,15 @@ public class ServerPlayer extends Player { @@ -129,10 +129,10 @@ index 645a226c2e3f6dcf1c25187d006d425038b4545d..17c313b9cb45c8158cab751ffc4e0dc3 } diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 7dd27fc7a539ab0cbf06936ba4daa37ea607845d..69780a4a69048291b4898c2d0ecc57ce518ffd93 100644 +index 7794964b08ac64e87fe83ebf7d7d483316172246..b069d3b3f68adbde23f69407a8803c13d15f7d9e 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2767,7 +2767,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2773,7 +2773,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic this.player = this.server.getPlayerList().respawn(this.player, false); if (this.server.isHardcore()) { @@ -142,10 +142,10 @@ index 7dd27fc7a539ab0cbf06936ba4daa37ea607845d..69780a4a69048291b4898c2d0ecc57ce } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 55c206d2bff70fd7febd5f635ea0d7a5e779a058..e225ef6eb6f061c3bdeebf824aa884611f79020e 100644 +index 69cfbe2c3ba14d7ebf4b29a89161b6d1d00ebc91..4315db62aa597de5fa2a022513ada129ae19a3f8 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1472,7 +1472,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1485,7 +1485,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { throw new IllegalArgumentException("Mode cannot be null"); } diff --git a/patches/server/0621-ItemStack-repair-check-API.patch b/patches/server/0620-ItemStack-repair-check-API.patch similarity index 95% rename from patches/server/0621-ItemStack-repair-check-API.patch rename to patches/server/0620-ItemStack-repair-check-API.patch index 1716a87abc..51ef504b30 100644 --- a/patches/server/0621-ItemStack-repair-check-API.patch +++ b/patches/server/0620-ItemStack-repair-check-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] ItemStack repair check API diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 46be2c75d68abaccc78e2120a0f45d344050c76d..d7ebb29138352661f4fb3fb4561d96dab812b1b7 100644 +index 21648628856e425dd68d44bd81ac17ce4b4bff47..12ad9ccac400159af9b6597811fec7d362be5906 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -539,6 +539,14 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -541,6 +541,14 @@ public final class CraftMagicNumbers implements UnsafeValues { return io.papermc.paper.inventory.ItemRarity.values()[getItem(itemStack.getType()).getRarity(CraftItemStack.asNMSCopy(itemStack)).ordinal()]; } diff --git a/patches/server/0622-More-Enchantment-API.patch b/patches/server/0621-More-Enchantment-API.patch similarity index 97% rename from patches/server/0622-More-Enchantment-API.patch rename to patches/server/0621-More-Enchantment-API.patch index 65f40ac844..25cf74c764 100644 --- a/patches/server/0622-More-Enchantment-API.patch +++ b/patches/server/0621-More-Enchantment-API.patch @@ -66,10 +66,10 @@ index 57decf4156f176ebcc988478c17856cbc555c5e4..3d0ce0803e1da8a2681a3cb41096ac94 public net.minecraft.world.item.enchantment.Enchantment getHandle() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index 3f349f3ac972c90412cd20a30ccb55598c8cf7ba..f4a219ba563aa153ae26128fe4e49ddc03fecc44 100644 +index fb74a06e73765a82d936975f4070093e35e2dade..3c6d64601afdf1c23756c1419e450228a2e7a362 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -@@ -924,5 +924,21 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { +@@ -930,5 +930,21 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { public void setHurtDirection(float hurtDirection) { getHandle().hurtDir = hurtDirection; } diff --git a/patches/server/0623-Move-range-check-for-block-placing-up.patch b/patches/server/0622-Move-range-check-for-block-placing-up.patch similarity index 92% rename from patches/server/0623-Move-range-check-for-block-placing-up.patch rename to patches/server/0622-Move-range-check-for-block-placing-up.patch index 65b239289c..b76eccb5f3 100644 --- a/patches/server/0623-Move-range-check-for-block-placing-up.patch +++ b/patches/server/0622-Move-range-check-for-block-placing-up.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Move range check for block placing up diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 69780a4a69048291b4898c2d0ecc57ce518ffd93..68b9c257f98617fe9e9e0492129bdbb3d22e6e0d 100644 +index b069d3b3f68adbde23f69407a8803c13d15f7d9e..9a2d9bcad94612e5c2506db5a9dcd4a3f9271a59 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -1821,6 +1821,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic diff --git a/patches/server/0624-Fix-and-optimise-world-force-upgrading.patch b/patches/server/0623-Fix-and-optimise-world-force-upgrading.patch similarity index 98% rename from patches/server/0624-Fix-and-optimise-world-force-upgrading.patch rename to patches/server/0623-Fix-and-optimise-world-force-upgrading.patch index fea31cc874..680ecdfbe2 100644 --- a/patches/server/0624-Fix-and-optimise-world-force-upgrading.patch +++ b/patches/server/0623-Fix-and-optimise-world-force-upgrading.patch @@ -247,7 +247,7 @@ index 0000000000000000000000000000000000000000..95cac7edae8ac64811fc6a2f6b97dd4a + } +} diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java -index 2dba2853764ca1cff114d3130672fbd596604ea3..6a5698f05a5f839e643e747c21834aacb90feec8 100644 +index 814a4823ab55d09172b2b699d303ced8bec21b47..c98a67de81439f6e5f8e2eedc7b9d8e3ddc5dc5b 100644 --- a/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java @@ -15,6 +15,7 @@ import java.nio.file.Paths; @@ -258,7 +258,7 @@ index 2dba2853764ca1cff114d3130672fbd596604ea3..6a5698f05a5f839e643e747c21834aac import joptsimple.NonOptionArgumentSpec; import joptsimple.OptionParser; import joptsimple.OptionSet; -@@ -329,6 +330,15 @@ public class Main { +@@ -340,6 +341,15 @@ public class Main { return new WorldLoader.InitConfig(worldloader_d, Commands.CommandSelection.DEDICATED, serverPropertiesHandler.functionPermissionLevel); } @@ -359,10 +359,10 @@ index b294ef87fb93e7f4651dc04128124f297575860d..65fd57609e45ccd49ebfc1ba80d25243 return this.regionCache.getAndMoveToFirst(ChunkPos.asLong(chunkcoordintpair.getRegionX(), chunkcoordintpair.getRegionZ())); } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index f28e588489088e948e70f87951e07728e600f737..e8f7b418b942a6a36e615dbcaf9bb18257c34ee4 100644 +index 86dda69e39f08de98faba44f4ee7725665f8df68..a24769e0be5c0d67b6a6b8441570e20a622e5cbd 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1232,12 +1232,7 @@ public final class CraftServer implements Server { +@@ -1215,12 +1215,7 @@ public final class CraftServer implements Server { worlddata.customDimensions = iregistry; worlddata.checkName(name); worlddata.setModdedInfo(this.console.getServerModName(), this.console.getModdedStatus().shouldReportAsModified()); @@ -376,7 +376,7 @@ index f28e588489088e948e70f87951e07728e600f737..e8f7b418b942a6a36e615dbcaf9bb182 long j = BiomeManager.obfuscateSeed(creator.seed()); List list = ImmutableList.of(new PhantomSpawner(), new PatrolSpawner(), new CatSpawner(), new VillageSiege(), new WanderingTraderSpawner(worlddata)); -@@ -1248,6 +1243,13 @@ public final class CraftServer implements Server { +@@ -1231,6 +1226,13 @@ public final class CraftServer implements Server { biomeProvider = generator.getDefaultBiomeProvider(worldInfo); } diff --git a/patches/server/0625-Add-Mob-lookAt-API.patch b/patches/server/0624-Add-Mob-lookAt-API.patch similarity index 100% rename from patches/server/0625-Add-Mob-lookAt-API.patch rename to patches/server/0624-Add-Mob-lookAt-API.patch diff --git a/patches/server/0626-Add-Unix-domain-socket-support.patch b/patches/server/0625-Add-Unix-domain-socket-support.patch similarity index 100% rename from patches/server/0626-Add-Unix-domain-socket-support.patch rename to patches/server/0625-Add-Unix-domain-socket-support.patch diff --git a/patches/server/0627-Add-EntityInsideBlockEvent.patch b/patches/server/0626-Add-EntityInsideBlockEvent.patch similarity index 100% rename from patches/server/0627-Add-EntityInsideBlockEvent.patch rename to patches/server/0626-Add-EntityInsideBlockEvent.patch diff --git a/patches/server/0628-Attributes-API-for-item-defaults.patch b/patches/server/0627-Attributes-API-for-item-defaults.patch similarity index 91% rename from patches/server/0628-Attributes-API-for-item-defaults.patch rename to patches/server/0627-Attributes-API-for-item-defaults.patch index bb66b43c47..bd9c621984 100644 --- a/patches/server/0628-Attributes-API-for-item-defaults.patch +++ b/patches/server/0627-Attributes-API-for-item-defaults.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Attributes API for item defaults diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index d7ebb29138352661f4fb3fb4561d96dab812b1b7..ec49b0719491f52057818a6fc2b4d3f16c7fc440 100644 +index 12ad9ccac400159af9b6597811fec7d362be5906..6c39b620e9909759ab37d659c93e426c9f33ba95 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -547,6 +547,19 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -549,6 +549,19 @@ public final class CraftMagicNumbers implements UnsafeValues { return CraftMagicNumbers.getItem(itemToBeRepaired.getType()).isValidRepairItem(CraftItemStack.asNMSCopy(itemToBeRepaired), CraftItemStack.asNMSCopy(repairMaterial)); } diff --git a/patches/server/0629-Add-cause-to-Weather-ThunderChangeEvents.patch b/patches/server/0628-Add-cause-to-Weather-ThunderChangeEvents.patch similarity index 98% rename from patches/server/0629-Add-cause-to-Weather-ThunderChangeEvents.patch rename to patches/server/0628-Add-cause-to-Weather-ThunderChangeEvents.patch index 13cadbfcb4..9ac0554d81 100644 --- a/patches/server/0629-Add-cause-to-Weather-ThunderChangeEvents.patch +++ b/patches/server/0628-Add-cause-to-Weather-ThunderChangeEvents.patch @@ -95,7 +95,7 @@ index 274c8eb1f76fb7cb8a16b438e7e1b14804f3dc51..b6218626bad7f8ddfba91b216ac1e106 if (weather.isCancelled()) { return; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 6ef1abea28f67704a308282b4addf645245e2595..8a81b0011d80d320a75308d18dc09a5f365e097a 100644 +index 066130e1651d05018e4e73e5b9879187e80e01e4..945a8f61eec02043008e31e3fe64a66f76ba715a 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -1183,7 +1183,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { diff --git a/patches/server/0630-More-Lidded-Block-API.patch b/patches/server/0629-More-Lidded-Block-API.patch similarity index 100% rename from patches/server/0630-More-Lidded-Block-API.patch rename to patches/server/0629-More-Lidded-Block-API.patch diff --git a/patches/server/0631-Limit-item-frame-cursors-on-maps.patch b/patches/server/0630-Limit-item-frame-cursors-on-maps.patch similarity index 100% rename from patches/server/0631-Limit-item-frame-cursors-on-maps.patch rename to patches/server/0630-Limit-item-frame-cursors-on-maps.patch diff --git a/patches/server/0632-Add-PlayerKickEvent-causes.patch b/patches/server/0631-Add-PlayerKickEvent-causes.patch similarity index 98% rename from patches/server/0632-Add-PlayerKickEvent-causes.patch rename to patches/server/0631-Add-PlayerKickEvent-causes.patch index 4b8fd7912f..1fa2899bc5 100644 --- a/patches/server/0632-Add-PlayerKickEvent-causes.patch +++ b/patches/server/0631-Add-PlayerKickEvent-causes.patch @@ -88,7 +88,7 @@ index 65637a33ba171a4b598f70cd943d24b0ee44a69f..57a9146bf2dee7a60aab16716e25348f } diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 68b9c257f98617fe9e9e0492129bdbb3d22e6e0d..7c0ef92a9bad6f66a5f7f466c47f76953e0d2e8d 100644 +index 9a2d9bcad94612e5c2506db5a9dcd4a3f9271a59..6c166950247118cb1bbae4aa1fc3ee8a6790ab1b 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -358,7 +358,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -352,7 +352,7 @@ index 68b9c257f98617fe9e9e0492129bdbb3d22e6e0d..7c0ef92a9bad6f66a5f7f466c47f7695 } } -@@ -2617,7 +2627,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2623,7 +2633,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic // Spigot Start if ( entity == this.player && !this.player.isSpectator() ) { @@ -361,7 +361,7 @@ index 68b9c257f98617fe9e9e0492129bdbb3d22e6e0d..7c0ef92a9bad6f66a5f7f466c47f7695 return; } // Spigot End -@@ -2714,7 +2724,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2720,7 +2730,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic // CraftBukkit end } } else { @@ -370,7 +370,7 @@ index 68b9c257f98617fe9e9e0492129bdbb3d22e6e0d..7c0ef92a9bad6f66a5f7f466c47f7695 ServerGamePacketListenerImpl.LOGGER.warn("Player {} tried to attack an invalid entity", ServerGamePacketListenerImpl.this.player.getName().getString()); } } -@@ -3122,7 +3132,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3128,7 +3138,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic // Paper start if (!org.bukkit.Bukkit.isPrimaryThread()) { if (recipeSpamPackets.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamLimit) { @@ -379,7 +379,7 @@ index 68b9c257f98617fe9e9e0492129bdbb3d22e6e0d..7c0ef92a9bad6f66a5f7f466c47f7695 return; } } -@@ -3330,7 +3340,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3336,7 +3346,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic } else if (!this.isSingleplayerOwner()) { // Paper start - This needs to be handled on the main thread for plugins server.submit(() -> { @@ -388,7 +388,7 @@ index 68b9c257f98617fe9e9e0492129bdbb3d22e6e0d..7c0ef92a9bad6f66a5f7f466c47f7695 }); // Paper end } -@@ -3376,7 +3386,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3382,7 +3392,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic } } catch (Exception ex) { ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t register custom payload", ex); @@ -397,7 +397,7 @@ index 68b9c257f98617fe9e9e0492129bdbb3d22e6e0d..7c0ef92a9bad6f66a5f7f466c47f7695 } } else if (packet.identifier.equals(CUSTOM_UNREGISTER)) { try { -@@ -3386,7 +3396,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3392,7 +3402,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic } } catch (Exception ex) { ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t unregister custom payload", ex); @@ -406,7 +406,7 @@ index 68b9c257f98617fe9e9e0492129bdbb3d22e6e0d..7c0ef92a9bad6f66a5f7f466c47f7695 } } else { try { -@@ -3404,7 +3414,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3410,7 +3420,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), packet.identifier.toString(), data); } catch (Exception ex) { ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex); @@ -415,7 +415,7 @@ index 68b9c257f98617fe9e9e0492129bdbb3d22e6e0d..7c0ef92a9bad6f66a5f7f466c47f7695 } } -@@ -3446,7 +3456,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3452,7 +3462,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic if (!Objects.equals(profilepublickey_a, profilepublickey_a1)) { if (profilepublickey_a != null && profilepublickey_a1.expiresAt().isBefore(profilepublickey_a.expiresAt())) { @@ -424,7 +424,7 @@ index 68b9c257f98617fe9e9e0492129bdbb3d22e6e0d..7c0ef92a9bad6f66a5f7f466c47f7695 } else { try { SignatureValidator signaturevalidator = this.server.getServiceSignatureValidator(); -@@ -3454,7 +3464,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3460,7 +3470,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic this.resetPlayerChatState(remotechatsession_a.validate(this.player.getGameProfile(), signaturevalidator, Duration.ZERO)); } catch (ProfilePublicKey.ValidationException profilepublickey_b) { ServerGamePacketListenerImpl.LOGGER.error("Failed to validate profile key: {}", profilepublickey_b.getMessage()); @@ -491,7 +491,7 @@ index a24e7a66d52eddbdad8db71cf5e45f1a458c389f..e1c13ac7b11fb0080435fc34502208c8 } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index e225ef6eb6f061c3bdeebf824aa884611f79020e..f425ba131dffd03d19ffb5c58373d19f097c75de 100644 +index 4315db62aa597de5fa2a022513ada129ae19a3f8..99753168f6611b9844c43766f2e54a9e721cfdbc 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -599,7 +599,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0633-Add-PufferFishStateChangeEvent.patch b/patches/server/0632-Add-PufferFishStateChangeEvent.patch similarity index 100% rename from patches/server/0633-Add-PufferFishStateChangeEvent.patch rename to patches/server/0632-Add-PufferFishStateChangeEvent.patch diff --git a/patches/server/0634-Fix-PlayerBucketEmptyEvent-result-itemstack.patch b/patches/server/0633-Fix-PlayerBucketEmptyEvent-result-itemstack.patch similarity index 100% rename from patches/server/0634-Fix-PlayerBucketEmptyEvent-result-itemstack.patch rename to patches/server/0633-Fix-PlayerBucketEmptyEvent-result-itemstack.patch diff --git a/patches/server/0635-Synchronize-PalettedContainer-instead-of-ThreadingDe.patch b/patches/server/0634-Synchronize-PalettedContainer-instead-of-ThreadingDe.patch similarity index 100% rename from patches/server/0635-Synchronize-PalettedContainer-instead-of-ThreadingDe.patch rename to patches/server/0634-Synchronize-PalettedContainer-instead-of-ThreadingDe.patch diff --git a/patches/server/0636-Add-option-to-fix-items-merging-through-walls.patch b/patches/server/0635-Add-option-to-fix-items-merging-through-walls.patch similarity index 100% rename from patches/server/0636-Add-option-to-fix-items-merging-through-walls.patch rename to patches/server/0635-Add-option-to-fix-items-merging-through-walls.patch diff --git a/patches/server/0637-Add-BellRevealRaiderEvent.patch b/patches/server/0636-Add-BellRevealRaiderEvent.patch similarity index 100% rename from patches/server/0637-Add-BellRevealRaiderEvent.patch rename to patches/server/0636-Add-BellRevealRaiderEvent.patch diff --git a/patches/server/0638-Fix-invulnerable-end-crystals.patch b/patches/server/0637-Fix-invulnerable-end-crystals.patch similarity index 100% rename from patches/server/0638-Fix-invulnerable-end-crystals.patch rename to patches/server/0637-Fix-invulnerable-end-crystals.patch diff --git a/patches/server/0639-Add-ElderGuardianAppearanceEvent.patch b/patches/server/0638-Add-ElderGuardianAppearanceEvent.patch similarity index 100% rename from patches/server/0639-Add-ElderGuardianAppearanceEvent.patch rename to patches/server/0638-Add-ElderGuardianAppearanceEvent.patch diff --git a/patches/server/0640-Fix-dangerous-end-portal-logic.patch b/patches/server/0639-Fix-dangerous-end-portal-logic.patch similarity index 100% rename from patches/server/0640-Fix-dangerous-end-portal-logic.patch rename to patches/server/0639-Fix-dangerous-end-portal-logic.patch diff --git a/patches/server/0641-Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch b/patches/server/0640-Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch similarity index 100% rename from patches/server/0641-Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch rename to patches/server/0640-Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch diff --git a/patches/server/0642-Make-item-validations-configurable.patch b/patches/server/0641-Make-item-validations-configurable.patch similarity index 100% rename from patches/server/0642-Make-item-validations-configurable.patch rename to patches/server/0641-Make-item-validations-configurable.patch diff --git a/patches/server/0643-Line-Of-Sight-Changes.patch b/patches/server/0642-Line-Of-Sight-Changes.patch similarity index 96% rename from patches/server/0643-Line-Of-Sight-Changes.patch rename to patches/server/0642-Line-Of-Sight-Changes.patch index 97f0f96e60..d8323f1562 100644 --- a/patches/server/0643-Line-Of-Sight-Changes.patch +++ b/patches/server/0642-Line-Of-Sight-Changes.patch @@ -40,7 +40,7 @@ index 6c627e3f2c34557e11232fb0c5fa4f1718018ef5..e5684294b2d71c4496a47e72afe41b8a // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index f4a219ba563aa153ae26128fe4e49ddc03fecc44..ba8b98f1a4b4c8865385033307dc0e7486d597be 100644 +index 3c6d64601afdf1c23756c1419e450228a2e7a362..9a0af16ffe32c096fb4190692875bfccfa6b769b 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -29,6 +29,9 @@ import net.minecraft.world.entity.projectile.ThrownEgg; @@ -53,7 +53,7 @@ index f4a219ba563aa153ae26128fe4e49ddc03fecc44..ba8b98f1a4b4c8865385033307dc0e74 import org.apache.commons.lang.Validate; import org.bukkit.FluidCollisionMode; import org.bukkit.Location; -@@ -570,6 +573,18 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { +@@ -576,6 +579,18 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { return this.getHandle().hasLineOfSight(((CraftEntity) other).getHandle()); } diff --git a/patches/server/0644-add-per-world-spawn-limits.patch b/patches/server/0643-add-per-world-spawn-limits.patch similarity index 91% rename from patches/server/0644-add-per-world-spawn-limits.patch rename to patches/server/0643-add-per-world-spawn-limits.patch index 1246c6fe62..daa9b82035 100644 --- a/patches/server/0644-add-per-world-spawn-limits.patch +++ b/patches/server/0643-add-per-world-spawn-limits.patch @@ -6,7 +6,7 @@ Subject: [PATCH] add per world spawn limits Taken from #2982. Credit to Chasewhip8 diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 8a81b0011d80d320a75308d18dc09a5f365e097a..7d57bf8ca060d6c3dcf8ef4201c7e4ff78ecabb3 100644 +index 945a8f61eec02043008e31e3fe64a66f76ba715a..6b7e77c35ae737551859e9e7515cd5c189ec7313 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -209,6 +209,13 @@ public class CraftWorld extends CraftRegionAccessor implements World { diff --git a/patches/server/0645-Fix-potions-splash-events.patch b/patches/server/0644-Fix-potions-splash-events.patch similarity index 100% rename from patches/server/0645-Fix-potions-splash-events.patch rename to patches/server/0644-Fix-potions-splash-events.patch diff --git a/patches/server/0646-Add-more-LimitedRegion-API.patch b/patches/server/0645-Add-more-LimitedRegion-API.patch similarity index 100% rename from patches/server/0646-Add-more-LimitedRegion-API.patch rename to patches/server/0645-Add-more-LimitedRegion-API.patch diff --git a/patches/server/0647-Fix-PlayerDropItemEvent-using-wrong-item.patch b/patches/server/0646-Fix-PlayerDropItemEvent-using-wrong-item.patch similarity index 89% rename from patches/server/0647-Fix-PlayerDropItemEvent-using-wrong-item.patch rename to patches/server/0646-Fix-PlayerDropItemEvent-using-wrong-item.patch index 30c41221b3..710fdd8048 100644 --- a/patches/server/0647-Fix-PlayerDropItemEvent-using-wrong-item.patch +++ b/patches/server/0646-Fix-PlayerDropItemEvent-using-wrong-item.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix PlayerDropItemEvent using wrong item diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 5428a5ee4097e29922d48564714998604ba07dbb..77a3fa81d94005de4c5b7c130e893487fe7adc77 100644 +index 1669d91153cef50f45f61b7cb2351ac854cb035b..26f4f00bb3d58255c030137fa7a8c187942aaacb 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -2225,7 +2225,7 @@ public class ServerPlayer extends Player { @@ -18,7 +18,7 @@ index 5428a5ee4097e29922d48564714998604ba07dbb..77a3fa81d94005de4c5b7c130e893487 this.awardStat(Stats.DROP); diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index f018533ecfd662532cf2658701be6d452ba774f4..321feaea3bd8c082151302fe7d93294a6bf5dec6 100644 +index c3aa6382cf2a45479d581b3957a972f814070387..9c9c7dd62a747f6d6597b01839b63840080eac82 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -718,6 +718,11 @@ public abstract class Player extends LivingEntity { diff --git a/patches/server/0648-Missing-Entity-Behavior-API.patch b/patches/server/0647-Missing-Entity-Behavior-API.patch similarity index 100% rename from patches/server/0648-Missing-Entity-Behavior-API.patch rename to patches/server/0647-Missing-Entity-Behavior-API.patch diff --git a/patches/server/0649-Ensure-disconnect-for-book-edit-is-called-on-main.patch b/patches/server/0648-Ensure-disconnect-for-book-edit-is-called-on-main.patch similarity index 92% rename from patches/server/0649-Ensure-disconnect-for-book-edit-is-called-on-main.patch rename to patches/server/0648-Ensure-disconnect-for-book-edit-is-called-on-main.patch index a5f5253327..ce4da42a74 100644 --- a/patches/server/0649-Ensure-disconnect-for-book-edit-is-called-on-main.patch +++ b/patches/server/0648-Ensure-disconnect-for-book-edit-is-called-on-main.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Ensure disconnect for book edit is called on main diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 7c0ef92a9bad6f66a5f7f466c47f76953e0d2e8d..ecabbf88fa8fc568eede8d083e9456c22613c2bd 100644 +index 6c166950247118cb1bbae4aa1fc3ee8a6790ab1b..d620f1358e0a75ccdfd9bed98b95af47b337748d 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -1201,7 +1201,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic diff --git a/patches/server/0650-Fix-return-value-of-Block-applyBoneMeal-always-being.patch b/patches/server/0649-Fix-return-value-of-Block-applyBoneMeal-always-being.patch similarity index 90% rename from patches/server/0650-Fix-return-value-of-Block-applyBoneMeal-always-being.patch rename to patches/server/0649-Fix-return-value-of-Block-applyBoneMeal-always-being.patch index e88c33e4f7..3a42add191 100644 --- a/patches/server/0650-Fix-return-value-of-Block-applyBoneMeal-always-being.patch +++ b/patches/server/0649-Fix-return-value-of-Block-applyBoneMeal-always-being.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix return value of Block#applyBoneMeal always being false diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -index 974ab329f92f488aba0999cef25e3b8e7e062209..60aa47a78b9d5921dffd1e205c0b69f453a94851 100644 +index e8d96c1e5dde67436fba1bfc6585c3e4a5c1a63c..4cfefcd6dc1ccdc9ecc52c9965fef5a3e339f862 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java @@ -583,7 +583,7 @@ public class CraftBlock implements Block { diff --git a/patches/server/0651-Use-getChunkIfLoadedImmediately-in-places.patch b/patches/server/0650-Use-getChunkIfLoadedImmediately-in-places.patch similarity index 100% rename from patches/server/0651-Use-getChunkIfLoadedImmediately-in-places.patch rename to patches/server/0650-Use-getChunkIfLoadedImmediately-in-places.patch diff --git a/patches/server/0652-Fix-commands-from-signs-not-firing-command-events.patch b/patches/server/0651-Fix-commands-from-signs-not-firing-command-events.patch similarity index 100% rename from patches/server/0652-Fix-commands-from-signs-not-firing-command-events.patch rename to patches/server/0651-Fix-commands-from-signs-not-firing-command-events.patch diff --git a/patches/server/0653-Adds-PlayerArmSwingEvent.patch b/patches/server/0652-Adds-PlayerArmSwingEvent.patch similarity index 93% rename from patches/server/0653-Adds-PlayerArmSwingEvent.patch rename to patches/server/0652-Adds-PlayerArmSwingEvent.patch index d7a802a46b..33ab167db8 100644 --- a/patches/server/0653-Adds-PlayerArmSwingEvent.patch +++ b/patches/server/0652-Adds-PlayerArmSwingEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Adds PlayerArmSwingEvent diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index ecabbf88fa8fc568eede8d083e9456c22613c2bd..1d84ee2afa76ecc1c7c07bf0a21c3d1ee7213515 100644 +index d620f1358e0a75ccdfd9bed98b95af47b337748d..49c45be8d757ee11a18ce507c6397835e3911e86 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -2490,7 +2490,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic diff --git a/patches/server/0654-Fixes-kick-event-leave-message-not-being-sent.patch b/patches/server/0653-Fixes-kick-event-leave-message-not-being-sent.patch similarity index 96% rename from patches/server/0654-Fixes-kick-event-leave-message-not-being-sent.patch rename to patches/server/0653-Fixes-kick-event-leave-message-not-being-sent.patch index 2d64b13037..0ddad48d90 100644 --- a/patches/server/0654-Fixes-kick-event-leave-message-not-being-sent.patch +++ b/patches/server/0653-Fixes-kick-event-leave-message-not-being-sent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fixes kick event leave message not being sent diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 77a3fa81d94005de4c5b7c130e893487fe7adc77..80aaa260c69598a403b8a364dc39caff2193ec0f 100644 +index 26f4f00bb3d58255c030137fa7a8c187942aaacb..c40028d82908a9dc939b6304d06b6cb7d2376b31 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -262,7 +262,6 @@ public class ServerPlayer extends Player { @@ -17,7 +17,7 @@ index 77a3fa81d94005de4c5b7c130e893487fe7adc77..80aaa260c69598a403b8a364dc39caff public boolean isRealPlayer; // Paper public double lastEntitySpawnRadiusSquared; // Paper - optimise isOutsideRange, this field is in blocks diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 1d84ee2afa76ecc1c7c07bf0a21c3d1ee7213515..3ccb8f290a842487da80ed24d04d55192ed317f4 100644 +index 49c45be8d757ee11a18ce507c6397835e3911e86..470b32ce81f5303c6d6d972e79f53cd82e9669a5 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -510,7 +510,6 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic diff --git a/patches/server/0655-Add-config-for-mobs-immune-to-default-effects.patch b/patches/server/0654-Add-config-for-mobs-immune-to-default-effects.patch similarity index 100% rename from patches/server/0655-Add-config-for-mobs-immune-to-default-effects.patch rename to patches/server/0654-Add-config-for-mobs-immune-to-default-effects.patch diff --git a/patches/server/0656-Fix-incorrect-message-for-outdated-client.patch b/patches/server/0655-Fix-incorrect-message-for-outdated-client.patch similarity index 100% rename from patches/server/0656-Fix-incorrect-message-for-outdated-client.patch rename to patches/server/0655-Fix-incorrect-message-for-outdated-client.patch diff --git a/patches/server/0657-Don-t-apply-cramming-damage-to-players.patch b/patches/server/0656-Don-t-apply-cramming-damage-to-players.patch similarity index 93% rename from patches/server/0657-Don-t-apply-cramming-damage-to-players.patch rename to patches/server/0656-Don-t-apply-cramming-damage-to-players.patch index bab43b293f..5c01265067 100644 --- a/patches/server/0657-Don-t-apply-cramming-damage-to-players.patch +++ b/patches/server/0656-Don-t-apply-cramming-damage-to-players.patch @@ -11,7 +11,7 @@ It does not make a lot of sense to damage players if they get crammed, For those who really want it a config option is provided. diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 80aaa260c69598a403b8a364dc39caff2193ec0f..ad110326b3086137a6762ef73d04ea796b3dbf39 100644 +index c40028d82908a9dc939b6304d06b6cb7d2376b31..715a719d58f3333d8c3ce761182d4932e5b08e6c 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1453,7 +1453,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0658-Rate-options-and-timings-for-sensors-and-behaviors.patch b/patches/server/0657-Rate-options-and-timings-for-sensors-and-behaviors.patch similarity index 100% rename from patches/server/0658-Rate-options-and-timings-for-sensors-and-behaviors.patch rename to patches/server/0657-Rate-options-and-timings-for-sensors-and-behaviors.patch diff --git a/patches/server/0659-Add-a-bunch-of-missing-forceDrop-toggles.patch b/patches/server/0658-Add-a-bunch-of-missing-forceDrop-toggles.patch similarity index 100% rename from patches/server/0659-Add-a-bunch-of-missing-forceDrop-toggles.patch rename to patches/server/0658-Add-a-bunch-of-missing-forceDrop-toggles.patch diff --git a/patches/server/0660-Stinger-API.patch b/patches/server/0659-Stinger-API.patch similarity index 77% rename from patches/server/0660-Stinger-API.patch rename to patches/server/0659-Stinger-API.patch index 5cb41b7757..daab5f02dc 100644 --- a/patches/server/0660-Stinger-API.patch +++ b/patches/server/0659-Stinger-API.patch @@ -5,12 +5,12 @@ Subject: [PATCH] Stinger API diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index ba8b98f1a4b4c8865385033307dc0e7486d597be..244123cd98171dcd8ea9e34b32d5ba8c2bd6b7f8 100644 +index 9a0af16ffe32c096fb4190692875bfccfa6b769b..f7d20efecfee6aaae2e323d543739308c4bb371c 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -@@ -334,7 +334,28 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { - Preconditions.checkArgument(count >= 0, "New arrow amount must be >= 0"); - this.getHandle().getEntityData().set(net.minecraft.world.entity.LivingEntity.DATA_ARROW_COUNT_ID, count); +@@ -340,7 +340,28 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { + } + // Paper end } + // Paper Start - Bee Stinger API + @Override diff --git a/patches/server/0661-Fix-incosistency-issue-with-empty-map-items-in-CB.patch b/patches/server/0660-Fix-incosistency-issue-with-empty-map-items-in-CB.patch similarity index 100% rename from patches/server/0661-Fix-incosistency-issue-with-empty-map-items-in-CB.patch rename to patches/server/0660-Fix-incosistency-issue-with-empty-map-items-in-CB.patch diff --git a/patches/server/0662-Add-System.out-err-catcher.patch b/patches/server/0661-Add-System.out-err-catcher.patch similarity index 97% rename from patches/server/0662-Add-System.out-err-catcher.patch rename to patches/server/0661-Add-System.out-err-catcher.patch index 91abcbaf67..ddb6ea8472 100644 --- a/patches/server/0662-Add-System.out-err-catcher.patch +++ b/patches/server/0661-Add-System.out-err-catcher.patch @@ -105,10 +105,10 @@ index 0000000000000000000000000000000000000000..76d0d00cd6742991e3f3ec827a75ee87 + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index e8f7b418b942a6a36e615dbcaf9bb18257c34ee4..caa9885dd942fc5b82ba6b820d89f1b1a7ffda20 100644 +index a24769e0be5c0d67b6a6b8441570e20a622e5cbd..6707c96293e3c734628cbb017ddcf098641d69c2 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -297,6 +297,7 @@ public final class CraftServer implements Server { +@@ -298,6 +298,7 @@ public final class CraftServer implements Server { public int reloadCount; private final io.papermc.paper.datapack.PaperDatapackManager datapackManager; // Paper public static Exception excessiveVelEx; // Paper - Velocity warnings diff --git a/patches/server/0663-Fix-test-not-bootstrapping.patch b/patches/server/0662-Fix-test-not-bootstrapping.patch similarity index 100% rename from patches/server/0663-Fix-test-not-bootstrapping.patch rename to patches/server/0662-Fix-test-not-bootstrapping.patch diff --git a/patches/server/0664-Rewrite-LogEvents-to-contain-the-source-jars-in-stac.patch b/patches/server/0663-Rewrite-LogEvents-to-contain-the-source-jars-in-stac.patch similarity index 100% rename from patches/server/0664-Rewrite-LogEvents-to-contain-the-source-jars-in-stac.patch rename to patches/server/0663-Rewrite-LogEvents-to-contain-the-source-jars-in-stac.patch diff --git a/patches/server/0665-Improve-boat-collision-performance.patch b/patches/server/0664-Improve-boat-collision-performance.patch similarity index 100% rename from patches/server/0665-Improve-boat-collision-performance.patch rename to patches/server/0664-Improve-boat-collision-performance.patch diff --git a/patches/server/0666-Prevent-AFK-kick-while-watching-end-credits.patch b/patches/server/0665-Prevent-AFK-kick-while-watching-end-credits.patch similarity index 93% rename from patches/server/0666-Prevent-AFK-kick-while-watching-end-credits.patch rename to patches/server/0665-Prevent-AFK-kick-while-watching-end-credits.patch index f6be3e59ad..2d96e2a69b 100644 --- a/patches/server/0666-Prevent-AFK-kick-while-watching-end-credits.patch +++ b/patches/server/0665-Prevent-AFK-kick-while-watching-end-credits.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Prevent AFK kick while watching end credits. diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 3ccb8f290a842487da80ed24d04d55192ed317f4..69d67c7c4fcdb8cbdae1a75d2a0f79987e48a581 100644 +index 470b32ce81f5303c6d6d972e79f53cd82e9669a5..15605b81993be6a88ee85fc3a9efaf3fa1669797 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -427,7 +427,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic diff --git a/patches/server/0667-Allow-skipping-writing-of-comments-to-server.propert.patch b/patches/server/0666-Allow-skipping-writing-of-comments-to-server.propert.patch similarity index 100% rename from patches/server/0667-Allow-skipping-writing-of-comments-to-server.propert.patch rename to patches/server/0666-Allow-skipping-writing-of-comments-to-server.propert.patch diff --git a/patches/server/0668-Add-PlayerSetSpawnEvent.patch b/patches/server/0667-Add-PlayerSetSpawnEvent.patch similarity index 97% rename from patches/server/0668-Add-PlayerSetSpawnEvent.patch rename to patches/server/0667-Add-PlayerSetSpawnEvent.patch index 791cd532aa..8732c5ceaf 100644 --- a/patches/server/0668-Add-PlayerSetSpawnEvent.patch +++ b/patches/server/0667-Add-PlayerSetSpawnEvent.patch @@ -32,7 +32,7 @@ index ce1c7512cc368e196ae94ee22c6a228c975b4980..1e41de9523c5fa3b9cfced798a5c35a2 String string = resourceKey.location().toString(); if (targets.size() == 1) { diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index ad110326b3086137a6762ef73d04ea796b3dbf39..36330e5a2b59cf4d5eb45b3d0840440a2991fc5e 100644 +index 715a719d58f3333d8c3ce761182d4932e5b08e6c..8f6ec40f9aebececd4506ce29d33f44a5eab43b7 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1294,7 +1294,7 @@ public class ServerPlayer extends Player { @@ -129,10 +129,10 @@ index 37e111589134d80fdfd7a04d624b8c1d58a2d664..53b35f003034e7f4c9dd8ccfaf773891 } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index f425ba131dffd03d19ffb5c58373d19f097c75de..3dbd458caf6098c57ca654fd17783e231abcfd43 100644 +index 99753168f6611b9844c43766f2e54a9e721cfdbc..485cbeeae012383ec959503c8b909441c25fa4d1 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1292,9 +1292,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1305,9 +1305,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override public void setBedSpawnLocation(Location location, boolean override) { if (location == null) { diff --git a/patches/server/0669-Make-hoppers-respect-inventory-max-stack-size.patch b/patches/server/0668-Make-hoppers-respect-inventory-max-stack-size.patch similarity index 100% rename from patches/server/0669-Make-hoppers-respect-inventory-max-stack-size.patch rename to patches/server/0668-Make-hoppers-respect-inventory-max-stack-size.patch diff --git a/patches/server/0670-Optimize-entity-tracker-passenger-checks.patch b/patches/server/0669-Optimize-entity-tracker-passenger-checks.patch similarity index 100% rename from patches/server/0670-Optimize-entity-tracker-passenger-checks.patch rename to patches/server/0669-Optimize-entity-tracker-passenger-checks.patch diff --git a/patches/server/0671-Config-option-for-Piglins-guarding-chests.patch b/patches/server/0670-Config-option-for-Piglins-guarding-chests.patch similarity index 100% rename from patches/server/0671-Config-option-for-Piglins-guarding-chests.patch rename to patches/server/0670-Config-option-for-Piglins-guarding-chests.patch diff --git a/patches/server/0672-Added-EntityDamageItemEvent.patch b/patches/server/0671-Added-EntityDamageItemEvent.patch similarity index 97% rename from patches/server/0672-Added-EntityDamageItemEvent.patch rename to patches/server/0671-Added-EntityDamageItemEvent.patch index fd4e1081d9..f62299682b 100644 --- a/patches/server/0672-Added-EntityDamageItemEvent.patch +++ b/patches/server/0671-Added-EntityDamageItemEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Added EntityDamageItemEvent diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index 40395738e41575a5b2b1b4020c1c60707ceac9ad..a6858017ff9468dbf4651fe62faea487a54b3878 100644 +index d16fbd7817e71f50e35bc84eb889444e35eab415..218065e92c2d0d1141359255f77eb6747dabce35 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java @@ -556,7 +556,7 @@ public final class ItemStack { diff --git a/patches/server/0673-Optimize-indirect-passenger-iteration.patch b/patches/server/0672-Optimize-indirect-passenger-iteration.patch similarity index 100% rename from patches/server/0673-Optimize-indirect-passenger-iteration.patch rename to patches/server/0672-Optimize-indirect-passenger-iteration.patch diff --git a/patches/server/0674-Fix-block-drops-position-losing-precision-millions-o.patch b/patches/server/0673-Fix-block-drops-position-losing-precision-millions-o.patch similarity index 100% rename from patches/server/0674-Fix-block-drops-position-losing-precision-millions-o.patch rename to patches/server/0673-Fix-block-drops-position-losing-precision-millions-o.patch diff --git a/patches/server/0675-Configurable-item-frame-map-cursor-update-interval.patch b/patches/server/0674-Configurable-item-frame-map-cursor-update-interval.patch similarity index 100% rename from patches/server/0675-Configurable-item-frame-map-cursor-update-interval.patch rename to patches/server/0674-Configurable-item-frame-map-cursor-update-interval.patch diff --git a/patches/server/0676-Make-EntityUnleashEvent-cancellable.patch b/patches/server/0675-Make-EntityUnleashEvent-cancellable.patch similarity index 100% rename from patches/server/0676-Make-EntityUnleashEvent-cancellable.patch rename to patches/server/0675-Make-EntityUnleashEvent-cancellable.patch diff --git a/patches/server/0677-Clear-bucket-NBT-after-dispense.patch b/patches/server/0676-Clear-bucket-NBT-after-dispense.patch similarity index 100% rename from patches/server/0677-Clear-bucket-NBT-after-dispense.patch rename to patches/server/0676-Clear-bucket-NBT-after-dispense.patch diff --git a/patches/server/0678-Change-EnderEye-target-without-changing-other-things.patch b/patches/server/0677-Change-EnderEye-target-without-changing-other-things.patch similarity index 100% rename from patches/server/0678-Change-EnderEye-target-without-changing-other-things.patch rename to patches/server/0677-Change-EnderEye-target-without-changing-other-things.patch diff --git a/patches/server/0679-Add-BlockBreakBlockEvent.patch b/patches/server/0678-Add-BlockBreakBlockEvent.patch similarity index 100% rename from patches/server/0679-Add-BlockBreakBlockEvent.patch rename to patches/server/0678-Add-BlockBreakBlockEvent.patch diff --git a/patches/server/0680-Option-to-prevent-NBT-copy-in-smithing-recipes.patch b/patches/server/0679-Option-to-prevent-NBT-copy-in-smithing-recipes.patch similarity index 100% rename from patches/server/0680-Option-to-prevent-NBT-copy-in-smithing-recipes.patch rename to patches/server/0679-Option-to-prevent-NBT-copy-in-smithing-recipes.patch diff --git a/patches/server/0681-More-CommandBlock-API.patch b/patches/server/0680-More-CommandBlock-API.patch similarity index 100% rename from patches/server/0681-More-CommandBlock-API.patch rename to patches/server/0680-More-CommandBlock-API.patch diff --git a/patches/server/0682-Add-missing-team-sidebar-display-slots.patch b/patches/server/0681-Add-missing-team-sidebar-display-slots.patch similarity index 100% rename from patches/server/0682-Add-missing-team-sidebar-display-slots.patch rename to patches/server/0681-Add-missing-team-sidebar-display-slots.patch diff --git a/patches/server/0683-Add-back-EntityPortalExitEvent.patch b/patches/server/0682-Add-back-EntityPortalExitEvent.patch similarity index 100% rename from patches/server/0683-Add-back-EntityPortalExitEvent.patch rename to patches/server/0682-Add-back-EntityPortalExitEvent.patch diff --git a/patches/server/0684-Add-methods-to-find-targets-for-lightning-strikes.patch b/patches/server/0683-Add-methods-to-find-targets-for-lightning-strikes.patch similarity index 96% rename from patches/server/0684-Add-methods-to-find-targets-for-lightning-strikes.patch rename to patches/server/0683-Add-methods-to-find-targets-for-lightning-strikes.patch index bf202bd38a..f48066d564 100644 --- a/patches/server/0684-Add-methods-to-find-targets-for-lightning-strikes.patch +++ b/patches/server/0683-Add-methods-to-find-targets-for-lightning-strikes.patch @@ -31,7 +31,7 @@ index 17e77f727b0cd3da788bf5593762f2930e98a609..2de60a2f3da7f8d30295def7045cd753 blockposition1 = blockposition1.above(2); } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 7d57bf8ca060d6c3dcf8ef4201c7e4ff78ecabb3..9942c1de6d8e087520c9e795a9f775f59bfa8942 100644 +index 6b7e77c35ae737551859e9e7515cd5c189ec7313..17351379ddea082c7b6792b21220eb086d9d1906 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -685,6 +685,23 @@ public class CraftWorld extends CraftRegionAccessor implements World { diff --git a/patches/server/0685-Get-entity-default-attributes.patch b/patches/server/0684-Get-entity-default-attributes.patch similarity index 97% rename from patches/server/0685-Get-entity-default-attributes.patch rename to patches/server/0684-Get-entity-default-attributes.patch index aeeb38dc20..564fc23423 100644 --- a/patches/server/0685-Get-entity-default-attributes.patch +++ b/patches/server/0684-Get-entity-default-attributes.patch @@ -81,10 +81,10 @@ index 0000000000000000000000000000000000000000..cf9d28ea97d93cec05c9fb768d59e283 + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index ec49b0719491f52057818a6fc2b4d3f16c7fc440..30ac1162851331526f3fc00332eded67be48e1d4 100644 +index 6c39b620e9909759ab37d659c93e426c9f33ba95..72ce08862419ce5b6da6decb39d8c36adc1eaaf0 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -564,6 +564,18 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -566,6 +566,18 @@ public final class CraftMagicNumbers implements UnsafeValues { public int getProtocolVersion() { return net.minecraft.SharedConstants.getCurrentVersion().getProtocolVersion(); } diff --git a/patches/server/0686-Left-handed-API.patch b/patches/server/0685-Left-handed-API.patch similarity index 100% rename from patches/server/0686-Left-handed-API.patch rename to patches/server/0685-Left-handed-API.patch diff --git a/patches/server/0687-Add-more-advancement-API.patch b/patches/server/0686-Add-more-advancement-API.patch similarity index 100% rename from patches/server/0687-Add-more-advancement-API.patch rename to patches/server/0686-Add-more-advancement-API.patch diff --git a/patches/server/0688-Add-ItemFactory-getSpawnEgg-API.patch b/patches/server/0687-Add-ItemFactory-getSpawnEgg-API.patch similarity index 100% rename from patches/server/0688-Add-ItemFactory-getSpawnEgg-API.patch rename to patches/server/0687-Add-ItemFactory-getSpawnEgg-API.patch diff --git a/patches/server/0689-Add-critical-damage-API.patch b/patches/server/0688-Add-critical-damage-API.patch similarity index 97% rename from patches/server/0689-Add-critical-damage-API.patch rename to patches/server/0688-Add-critical-damage-API.patch index 4f802fd238..f666cbb03d 100644 --- a/patches/server/0689-Add-critical-damage-API.patch +++ b/patches/server/0688-Add-critical-damage-API.patch @@ -29,7 +29,7 @@ index ed8bad446a1845befa6d5d75c40cf281fa47a9d9..8795c94e6b6474addddbb0b337a962e8 public static DamageSource fallingBlock(Entity attacker) { return (new EntityDamageSource("fallingBlock", attacker)).damageHelmet(); diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index 321feaea3bd8c082151302fe7d93294a6bf5dec6..72b11ea489becaee3aaeb644347142b62adfbf28 100644 +index 9c9c7dd62a747f6d6597b01839b63840080eac82..59cead9833b7d0266a0c19fdbebd42256e4f54c4 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -1256,7 +1256,7 @@ public abstract class Player extends LivingEntity { @@ -60,7 +60,7 @@ index 321feaea3bd8c082151302fe7d93294a6bf5dec6..72b11ea489becaee3aaeb644347142b6 } // CraftBukkit end diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java -index 9b487737fc83166a66f9a6cc57aa505b5243c530..8c08e07ba78e2ed042d79b692221008f59e92593 100644 +index f427ad266a1e00adb661b9e4bc7cfe2a7ec52caa..11e0601c08e66ff7fe4febc2c38b38fec8d48c91 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java +++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java @@ -372,6 +372,7 @@ public abstract class AbstractArrow extends Projectile { diff --git a/patches/server/0690-Fix-issues-with-mob-conversion.patch b/patches/server/0689-Fix-issues-with-mob-conversion.patch similarity index 100% rename from patches/server/0690-Fix-issues-with-mob-conversion.patch rename to patches/server/0689-Fix-issues-with-mob-conversion.patch diff --git a/patches/server/0691-Add-isCollidable-methods-to-various-places.patch b/patches/server/0690-Add-isCollidable-methods-to-various-places.patch similarity index 90% rename from patches/server/0691-Add-isCollidable-methods-to-various-places.patch rename to patches/server/0690-Add-isCollidable-methods-to-various-places.patch index eda75c590e..57cf599be2 100644 --- a/patches/server/0691-Add-isCollidable-methods-to-various-places.patch +++ b/patches/server/0690-Add-isCollidable-methods-to-various-places.patch @@ -7,7 +7,7 @@ Subject: [PATCH] Add isCollidable methods to various places public net.minecraft.world.level.block.state.BlockBehaviour hasCollision diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -index 60aa47a78b9d5921dffd1e205c0b69f453a94851..b7496922faee8bc5d82f3f5922f6fb2fe44a8d2f 100644 +index 4cfefcd6dc1ccdc9ecc52c9965fef5a3e339f862..5343ae3cdda55d7e0b41747c7eccb52e6828f6c9 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java @@ -482,6 +482,11 @@ public class CraftBlock implements Block { @@ -39,10 +39,10 @@ index 7b9e943b391c061782fccd2b8d705ceec8db50fe..966ac60daebb7bb211ab8096fc0c5f33 + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 30ac1162851331526f3fc00332eded67be48e1d4..abffb2328a0a85a6a5c664d58d2738b833b9431d 100644 +index 72ce08862419ce5b6da6decb39d8c36adc1eaaf0..dea05265776f2b57115f36e8a31ed7720cce2cd0 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -576,6 +576,12 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -578,6 +578,12 @@ public final class CraftMagicNumbers implements UnsafeValues { var supplier = net.minecraft.world.entity.ai.attributes.DefaultAttributes.getSupplier((net.minecraft.world.entity.EntityType) net.minecraft.core.registries.BuiltInRegistries.ENTITY_TYPE.get(CraftNamespacedKey.toMinecraft(bukkitEntityKey))); return new io.papermc.paper.attribute.UnmodifiableAttributeMap(supplier); } diff --git a/patches/server/0692-Goat-ram-API.patch b/patches/server/0691-Goat-ram-API.patch similarity index 100% rename from patches/server/0692-Goat-ram-API.patch rename to patches/server/0691-Goat-ram-API.patch diff --git a/patches/server/0693-Add-API-for-resetting-a-single-score.patch b/patches/server/0692-Add-API-for-resetting-a-single-score.patch similarity index 100% rename from patches/server/0693-Add-API-for-resetting-a-single-score.patch rename to patches/server/0692-Add-API-for-resetting-a-single-score.patch diff --git a/patches/server/0694-Add-Raw-Byte-Entity-Serialization.patch b/patches/server/0693-Add-Raw-Byte-Entity-Serialization.patch similarity index 96% rename from patches/server/0694-Add-Raw-Byte-Entity-Serialization.patch rename to patches/server/0693-Add-Raw-Byte-Entity-Serialization.patch index 0cbcce0f60..2b5211da2b 100644 --- a/patches/server/0694-Add-Raw-Byte-Entity-Serialization.patch +++ b/patches/server/0693-Add-Raw-Byte-Entity-Serialization.patch @@ -45,10 +45,10 @@ index f1ee89047e8cd916c762b91162842e3f981856b3..726a4ae7ab928eda3ae1c1e98f342157 // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index abffb2328a0a85a6a5c664d58d2738b833b9431d..90dbc63a7472b923ed4faca5ac52f9438126fa63 100644 +index dea05265776f2b57115f36e8a31ed7720cce2cd0..109f36e8892cc2e50d88054459321007ea00cf93 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -459,6 +459,29 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -484,6 +484,29 @@ public final class CraftMagicNumbers implements UnsafeValues { return CraftItemStack.asCraftMirror(net.minecraft.world.item.ItemStack.of(ca.spottedleaf.dataconverter.minecraft.MCDataConverter.convertTag(ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.ITEM_STACK, compound, dataVersion, getDataVersion()))); } diff --git a/patches/server/0695-Vanilla-command-permission-fixes.patch b/patches/server/0694-Vanilla-command-permission-fixes.patch similarity index 94% rename from patches/server/0695-Vanilla-command-permission-fixes.patch rename to patches/server/0694-Vanilla-command-permission-fixes.patch index c109df4692..cdd41b284c 100644 --- a/patches/server/0695-Vanilla-command-permission-fixes.patch +++ b/patches/server/0694-Vanilla-command-permission-fixes.patch @@ -33,14 +33,13 @@ index 899008b2980d13f1be6280cd8cb959c53a29bebf..f875507241ac6769545e91cd3285232b private RedirectModifier modifier = null; private boolean forks; diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java -index 7e61f0cb96c7697fc3487fd941cacc15d78a14dc..9cf69ef59ef4330a69753cab7aa8ec7716587d32 100644 +index 7ebe1c200c26c66b293b245d7f470bf4f81f3eea..f2b312367895f121bcf4135c12dfdb354f32dddb 100644 --- a/src/main/java/net/minecraft/commands/Commands.java +++ b/src/main/java/net/minecraft/commands/Commands.java -@@ -220,7 +220,13 @@ public class Commands { - if (environment.includeIntegrated) { - PublishCommand.register(this.dispatcher); +@@ -223,6 +223,13 @@ public class Commands { } -- + this.vanillaCommandNodes.addAll(this.dispatcher.getRoot().getChildren()); // Paper + + // Paper start + for (final CommandNode node : this.dispatcher.getRoot().getChildren()) { + if (node.getRequirement() == com.mojang.brigadier.builder.ArgumentBuilder.defaultRequirement()) { diff --git a/patches/server/0696-Do-not-run-close-logic-for-inventories-on-chunk-unlo.patch b/patches/server/0695-Do-not-run-close-logic-for-inventories-on-chunk-unlo.patch similarity index 95% rename from patches/server/0696-Do-not-run-close-logic-for-inventories-on-chunk-unlo.patch rename to patches/server/0695-Do-not-run-close-logic-for-inventories-on-chunk-unlo.patch index 53f3c7e439..a9ccad85a7 100644 --- a/patches/server/0696-Do-not-run-close-logic-for-inventories-on-chunk-unlo.patch +++ b/patches/server/0695-Do-not-run-close-logic-for-inventories-on-chunk-unlo.patch @@ -28,7 +28,7 @@ index 2de60a2f3da7f8d30295def7045cd7535f84e37f..d984a4304e8ebbcc3147e34bd3e35a7f } // Spigot End diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 36330e5a2b59cf4d5eb45b3d0840440a2991fc5e..5015076ff1ac2b13203588db4566b9cf6d934a28 100644 +index 8f6ec40f9aebececd4506ce29d33f44a5eab43b7..93fc24962062acf1425a475f8781b6d8827a5af8 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1595,6 +1595,18 @@ public class ServerPlayer extends Player { @@ -51,7 +51,7 @@ index 36330e5a2b59cf4d5eb45b3d0840440a2991fc5e..5015076ff1ac2b13203588db4566b9cf @Override public void doCloseContainer() { diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index 72b11ea489becaee3aaeb644347142b62adfbf28..23ef09683ff506996c45aa8a3b84c72055960f03 100644 +index 59cead9833b7d0266a0c19fdbebd42256e4f54c4..69900f89e7c5f8c6e33025059d7248c7e9371fe9 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -499,6 +499,11 @@ public abstract class Player extends LivingEntity { diff --git a/patches/server/0697-Fix-GameProfileCache-concurrency.patch b/patches/server/0696-Fix-GameProfileCache-concurrency.patch similarity index 100% rename from patches/server/0697-Fix-GameProfileCache-concurrency.patch rename to patches/server/0696-Fix-GameProfileCache-concurrency.patch diff --git a/patches/server/0698-Log-when-the-async-catcher-is-tripped.patch b/patches/server/0697-Log-when-the-async-catcher-is-tripped.patch similarity index 100% rename from patches/server/0698-Log-when-the-async-catcher-is-tripped.patch rename to patches/server/0697-Log-when-the-async-catcher-is-tripped.patch diff --git a/patches/server/0699-Add-paper-mobcaps-and-paper-playermobcaps.patch b/patches/server/0698-Add-paper-mobcaps-and-paper-playermobcaps.patch similarity index 97% rename from patches/server/0699-Add-paper-mobcaps-and-paper-playermobcaps.patch rename to patches/server/0698-Add-paper-mobcaps-and-paper-playermobcaps.patch index 229c8c9124..d01b4444b0 100644 --- a/patches/server/0699-Add-paper-mobcaps-and-paper-playermobcaps.patch +++ b/patches/server/0698-Add-paper-mobcaps-and-paper-playermobcaps.patch @@ -10,7 +10,7 @@ Also has a hover text on each mob category listing what entity types are in said category diff --git a/src/main/java/io/papermc/paper/command/PaperCommand.java b/src/main/java/io/papermc/paper/command/PaperCommand.java -index a7b78508ef78229835805300e62a306a3f1ddf6d..724592234e2a178a518f6ab7d09c3180780371a7 100644 +index 312c0e42643355183ea3346a69fe9b5a5624bf1d..5c0b02f1ca8f6594f8f94613edba2783087950f2 100644 --- a/src/main/java/io/papermc/paper/command/PaperCommand.java +++ b/src/main/java/io/papermc/paper/command/PaperCommand.java @@ -5,6 +5,7 @@ import io.papermc.paper.command.subcommands.DumpItemCommand; @@ -21,7 +21,7 @@ index a7b78508ef78229835805300e62a306a3f1ddf6d..724592234e2a178a518f6ab7d09c3180 import io.papermc.paper.command.subcommands.ReloadCommand; import io.papermc.paper.command.subcommands.SyncLoadInfoCommand; import io.papermc.paper.command.subcommands.VersionCommand; -@@ -48,6 +49,7 @@ public final class PaperCommand extends Command { +@@ -50,6 +51,7 @@ public final class PaperCommand extends Command { commands.put(Set.of("debug", "chunkinfo", "holderinfo"), new ChunkDebugCommand()); commands.put(Set.of("syncloadinfo"), new SyncLoadInfoCommand()); commands.put(Set.of("dumpitem"), new DumpItemCommand()); @@ -286,10 +286,10 @@ index bf3fb416d36a19958033cdbf5cc313556fa0201b..0a49769bfa83d0b9c435e3ab4bba8597 // Paper start - add parameters and int ret type spawnCategoryForChunk(group, world, chunk, checker, runner, Integer.MAX_VALUE, null); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index caa9885dd942fc5b82ba6b820d89f1b1a7ffda20..9ab3f3a490e55211670e2847f03bd4f8229162da 100644 +index 6707c96293e3c734628cbb017ddcf098641d69c2..ed7c94b31db6f759c5e24bee01ba6d5df266a126 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2183,6 +2183,11 @@ public final class CraftServer implements Server { +@@ -2166,6 +2166,11 @@ public final class CraftServer implements Server { @Override public int getSpawnLimit(SpawnCategory spawnCategory) { @@ -302,7 +302,7 @@ index caa9885dd942fc5b82ba6b820d89f1b1a7ffda20..9ab3f3a490e55211670e2847f03bd4f8 } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 9942c1de6d8e087520c9e795a9f775f59bfa8942..c093401834d7111857a0d49e60faa36ee22aae40 100644 +index 17351379ddea082c7b6792b21220eb086d9d1906..c8e798cb13ffc1800fb04cdf0516a1f787f1da56 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -1700,9 +1700,14 @@ public class CraftWorld extends CraftRegionAccessor implements World { diff --git a/patches/server/0700-Sanitize-ResourceLocation-error-logging.patch b/patches/server/0699-Sanitize-ResourceLocation-error-logging.patch similarity index 100% rename from patches/server/0700-Sanitize-ResourceLocation-error-logging.patch rename to patches/server/0699-Sanitize-ResourceLocation-error-logging.patch diff --git a/patches/server/0701-Allow-controlled-flushing-for-network-manager.patch b/patches/server/0700-Allow-controlled-flushing-for-network-manager.patch similarity index 100% rename from patches/server/0701-Allow-controlled-flushing-for-network-manager.patch rename to patches/server/0700-Allow-controlled-flushing-for-network-manager.patch diff --git a/patches/server/0702-Optimise-general-POI-access.patch b/patches/server/0701-Optimise-general-POI-access.patch similarity index 100% rename from patches/server/0702-Optimise-general-POI-access.patch rename to patches/server/0701-Optimise-general-POI-access.patch diff --git a/patches/server/0703-Optimise-chunk-tick-iteration.patch b/patches/server/0702-Optimise-chunk-tick-iteration.patch similarity index 100% rename from patches/server/0703-Optimise-chunk-tick-iteration.patch rename to patches/server/0702-Optimise-chunk-tick-iteration.patch diff --git a/patches/server/0704-Execute-chunk-tasks-mid-tick.patch b/patches/server/0703-Execute-chunk-tasks-mid-tick.patch similarity index 100% rename from patches/server/0704-Execute-chunk-tasks-mid-tick.patch rename to patches/server/0703-Execute-chunk-tasks-mid-tick.patch diff --git a/patches/server/0705-Attempt-to-recalculate-regionfile-header-if-it-is-co.patch b/patches/server/0704-Attempt-to-recalculate-regionfile-header-if-it-is-co.patch similarity index 100% rename from patches/server/0705-Attempt-to-recalculate-regionfile-header-if-it-is-co.patch rename to patches/server/0704-Attempt-to-recalculate-regionfile-header-if-it-is-co.patch diff --git a/patches/server/0706-Custom-table-implementation-for-blockstate-state-loo.patch b/patches/server/0705-Custom-table-implementation-for-blockstate-state-loo.patch similarity index 100% rename from patches/server/0706-Custom-table-implementation-for-blockstate-state-loo.patch rename to patches/server/0705-Custom-table-implementation-for-blockstate-state-loo.patch diff --git a/patches/server/0707-Detail-more-information-in-watchdog-dumps.patch b/patches/server/0706-Detail-more-information-in-watchdog-dumps.patch similarity index 100% rename from patches/server/0707-Detail-more-information-in-watchdog-dumps.patch rename to patches/server/0706-Detail-more-information-in-watchdog-dumps.patch diff --git a/patches/server/0708-Manually-inline-methods-in-BlockPosition.patch b/patches/server/0707-Manually-inline-methods-in-BlockPosition.patch similarity index 100% rename from patches/server/0708-Manually-inline-methods-in-BlockPosition.patch rename to patches/server/0707-Manually-inline-methods-in-BlockPosition.patch diff --git a/patches/server/0709-Distance-manager-tick-timings.patch b/patches/server/0708-Distance-manager-tick-timings.patch similarity index 100% rename from patches/server/0709-Distance-manager-tick-timings.patch rename to patches/server/0708-Distance-manager-tick-timings.patch diff --git a/patches/server/0710-Name-craft-scheduler-threads-according-to-the-plugin.patch b/patches/server/0709-Name-craft-scheduler-threads-according-to-the-plugin.patch similarity index 100% rename from patches/server/0710-Name-craft-scheduler-threads-according-to-the-plugin.patch rename to patches/server/0709-Name-craft-scheduler-threads-according-to-the-plugin.patch diff --git a/patches/server/0711-Make-sure-inlined-getChunkAt-has-inlined-logic-for-l.patch b/patches/server/0710-Make-sure-inlined-getChunkAt-has-inlined-logic-for-l.patch similarity index 100% rename from patches/server/0711-Make-sure-inlined-getChunkAt-has-inlined-logic-for-l.patch rename to patches/server/0710-Make-sure-inlined-getChunkAt-has-inlined-logic-for-l.patch diff --git a/patches/server/0712-Add-packet-limiter-config.patch b/patches/server/0711-Add-packet-limiter-config.patch similarity index 100% rename from patches/server/0712-Add-packet-limiter-config.patch rename to patches/server/0711-Add-packet-limiter-config.patch diff --git a/patches/server/0713-Don-t-read-neighbour-chunk-data-off-disk-when-conver.patch b/patches/server/0712-Don-t-read-neighbour-chunk-data-off-disk-when-conver.patch similarity index 100% rename from patches/server/0713-Don-t-read-neighbour-chunk-data-off-disk-when-conver.patch rename to patches/server/0712-Don-t-read-neighbour-chunk-data-off-disk-when-conver.patch diff --git a/patches/server/0714-Consolidate-flush-calls-for-entity-tracker-packets.patch b/patches/server/0713-Consolidate-flush-calls-for-entity-tracker-packets.patch similarity index 100% rename from patches/server/0714-Consolidate-flush-calls-for-entity-tracker-packets.patch rename to patches/server/0713-Consolidate-flush-calls-for-entity-tracker-packets.patch diff --git a/patches/server/0715-Don-t-lookup-fluid-state-when-raytracing.patch b/patches/server/0714-Don-t-lookup-fluid-state-when-raytracing.patch similarity index 100% rename from patches/server/0715-Don-t-lookup-fluid-state-when-raytracing.patch rename to patches/server/0714-Don-t-lookup-fluid-state-when-raytracing.patch diff --git a/patches/server/0716-Time-scoreboard-search.patch b/patches/server/0715-Time-scoreboard-search.patch similarity index 100% rename from patches/server/0716-Time-scoreboard-search.patch rename to patches/server/0715-Time-scoreboard-search.patch diff --git a/patches/server/0717-Send-full-pos-packets-for-hard-colliding-entities.patch b/patches/server/0716-Send-full-pos-packets-for-hard-colliding-entities.patch similarity index 100% rename from patches/server/0717-Send-full-pos-packets-for-hard-colliding-entities.patch rename to patches/server/0716-Send-full-pos-packets-for-hard-colliding-entities.patch diff --git a/patches/server/0718-Do-not-run-raytrace-logic-for-AIR.patch b/patches/server/0717-Do-not-run-raytrace-logic-for-AIR.patch similarity index 100% rename from patches/server/0718-Do-not-run-raytrace-logic-for-AIR.patch rename to patches/server/0717-Do-not-run-raytrace-logic-for-AIR.patch diff --git a/patches/server/0719-Oprimise-map-impl-for-tracked-players.patch b/patches/server/0718-Oprimise-map-impl-for-tracked-players.patch similarity index 100% rename from patches/server/0719-Oprimise-map-impl-for-tracked-players.patch rename to patches/server/0718-Oprimise-map-impl-for-tracked-players.patch diff --git a/patches/server/0720-Optimise-BlockSoil-nearby-water-lookup.patch b/patches/server/0719-Optimise-BlockSoil-nearby-water-lookup.patch similarity index 100% rename from patches/server/0720-Optimise-BlockSoil-nearby-water-lookup.patch rename to patches/server/0719-Optimise-BlockSoil-nearby-water-lookup.patch diff --git a/patches/server/0721-Optimise-random-block-ticking.patch b/patches/server/0720-Optimise-random-block-ticking.patch similarity index 100% rename from patches/server/0721-Optimise-random-block-ticking.patch rename to patches/server/0720-Optimise-random-block-ticking.patch diff --git a/patches/server/0722-Optimise-non-flush-packet-sending.patch b/patches/server/0721-Optimise-non-flush-packet-sending.patch similarity index 100% rename from patches/server/0722-Optimise-non-flush-packet-sending.patch rename to patches/server/0721-Optimise-non-flush-packet-sending.patch diff --git a/patches/server/0723-Optimise-nearby-player-lookups.patch b/patches/server/0722-Optimise-nearby-player-lookups.patch similarity index 100% rename from patches/server/0723-Optimise-nearby-player-lookups.patch rename to patches/server/0722-Optimise-nearby-player-lookups.patch diff --git a/patches/server/0724-Remove-streams-for-villager-AI.patch b/patches/server/0723-Remove-streams-for-villager-AI.patch similarity index 100% rename from patches/server/0724-Remove-streams-for-villager-AI.patch rename to patches/server/0723-Remove-streams-for-villager-AI.patch diff --git a/patches/server/0725-Use-Velocity-compression-and-cipher-natives.patch b/patches/server/0724-Use-Velocity-compression-and-cipher-natives.patch similarity index 99% rename from patches/server/0725-Use-Velocity-compression-and-cipher-natives.patch rename to patches/server/0724-Use-Velocity-compression-and-cipher-natives.patch index 2ee4a41d37..6ec08a7498 100644 --- a/patches/server/0725-Use-Velocity-compression-and-cipher-natives.patch +++ b/patches/server/0724-Use-Velocity-compression-and-cipher-natives.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Use Velocity compression and cipher natives diff --git a/build.gradle.kts b/build.gradle.kts -index dea5594330830b4a7a2a717188cc33367c38a5ad..9411103b2d68e46ef9889f7a512362a4701486dc 100644 +index 5f9823714a0e7d1d4a73861996c4db03c8a0b99b..da408b67c42f6cc0b5322f57ff86f93f66eb8c06 100644 --- a/build.gradle.kts +++ b/build.gradle.kts -@@ -27,6 +27,11 @@ dependencies { +@@ -28,6 +28,11 @@ dependencies { implementation("org.spongepowered:configurate-yaml:4.1.2") // Paper - config files implementation("commons-lang:commons-lang:2.6") implementation("net.fabricmc:mapping-io:0.3.0") // Paper - needed to read mappings for stacktrace deobfuscation diff --git a/patches/server/0726-Reduce-worldgen-thread-worker-count-for-low-core-cou.patch b/patches/server/0725-Reduce-worldgen-thread-worker-count-for-low-core-cou.patch similarity index 100% rename from patches/server/0726-Reduce-worldgen-thread-worker-count-for-low-core-cou.patch rename to patches/server/0725-Reduce-worldgen-thread-worker-count-for-low-core-cou.patch diff --git a/patches/server/0727-Async-catch-modifications-to-critical-entity-state.patch b/patches/server/0726-Async-catch-modifications-to-critical-entity-state.patch similarity index 100% rename from patches/server/0727-Async-catch-modifications-to-critical-entity-state.patch rename to patches/server/0726-Async-catch-modifications-to-critical-entity-state.patch diff --git a/patches/server/0728-Fix-Bukkit-NamespacedKey-shenanigans.patch b/patches/server/0727-Fix-Bukkit-NamespacedKey-shenanigans.patch similarity index 100% rename from patches/server/0728-Fix-Bukkit-NamespacedKey-shenanigans.patch rename to patches/server/0727-Fix-Bukkit-NamespacedKey-shenanigans.patch diff --git a/patches/server/0729-Fix-merchant-inventory-not-closing-on-entity-removal.patch b/patches/server/0728-Fix-merchant-inventory-not-closing-on-entity-removal.patch similarity index 100% rename from patches/server/0729-Fix-merchant-inventory-not-closing-on-entity-removal.patch rename to patches/server/0728-Fix-merchant-inventory-not-closing-on-entity-removal.patch diff --git a/patches/server/0730-Check-requirement-before-suggesting-root-nodes.patch b/patches/server/0729-Check-requirement-before-suggesting-root-nodes.patch similarity index 100% rename from patches/server/0730-Check-requirement-before-suggesting-root-nodes.patch rename to patches/server/0729-Check-requirement-before-suggesting-root-nodes.patch diff --git a/patches/server/0731-Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch b/patches/server/0730-Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch similarity index 92% rename from patches/server/0731-Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch rename to patches/server/0730-Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch index f321f26513..ad22b266f9 100644 --- a/patches/server/0731-Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch +++ b/patches/server/0730-Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Don't respond to ServerboundCommandSuggestionPacket when diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 69d67c7c4fcdb8cbdae1a75d2a0f79987e48a581..2b7abf42c08672194cc460e6e74e6f8e5f3c7443 100644 +index 15605b81993be6a88ee85fc3a9efaf3fa1669797..411b555415f90504adadddc67387276ba340f360 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -835,6 +835,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic diff --git a/patches/server/0732-Fix-setPatternColor-on-tropical-fish-bucket-meta.patch b/patches/server/0731-Fix-setPatternColor-on-tropical-fish-bucket-meta.patch similarity index 100% rename from patches/server/0732-Fix-setPatternColor-on-tropical-fish-bucket-meta.patch rename to patches/server/0731-Fix-setPatternColor-on-tropical-fish-bucket-meta.patch diff --git a/patches/server/0733-Ensure-valid-vehicle-status.patch b/patches/server/0732-Ensure-valid-vehicle-status.patch similarity index 90% rename from patches/server/0733-Ensure-valid-vehicle-status.patch rename to patches/server/0732-Ensure-valid-vehicle-status.patch index 2746c8e4a0..5ac14513e9 100644 --- a/patches/server/0733-Ensure-valid-vehicle-status.patch +++ b/patches/server/0732-Ensure-valid-vehicle-status.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Ensure valid vehicle status diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 5015076ff1ac2b13203588db4566b9cf6d934a28..e1b59a1e6fd957b45f0a73eb51487e44108af34c 100644 +index 93fc24962062acf1425a475f8781b6d8827a5af8..d5b0777219c78aaff5c87fe8f422e67952ac241b 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -518,7 +518,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0734-Prevent-softlocked-end-exit-portal-generation.patch b/patches/server/0733-Prevent-softlocked-end-exit-portal-generation.patch similarity index 100% rename from patches/server/0734-Prevent-softlocked-end-exit-portal-generation.patch rename to patches/server/0733-Prevent-softlocked-end-exit-portal-generation.patch diff --git a/patches/server/0735-Fix-CocaoDecorator-causing-a-crash-when-trying-to-ge.patch b/patches/server/0734-Fix-CocaoDecorator-causing-a-crash-when-trying-to-ge.patch similarity index 100% rename from patches/server/0735-Fix-CocaoDecorator-causing-a-crash-when-trying-to-ge.patch rename to patches/server/0734-Fix-CocaoDecorator-causing-a-crash-when-trying-to-ge.patch diff --git a/patches/server/0736-Don-t-log-debug-logging-being-disabled.patch b/patches/server/0735-Don-t-log-debug-logging-being-disabled.patch similarity index 100% rename from patches/server/0736-Don-t-log-debug-logging-being-disabled.patch rename to patches/server/0735-Don-t-log-debug-logging-being-disabled.patch diff --git a/patches/server/0737-fix-various-menus-with-empty-level-accesses.patch b/patches/server/0736-fix-various-menus-with-empty-level-accesses.patch similarity index 100% rename from patches/server/0737-fix-various-menus-with-empty-level-accesses.patch rename to patches/server/0736-fix-various-menus-with-empty-level-accesses.patch diff --git a/patches/server/0738-Preserve-overstacked-loot.patch b/patches/server/0737-Preserve-overstacked-loot.patch similarity index 100% rename from patches/server/0738-Preserve-overstacked-loot.patch rename to patches/server/0737-Preserve-overstacked-loot.patch diff --git a/patches/server/0739-Update-head-rotation-in-missing-places.patch b/patches/server/0738-Update-head-rotation-in-missing-places.patch similarity index 100% rename from patches/server/0739-Update-head-rotation-in-missing-places.patch rename to patches/server/0738-Update-head-rotation-in-missing-places.patch diff --git a/patches/server/0740-prevent-unintended-light-block-manipulation.patch b/patches/server/0739-prevent-unintended-light-block-manipulation.patch similarity index 100% rename from patches/server/0740-prevent-unintended-light-block-manipulation.patch rename to patches/server/0739-prevent-unintended-light-block-manipulation.patch diff --git a/patches/server/0741-Fix-CraftCriteria-defaults-map.patch b/patches/server/0740-Fix-CraftCriteria-defaults-map.patch similarity index 100% rename from patches/server/0741-Fix-CraftCriteria-defaults-map.patch rename to patches/server/0740-Fix-CraftCriteria-defaults-map.patch diff --git a/patches/server/0742-Fix-upstreams-block-state-factories.patch b/patches/server/0741-Fix-upstreams-block-state-factories.patch similarity index 100% rename from patches/server/0742-Fix-upstreams-block-state-factories.patch rename to patches/server/0741-Fix-upstreams-block-state-factories.patch diff --git a/patches/server/0743-Add-config-option-for-logging-player-ip-addresses.patch b/patches/server/0742-Add-config-option-for-logging-player-ip-addresses.patch similarity index 100% rename from patches/server/0743-Add-config-option-for-logging-player-ip-addresses.patch rename to patches/server/0742-Add-config-option-for-logging-player-ip-addresses.patch diff --git a/patches/server/0744-Configurable-feature-seeds.patch b/patches/server/0743-Configurable-feature-seeds.patch similarity index 100% rename from patches/server/0744-Configurable-feature-seeds.patch rename to patches/server/0743-Configurable-feature-seeds.patch diff --git a/patches/server/0745-VanillaCommandWrapper-didnt-account-for-entity-sende.patch b/patches/server/0744-VanillaCommandWrapper-didnt-account-for-entity-sende.patch similarity index 100% rename from patches/server/0745-VanillaCommandWrapper-didnt-account-for-entity-sende.patch rename to patches/server/0744-VanillaCommandWrapper-didnt-account-for-entity-sende.patch diff --git a/patches/server/0746-Add-root-admin-user-detection.patch b/patches/server/0745-Add-root-admin-user-detection.patch similarity index 100% rename from patches/server/0746-Add-root-admin-user-detection.patch rename to patches/server/0745-Add-root-admin-user-detection.patch diff --git a/patches/server/0747-Always-allow-item-changing-in-Fireball.patch b/patches/server/0746-Always-allow-item-changing-in-Fireball.patch similarity index 100% rename from patches/server/0747-Always-allow-item-changing-in-Fireball.patch rename to patches/server/0746-Always-allow-item-changing-in-Fireball.patch diff --git a/patches/server/0748-don-t-attempt-to-teleport-dead-entities.patch b/patches/server/0747-don-t-attempt-to-teleport-dead-entities.patch similarity index 100% rename from patches/server/0748-don-t-attempt-to-teleport-dead-entities.patch rename to patches/server/0747-don-t-attempt-to-teleport-dead-entities.patch diff --git a/patches/server/0749-Prevent-excessive-velocity-through-repeated-crits.patch b/patches/server/0748-Prevent-excessive-velocity-through-repeated-crits.patch similarity index 100% rename from patches/server/0749-Prevent-excessive-velocity-through-repeated-crits.patch rename to patches/server/0748-Prevent-excessive-velocity-through-repeated-crits.patch diff --git a/patches/server/0750-Remove-client-side-code-using-deprecated-for-removal.patch b/patches/server/0749-Remove-client-side-code-using-deprecated-for-removal.patch similarity index 100% rename from patches/server/0750-Remove-client-side-code-using-deprecated-for-removal.patch rename to patches/server/0749-Remove-client-side-code-using-deprecated-for-removal.patch diff --git a/patches/server/0751-Always-parse-protochunk-light-sources-unless-it-is-m.patch b/patches/server/0750-Always-parse-protochunk-light-sources-unless-it-is-m.patch similarity index 100% rename from patches/server/0751-Always-parse-protochunk-light-sources-unless-it-is-m.patch rename to patches/server/0750-Always-parse-protochunk-light-sources-unless-it-is-m.patch diff --git a/patches/server/0752-Fix-removing-recipes-from-RecipeIterator.patch b/patches/server/0751-Fix-removing-recipes-from-RecipeIterator.patch similarity index 100% rename from patches/server/0752-Fix-removing-recipes-from-RecipeIterator.patch rename to patches/server/0751-Fix-removing-recipes-from-RecipeIterator.patch diff --git a/patches/server/0753-Prevent-sending-oversized-item-data-in-equipment-and.patch b/patches/server/0752-Prevent-sending-oversized-item-data-in-equipment-and.patch similarity index 100% rename from patches/server/0753-Prevent-sending-oversized-item-data-in-equipment-and.patch rename to patches/server/0752-Prevent-sending-oversized-item-data-in-equipment-and.patch diff --git a/patches/server/0754-Hide-unnecessary-itemmeta-from-clients.patch b/patches/server/0753-Hide-unnecessary-itemmeta-from-clients.patch similarity index 97% rename from patches/server/0754-Hide-unnecessary-itemmeta-from-clients.patch rename to patches/server/0753-Hide-unnecessary-itemmeta-from-clients.patch index 10544cf651..15d77ef391 100644 --- a/patches/server/0754-Hide-unnecessary-itemmeta-from-clients.patch +++ b/patches/server/0753-Hide-unnecessary-itemmeta-from-clients.patch @@ -18,10 +18,10 @@ index d2fed123ed56eaf550ac2c7a3fcc1678a127bba3..77443525e68fab0211ff48af12020ff0 } } diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 2b7abf42c08672194cc460e6e74e6f8e5f3c7443..ef8ce274f4085a76b4a7dc4ab37a110069f83537 100644 +index 411b555415f90504adadddc67387276ba340f360..cc667a99b17fb8f87e75e552964a8cef66c19131 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2677,8 +2677,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2683,8 +2683,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic // Refresh the current entity metadata entity.getEntityData().refresh(player); // SPIGOT-7136 - Allays diff --git a/patches/server/0755-Fix-Spigot-growth-modifiers.patch b/patches/server/0754-Fix-Spigot-growth-modifiers.patch similarity index 100% rename from patches/server/0755-Fix-Spigot-growth-modifiers.patch rename to patches/server/0754-Fix-Spigot-growth-modifiers.patch diff --git a/patches/server/0756-Prevent-ContainerOpenersCounter-openCount-from-going.patch b/patches/server/0755-Prevent-ContainerOpenersCounter-openCount-from-going.patch similarity index 100% rename from patches/server/0756-Prevent-ContainerOpenersCounter-openCount-from-going.patch rename to patches/server/0755-Prevent-ContainerOpenersCounter-openCount-from-going.patch diff --git a/patches/server/0757-Add-PlayerItemFrameChangeEvent.patch b/patches/server/0756-Add-PlayerItemFrameChangeEvent.patch similarity index 100% rename from patches/server/0757-Add-PlayerItemFrameChangeEvent.patch rename to patches/server/0756-Add-PlayerItemFrameChangeEvent.patch diff --git a/patches/server/0758-Add-player-health-update-API.patch b/patches/server/0757-Add-player-health-update-API.patch similarity index 88% rename from patches/server/0758-Add-player-health-update-API.patch rename to patches/server/0757-Add-player-health-update-API.patch index 012de4570c..7bba3bae3b 100644 --- a/patches/server/0758-Add-player-health-update-API.patch +++ b/patches/server/0757-Add-player-health-update-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add player health update API diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 3dbd458caf6098c57ca654fd17783e231abcfd43..9b3d37e408522cad6eb3cca280b7078a73794f1f 100644 +index 485cbeeae012383ec959503c8b909441c25fa4d1..070eaaf9b92757ead4cba398025412f68fcb8bc9 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -2228,9 +2228,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -2247,9 +2247,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player { this.getHandle().maxHealthCache = getMaxHealth(); } @@ -22,7 +22,7 @@ index 3dbd458caf6098c57ca654fd17783e231abcfd43..9b3d37e408522cad6eb3cca280b7078a if (this.getHandle().queueHealthUpdatePacket) { this.getHandle().queuedHealthUpdatePacket = packet; } else { -@@ -2238,7 +2240,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -2257,7 +2259,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } // Paper end } diff --git a/patches/server/0759-Optimize-HashMapPalette.patch b/patches/server/0758-Optimize-HashMapPalette.patch similarity index 100% rename from patches/server/0759-Optimize-HashMapPalette.patch rename to patches/server/0758-Optimize-HashMapPalette.patch diff --git a/patches/server/0760-Allow-delegation-to-vanilla-chunk-gen.patch b/patches/server/0759-Allow-delegation-to-vanilla-chunk-gen.patch similarity index 97% rename from patches/server/0760-Allow-delegation-to-vanilla-chunk-gen.patch rename to patches/server/0759-Allow-delegation-to-vanilla-chunk-gen.patch index c8c346c8fd..41f75dfd1f 100644 --- a/patches/server/0760-Allow-delegation-to-vanilla-chunk-gen.patch +++ b/patches/server/0759-Allow-delegation-to-vanilla-chunk-gen.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Allow delegation to vanilla chunk gen diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 9ab3f3a490e55211670e2847f03bd4f8229162da..74c2bb3de8b5bfc3b285a19a322cfe308a9b88f2 100644 +index ed7c94b31db6f759c5e24bee01ba6d5df266a126..a47deed87d662e39981abfa03eed23785f4862ff 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2356,6 +2356,90 @@ public final class CraftServer implements Server { +@@ -2339,6 +2339,90 @@ public final class CraftServer implements Server { return new OldCraftChunkData(world.getMinHeight(), world.getMaxHeight(), handle.registryAccess().registryOrThrow(Registries.BIOME), world); // Paper - Anti-Xray - Add parameters } diff --git a/patches/server/0761-Highly-optimise-single-and-multi-AABB-VoxelShapes-an.patch b/patches/server/0760-Highly-optimise-single-and-multi-AABB-VoxelShapes-an.patch similarity index 99% rename from patches/server/0761-Highly-optimise-single-and-multi-AABB-VoxelShapes-an.patch rename to patches/server/0760-Highly-optimise-single-and-multi-AABB-VoxelShapes-an.patch index ba54a7286b..b878128eec 100644 --- a/patches/server/0761-Highly-optimise-single-and-multi-AABB-VoxelShapes-an.patch +++ b/patches/server/0760-Highly-optimise-single-and-multi-AABB-VoxelShapes-an.patch @@ -1180,7 +1180,7 @@ index 0000000000000000000000000000000000000000..d67a40e7be030142443680c89e1763fc + } +} diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index e1b59a1e6fd957b45f0a73eb51487e44108af34c..2e3d5b38ace99ce99a8107e750c5eeaf281c8552 100644 +index d5b0777219c78aaff5c87fe8f422e67952ac241b..0c212a2136b4d275aa0d7e31af19f90d96cca2ac 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -411,7 +411,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0762-Optimise-collision-checking-in-player-move-packet-ha.patch b/patches/server/0761-Optimise-collision-checking-in-player-move-packet-ha.patch similarity index 99% rename from patches/server/0762-Optimise-collision-checking-in-player-move-packet-ha.patch rename to patches/server/0761-Optimise-collision-checking-in-player-move-packet-ha.patch index 577d48217f..4e03570d78 100644 --- a/patches/server/0762-Optimise-collision-checking-in-player-move-packet-ha.patch +++ b/patches/server/0761-Optimise-collision-checking-in-player-move-packet-ha.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Optimise collision checking in player move packet handling Move collision logic to just the hasNewCollision call instead of getCubes + hasNewCollision diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index ef8ce274f4085a76b4a7dc4ab37a110069f83537..60024e98de6a910e4db6d45d6be427a0dea6f568 100644 +index cc667a99b17fb8f87e75e552964a8cef66c19131..5adbb9bf95df8940d55f66b1e583a11e3d5c925a 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -643,7 +643,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic diff --git a/patches/server/0763-Fix-ChunkSnapshot-isSectionEmpty-int-and-optimize-Pa.patch b/patches/server/0762-Fix-ChunkSnapshot-isSectionEmpty-int-and-optimize-Pa.patch similarity index 66% rename from patches/server/0763-Fix-ChunkSnapshot-isSectionEmpty-int-and-optimize-Pa.patch rename to patches/server/0762-Fix-ChunkSnapshot-isSectionEmpty-int-and-optimize-Pa.patch index f62838aadb..13937bc043 100644 --- a/patches/server/0763-Fix-ChunkSnapshot-isSectionEmpty-int-and-optimize-Pa.patch +++ b/patches/server/0762-Fix-ChunkSnapshot-isSectionEmpty-int-and-optimize-Pa.patch @@ -6,14 +6,14 @@ Subject: [PATCH] Fix ChunkSnapshot#isSectionEmpty(int) and optimize diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java -index 1ac0778fba70ba9f09487c76e086b5a873c6c12a..f7e19bb7d2ff8f8aaf061cec16462913d77c10d5 100644 +index 0fadc763fb482cf9f3b51ed44427029bec9f7f63..edb726d7db0c2e1c276458c997bbfed9b76b69d4 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java -@@ -284,13 +284,17 @@ public class CraftChunk implements Chunk { - PalettedContainerRO>[] biome = (includeBiome || includeBiomeTempRain) ? new PalettedContainer[cs.length] : null; +@@ -298,13 +298,17 @@ public class CraftChunk implements Chunk { + PalettedContainerRO>[] biome = (includeBiome || includeBiomeTempRain) ? new PalettedContainer[cs.length] : null; - Registry iregistry = this.worldServer.registryAccess().registryOrThrow(Registries.BIOME); -- Codec>> biomeCodec = PalettedContainer.codecRO(iregistry.asHolderIdMap(), iregistry.holderByNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, iregistry.getHolderOrThrow(Biomes.PLAINS)); + Registry iregistry = this.worldServer.registryAccess().registryOrThrow(Registries.BIOME); +- Codec>> biomeCodec = PalettedContainer.codecRO(iregistry.asHolderIdMap(), iregistry.holderByNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, iregistry.getHolderOrThrow(Biomes.PLAINS)); for (int i = 0; i < cs.length; i++) { - CompoundTag data = new CompoundTag(); @@ -31,13 +31,13 @@ index 1ac0778fba70ba9f09487c76e086b5a873c6c12a..f7e19bb7d2ff8f8aaf061cec16462913 LevelLightEngine lightengine = chunk.level.getLightEngine(); DataLayer skyLightArray = lightengine.getLayerListener(LightLayer.SKY).getDataLayerData(SectionPos.of(x, i, z)); -@@ -309,8 +313,7 @@ public class CraftChunk implements Chunk { +@@ -323,8 +327,7 @@ public class CraftChunk implements Chunk { } if (biome != null) { - data.put("biomes", biomeCodec.encodeStart(NbtOps.INSTANCE, cs[i].getBiomes()).get().left().get()); - biome[i] = biomeCodec.parse(NbtOps.INSTANCE, data.getCompound("biomes")).get().left().get(); -+ biome[i] = ((PalettedContainer>) cs[i].getBiomes()).copy(); // Paper - use copy instead of round tripping with codecs ++ biome[i] = ((PalettedContainer>) cs[i].getBiomes()).copy(); // Paper - use copy instead of round tripping with codecs } } diff --git a/patches/server/0764-Add-more-Campfire-API.patch b/patches/server/0763-Add-more-Campfire-API.patch similarity index 92% rename from patches/server/0764-Add-more-Campfire-API.patch rename to patches/server/0763-Add-more-Campfire-API.patch index 5761fef3d0..db98ffe8ae 100644 --- a/patches/server/0764-Add-more-Campfire-API.patch +++ b/patches/server/0763-Add-more-Campfire-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add more Campfire API diff --git a/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java -index 06df710f58ca7d55b19c0db9d393a73ca6e5aa79..830326496e2f961682daadc7a7859247042b4cdd 100644 +index 0f7e765263a09a3f8b021bbac8d062c72ab3bdc0..01d8f1c985223eec83beb4a84a710d1bf8d70849 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java -@@ -39,6 +39,7 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable { +@@ -41,6 +41,7 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable { public final int[] cookingProgress; public final int[] cookingTime; private final RecipeManager.CachedCheck quickCheck; @@ -16,7 +16,7 @@ index 06df710f58ca7d55b19c0db9d393a73ca6e5aa79..830326496e2f961682daadc7a7859247 public CampfireBlockEntity(BlockPos pos, BlockState state) { super(BlockEntityType.CAMPFIRE, pos, state); -@@ -46,6 +47,7 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable { +@@ -48,6 +49,7 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable { this.cookingProgress = new int[4]; this.cookingTime = new int[4]; this.quickCheck = RecipeManager.createCheck(RecipeType.CAMPFIRE_COOKING); @@ -24,7 +24,7 @@ index 06df710f58ca7d55b19c0db9d393a73ca6e5aa79..830326496e2f961682daadc7a7859247 } public static void cookTick(Level world, BlockPos pos, BlockState state, CampfireBlockEntity campfire) { -@@ -56,7 +58,9 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable { +@@ -58,7 +60,9 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable { if (!itemstack.isEmpty()) { flag = true; @@ -34,7 +34,7 @@ index 06df710f58ca7d55b19c0db9d393a73ca6e5aa79..830326496e2f961682daadc7a7859247 if (campfire.cookingProgress[i] >= campfire.cookingTime[i]) { SimpleContainer inventorysubcontainer = new SimpleContainer(new ItemStack[]{itemstack}); -@@ -165,6 +169,16 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable { +@@ -167,6 +171,16 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable { System.arraycopy(aint, 0, this.cookingTime, 0, Math.min(this.cookingTime.length, aint.length)); } @@ -51,7 +51,7 @@ index 06df710f58ca7d55b19c0db9d393a73ca6e5aa79..830326496e2f961682daadc7a7859247 } @Override -@@ -173,6 +187,13 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable { +@@ -175,6 +189,13 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable { ContainerHelper.saveAllItems(nbt, this.items, true); nbt.putIntArray("CookingTimes", this.cookingProgress); nbt.putIntArray("CookingTotalTimes", this.cookingTime); diff --git a/patches/server/0765-Only-write-chunk-data-to-disk-if-it-serializes-witho.patch b/patches/server/0764-Only-write-chunk-data-to-disk-if-it-serializes-witho.patch similarity index 100% rename from patches/server/0765-Only-write-chunk-data-to-disk-if-it-serializes-witho.patch rename to patches/server/0764-Only-write-chunk-data-to-disk-if-it-serializes-witho.patch diff --git a/patches/server/0766-Fix-tripwire-state-inconsistency.patch b/patches/server/0765-Fix-tripwire-state-inconsistency.patch similarity index 100% rename from patches/server/0766-Fix-tripwire-state-inconsistency.patch rename to patches/server/0765-Fix-tripwire-state-inconsistency.patch diff --git a/patches/server/0767-Forward-CraftEntity-in-teleport-command.patch b/patches/server/0766-Forward-CraftEntity-in-teleport-command.patch similarity index 100% rename from patches/server/0767-Forward-CraftEntity-in-teleport-command.patch rename to patches/server/0766-Forward-CraftEntity-in-teleport-command.patch diff --git a/patches/server/0768-Improve-scoreboard-entries.patch b/patches/server/0767-Improve-scoreboard-entries.patch similarity index 100% rename from patches/server/0768-Improve-scoreboard-entries.patch rename to patches/server/0767-Improve-scoreboard-entries.patch diff --git a/patches/server/0769-Entity-powdered-snow-API.patch b/patches/server/0768-Entity-powdered-snow-API.patch similarity index 100% rename from patches/server/0769-Entity-powdered-snow-API.patch rename to patches/server/0768-Entity-powdered-snow-API.patch diff --git a/patches/server/0770-Add-API-for-item-entity-health.patch b/patches/server/0769-Add-API-for-item-entity-health.patch similarity index 100% rename from patches/server/0770-Add-API-for-item-entity-health.patch rename to patches/server/0769-Add-API-for-item-entity-health.patch diff --git a/patches/server/0771-Fix-entity-type-tags-suggestions-in-selectors.patch b/patches/server/0770-Fix-entity-type-tags-suggestions-in-selectors.patch similarity index 96% rename from patches/server/0771-Fix-entity-type-tags-suggestions-in-selectors.patch rename to patches/server/0770-Fix-entity-type-tags-suggestions-in-selectors.patch index 2d602e1ad6..b5600ffa3e 100644 --- a/patches/server/0771-Fix-entity-type-tags-suggestions-in-selectors.patch +++ b/patches/server/0770-Fix-entity-type-tags-suggestions-in-selectors.patch @@ -10,10 +10,10 @@ when if this was fixed on the client, that wouldn't be needed. Mojira Issue: https://bugs.mojang.com/browse/MC-235045 diff --git a/src/main/java/net/minecraft/commands/CommandSourceStack.java b/src/main/java/net/minecraft/commands/CommandSourceStack.java -index c2af60bdb755034e46b85143826a29c4482d58f5..ae5dd08de75a7ed231295f306fd0974da3988249 100644 +index 24172c3b7b1d2faa13b18bedf89ad051267feb6c..7b6b51392b123d34382233adcf4c3d4867bdaa32 100644 --- a/src/main/java/net/minecraft/commands/CommandSourceStack.java +++ b/src/main/java/net/minecraft/commands/CommandSourceStack.java -@@ -416,4 +416,20 @@ public class CommandSourceStack implements SharedSuggestionProvider, com.destroy +@@ -421,4 +421,20 @@ public class CommandSourceStack implements SharedSuggestionProvider, com.destroy return this.source.getBukkitSender(this); } // CraftBukkit end @@ -35,10 +35,10 @@ index c2af60bdb755034e46b85143826a29c4482d58f5..ae5dd08de75a7ed231295f306fd0974d + // Paper end } diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java -index 9cf69ef59ef4330a69753cab7aa8ec7716587d32..6a82d83bca27b3b023d9d6771d194b4db9c97dc2 100644 +index f2b312367895f121bcf4135c12dfdb354f32dddb..401a87de8fc48b9e69423d547f79e9e356cc20f1 100644 --- a/src/main/java/net/minecraft/commands/Commands.java +++ b/src/main/java/net/minecraft/commands/Commands.java -@@ -441,6 +441,7 @@ public class Commands { +@@ -464,6 +464,7 @@ public class Commands { private void fillUsableCommands(CommandNode tree, CommandNode result, CommandSourceStack source, Map, CommandNode> resultNodes) { Iterator iterator = tree.getChildren().iterator(); @@ -46,7 +46,7 @@ index 9cf69ef59ef4330a69753cab7aa8ec7716587d32..6a82d83bca27b3b023d9d6771d194b4d while (iterator.hasNext()) { CommandNode commandnode2 = (CommandNode) iterator.next(); // Paper start -@@ -467,6 +468,12 @@ public class Commands { +@@ -490,6 +491,12 @@ public class Commands { if (requiredargumentbuilder.getSuggestionsProvider() != null) { requiredargumentbuilder.suggests(SuggestionProviders.safelySwap(requiredargumentbuilder.getSuggestionsProvider())); diff --git a/patches/server/0772-Configurable-max-block-light-for-monster-spawning.patch b/patches/server/0771-Configurable-max-block-light-for-monster-spawning.patch similarity index 100% rename from patches/server/0772-Configurable-max-block-light-for-monster-spawning.patch rename to patches/server/0771-Configurable-max-block-light-for-monster-spawning.patch diff --git a/patches/server/0773-Fix-sticky-pistons-and-BlockPistonRetractEvent.patch b/patches/server/0772-Fix-sticky-pistons-and-BlockPistonRetractEvent.patch similarity index 100% rename from patches/server/0773-Fix-sticky-pistons-and-BlockPistonRetractEvent.patch rename to patches/server/0772-Fix-sticky-pistons-and-BlockPistonRetractEvent.patch diff --git a/patches/server/0774-Load-effect-amplifiers-greater-than-127-correctly.patch b/patches/server/0773-Load-effect-amplifiers-greater-than-127-correctly.patch similarity index 100% rename from patches/server/0774-Load-effect-amplifiers-greater-than-127-correctly.patch rename to patches/server/0773-Load-effect-amplifiers-greater-than-127-correctly.patch diff --git a/patches/server/0775-Expose-isFuel-and-canSmelt-methods-to-FurnaceInvento.patch b/patches/server/0774-Expose-isFuel-and-canSmelt-methods-to-FurnaceInvento.patch similarity index 100% rename from patches/server/0775-Expose-isFuel-and-canSmelt-methods-to-FurnaceInvento.patch rename to patches/server/0774-Expose-isFuel-and-canSmelt-methods-to-FurnaceInvento.patch diff --git a/patches/server/0776-Fix-bees-aging-inside-hives.patch b/patches/server/0775-Fix-bees-aging-inside-hives.patch similarity index 100% rename from patches/server/0776-Fix-bees-aging-inside-hives.patch rename to patches/server/0775-Fix-bees-aging-inside-hives.patch diff --git a/patches/server/0777-Bucketable-API.patch b/patches/server/0776-Bucketable-API.patch similarity index 100% rename from patches/server/0777-Bucketable-API.patch rename to patches/server/0776-Bucketable-API.patch diff --git a/patches/server/0778-Validate-usernames.patch b/patches/server/0777-Validate-usernames.patch similarity index 100% rename from patches/server/0778-Validate-usernames.patch rename to patches/server/0777-Validate-usernames.patch diff --git a/patches/server/0779-Make-water-animal-spawn-height-configurable.patch b/patches/server/0778-Make-water-animal-spawn-height-configurable.patch similarity index 100% rename from patches/server/0779-Make-water-animal-spawn-height-configurable.patch rename to patches/server/0778-Make-water-animal-spawn-height-configurable.patch diff --git a/patches/server/0780-Expose-vanilla-BiomeProvider-from-WorldInfo.patch b/patches/server/0779-Expose-vanilla-BiomeProvider-from-WorldInfo.patch similarity index 97% rename from patches/server/0780-Expose-vanilla-BiomeProvider-from-WorldInfo.patch rename to patches/server/0779-Expose-vanilla-BiomeProvider-from-WorldInfo.patch index 868eef4b9d..0dfbdd9499 100644 --- a/patches/server/0780-Expose-vanilla-BiomeProvider-from-WorldInfo.patch +++ b/patches/server/0779-Expose-vanilla-BiomeProvider-from-WorldInfo.patch @@ -18,10 +18,10 @@ index 0868805c78d991c602d8f1d1b5aeb5c790c13384..6986d5475b090bca60b5ae892512fd5e biomeProvider = gen.getDefaultBiomeProvider(worldInfo); } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 74c2bb3de8b5bfc3b285a19a322cfe308a9b88f2..9d8b856132f20d94b928d4e343ede2e027e122b0 100644 +index a47deed87d662e39981abfa03eed23785f4862ff..aa3387361b9f5b73ed5ecfb12b826f8a17d2623a 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1239,7 +1239,7 @@ public final class CraftServer implements Server { +@@ -1222,7 +1222,7 @@ public final class CraftServer implements Server { List list = ImmutableList.of(new PhantomSpawner(), new PatrolSpawner(), new CatSpawner(), new VillageSiege(), new WanderingTraderSpawner(worlddata)); LevelStem worlddimension = iregistry.get(actualDimension); @@ -31,7 +31,7 @@ index 74c2bb3de8b5bfc3b285a19a322cfe308a9b88f2..9d8b856132f20d94b928d4e343ede2e0 biomeProvider = generator.getDefaultBiomeProvider(worldInfo); } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index c093401834d7111857a0d49e60faa36ee22aae40..bbef20b0be264b429bcb037ae6740120d4113bb0 100644 +index c8e798cb13ffc1800fb04cdf0516a1f787f1da56..24366ba6c95284b18d6caa3205efd86efe61aadd 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -199,6 +199,30 @@ public class CraftWorld extends CraftRegionAccessor implements World { diff --git a/patches/server/0781-Add-config-option-for-worlds-affected-by-time-cmd.patch b/patches/server/0780-Add-config-option-for-worlds-affected-by-time-cmd.patch similarity index 100% rename from patches/server/0781-Add-config-option-for-worlds-affected-by-time-cmd.patch rename to patches/server/0780-Add-config-option-for-worlds-affected-by-time-cmd.patch diff --git a/patches/server/0782-Add-new-overload-to-PersistentDataContainer-has.patch b/patches/server/0781-Add-new-overload-to-PersistentDataContainer-has.patch similarity index 100% rename from patches/server/0782-Add-new-overload-to-PersistentDataContainer-has.patch rename to patches/server/0781-Add-new-overload-to-PersistentDataContainer-has.patch diff --git a/patches/server/0783-Multiple-Entries-with-Scoreboards.patch b/patches/server/0782-Multiple-Entries-with-Scoreboards.patch similarity index 100% rename from patches/server/0783-Multiple-Entries-with-Scoreboards.patch rename to patches/server/0782-Multiple-Entries-with-Scoreboards.patch diff --git a/patches/server/0784-Reset-placed-block-on-exception.patch b/patches/server/0783-Reset-placed-block-on-exception.patch similarity index 100% rename from patches/server/0784-Reset-placed-block-on-exception.patch rename to patches/server/0783-Reset-placed-block-on-exception.patch diff --git a/patches/server/0785-Add-configurable-height-for-slime-spawn.patch b/patches/server/0784-Add-configurable-height-for-slime-spawn.patch similarity index 100% rename from patches/server/0785-Add-configurable-height-for-slime-spawn.patch rename to patches/server/0784-Add-configurable-height-for-slime-spawn.patch diff --git a/patches/server/0786-Added-getHostname-to-AsyncPlayerPreLoginEvent.patch b/patches/server/0785-Added-getHostname-to-AsyncPlayerPreLoginEvent.patch similarity index 100% rename from patches/server/0786-Added-getHostname-to-AsyncPlayerPreLoginEvent.patch rename to patches/server/0785-Added-getHostname-to-AsyncPlayerPreLoginEvent.patch diff --git a/patches/server/0787-Fix-xp-reward-for-baby-zombies.patch b/patches/server/0786-Fix-xp-reward-for-baby-zombies.patch similarity index 100% rename from patches/server/0787-Fix-xp-reward-for-baby-zombies.patch rename to patches/server/0786-Fix-xp-reward-for-baby-zombies.patch diff --git a/patches/server/0788-Kick-on-main-for-illegal-chat.patch b/patches/server/0787-Kick-on-main-for-illegal-chat.patch similarity index 97% rename from patches/server/0788-Kick-on-main-for-illegal-chat.patch rename to patches/server/0787-Kick-on-main-for-illegal-chat.patch index 0edc1567db..d25f2adee2 100644 --- a/patches/server/0788-Kick-on-main-for-illegal-chat.patch +++ b/patches/server/0787-Kick-on-main-for-illegal-chat.patch @@ -7,7 +7,7 @@ Makes the PlayerKickEvent fire on the main thread for illegal characters or chat out-of-order errors. diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 60024e98de6a910e4db6d45d6be427a0dea6f568..c50ac593ad5db6b65015151bcc26a9b8ed510ba5 100644 +index 5adbb9bf95df8940d55f66b1e583a11e3d5c925a..2e1141b7672907b1a0b807e4e0e0d5233480e5d6 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -2168,7 +2168,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic diff --git a/patches/server/0789-Multi-Block-Change-API-Implementation.patch b/patches/server/0788-Multi-Block-Change-API-Implementation.patch similarity index 95% rename from patches/server/0789-Multi-Block-Change-API-Implementation.patch rename to patches/server/0788-Multi-Block-Change-API-Implementation.patch index bd09f7eab0..3013eb9b82 100644 --- a/patches/server/0789-Multi-Block-Change-API-Implementation.patch +++ b/patches/server/0788-Multi-Block-Change-API-Implementation.patch @@ -25,10 +25,10 @@ index 0d851e197e65ec79386ad1f981f6d1d38b65124a..24c677e80af652952263253409c05064 public void write(FriendlyByteBuf buf) { buf.writeLong(this.sectionPos.asLong()); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 9b3d37e408522cad6eb3cca280b7078a73794f1f..1ca03597ce9ca9b47017979d919f9082c21cdd45 100644 +index 070eaaf9b92757ead4cba398025412f68fcb8bc9..118a671cdeee8c5fd051192b7b72ad63f79e7eca 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -930,6 +930,35 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -943,6 +943,35 @@ public class CraftPlayer extends CraftHumanEntity implements Player { this.getHandle().connection.send(packet); } diff --git a/patches/server/0790-Fix-NotePlayEvent.patch b/patches/server/0789-Fix-NotePlayEvent.patch similarity index 100% rename from patches/server/0790-Fix-NotePlayEvent.patch rename to patches/server/0789-Fix-NotePlayEvent.patch diff --git a/patches/server/0791-Freeze-Tick-Lock-API.patch b/patches/server/0790-Freeze-Tick-Lock-API.patch similarity index 100% rename from patches/server/0791-Freeze-Tick-Lock-API.patch rename to patches/server/0790-Freeze-Tick-Lock-API.patch diff --git a/patches/server/0792-Dolphin-API.patch b/patches/server/0791-Dolphin-API.patch similarity index 100% rename from patches/server/0792-Dolphin-API.patch rename to patches/server/0791-Dolphin-API.patch diff --git a/patches/server/0793-More-PotionEffectType-API.patch b/patches/server/0792-More-PotionEffectType-API.patch similarity index 100% rename from patches/server/0793-More-PotionEffectType-API.patch rename to patches/server/0792-More-PotionEffectType-API.patch diff --git a/patches/server/0794-Use-a-CHM-for-StructureTemplate.Pallete-cache.patch b/patches/server/0793-Use-a-CHM-for-StructureTemplate.Pallete-cache.patch similarity index 100% rename from patches/server/0794-Use-a-CHM-for-StructureTemplate.Pallete-cache.patch rename to patches/server/0793-Use-a-CHM-for-StructureTemplate.Pallete-cache.patch diff --git a/patches/server/0795-API-for-creating-command-sender-which-forwards-feedb.patch b/patches/server/0794-API-for-creating-command-sender-which-forwards-feedb.patch similarity index 97% rename from patches/server/0795-API-for-creating-command-sender-which-forwards-feedb.patch rename to patches/server/0794-API-for-creating-command-sender-which-forwards-feedb.patch index 3e52cb21e5..a35004a1c8 100644 --- a/patches/server/0795-API-for-creating-command-sender-which-forwards-feedb.patch +++ b/patches/server/0794-API-for-creating-command-sender-which-forwards-feedb.patch @@ -122,10 +122,10 @@ index 0000000000000000000000000000000000000000..e3a5f1ec376319bdfda87fa27ae217bf + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 9d8b856132f20d94b928d4e343ede2e027e122b0..a03bb7341d07c39d2a8740823e4cf341b294236e 100644 +index aa3387361b9f5b73ed5ecfb12b826f8a17d2623a..944f9dec587ed17c737846362f63e947a99bc173 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2017,6 +2017,13 @@ public final class CraftServer implements Server { +@@ -2000,6 +2000,13 @@ public final class CraftServer implements Server { return console.console; } diff --git a/patches/server/0796-Add-missing-structure-set-seed-configs.patch b/patches/server/0795-Add-missing-structure-set-seed-configs.patch similarity index 100% rename from patches/server/0796-Add-missing-structure-set-seed-configs.patch rename to patches/server/0795-Add-missing-structure-set-seed-configs.patch diff --git a/patches/server/0797-Implement-regenerateChunk.patch b/patches/server/0796-Implement-regenerateChunk.patch similarity index 98% rename from patches/server/0797-Implement-regenerateChunk.patch rename to patches/server/0796-Implement-regenerateChunk.patch index 65c36cccb0..1fe79c280b 100644 --- a/patches/server/0797-Implement-regenerateChunk.patch +++ b/patches/server/0796-Implement-regenerateChunk.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Implement regenerateChunk Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com> diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index bbef20b0be264b429bcb037ae6740120d4113bb0..36bdc4aa5356ddcf9353c28a6ef15cd8c6aa4a47 100644 +index 24366ba6c95284b18d6caa3205efd86efe61aadd..0f13354db729fbc5ad299dd36ba54f64332ca21f 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -138,6 +138,7 @@ import org.bukkit.util.Vector; diff --git a/patches/server/0798-Fix-cancelled-powdered-snow-bucket-placement.patch b/patches/server/0797-Fix-cancelled-powdered-snow-bucket-placement.patch similarity index 96% rename from patches/server/0798-Fix-cancelled-powdered-snow-bucket-placement.patch rename to patches/server/0797-Fix-cancelled-powdered-snow-bucket-placement.patch index c37348f1c6..cc0ba1ea78 100644 --- a/patches/server/0798-Fix-cancelled-powdered-snow-bucket-placement.patch +++ b/patches/server/0797-Fix-cancelled-powdered-snow-bucket-placement.patch @@ -20,7 +20,7 @@ index e581dc10f3c805f7f8b6e4c842092609e7e1a0f8..b0204af850ee182773ad458208cccd94 } return InteractionResult.FAIL; diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index a6858017ff9468dbf4651fe62faea487a54b3878..def4d9c5a9b311d002eb88729bdba73b30f99bb7 100644 +index 218065e92c2d0d1141359255f77eb6747dabce35..1d52646d68ff05a597a41495f288471ce60b2d29 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java @@ -345,7 +345,7 @@ public final class ItemStack { diff --git a/patches/server/0799-Add-missing-Validate-calls-to-CraftServer-getSpawnLi.patch b/patches/server/0798-Add-missing-Validate-calls-to-CraftServer-getSpawnLi.patch similarity index 86% rename from patches/server/0799-Add-missing-Validate-calls-to-CraftServer-getSpawnLi.patch rename to patches/server/0798-Add-missing-Validate-calls-to-CraftServer-getSpawnLi.patch index 4de2c32cbb..c05f61b9a8 100644 --- a/patches/server/0799-Add-missing-Validate-calls-to-CraftServer-getSpawnLi.patch +++ b/patches/server/0798-Add-missing-Validate-calls-to-CraftServer-getSpawnLi.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Add missing Validate calls to CraftServer#getSpawnLimit Copies appropriate checks from CraftWorld#getSpawnLimit diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index a03bb7341d07c39d2a8740823e4cf341b294236e..40e2a38317403d19ab53cb623aa1ba2502d6a4a7 100644 +index 944f9dec587ed17c737846362f63e947a99bc173..bbeab1eac527d06f867fb6a67c30e93be6642f8b 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2191,6 +2191,8 @@ public final class CraftServer implements Server { +@@ -2174,6 +2174,8 @@ public final class CraftServer implements Server { @Override public int getSpawnLimit(SpawnCategory spawnCategory) { // Paper start diff --git a/patches/server/0800-Add-GameEvent-tags.patch b/patches/server/0799-Add-GameEvent-tags.patch similarity index 95% rename from patches/server/0800-Add-GameEvent-tags.patch rename to patches/server/0799-Add-GameEvent-tags.patch index 0fedca5942..3a96665b2b 100644 --- a/patches/server/0800-Add-GameEvent-tags.patch +++ b/patches/server/0799-Add-GameEvent-tags.patch @@ -46,10 +46,10 @@ index 0000000000000000000000000000000000000000..e7d9fd2702a1ce96596580fff8f5ee4f + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 40e2a38317403d19ab53cb623aa1ba2502d6a4a7..42ca82adacc079044c50106c7490d341f16bbbbc 100644 +index bbeab1eac527d06f867fb6a67c30e93be6642f8b..782a0ed5b128912257571a527e9ba5e77204896e 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2602,6 +2602,15 @@ public final class CraftServer implements Server { +@@ -2585,6 +2585,15 @@ public final class CraftServer implements Server { return (org.bukkit.Tag) new CraftEntityTag(BuiltInRegistries.ENTITY_TYPE, entityTagKey); } } @@ -65,7 +65,7 @@ index 40e2a38317403d19ab53cb623aa1ba2502d6a4a7..42ca82adacc079044c50106c7490d341 default -> throw new IllegalArgumentException(); } -@@ -2634,6 +2643,13 @@ public final class CraftServer implements Server { +@@ -2617,6 +2626,13 @@ public final class CraftServer implements Server { net.minecraft.core.Registry> entityTags = BuiltInRegistries.ENTITY_TYPE; return entityTags.getTags().map(pair -> (org.bukkit.Tag) new CraftEntityTag(entityTags, pair.getFirst())).collect(ImmutableList.toImmutableList()); } diff --git a/patches/server/0801-Execute-chunk-tasks-fairly-for-worlds-while-waiting-.patch b/patches/server/0800-Execute-chunk-tasks-fairly-for-worlds-while-waiting-.patch similarity index 100% rename from patches/server/0801-Execute-chunk-tasks-fairly-for-worlds-while-waiting-.patch rename to patches/server/0800-Execute-chunk-tasks-fairly-for-worlds-while-waiting-.patch diff --git a/patches/server/0802-Furnace-RecipesUsed-API.patch b/patches/server/0801-Furnace-RecipesUsed-API.patch similarity index 100% rename from patches/server/0802-Furnace-RecipesUsed-API.patch rename to patches/server/0801-Furnace-RecipesUsed-API.patch diff --git a/patches/server/0803-Configurable-sculk-sensor-listener-range.patch b/patches/server/0802-Configurable-sculk-sensor-listener-range.patch similarity index 100% rename from patches/server/0803-Configurable-sculk-sensor-listener-range.patch rename to patches/server/0802-Configurable-sculk-sensor-listener-range.patch diff --git a/patches/server/0804-Add-missing-block-data-mins-and-maxes.patch b/patches/server/0803-Add-missing-block-data-mins-and-maxes.patch similarity index 100% rename from patches/server/0804-Add-missing-block-data-mins-and-maxes.patch rename to patches/server/0803-Add-missing-block-data-mins-and-maxes.patch diff --git a/patches/server/0805-Option-to-have-default-CustomSpawners-in-custom-worl.patch b/patches/server/0804-Option-to-have-default-CustomSpawners-in-custom-worl.patch similarity index 100% rename from patches/server/0805-Option-to-have-default-CustomSpawners-in-custom-worl.patch rename to patches/server/0804-Option-to-have-default-CustomSpawners-in-custom-worl.patch diff --git a/patches/server/0806-Put-world-into-worldlist-before-initing-the-world.patch b/patches/server/0805-Put-world-into-worldlist-before-initing-the-world.patch similarity index 92% rename from patches/server/0806-Put-world-into-worldlist-before-initing-the-world.patch rename to patches/server/0805-Put-world-into-worldlist-before-initing-the-world.patch index 84ba26d468..c27ddabb68 100644 --- a/patches/server/0806-Put-world-into-worldlist-before-initing-the-world.patch +++ b/patches/server/0805-Put-world-into-worldlist-before-initing-the-world.patch @@ -23,10 +23,10 @@ index d2409599c9d9765a2e1dc7418339923049abc416..f42d7d9e11542370489fcc8dc42ea6ec if (worlddata.getCustomBossEvents() != null) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 42ca82adacc079044c50106c7490d341f16bbbbc..0aab988ca42d0acdce003c3c69396737181e7104 100644 +index 782a0ed5b128912257571a527e9ba5e77204896e..e1cb7ae143b1d85cbea494e4694d34f0e954f64e 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1268,10 +1268,11 @@ public final class CraftServer implements Server { +@@ -1251,10 +1251,11 @@ public final class CraftServer implements Server { return null; } diff --git a/patches/server/0807-Fix-Entity-Position-Desync.patch b/patches/server/0806-Fix-Entity-Position-Desync.patch similarity index 100% rename from patches/server/0807-Fix-Entity-Position-Desync.patch rename to patches/server/0806-Fix-Entity-Position-Desync.patch diff --git a/patches/server/0808-Custom-Potion-Mixes.patch b/patches/server/0807-Custom-Potion-Mixes.patch similarity index 96% rename from patches/server/0808-Custom-Potion-Mixes.patch rename to patches/server/0807-Custom-Potion-Mixes.patch index f9e77e980d..2f01d4cdfb 100644 --- a/patches/server/0808-Custom-Potion-Mixes.patch +++ b/patches/server/0807-Custom-Potion-Mixes.patch @@ -151,10 +151,10 @@ index 421c2131fec0b7266c773c3f1983308f6921df6b..12d9556a11ac4ef2e7a62fcd2686d868 addContainer(Items.POTION); addContainer(Items.SPLASH_POTION); diff --git a/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java -index 3d688e334c7287f41460bd866bfd1155e8bb55d2..55006724ccec9f3de828ec18693728e9741ff65f 100644 +index cf2b6487a640a7a613f3b3604ca7b1063b3ff102..0bab2693b91d5bab222c7db8bc6965ccde954003 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java -@@ -335,7 +335,7 @@ public class BrewingStandBlockEntity extends BaseContainerBlockEntity implements +@@ -340,7 +340,7 @@ public class BrewingStandBlockEntity extends BaseContainerBlockEntity implements @Override public boolean canPlaceItem(int slot, ItemStack stack) { @@ -164,10 +164,10 @@ index 3d688e334c7287f41460bd866bfd1155e8bb55d2..55006724ccec9f3de828ec18693728e9 @Override diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 0aab988ca42d0acdce003c3c69396737181e7104..5eb52dce4ab8cf970dc5b4cddf7a38fbef689df1 100644 +index e1cb7ae143b1d85cbea494e4694d34f0e954f64e..7936ff9da40a6938268b7020ba751e3724eb1d72 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -298,6 +298,7 @@ public final class CraftServer implements Server { +@@ -299,6 +299,7 @@ public final class CraftServer implements Server { private final io.papermc.paper.datapack.PaperDatapackManager datapackManager; // Paper public static Exception excessiveVelEx; // Paper - Velocity warnings private final io.papermc.paper.logging.SysoutCatcher sysoutCatcher = new io.papermc.paper.logging.SysoutCatcher(); // Paper @@ -175,7 +175,7 @@ index 0aab988ca42d0acdce003c3c69396737181e7104..5eb52dce4ab8cf970dc5b4cddf7a38fb static { ConfigurationSerialization.registerClass(CraftOfflinePlayer.class); -@@ -324,7 +325,7 @@ public final class CraftServer implements Server { +@@ -326,7 +327,7 @@ public final class CraftServer implements Server { Enchantments.SHARPNESS.getClass(); org.bukkit.enchantments.Enchantment.stopAcceptingRegistrations(); @@ -184,7 +184,7 @@ index 0aab988ca42d0acdce003c3c69396737181e7104..5eb52dce4ab8cf970dc5b4cddf7a38fb MobEffects.BLINDNESS.getClass(); PotionEffectType.stopAcceptingRegistrations(); // Ugly hack :( -@@ -2923,5 +2924,10 @@ public final class CraftServer implements Server { +@@ -2906,5 +2907,10 @@ public final class CraftServer implements Server { return datapackManager; } diff --git a/patches/server/0810-Force-close-world-loading-screen.patch b/patches/server/0808-Force-close-world-loading-screen.patch similarity index 100% rename from patches/server/0810-Force-close-world-loading-screen.patch rename to patches/server/0808-Force-close-world-loading-screen.patch diff --git a/patches/server/0809-Fix-Fluid-tags-isTagged-method.patch b/patches/server/0809-Fix-Fluid-tags-isTagged-method.patch deleted file mode 100644 index adf5cdf802..0000000000 --- a/patches/server/0809-Fix-Fluid-tags-isTagged-method.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Tue, 1 Mar 2022 12:45:50 -0800 -Subject: [PATCH] Fix Fluid tags isTagged method - - -diff --git a/src/main/java/org/bukkit/craftbukkit/tag/CraftFluidTag.java b/src/main/java/org/bukkit/craftbukkit/tag/CraftFluidTag.java -index 89cb1ec575c0f58e9934d98b056621348dbbe27a..cdd474e9b0363641839a66d3e61fec46c735879a 100644 ---- a/src/main/java/org/bukkit/craftbukkit/tag/CraftFluidTag.java -+++ b/src/main/java/org/bukkit/craftbukkit/tag/CraftFluidTag.java -@@ -16,7 +16,7 @@ public class CraftFluidTag extends CraftTag 0) { + if (this.piercingIgnoreEntityIds == null) { diff --git a/patches/server/0814-More-Projectile-API.patch b/patches/server/0812-More-Projectile-API.patch similarity index 94% rename from patches/server/0814-More-Projectile-API.patch rename to patches/server/0812-More-Projectile-API.patch index 0d4b17fc77..34b0f3c7cb 100644 --- a/patches/server/0814-More-Projectile-API.patch +++ b/patches/server/0812-More-Projectile-API.patch @@ -14,6 +14,8 @@ public net.minecraft.world.entity.projectile.AbstractArrow soundEvent public net.minecraft.world.entity.projectile.ThrownTrident dealtDamage public net.minecraft.world.entity.projectile.Projectile hasBeenShot public net.minecraft.world.entity.projectile.Projectile leftOwner +public net.minecraft.world.entity.projectile.Projectile preOnHit(Lnet/minecraft/world/phys/HitResult;)V +public net.minecraft.world.entity.projectile.Projectile canHitEntity(Lnet/minecraft/world/entity/Entity;)Z Co-authored-by: Nassim Jahnke @@ -43,10 +45,10 @@ index 740ff3fed9c8d637527fda8544eba2b9d7d7280a..1f1519c1b33d16eba59546c86f20a099 } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/AbstractProjectile.java b/src/main/java/org/bukkit/craftbukkit/entity/AbstractProjectile.java -index 40e5b19bc8fa3de3b3d54da0762aee5bd7bb8d7b..825fdc6162797ade8e76e1ca3a863ed5fb48f936 100644 +index 40e5b19bc8fa3de3b3d54da0762aee5bd7bb8d7b..1c8d63e462f3ed3d5286659ae0d1ec04d8b55177 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/AbstractProjectile.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/AbstractProjectile.java -@@ -21,5 +21,31 @@ public abstract class AbstractProjectile extends CraftEntity implements Projecti +@@ -21,5 +21,46 @@ public abstract class AbstractProjectile extends CraftEntity implements Projecti public void setBounce(boolean doesBounce) { this.doesBounce = doesBounce; } @@ -72,6 +74,21 @@ index 40e5b19bc8fa3de3b3d54da0762aee5bd7bb8d7b..825fdc6162797ade8e76e1ca3a863ed5 + } + + @Override ++ public boolean canHitEntity(org.bukkit.entity.Entity entity) { ++ return this.getHandle().canHitEntity(((CraftEntity) entity).getHandle()); ++ } ++ ++ @Override ++ public void hitEntity(org.bukkit.entity.Entity entity) { ++ this.getHandle().preOnHit(new net.minecraft.world.phys.EntityHitResult(((CraftEntity) entity).getHandle())); ++ } ++ ++ @Override ++ public void hitEntity(org.bukkit.entity.Entity entity, org.bukkit.util.Vector vector) { ++ this.getHandle().preOnHit(new net.minecraft.world.phys.EntityHitResult(((CraftEntity) entity).getHandle(), new net.minecraft.world.phys.Vec3(vector.getX(), vector.getY(), vector.getZ()))); ++ } ++ ++ @Override + public net.minecraft.world.entity.projectile.Projectile getHandle() { + return (net.minecraft.world.entity.projectile.Projectile) entity; + } diff --git a/patches/server/0815-Fix-swamp-hut-cat-generation-deadlock.patch b/patches/server/0813-Fix-swamp-hut-cat-generation-deadlock.patch similarity index 100% rename from patches/server/0815-Fix-swamp-hut-cat-generation-deadlock.patch rename to patches/server/0813-Fix-swamp-hut-cat-generation-deadlock.patch diff --git a/patches/server/0816-Don-t-allow-vehicle-movement-from-players-while-tele.patch b/patches/server/0814-Don-t-allow-vehicle-movement-from-players-while-tele.patch similarity index 93% rename from patches/server/0816-Don-t-allow-vehicle-movement-from-players-while-tele.patch rename to patches/server/0814-Don-t-allow-vehicle-movement-from-players-while-tele.patch index 8f564ae01f..df97f9e145 100644 --- a/patches/server/0816-Don-t-allow-vehicle-movement-from-players-while-tele.patch +++ b/patches/server/0814-Don-t-allow-vehicle-movement-from-players-while-tele.patch @@ -7,7 +7,7 @@ Bring the vehicle move packet behavior in line with the regular player move packet. diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index c50ac593ad5db6b65015151bcc26a9b8ed510ba5..d3f002da6875ce46977c12e48c2a786135e40601 100644 +index 2e1141b7672907b1a0b807e4e0e0d5233480e5d6..023b58f9353ed8945a80243ba5af13a3ac34feb6 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -573,6 +573,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic diff --git a/patches/server/0817-Implement-getComputedBiome-API.patch b/patches/server/0815-Implement-getComputedBiome-API.patch similarity index 97% rename from patches/server/0817-Implement-getComputedBiome-API.patch rename to patches/server/0815-Implement-getComputedBiome-API.patch index 4c57720593..447fd784cc 100644 --- a/patches/server/0817-Implement-getComputedBiome-API.patch +++ b/patches/server/0815-Implement-getComputedBiome-API.patch @@ -23,7 +23,7 @@ index e365081bf532488f2b41b22deb2fb2346d4f2322..446657577aa843e6ebc5143b6c511f33 public void setBiome(Location location, Biome biome) { this.setBiome(location.getBlockX(), location.getBlockY(), location.getBlockZ(), biome); diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -index b7496922faee8bc5d82f3f5922f6fb2fe44a8d2f..0976a1295be35dd7c053fb4ee4050011fc3d95fe 100644 +index 5343ae3cdda55d7e0b41747c7eccb52e6828f6c9..69d1c21a5c1007ae65f86b130c421f3f9540da2d 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java @@ -343,6 +343,13 @@ public class CraftBlock implements Block { diff --git a/patches/server/0818-Make-some-itemstacks-nonnull.patch b/patches/server/0816-Make-some-itemstacks-nonnull.patch similarity index 100% rename from patches/server/0818-Make-some-itemstacks-nonnull.patch rename to patches/server/0816-Make-some-itemstacks-nonnull.patch diff --git a/patches/server/0819-Implement-enchantWithLevels-API.patch b/patches/server/0817-Implement-enchantWithLevels-API.patch similarity index 100% rename from patches/server/0819-Implement-enchantWithLevels-API.patch rename to patches/server/0817-Implement-enchantWithLevels-API.patch diff --git a/patches/server/0820-Fix-saving-in-unloadWorld.patch b/patches/server/0818-Fix-saving-in-unloadWorld.patch similarity index 83% rename from patches/server/0820-Fix-saving-in-unloadWorld.patch rename to patches/server/0818-Fix-saving-in-unloadWorld.patch index 839307504c..30ca37fabf 100644 --- a/patches/server/0820-Fix-saving-in-unloadWorld.patch +++ b/patches/server/0818-Fix-saving-in-unloadWorld.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Fix saving in unloadWorld Change savingDisabled to false to ensure ServerLevel's saving logic gets called when unloadWorld is called with save = true diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 5eb52dce4ab8cf970dc5b4cddf7a38fbef689df1..63e90208c094345a25746448ff86fb7d3eb21580 100644 +index 7936ff9da40a6938268b7020ba751e3724eb1d72..0d8a8a49368401e0c801ee63d99c6910467507b9 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1316,7 +1316,7 @@ public final class CraftServer implements Server { +@@ -1299,7 +1299,7 @@ public final class CraftServer implements Server { try { if (save) { diff --git a/patches/server/0821-Buffer-OOB-setBlock-calls.patch b/patches/server/0819-Buffer-OOB-setBlock-calls.patch similarity index 100% rename from patches/server/0821-Buffer-OOB-setBlock-calls.patch rename to patches/server/0819-Buffer-OOB-setBlock-calls.patch diff --git a/patches/server/0822-Add-TameableDeathMessageEvent.patch b/patches/server/0820-Add-TameableDeathMessageEvent.patch similarity index 100% rename from patches/server/0822-Add-TameableDeathMessageEvent.patch rename to patches/server/0820-Add-TameableDeathMessageEvent.patch diff --git a/patches/server/0823-Fix-new-block-data-for-EntityChangeBlockEvent.patch b/patches/server/0821-Fix-new-block-data-for-EntityChangeBlockEvent.patch similarity index 100% rename from patches/server/0823-Fix-new-block-data-for-EntityChangeBlockEvent.patch rename to patches/server/0821-Fix-new-block-data-for-EntityChangeBlockEvent.patch diff --git a/patches/server/0824-fix-player-loottables-running-when-mob-loot-gamerule.patch b/patches/server/0822-fix-player-loottables-running-when-mob-loot-gamerule.patch similarity index 92% rename from patches/server/0824-fix-player-loottables-running-when-mob-loot-gamerule.patch rename to patches/server/0822-fix-player-loottables-running-when-mob-loot-gamerule.patch index 4b828e77e2..6fd169c224 100644 --- a/patches/server/0824-fix-player-loottables-running-when-mob-loot-gamerule.patch +++ b/patches/server/0822-fix-player-loottables-running-when-mob-loot-gamerule.patch @@ -5,7 +5,7 @@ Subject: [PATCH] fix player loottables running when mob loot gamerule is false diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 2e3d5b38ace99ce99a8107e750c5eeaf281c8552..a2a7e6813101e0218224701fefc423dca2e6f0f0 100644 +index 0c212a2136b4d275aa0d7e31af19f90d96cca2ac..833a431567693121acb9b4d8e8ecb71b9c583e1c 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -866,12 +866,14 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0825-Ensure-entity-passenger-world-matches-ridden-entity.patch b/patches/server/0823-Ensure-entity-passenger-world-matches-ridden-entity.patch similarity index 100% rename from patches/server/0825-Ensure-entity-passenger-world-matches-ridden-entity.patch rename to patches/server/0823-Ensure-entity-passenger-world-matches-ridden-entity.patch diff --git a/patches/server/0826-Guard-against-invalid-entity-positions.patch b/patches/server/0824-Guard-against-invalid-entity-positions.patch similarity index 100% rename from patches/server/0826-Guard-against-invalid-entity-positions.patch rename to patches/server/0824-Guard-against-invalid-entity-positions.patch diff --git a/patches/server/0827-cache-resource-keys.patch b/patches/server/0825-cache-resource-keys.patch similarity index 65% rename from patches/server/0827-cache-resource-keys.patch rename to patches/server/0825-cache-resource-keys.patch index ebefeaede3..6015b1196f 100644 --- a/patches/server/0827-cache-resource-keys.patch +++ b/patches/server/0825-cache-resource-keys.patch @@ -5,7 +5,7 @@ Subject: [PATCH] cache resource keys diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -index 0976a1295be35dd7c053fb4ee4050011fc3d95fe..87dfc2fd1e2ff9e9449f1ce00dfb63e3e88839cd 100644 +index 69d1c21a5c1007ae65f86b130c421f3f9540da2d..0d30b388d8d93a6dbbf8dfb30d26eb44c73e1e4e 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java @@ -368,12 +368,13 @@ public class CraftBlock implements Block { @@ -38,20 +38,4 @@ index e0bf615fb1b99abbab2be55a4ee345204b36e218..7b3b12b4b2f5dbd37e23a7f5a0ad2abd + return registry.getHolderOrThrow(KEY_CACHE.computeIfAbsent(entity, type -> ResourceKey.create(Registries.ENTITY_TYPE, CraftNamespacedKey.toMinecraft(type.getKey())))).is(tag); // Paper - cache key } - @Override -diff --git a/src/main/java/org/bukkit/craftbukkit/tag/CraftFluidTag.java b/src/main/java/org/bukkit/craftbukkit/tag/CraftFluidTag.java -index cdd474e9b0363641839a66d3e61fec46c735879a..1a987b3c8f044dfd217e984dc122582095367e46 100644 ---- a/src/main/java/org/bukkit/craftbukkit/tag/CraftFluidTag.java -+++ b/src/main/java/org/bukkit/craftbukkit/tag/CraftFluidTag.java -@@ -14,9 +14,10 @@ public class CraftFluidTag extends CraftTag> KEY_CACHE = Collections.synchronizedMap(new java.util.EnumMap<>(Fluid.class)); // Paper - @Override - public boolean isTagged(Fluid fluid) { -- return registry.getHolderOrThrow(net.minecraft.resources.ResourceKey.create(net.minecraft.core.Registry.FLUID_REGISTRY, org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(fluid.getKey()))).is(tag); // Paper -+ return registry.getHolderOrThrow(KEY_CACHE.computeIfAbsent(fluid, f -> net.minecraft.resources.ResourceKey.create(net.minecraft.core.registries.Registries.FLUID, org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(f.getKey())))).is(tag); // Paper - cache key - } - @Override diff --git a/patches/server/0828-Allow-to-change-the-podium-for-the-EnderDragon.patch b/patches/server/0826-Allow-to-change-the-podium-for-the-EnderDragon.patch similarity index 100% rename from patches/server/0828-Allow-to-change-the-podium-for-the-EnderDragon.patch rename to patches/server/0826-Allow-to-change-the-podium-for-the-EnderDragon.patch diff --git a/patches/server/0829-Fix-NBT-pieces-overriding-a-block-entity-during-worl.patch b/patches/server/0827-Fix-NBT-pieces-overriding-a-block-entity-during-worl.patch similarity index 100% rename from patches/server/0829-Fix-NBT-pieces-overriding-a-block-entity-during-worl.patch rename to patches/server/0827-Fix-NBT-pieces-overriding-a-block-entity-during-worl.patch diff --git a/patches/server/0830-Fix-StructureGrowEvent-species-for-RED_MUSHROOM.patch b/patches/server/0828-Fix-StructureGrowEvent-species-for-RED_MUSHROOM.patch similarity index 100% rename from patches/server/0830-Fix-StructureGrowEvent-species-for-RED_MUSHROOM.patch rename to patches/server/0828-Fix-StructureGrowEvent-species-for-RED_MUSHROOM.patch diff --git a/patches/server/0831-Prevent-tile-entity-copies-loading-chunks.patch b/patches/server/0829-Prevent-tile-entity-copies-loading-chunks.patch similarity index 89% rename from patches/server/0831-Prevent-tile-entity-copies-loading-chunks.patch rename to patches/server/0829-Prevent-tile-entity-copies-loading-chunks.patch index 2df5b37380..b78d274572 100644 --- a/patches/server/0831-Prevent-tile-entity-copies-loading-chunks.patch +++ b/patches/server/0829-Prevent-tile-entity-copies-loading-chunks.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Prevent tile entity copies loading chunks diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index d3f002da6875ce46977c12e48c2a786135e40601..39581df4ebbe554b89bf5e21d70580aa74a1d679 100644 +index 023b58f9353ed8945a80243ba5af13a3ac34feb6..c8a8570b694e649886a46cd9776acd8d748a92a7 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -3280,7 +3280,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3286,7 +3286,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic BlockPos blockposition = BlockEntity.getPosFromTag(nbttagcompound); if (this.player.level.isLoaded(blockposition)) { diff --git a/patches/server/0832-Use-username-instead-of-display-name-in-PlayerList-g.patch b/patches/server/0830-Use-username-instead-of-display-name-in-PlayerList-g.patch similarity index 100% rename from patches/server/0832-Use-username-instead-of-display-name-in-PlayerList-g.patch rename to patches/server/0830-Use-username-instead-of-display-name-in-PlayerList-g.patch diff --git a/patches/server/0833-Fix-slime-spawners-not-spawning-outside-slime-chunks.patch b/patches/server/0831-Fix-slime-spawners-not-spawning-outside-slime-chunks.patch similarity index 100% rename from patches/server/0833-Fix-slime-spawners-not-spawning-outside-slime-chunks.patch rename to patches/server/0831-Fix-slime-spawners-not-spawning-outside-slime-chunks.patch diff --git a/patches/server/0834-Pass-ServerLevel-for-gamerule-callbacks.patch b/patches/server/0832-Pass-ServerLevel-for-gamerule-callbacks.patch similarity index 96% rename from patches/server/0834-Pass-ServerLevel-for-gamerule-callbacks.patch rename to patches/server/0832-Pass-ServerLevel-for-gamerule-callbacks.patch index e222a0da56..815417382c 100644 --- a/patches/server/0834-Pass-ServerLevel-for-gamerule-callbacks.patch +++ b/patches/server/0832-Pass-ServerLevel-for-gamerule-callbacks.patch @@ -18,10 +18,10 @@ index 5b46cabf4f2e2a1f7feaad378dd98d64aeef8671..51b3db0b6c2cede95b584268e035c0fb if (dedicatedserverproperties.enableQuery) { diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 39581df4ebbe554b89bf5e21d70580aa74a1d679..aaaf45586fd5b4336e4affa04bb45eb62a879de8 100644 +index c8a8570b694e649886a46cd9776acd8d748a92a7..a29c3a4314d6ac4b18dd873dd6260488efcb8a89 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2871,7 +2871,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2877,7 +2877,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic this.player = this.server.getPlayerList().respawn(this.player, false); if (this.server.isHardcore()) { this.player.setGameMode(GameType.SPECTATOR, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.HARDCORE_DEATH, null); // Paper @@ -158,10 +158,10 @@ index fa8cd4438c19a262272da47985a57f7e84654f1b..663c1d8c1611af915a1bae733920dd75 this.onChanged(server); } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index bfc9badadd90303cd9042d85697c95bd5b4f6f9c..346348eb37f6026931a864d2dc9926db8d4321bc 100644 +index aa6a2f8fff6d2f4978cee2ae2ed0d0ee2fffb950..8100b2f7627b667fee57504755c8b9fc71e77a74 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -1898,7 +1898,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -1914,7 +1914,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { // Paper end GameRules.Value handle = this.getHandle().getGameRules().getRule(CraftWorld.getGameRulesNMS().get(rule)); handle.deserialize(event.getValue()); // Paper @@ -170,7 +170,7 @@ index bfc9badadd90303cd9042d85697c95bd5b4f6f9c..346348eb37f6026931a864d2dc9926db return true; } -@@ -1938,7 +1938,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -1954,7 +1954,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { // Paper end GameRules.Value handle = this.getHandle().getGameRules().getRule(CraftWorld.getGameRulesNMS().get(rule.getName())); handle.deserialize(event.getValue()); // Paper diff --git a/patches/server/0835-Add-pre-unbreaking-amount-to-PlayerItemDamageEvent.patch b/patches/server/0833-Add-pre-unbreaking-amount-to-PlayerItemDamageEvent.patch similarity index 93% rename from patches/server/0835-Add-pre-unbreaking-amount-to-PlayerItemDamageEvent.patch rename to patches/server/0833-Add-pre-unbreaking-amount-to-PlayerItemDamageEvent.patch index 710c21cbb7..41b2304bc2 100644 --- a/patches/server/0835-Add-pre-unbreaking-amount-to-PlayerItemDamageEvent.patch +++ b/patches/server/0833-Add-pre-unbreaking-amount-to-PlayerItemDamageEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add pre-unbreaking amount to PlayerItemDamageEvent diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index def4d9c5a9b311d002eb88729bdba73b30f99bb7..6860096cb8c0deecc9c1d87543d1128fb95fd2d4 100644 +index 1d52646d68ff05a597a41495f288471ce60b2d29..31eed67d07097c7eb1b06547a9f556bcc709d96c 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java @@ -572,10 +572,11 @@ public final class ItemStack { diff --git a/patches/server/0836-WorldCreator-keepSpawnLoaded.patch b/patches/server/0834-WorldCreator-keepSpawnLoaded.patch similarity index 85% rename from patches/server/0836-WorldCreator-keepSpawnLoaded.patch rename to patches/server/0834-WorldCreator-keepSpawnLoaded.patch index c1bc70c683..ffb6800d6c 100644 --- a/patches/server/0836-WorldCreator-keepSpawnLoaded.patch +++ b/patches/server/0834-WorldCreator-keepSpawnLoaded.patch @@ -5,10 +5,10 @@ Subject: [PATCH] WorldCreator#keepSpawnLoaded diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 63e90208c094345a25746448ff86fb7d3eb21580..3e00f74b43b5459e8e1b6dff1e25d38933dde3dc 100644 +index 0d8a8a49368401e0c801ee63d99c6910467507b9..be087ee023fc124c676fb83f3d0796b2da3b8bc0 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1275,6 +1275,7 @@ public final class CraftServer implements Server { +@@ -1258,6 +1258,7 @@ public final class CraftServer implements Server { internal.setSpawnSettings(true, true); // Paper - move up diff --git a/patches/server/0837-Fix-NPE-for-BlockDataMeta-getBlockData.patch b/patches/server/0835-Fix-NPE-for-BlockDataMeta-getBlockData.patch similarity index 100% rename from patches/server/0837-Fix-NPE-for-BlockDataMeta-getBlockData.patch rename to patches/server/0835-Fix-NPE-for-BlockDataMeta-getBlockData.patch diff --git a/patches/server/0838-Trigger-bee_nest_destroyed-trigger-in-the-correct-pl.patch b/patches/server/0836-Trigger-bee_nest_destroyed-trigger-in-the-correct-pl.patch similarity index 100% rename from patches/server/0838-Trigger-bee_nest_destroyed-trigger-in-the-correct-pl.patch rename to patches/server/0836-Trigger-bee_nest_destroyed-trigger-in-the-correct-pl.patch diff --git a/patches/server/0839-Add-EntityDyeEvent-and-CollarColorable-interface.patch b/patches/server/0837-Add-EntityDyeEvent-and-CollarColorable-interface.patch similarity index 100% rename from patches/server/0839-Add-EntityDyeEvent-and-CollarColorable-interface.patch rename to patches/server/0837-Add-EntityDyeEvent-and-CollarColorable-interface.patch diff --git a/patches/server/0840-Fire-CauldronLevelChange-on-initial-fill.patch b/patches/server/0838-Fire-CauldronLevelChange-on-initial-fill.patch similarity index 76% rename from patches/server/0840-Fire-CauldronLevelChange-on-initial-fill.patch rename to patches/server/0838-Fire-CauldronLevelChange-on-initial-fill.patch index c0fcd53f55..bcc871d7bc 100644 --- a/patches/server/0840-Fire-CauldronLevelChange-on-initial-fill.patch +++ b/patches/server/0838-Fire-CauldronLevelChange-on-initial-fill.patch @@ -7,7 +7,7 @@ Also don't fire level events or game events if stalactite drip is cancelled diff --git a/src/main/java/net/minecraft/world/level/block/CauldronBlock.java b/src/main/java/net/minecraft/world/level/block/CauldronBlock.java -index 53089c3a36bf2c0ec1bc9b436884deff0c30f028..46846ac9981e447fc6886aecf82563378a4f5548 100644 +index 53089c3a36bf2c0ec1bc9b436884deff0c30f028..2f85b893dd0abc39fcedec65acc89e1567faf6f0 100644 --- a/src/main/java/net/minecraft/world/level/block/CauldronBlock.java +++ b/src/main/java/net/minecraft/world/level/block/CauldronBlock.java @@ -36,10 +36,18 @@ public class CauldronBlock extends AbstractCauldronBlock { @@ -16,7 +16,7 @@ index 53089c3a36bf2c0ec1bc9b436884deff0c30f028..46846ac9981e447fc6886aecf8256337 if (precipitation == Biome.Precipitation.RAIN) { - world.setBlockAndUpdate(pos, Blocks.WATER_CAULDRON.defaultBlockState()); + // Paper start - call event for initial fill -+ if (!LayeredCauldronBlock.changeLevel(state, world, pos, Blocks.WATER_CAULDRON.defaultBlockState(), null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL)) { ++ if (!LayeredCauldronBlock.changeLevel(state, world, pos, Blocks.WATER_CAULDRON.defaultBlockState(), null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL, false)) { // avoid duplicate game event + return; + } + // Paper end @@ -24,7 +24,7 @@ index 53089c3a36bf2c0ec1bc9b436884deff0c30f028..46846ac9981e447fc6886aecf8256337 } else if (precipitation == Biome.Precipitation.SNOW) { - world.setBlockAndUpdate(pos, Blocks.POWDER_SNOW_CAULDRON.defaultBlockState()); + // Paper start - call event for initial fill -+ if (!LayeredCauldronBlock.changeLevel(state, world, pos, Blocks.POWDER_SNOW_CAULDRON.defaultBlockState(), null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL)) { ++ if (!LayeredCauldronBlock.changeLevel(state, world, pos, Blocks.POWDER_SNOW_CAULDRON.defaultBlockState(), null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL, false)) { // avoid duplicate game event + return; + } + // Paper end @@ -54,15 +54,30 @@ index 53089c3a36bf2c0ec1bc9b436884deff0c30f028..46846ac9981e447fc6886aecf8256337 } diff --git a/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java b/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java -index 24d2da792bc498adf4251555a538df4cafe2e827..1a7cb12fd3f183c00079d679452a01b8df8d2bbb 100644 +index 24d2da792bc498adf4251555a538df4cafe2e827..14164aa59fa5e315788cd7a207228081a05fd18f 100644 --- a/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java +++ b/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java -@@ -91,7 +91,7 @@ public class LayeredCauldronBlock extends AbstractCauldronBlock { +@@ -91,7 +91,13 @@ public class LayeredCauldronBlock extends AbstractCauldronBlock { } // CraftBukkit start - public static boolean changeLevel(BlockState iblockdata, Level world, BlockPos blockposition, BlockState newBlock, Entity entity, CauldronLevelChangeEvent.ChangeReason reason) { ++ // Paper start + public static boolean changeLevel(BlockState iblockdata, Level world, BlockPos blockposition, BlockState newBlock, @javax.annotation.Nullable Entity entity, CauldronLevelChangeEvent.ChangeReason reason) { // Paper - entity is nullable ++ return changeLevel(iblockdata, world, blockposition, newBlock, entity, reason, true); ++ } ++ ++ public static boolean changeLevel(BlockState iblockdata, Level world, BlockPos blockposition, BlockState newBlock, @javax.annotation.Nullable Entity entity, CauldronLevelChangeEvent.ChangeReason reason, boolean sendGameEvent) { // Paper - entity is nullable ++ // Paper end CraftBlockState newState = CraftBlockStates.getBlockState(world, blockposition); newState.setData(newBlock); +@@ -104,7 +110,7 @@ public class LayeredCauldronBlock extends AbstractCauldronBlock { + return false; + } + newState.update(true); +- world.gameEvent(GameEvent.BLOCK_CHANGE, blockposition, GameEvent.Context.of(newBlock)); ++ if (sendGameEvent) world.gameEvent(GameEvent.BLOCK_CHANGE, blockposition, GameEvent.Context.of(newBlock)); // Paper + return true; + } + // CraftBukkit end diff --git a/patches/server/0841-fix-powder-snow-cauldrons-not-turning-to-water.patch b/patches/server/0839-fix-powder-snow-cauldrons-not-turning-to-water.patch similarity index 100% rename from patches/server/0841-fix-powder-snow-cauldrons-not-turning-to-water.patch rename to patches/server/0839-fix-powder-snow-cauldrons-not-turning-to-water.patch diff --git a/patches/server/0842-Add-PlayerStopUsingItemEvent.patch b/patches/server/0840-Add-PlayerStopUsingItemEvent.patch similarity index 100% rename from patches/server/0842-Add-PlayerStopUsingItemEvent.patch rename to patches/server/0840-Add-PlayerStopUsingItemEvent.patch diff --git a/patches/server/0843-FallingBlock-auto-expire-setting.patch b/patches/server/0841-FallingBlock-auto-expire-setting.patch similarity index 100% rename from patches/server/0843-FallingBlock-auto-expire-setting.patch rename to patches/server/0841-FallingBlock-auto-expire-setting.patch diff --git a/patches/server/0844-Don-t-tick-markers.patch b/patches/server/0842-Don-t-tick-markers.patch similarity index 100% rename from patches/server/0844-Don-t-tick-markers.patch rename to patches/server/0842-Don-t-tick-markers.patch diff --git a/patches/server/0845-Do-not-accept-invalid-client-settings.patch b/patches/server/0843-Do-not-accept-invalid-client-settings.patch similarity index 88% rename from patches/server/0845-Do-not-accept-invalid-client-settings.patch rename to patches/server/0843-Do-not-accept-invalid-client-settings.patch index 38ba6cef9a..6abe25b283 100644 --- a/patches/server/0845-Do-not-accept-invalid-client-settings.patch +++ b/patches/server/0843-Do-not-accept-invalid-client-settings.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Do not accept invalid client settings diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index aaaf45586fd5b4336e4affa04bb45eb62a879de8..6b25bfcc686f4ef52f005d794dd070958b03cd23 100644 +index a29c3a4314d6ac4b18dd873dd6260488efcb8a89..0ad005927d6b03d3fc231030bfbfdffe10f11649 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -3459,6 +3459,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3465,6 +3465,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @Override public void handleClientInformation(ServerboundClientInformationPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); diff --git a/patches/server/0846-Add-support-for-Proxy-Protocol.patch b/patches/server/0844-Add-support-for-Proxy-Protocol.patch similarity index 97% rename from patches/server/0846-Add-support-for-Proxy-Protocol.patch rename to patches/server/0844-Add-support-for-Proxy-Protocol.patch index f5843be478..434262e860 100644 --- a/patches/server/0846-Add-support-for-Proxy-Protocol.patch +++ b/patches/server/0844-Add-support-for-Proxy-Protocol.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add support for Proxy Protocol diff --git a/build.gradle.kts b/build.gradle.kts -index 9411103b2d68e46ef9889f7a512362a4701486dc..781609605d25283009e5f3e61649ecde9ea9a4cb 100644 +index da408b67c42f6cc0b5322f57ff86f93f66eb8c06..6a1853f3d988820f357c11371e32d50682e60401 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -20,6 +20,7 @@ dependencies { diff --git a/patches/server/0847-Fix-OfflinePlayer-getBedSpawnLocation.patch b/patches/server/0845-Fix-OfflinePlayer-getBedSpawnLocation.patch similarity index 100% rename from patches/server/0847-Fix-OfflinePlayer-getBedSpawnLocation.patch rename to patches/server/0845-Fix-OfflinePlayer-getBedSpawnLocation.patch diff --git a/patches/server/0848-Fix-FurnaceInventory-for-smokers-and-blast-furnaces.patch b/patches/server/0846-Fix-FurnaceInventory-for-smokers-and-blast-furnaces.patch similarity index 100% rename from patches/server/0848-Fix-FurnaceInventory-for-smokers-and-blast-furnaces.patch rename to patches/server/0846-Fix-FurnaceInventory-for-smokers-and-blast-furnaces.patch diff --git a/patches/server/0849-Sanitize-Sent-BlockEntity-NBT.patch b/patches/server/0847-Sanitize-Sent-BlockEntity-NBT.patch similarity index 100% rename from patches/server/0849-Sanitize-Sent-BlockEntity-NBT.patch rename to patches/server/0847-Sanitize-Sent-BlockEntity-NBT.patch diff --git a/patches/server/0850-Prevent-entity-loading-causing-async-lookups.patch b/patches/server/0848-Prevent-entity-loading-causing-async-lookups.patch similarity index 100% rename from patches/server/0850-Prevent-entity-loading-causing-async-lookups.patch rename to patches/server/0848-Prevent-entity-loading-causing-async-lookups.patch diff --git a/patches/server/0851-Disable-component-selector-resolving-in-books-by-def.patch b/patches/server/0849-Disable-component-selector-resolving-in-books-by-def.patch similarity index 100% rename from patches/server/0851-Disable-component-selector-resolving-in-books-by-def.patch rename to patches/server/0849-Disable-component-selector-resolving-in-books-by-def.patch diff --git a/patches/server/0852-Throw-exception-on-world-create-while-being-ticked.patch b/patches/server/0850-Throw-exception-on-world-create-while-being-ticked.patch similarity index 93% rename from patches/server/0852-Throw-exception-on-world-create-while-being-ticked.patch rename to patches/server/0850-Throw-exception-on-world-create-while-being-ticked.patch index 3428f78332..ce1deb01dd 100644 --- a/patches/server/0852-Throw-exception-on-world-create-while-being-ticked.patch +++ b/patches/server/0850-Throw-exception-on-world-create-while-being-ticked.patch @@ -45,10 +45,10 @@ index a8b3f0e8be414c4ea92cc85c9811ecd42e5ce9c1..0e04083ff0598451c66731b1518b2eb6 this.profiler.popPush("connection"); MinecraftTimings.connectionTimer.startTiming(); // Spigot diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 3e00f74b43b5459e8e1b6dff1e25d38933dde3dc..22b30f8ae67bad1b8fb50be835c134ec275e14f9 100644 +index be087ee023fc124c676fb83f3d0796b2da3b8bc0..3ce33ca4ce86a915be1cebb26de1eb3ef5d0d4fb 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -868,6 +868,11 @@ public final class CraftServer implements Server { +@@ -851,6 +851,11 @@ public final class CraftServer implements Server { return new ArrayList(this.worlds.values()); } @@ -60,7 +60,7 @@ index 3e00f74b43b5459e8e1b6dff1e25d38933dde3dc..22b30f8ae67bad1b8fb50be835c134ec public DedicatedPlayerList getHandle() { return this.playerList; } -@@ -1152,6 +1157,7 @@ public final class CraftServer implements Server { +@@ -1135,6 +1140,7 @@ public final class CraftServer implements Server { @Override public World createWorld(WorldCreator creator) { Preconditions.checkState(this.console.getAllLevels().iterator().hasNext(), "Cannot create additional worlds on STARTUP"); @@ -68,7 +68,7 @@ index 3e00f74b43b5459e8e1b6dff1e25d38933dde3dc..22b30f8ae67bad1b8fb50be835c134ec Validate.notNull(creator, "Creator may not be null"); String name = creator.name(); -@@ -1290,6 +1296,7 @@ public final class CraftServer implements Server { +@@ -1273,6 +1279,7 @@ public final class CraftServer implements Server { @Override public boolean unloadWorld(World world, boolean save) { diff --git a/patches/server/0853-Add-Alternate-Current-redstone-implementation.patch b/patches/server/0851-Add-Alternate-Current-redstone-implementation.patch similarity index 99% rename from patches/server/0853-Add-Alternate-Current-redstone-implementation.patch rename to patches/server/0851-Add-Alternate-Current-redstone-implementation.patch index 2c2f1e5d0c..785ab6526b 100644 --- a/patches/server/0853-Add-Alternate-Current-redstone-implementation.patch +++ b/patches/server/0851-Add-Alternate-Current-redstone-implementation.patch @@ -725,7 +725,7 @@ index 0000000000000000000000000000000000000000..5a7209f05b549c222f6c9bc2af2a3579 +} diff --git a/src/main/java/alternate/current/wire/WireHandler.java b/src/main/java/alternate/current/wire/WireHandler.java new file mode 100644 -index 0000000000000000000000000000000000000000..35d9017c21ce77290d8e86cceb0676666e6e0eff +index 0000000000000000000000000000000000000000..dbd0f5eee8b7f0590817673ee5f9a529bd5184cd --- /dev/null +++ b/src/main/java/alternate/current/wire/WireHandler.java @@ -0,0 +1,1150 @@ @@ -1347,9 +1347,9 @@ index 0000000000000000000000000000000000000000..35d9017c21ce77290d8e86cceb067666 + WireNode wire = node.asWire(); + findRoot(wire); + -+ // If the wire at the given position is not in an invalid state or is not -+ // part of a larger network, we can exit early. -+ if (!wire.searched || wire.connections.total == 0) { ++ // If the wire at the given position is not in an invalid state ++ // we can exit early. ++ if (!wire.searched) { + return; + } + diff --git a/patches/server/0854-Dont-resent-entity-on-art-update.patch b/patches/server/0852-Dont-resent-entity-on-art-update.patch similarity index 100% rename from patches/server/0854-Dont-resent-entity-on-art-update.patch rename to patches/server/0852-Dont-resent-entity-on-art-update.patch diff --git a/patches/server/0855-Add-WardenAngerChangeEvent.patch b/patches/server/0853-Add-WardenAngerChangeEvent.patch similarity index 100% rename from patches/server/0855-Add-WardenAngerChangeEvent.patch rename to patches/server/0853-Add-WardenAngerChangeEvent.patch diff --git a/patches/server/0856-Add-option-for-strict-advancement-dimension-checks.patch b/patches/server/0854-Add-option-for-strict-advancement-dimension-checks.patch similarity index 94% rename from patches/server/0856-Add-option-for-strict-advancement-dimension-checks.patch rename to patches/server/0854-Add-option-for-strict-advancement-dimension-checks.patch index ae89578d9c..2f47d6f144 100644 --- a/patches/server/0856-Add-option-for-strict-advancement-dimension-checks.patch +++ b/patches/server/0854-Add-option-for-strict-advancement-dimension-checks.patch @@ -11,7 +11,7 @@ distance trigger. This adds a config option to ignore that and use the exact dimension key of the worlds involved. diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index a2a7e6813101e0218224701fefc423dca2e6f0f0..9ec0ae8fd404a595f4a659b10c5107421db8f1f8 100644 +index 833a431567693121acb9b4d8e8ecb71b9c583e1c..472f4b8bbd609aa3776c38a6b8cbec61a73b4209 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1258,6 +1258,12 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0857-Add-missing-important-BlockStateListPopulator-method.patch b/patches/server/0855-Add-missing-important-BlockStateListPopulator-method.patch similarity index 100% rename from patches/server/0857-Add-missing-important-BlockStateListPopulator-method.patch rename to patches/server/0855-Add-missing-important-BlockStateListPopulator-method.patch diff --git a/patches/server/0858-Nameable-Banner-API.patch b/patches/server/0856-Nameable-Banner-API.patch similarity index 100% rename from patches/server/0858-Nameable-Banner-API.patch rename to patches/server/0856-Nameable-Banner-API.patch diff --git a/patches/server/0859-Don-t-broadcast-messages-to-command-blocks.patch b/patches/server/0857-Don-t-broadcast-messages-to-command-blocks.patch similarity index 92% rename from patches/server/0859-Don-t-broadcast-messages-to-command-blocks.patch rename to patches/server/0857-Don-t-broadcast-messages-to-command-blocks.patch index b09d0677d4..0fab6586b8 100644 --- a/patches/server/0859-Don-t-broadcast-messages-to-command-blocks.patch +++ b/patches/server/0857-Don-t-broadcast-messages-to-command-blocks.patch @@ -20,10 +20,10 @@ index 7c7e5f3c0f9cd1f16192a8fc8163da9b2d9519d5..888936385196a178ab8b730fd5e4fff4 Date date = new Date(); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 22b30f8ae67bad1b8fb50be835c134ec275e14f9..4585fe9467c1866ad6746e44b45f77d614be8201 100644 +index 3ce33ca4ce86a915be1cebb26de1eb3ef5d0d4fb..9c97e31a00bf226c7298242a6e0d4c0b35a49817 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1790,7 +1790,7 @@ public final class CraftServer implements Server { +@@ -1773,7 +1773,7 @@ public final class CraftServer implements Server { // Paper end Set recipients = new HashSet<>(); for (Permissible permissible : this.getPluginManager().getPermissionSubscriptions(permission)) { diff --git a/patches/server/0860-Prevent-empty-items-from-being-added-to-world.patch b/patches/server/0858-Prevent-empty-items-from-being-added-to-world.patch similarity index 100% rename from patches/server/0860-Prevent-empty-items-from-being-added-to-world.patch rename to patches/server/0858-Prevent-empty-items-from-being-added-to-world.patch diff --git a/patches/server/0861-Fix-CCE-for-SplashPotion-and-LingeringPotion-spawnin.patch b/patches/server/0859-Fix-CCE-for-SplashPotion-and-LingeringPotion-spawnin.patch similarity index 100% rename from patches/server/0861-Fix-CCE-for-SplashPotion-and-LingeringPotion-spawnin.patch rename to patches/server/0859-Fix-CCE-for-SplashPotion-and-LingeringPotion-spawnin.patch diff --git a/patches/server/0862-Don-t-print-component-in-resource-pack-rejection-mes.patch b/patches/server/0860-Don-t-print-component-in-resource-pack-rejection-mes.patch similarity index 94% rename from patches/server/0862-Don-t-print-component-in-resource-pack-rejection-mes.patch rename to patches/server/0860-Don-t-print-component-in-resource-pack-rejection-mes.patch index 3fec1a0323..a26d388480 100644 --- a/patches/server/0862-Don-t-print-component-in-resource-pack-rejection-mes.patch +++ b/patches/server/0860-Don-t-print-component-in-resource-pack-rejection-mes.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Don't print component in resource pack rejection message diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 6b25bfcc686f4ef52f005d794dd070958b03cd23..edfe4ce54c34eca1cd3b7289df74994560e5cb24 100644 +index 0ad005927d6b03d3fc231030bfbfdffe10f11649..fcfd8ff903dbfcd3bdeb1af68277fbc5ab0f2d91 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -2041,7 +2041,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic diff --git a/patches/server/0863-Add-Player-getFishHook.patch b/patches/server/0861-Add-Player-getFishHook.patch similarity index 92% rename from patches/server/0863-Add-Player-getFishHook.patch rename to patches/server/0861-Add-Player-getFishHook.patch index bf5ccb5986..5870dbdcdc 100644 --- a/patches/server/0863-Add-Player-getFishHook.patch +++ b/patches/server/0861-Add-Player-getFishHook.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add Player#getFishHook diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -index 44dab523264c594aa9c619e3ee2e0d7f93982ddc..e779dcc4982ff51e4d450265fd61bc26e8e74d3a 100644 +index 73d8f4af09689eb549047bf1fa79254cc7736158..d69c05223fca71fc5e282095d02bc39fee7ec757 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java @@ -153,6 +153,15 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { diff --git a/patches/server/0864-Do-not-sync-load-chunk-for-dynamic-game-event-listen.patch b/patches/server/0862-Do-not-sync-load-chunk-for-dynamic-game-event-listen.patch similarity index 100% rename from patches/server/0864-Do-not-sync-load-chunk-for-dynamic-game-event-listen.patch rename to patches/server/0862-Do-not-sync-load-chunk-for-dynamic-game-event-listen.patch diff --git a/patches/server/0865-Add-various-missing-EntityDropItemEvent-calls.patch b/patches/server/0863-Add-various-missing-EntityDropItemEvent-calls.patch similarity index 100% rename from patches/server/0865-Add-various-missing-EntityDropItemEvent-calls.patch rename to patches/server/0863-Add-various-missing-EntityDropItemEvent-calls.patch diff --git a/patches/server/0866-Add-some-minimal-debug-information-to-chat-packet-er.patch b/patches/server/0864-Add-some-minimal-debug-information-to-chat-packet-er.patch similarity index 94% rename from patches/server/0866-Add-some-minimal-debug-information-to-chat-packet-er.patch rename to patches/server/0864-Add-some-minimal-debug-information-to-chat-packet-er.patch index 3236b05f6d..19c7d24651 100644 --- a/patches/server/0866-Add-some-minimal-debug-information-to-chat-packet-er.patch +++ b/patches/server/0864-Add-some-minimal-debug-information-to-chat-packet-er.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Add some minimal debug information to chat packet errors TODO: potentially add some kick leeway diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index edfe4ce54c34eca1cd3b7289df74994560e5cb24..b0611e3876b125c1b79e893f0de62ebca0095ac0 100644 +index fcfd8ff903dbfcd3bdeb1af68277fbc5ab0f2d91..400775b6c88a68c81a7f074844588ea308fb84ea 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -2291,7 +2291,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic diff --git a/patches/server/0867-Fix-Bee-flower-NPE.patch b/patches/server/0865-Fix-Bee-flower-NPE.patch similarity index 100% rename from patches/server/0867-Fix-Bee-flower-NPE.patch rename to patches/server/0865-Fix-Bee-flower-NPE.patch diff --git a/patches/server/0868-Fix-Spigot-Config-not-using-commands.spam-exclusions.patch b/patches/server/0866-Fix-Spigot-Config-not-using-commands.spam-exclusions.patch similarity index 92% rename from patches/server/0868-Fix-Spigot-Config-not-using-commands.spam-exclusions.patch rename to patches/server/0866-Fix-Spigot-Config-not-using-commands.spam-exclusions.patch index 1605ccc33d..b1bf2a4d10 100644 --- a/patches/server/0868-Fix-Spigot-Config-not-using-commands.spam-exclusions.patch +++ b/patches/server/0866-Fix-Spigot-Config-not-using-commands.spam-exclusions.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix Spigot Config not using commands.spam-exclusions diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index b0611e3876b125c1b79e893f0de62ebca0095ac0..cccf4885385412e799215092bfbe04f2f2455fc8 100644 +index 400775b6c88a68c81a7f074844588ea308fb84ea..5f2ca04a299b61f2cce8a4dfd060485e05153650 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -2536,7 +2536,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic diff --git a/patches/server/0869-More-Teleport-API.patch b/patches/server/0867-More-Teleport-API.patch similarity index 95% rename from patches/server/0869-More-Teleport-API.patch rename to patches/server/0867-More-Teleport-API.patch index 97ec340118..d10143439e 100644 --- a/patches/server/0869-More-Teleport-API.patch +++ b/patches/server/0867-More-Teleport-API.patch @@ -7,7 +7,7 @@ Subject: [PATCH] More Teleport API public net.minecraft.server.network.ServerGamePacketListenerImpl internalTeleport(DDDFFLjava/util/Set;Z)V diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index cccf4885385412e799215092bfbe04f2f2455fc8..189d1aa21e2fc0c9d4e73e199f56e0be1bcabc9e 100644 +index 5f2ca04a299b61f2cce8a4dfd060485e05153650..c1041c3832c73728cbb146815ca3c03b3ba41dc4 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -1718,11 +1718,17 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -71,10 +71,10 @@ index 32b9816283c8c1de929d5664733553277cf6bf3c..32c724060a532e551f0ab4e7277831bb // Let the server handle cross world teleports if (location.getWorld() != null && !location.getWorld().equals(this.getWorld())) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 1ca03597ce9ca9b47017979d919f9082c21cdd45..2f184121d1b6e037c5dd7f30eb075e6fe01c1973 100644 +index 118a671cdeee8c5fd051192b7b72ad63f79e7eca..ddafba3daa668281134ec348c6fda48cfab1a007 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1185,13 +1185,92 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1198,13 +1198,92 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override public void setRotation(float yaw, float pitch) { @@ -168,7 +168,7 @@ index 1ca03597ce9ca9b47017979d919f9082c21cdd45..2f184121d1b6e037c5dd7f30eb075e6f location.checkFinite(); ServerPlayer entity = this.getHandle(); -@@ -1204,7 +1283,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1217,7 +1296,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { return false; } @@ -177,7 +177,7 @@ index 1ca03597ce9ca9b47017979d919f9082c21cdd45..2f184121d1b6e037c5dd7f30eb075e6f return false; } -@@ -1222,7 +1301,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1235,7 +1314,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } // If this player is riding another entity, we must dismount before teleporting. @@ -186,7 +186,7 @@ index 1ca03597ce9ca9b47017979d919f9082c21cdd45..2f184121d1b6e037c5dd7f30eb075e6f // SPIGOT-5509: Wakeup, similar to riding if (this.isSleeping()) { -@@ -1244,7 +1323,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1257,7 +1336,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { // Check if the fromWorld and toWorld are the same. if (fromWorld == toWorld) { diff --git a/patches/server/0870-Add-EntityPortalReadyEvent.patch b/patches/server/0868-Add-EntityPortalReadyEvent.patch similarity index 100% rename from patches/server/0870-Add-EntityPortalReadyEvent.patch rename to patches/server/0868-Add-EntityPortalReadyEvent.patch diff --git a/patches/server/0871-Don-t-use-level-random-in-entity-constructors.patch b/patches/server/0869-Don-t-use-level-random-in-entity-constructors.patch similarity index 100% rename from patches/server/0871-Don-t-use-level-random-in-entity-constructors.patch rename to patches/server/0869-Don-t-use-level-random-in-entity-constructors.patch diff --git a/patches/server/0872-Send-block-entities-after-destroy-prediction.patch b/patches/server/0870-Send-block-entities-after-destroy-prediction.patch similarity index 98% rename from patches/server/0872-Send-block-entities-after-destroy-prediction.patch rename to patches/server/0870-Send-block-entities-after-destroy-prediction.patch index 0895e311c8..feff7dfed9 100644 --- a/patches/server/0872-Send-block-entities-after-destroy-prediction.patch +++ b/patches/server/0870-Send-block-entities-after-destroy-prediction.patch @@ -57,7 +57,7 @@ index 796d17f51496974cfdfed2593753b8c09b5c81c1..13031576c20bda3bb12c926f6cd938fa } } diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 189d1aa21e2fc0c9d4e73e199f56e0be1bcabc9e..da2a074d8dc048351d90ca484d33f55f79c49dc1 100644 +index c1041c3832c73728cbb146815ca3c03b3ba41dc4..7183db74a3ebd7d278b7bf65de49dd1cde11611f 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -1863,8 +1863,28 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic diff --git a/patches/server/0873-Warn-on-plugins-accessing-faraway-chunks.patch b/patches/server/0871-Warn-on-plugins-accessing-faraway-chunks.patch similarity index 97% rename from patches/server/0873-Warn-on-plugins-accessing-faraway-chunks.patch rename to patches/server/0871-Warn-on-plugins-accessing-faraway-chunks.patch index 361a384ff4..efbd4c3920 100644 --- a/patches/server/0873-Warn-on-plugins-accessing-faraway-chunks.patch +++ b/patches/server/0871-Warn-on-plugins-accessing-faraway-chunks.patch @@ -18,7 +18,7 @@ index bb411f4efc550ed7872f0252373be81bd8e99b76..3cbf801b2e5420c0e870f73788deb550 private static boolean isOutsideSpawnableHeight(int y) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 346348eb37f6026931a864d2dc9926db8d4321bc..4cb0307935aa63d44aac55c80ee50be074d7913c 100644 +index 8100b2f7627b667fee57504755c8b9fc71e77a74..54932d92b13b890b07f827c5f09bd137383d4ab5 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -312,9 +312,24 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -86,7 +86,7 @@ index 346348eb37f6026931a864d2dc9926db8d4321bc..4cb0307935aa63d44aac55c80ee50be0 // Transient load for this tick return this.world.getChunk(x >> 4, z >> 4).getHeight(CraftHeightMap.toNMS(heightMap), x, z); } -@@ -2318,6 +2338,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -2334,6 +2354,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { // Spigot end // Paper start public java.util.concurrent.CompletableFuture getChunkAtAsync(int x, int z, boolean gen, boolean urgent) { diff --git a/patches/server/0874-Custom-Chat-Completion-Suggestions-API.patch b/patches/server/0872-Custom-Chat-Completion-Suggestions-API.patch similarity index 94% rename from patches/server/0874-Custom-Chat-Completion-Suggestions-API.patch rename to patches/server/0872-Custom-Chat-Completion-Suggestions-API.patch index 146c452af0..4c1a01216b 100644 --- a/patches/server/0874-Custom-Chat-Completion-Suggestions-API.patch +++ b/patches/server/0872-Custom-Chat-Completion-Suggestions-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Custom Chat Completion Suggestions API diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 2f184121d1b6e037c5dd7f30eb075e6fe01c1973..a96a3e459e27a6b5c84f0e4550241e66df0505c5 100644 +index ddafba3daa668281134ec348c6fda48cfab1a007..89a3ff58e574485ccfdf55db3172a74aa63b4818 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -665,6 +665,22 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0875-Add-missing-BlockFadeEvents.patch b/patches/server/0873-Add-missing-BlockFadeEvents.patch similarity index 100% rename from patches/server/0875-Add-missing-BlockFadeEvents.patch rename to patches/server/0873-Add-missing-BlockFadeEvents.patch diff --git a/patches/server/0876-Collision-API.patch b/patches/server/0874-Collision-API.patch similarity index 100% rename from patches/server/0876-Collision-API.patch rename to patches/server/0874-Collision-API.patch diff --git a/patches/server/0877-Fix-suggest-command-message-for-brigadier-syntax-exc.patch b/patches/server/0875-Fix-suggest-command-message-for-brigadier-syntax-exc.patch similarity index 89% rename from patches/server/0877-Fix-suggest-command-message-for-brigadier-syntax-exc.patch rename to patches/server/0875-Fix-suggest-command-message-for-brigadier-syntax-exc.patch index 49e5f4b7c3..44573069dc 100644 --- a/patches/server/0877-Fix-suggest-command-message-for-brigadier-syntax-exc.patch +++ b/patches/server/0875-Fix-suggest-command-message-for-brigadier-syntax-exc.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Fix suggest command message for brigadier syntax exceptions This is a bug accidentally introduced in upstream CB diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java -index 6a82d83bca27b3b023d9d6771d194b4db9c97dc2..330f6c79417378da855326b4da665f9d240e748d 100644 +index 401a87de8fc48b9e69423d547f79e9e356cc20f1..e92864ecf32dd984f6f87f7b05341e43af3a2977 100644 --- a/src/main/java/net/minecraft/commands/Commands.java +++ b/src/main/java/net/minecraft/commands/Commands.java -@@ -322,7 +322,7 @@ public class Commands { +@@ -334,7 +334,7 @@ public class Commands { if (commandsyntaxexception.getInput() != null && commandsyntaxexception.getCursor() >= 0) { int j = Math.min(commandsyntaxexception.getInput().length(), commandsyntaxexception.getCursor()); MutableComponent ichatmutablecomponent = Component.empty().withStyle(ChatFormatting.GRAY).withStyle((chatmodifier) -> { diff --git a/patches/server/0878-Remove-invalid-signature-login-stacktrace.patch b/patches/server/0876-Remove-invalid-signature-login-stacktrace.patch similarity index 88% rename from patches/server/0878-Remove-invalid-signature-login-stacktrace.patch rename to patches/server/0876-Remove-invalid-signature-login-stacktrace.patch index dca56b5a89..5e8f59ae84 100644 --- a/patches/server/0878-Remove-invalid-signature-login-stacktrace.patch +++ b/patches/server/0876-Remove-invalid-signature-login-stacktrace.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Remove invalid signature login stacktrace diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index da2a074d8dc048351d90ca484d33f55f79c49dc1..eed16d8124d6256e3e259263b26cba2cbb3582d4 100644 +index 7183db74a3ebd7d278b7bf65de49dd1cde11611f..7a6736cdd31bc1832965cc72596b643deaccc07b 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -3589,7 +3589,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3595,7 +3595,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic this.resetPlayerChatState(remotechatsession_a.validate(this.player.getGameProfile(), signaturevalidator, Duration.ZERO)); } catch (ProfilePublicKey.ValidationException profilepublickey_b) { diff --git a/patches/server/0879-Add-async-catcher-to-PlayerConnection-internalTelepo.patch b/patches/server/0877-Add-async-catcher-to-PlayerConnection-internalTelepo.patch similarity index 91% rename from patches/server/0879-Add-async-catcher-to-PlayerConnection-internalTelepo.patch rename to patches/server/0877-Add-async-catcher-to-PlayerConnection-internalTelepo.patch index d154b92207..7698ed96bf 100644 --- a/patches/server/0879-Add-async-catcher-to-PlayerConnection-internalTelepo.patch +++ b/patches/server/0877-Add-async-catcher-to-PlayerConnection-internalTelepo.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add async catcher to PlayerConnection internalTeleport diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index eed16d8124d6256e3e259263b26cba2cbb3582d4..50c1d6dedcb7579ce5e83599b47016e4fc8d9d9a 100644 +index 7a6736cdd31bc1832965cc72596b643deaccc07b..834b899ec913def6fe4f517f5b76c9c0f92c970b 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -1746,6 +1746,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic diff --git a/patches/server/0880-Block-Ticking-API.patch b/patches/server/0878-Block-Ticking-API.patch similarity index 85% rename from patches/server/0880-Block-Ticking-API.patch rename to patches/server/0878-Block-Ticking-API.patch index 5827f7c67d..e742ff3265 100644 --- a/patches/server/0880-Block-Ticking-API.patch +++ b/patches/server/0878-Block-Ticking-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Block Ticking API diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -index 87dfc2fd1e2ff9e9449f1ce00dfb63e3e88839cd..350cbf64c17938021002d5fd67176c44b398231e 100644 +index 0d30b388d8d93a6dbbf8dfb30d26eb44c73e1e4e..962c950ca9c7e047a3aec215d4faa73676049d36 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -@@ -760,5 +760,21 @@ public class CraftBlock implements Block { +@@ -756,5 +756,21 @@ public class CraftBlock implements Block { public boolean isValidTool(ItemStack itemStack) { return getDrops(itemStack).size() != 0; } @@ -31,10 +31,10 @@ index 87dfc2fd1e2ff9e9449f1ce00dfb63e3e88839cd..350cbf64c17938021002d5fd67176c44 // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java -index 3399e8cdf2230bd71444abb43829c54d7277ce36..6f7ee97e381e80d6e8cf6b9c3f40b5e25f6bf64b 100644 +index 7acf213194f61d04cffabaaee6c1372bfa2e1933..0a04366b3f472bc4ce20ed814dc326b278119c74 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java +++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java -@@ -617,4 +617,10 @@ public class CraftBlockData implements BlockData { +@@ -652,4 +652,10 @@ public class CraftBlockData implements BlockData { return this.state.isFaceSturdy(EmptyBlockGetter.INSTANCE, BlockPos.ZERO, CraftBlock.blockFaceToNotch(face), CraftBlockSupport.toNMS(support)); } diff --git a/patches/server/0881-Add-Velocity-IP-Forwarding-Support.patch b/patches/server/0879-Add-Velocity-IP-Forwarding-Support.patch similarity index 80% rename from patches/server/0881-Add-Velocity-IP-Forwarding-Support.patch rename to patches/server/0879-Add-Velocity-IP-Forwarding-Support.patch index ac101f06a4..57ecf1f666 100644 --- a/patches/server/0881-Add-Velocity-IP-Forwarding-Support.patch +++ b/patches/server/0879-Add-Velocity-IP-Forwarding-Support.patch @@ -94,6 +94,34 @@ index 0000000000000000000000000000000000000000..c4934979b1ed85bfc4f8d9e6f8848b2b + return buf.readBoolean() ? buf.readUUID() : orElse; + } +} +diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +index 51b3db0b6c2cede95b584268e035c0fb36d38094..a7e133f3495e9132a5fdae2c24f225e7b026295a 100644 +--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java ++++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +@@ -274,13 +274,20 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface + server.enablePlugins(org.bukkit.plugin.PluginLoadOrder.STARTUP); + // CraftBukkit end + ++ // Paper start ++ boolean usingProxy = org.spigotmc.SpigotConfig.bungee || io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled; ++ String proxyFlavor = (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled) ? "Velocity" : "BungeeCord"; ++ String proxyLink = (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled) ? "https://docs.papermc.io/velocity/security" : "http://www.spigotmc.org/wiki/firewall-guide/"; ++ // Paper end + if (!this.usesAuthentication()) { + DedicatedServer.LOGGER.warn("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!"); + DedicatedServer.LOGGER.warn("The server will make no attempt to authenticate usernames. Beware."); + // Spigot start +- if (org.spigotmc.SpigotConfig.bungee) { +- DedicatedServer.LOGGER.warn("Whilst this makes it possible to use BungeeCord, unless access to your server is properly restricted, it also opens up the ability for hackers to connect with any username they choose."); +- DedicatedServer.LOGGER.warn("Please see http://www.spigotmc.org/wiki/firewall-guide/ for further information."); ++ // Paper start ++ if (usingProxy) { ++ DedicatedServer.LOGGER.warn("Whilst this makes it possible to use " + proxyFlavor + ", unless access to your server is properly restricted, it also opens up the ability for hackers to connect with any username they choose."); ++ DedicatedServer.LOGGER.warn("Please see " + proxyLink + " for further information."); ++ // Paper end + } else { + DedicatedServer.LOGGER.warn("While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose."); + } diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java index 0bedd9eadbfe1ce290f22d6c648571e25e3ae0e9..093822a5256e8e919350a000239a3e92a2379aaf 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java @@ -185,10 +213,10 @@ index 0bedd9eadbfe1ce290f22d6c648571e25e3ae0e9..093822a5256e8e919350a000239a3e92 } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 4585fe9467c1866ad6746e44b45f77d614be8201..bfc4ee36befb925ab4eb6b96f5c1aa6c76bf711f 100644 +index 9c97e31a00bf226c7298242a6e0d4c0b35a49817..621919a4a45caa73a43020fdca24764d95d89fd2 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -797,7 +797,7 @@ public final class CraftServer implements Server { +@@ -780,7 +780,7 @@ public final class CraftServer implements Server { @Override public long getConnectionThrottle() { // Spigot Start - Automatically set connection throttle for bungee configurations diff --git a/patches/server/0882-Use-thread-safe-random-in-ServerLoginPacketListenerI.patch b/patches/server/0880-Use-thread-safe-random-in-ServerLoginPacketListenerI.patch similarity index 100% rename from patches/server/0882-Use-thread-safe-random-in-ServerLoginPacketListenerI.patch rename to patches/server/0880-Use-thread-safe-random-in-ServerLoginPacketListenerI.patch diff --git a/patches/server/0883-Add-NamespacedKey-biome-methods.patch b/patches/server/0881-Add-NamespacedKey-biome-methods.patch similarity index 92% rename from patches/server/0883-Add-NamespacedKey-biome-methods.patch rename to patches/server/0881-Add-NamespacedKey-biome-methods.patch index ae8b1ea77d..60d181b0f7 100644 --- a/patches/server/0883-Add-NamespacedKey-biome-methods.patch +++ b/patches/server/0881-Add-NamespacedKey-biome-methods.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Add NamespacedKey biome methods Co-authored-by: Thonk <30448663+ExcessiveAmountsOfZombies@users.noreply.github.com> diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 73e82653e0a68560c25ae41ade4c58111cbcd276..daeaa30cdd64f5cb775304e82f2390684c02a9d3 100644 +index 109f36e8892cc2e50d88054459321007ea00cf93..adde9b49bf043112765734716f01b0d29456e46c 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -605,6 +605,19 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -607,6 +607,19 @@ public final class CraftMagicNumbers implements UnsafeValues { Preconditions.checkArgument(material.isBlock(), material + " is not a block"); return getBlock(material).hasCollision; } diff --git a/patches/server/0884-Fix-plugin-loggers-on-server-shutdown.patch b/patches/server/0882-Fix-plugin-loggers-on-server-shutdown.patch similarity index 100% rename from patches/server/0884-Fix-plugin-loggers-on-server-shutdown.patch rename to patches/server/0882-Fix-plugin-loggers-on-server-shutdown.patch diff --git a/patches/server/0885-Workaround-for-client-lag-spikes-MC-162253.patch b/patches/server/0883-Workaround-for-client-lag-spikes-MC-162253.patch similarity index 100% rename from patches/server/0885-Workaround-for-client-lag-spikes-MC-162253.patch rename to patches/server/0883-Workaround-for-client-lag-spikes-MC-162253.patch diff --git a/patches/server/0886-Stop-large-look-changes-from-crashing-the-server.patch b/patches/server/0884-Stop-large-look-changes-from-crashing-the-server.patch similarity index 96% rename from patches/server/0886-Stop-large-look-changes-from-crashing-the-server.patch rename to patches/server/0884-Stop-large-look-changes-from-crashing-the-server.patch index 81badd0182..b522ef8dac 100644 --- a/patches/server/0886-Stop-large-look-changes-from-crashing-the-server.patch +++ b/patches/server/0884-Stop-large-look-changes-from-crashing-the-server.patch @@ -54,7 +54,7 @@ index 8433a1359a742f8947a328cc621c0ff4f64977f0..c9c16dfffa782b82c1697f3819591077 this.level.getProfiler().pop(); this.animStep += f2; diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java -index 3eb33d83b9cfa6ac87876a6343c88ac992b60374..66476b33cede1e44db5ec166a0cea81f82ffe47a 100644 +index b226800c15f5adbc40c89b36536db23f08e2857d..893975e8587b9036f622e2088c302e33004496d2 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java +++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java @@ -246,13 +246,7 @@ public abstract class Projectile extends Entity { diff --git a/patches/server/0887-Add-custom-destroyerIdentity-to-sendBlockDamage.patch b/patches/server/0885-Add-custom-destroyerIdentity-to-sendBlockDamage.patch similarity index 91% rename from patches/server/0887-Add-custom-destroyerIdentity-to-sendBlockDamage.patch rename to patches/server/0885-Add-custom-destroyerIdentity-to-sendBlockDamage.patch index 3013d553e5..bf3b9ec551 100644 --- a/patches/server/0887-Add-custom-destroyerIdentity-to-sendBlockDamage.patch +++ b/patches/server/0885-Add-custom-destroyerIdentity-to-sendBlockDamage.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add custom destroyerIdentity to sendBlockDamage diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index a96a3e459e27a6b5c84f0e4550241e66df0505c5..cd439593d050fb157fae3575207a285a48d71783 100644 +index 89a3ff58e574485ccfdf55db3172a74aa63b4818..6d1309e811e299984823caab24325fa6970dee57 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1015,13 +1015,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1028,13 +1028,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override public void sendBlockDamage(Location loc, float progress) { diff --git a/patches/server/0888-Fix-EndDragonFight-killed-statuses-should-be-false-f.patch b/patches/server/0886-Fix-EndDragonFight-killed-statuses-should-be-false-f.patch similarity index 100% rename from patches/server/0888-Fix-EndDragonFight-killed-statuses-should-be-false-f.patch rename to patches/server/0886-Fix-EndDragonFight-killed-statuses-should-be-false-f.patch diff --git a/patches/server/0889-Fire-EntityChangeBlockEvent-in-more-places.patch b/patches/server/0887-Fire-EntityChangeBlockEvent-in-more-places.patch similarity index 97% rename from patches/server/0889-Fire-EntityChangeBlockEvent-in-more-places.patch rename to patches/server/0887-Fire-EntityChangeBlockEvent-in-more-places.patch index a006824b2c..954dc118cf 100644 --- a/patches/server/0889-Fire-EntityChangeBlockEvent-in-more-places.patch +++ b/patches/server/0887-Fire-EntityChangeBlockEvent-in-more-places.patch @@ -111,15 +111,18 @@ index e0c3aa1285709a40ff0ea8c1d74d43d2b341aecc..f4fc8ff3981555e4b560289248a9b02a Block.pushEntitiesUp(iblockdata, iblockdata1, world, blockposition); world.setBlock(blockposition, iblockdata1, 2); diff --git a/src/main/java/net/minecraft/world/item/HoneycombItem.java b/src/main/java/net/minecraft/world/item/HoneycombItem.java -index 68a8d3b16d49c10fc9834f32009095d35c9c55a8..1f8b7b50c6aa24778d87821ae2ff4d019d176082 100644 +index 68a8d3b16d49c10fc9834f32009095d35c9c55a8..f0b720eafc538f97d788f89bd2f2e9da0ff84a19 100644 --- a/src/main/java/net/minecraft/world/item/HoneycombItem.java +++ b/src/main/java/net/minecraft/world/item/HoneycombItem.java -@@ -37,6 +37,11 @@ public class HoneycombItem extends Item { +@@ -37,6 +37,14 @@ public class HoneycombItem extends Item { return getWaxed(blockState).map((state) -> { Player player = context.getPlayer(); ItemStack itemStack = context.getItemInHand(); + // Paper start - EntityChangeBlockEvent + if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(player, blockPos, state).isCancelled()) { ++ if (!player.isCreative()) { ++ player.containerMenu.sendAllDataToRemote(); ++ } + return InteractionResult.PASS; + } + // Paper end diff --git a/patches/server/0890-Missing-eating-regain-reason.patch b/patches/server/0888-Missing-eating-regain-reason.patch similarity index 100% rename from patches/server/0890-Missing-eating-regain-reason.patch rename to patches/server/0888-Missing-eating-regain-reason.patch diff --git a/patches/server/0891-Missing-effect-cause.patch b/patches/server/0889-Missing-effect-cause.patch similarity index 100% rename from patches/server/0891-Missing-effect-cause.patch rename to patches/server/0889-Missing-effect-cause.patch diff --git a/patches/server/0892-Added-byte-array-serialization-deserialization-for-P.patch b/patches/server/0890-Added-byte-array-serialization-deserialization-for-P.patch similarity index 100% rename from patches/server/0892-Added-byte-array-serialization-deserialization-for-P.patch rename to patches/server/0890-Added-byte-array-serialization-deserialization-for-P.patch diff --git a/patches/server/0893-Add-a-consumer-parameter-to-ProjectileSource-launchP.patch b/patches/server/0891-Add-a-consumer-parameter-to-ProjectileSource-launchP.patch similarity index 93% rename from patches/server/0893-Add-a-consumer-parameter-to-ProjectileSource-launchP.patch rename to patches/server/0891-Add-a-consumer-parameter-to-ProjectileSource-launchP.patch index 08105c906f..0a96c29e31 100644 --- a/patches/server/0893-Add-a-consumer-parameter-to-ProjectileSource-launchP.patch +++ b/patches/server/0891-Add-a-consumer-parameter-to-ProjectileSource-launchP.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add a consumer parameter to ProjectileSource#launchProjectile diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index 244123cd98171dcd8ea9e34b32d5ba8c2bd6b7f8..a4d916fcb12da37f9b75e844346578c160abea96 100644 +index f7d20efecfee6aaae2e323d543739308c4bb371c..65f8d9b6a4ecffdf50b88c6924402bdf0668a8f2 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -@@ -493,8 +493,15 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { +@@ -499,8 +499,15 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { } @Override @@ -25,7 +25,7 @@ index 244123cd98171dcd8ea9e34b32d5ba8c2bd6b7f8..a4d916fcb12da37f9b75e844346578c1 Preconditions.checkState(!this.getHandle().generation, "Cannot launch projectile during world generation"); net.minecraft.world.level.Level world = ((CraftWorld) getWorld()).getHandle(); -@@ -577,6 +584,11 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { +@@ -583,6 +590,11 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { if (velocity != null) { ((T) launch.getBukkitEntity()).setVelocity(velocity); } diff --git a/patches/server/0894-Call-BlockPhysicsEvent-more-often.patch b/patches/server/0892-Call-BlockPhysicsEvent-more-often.patch similarity index 100% rename from patches/server/0894-Call-BlockPhysicsEvent-more-often.patch rename to patches/server/0892-Call-BlockPhysicsEvent-more-often.patch diff --git a/patches/server/0895-Configurable-chat-thread-limit.patch b/patches/server/0893-Configurable-chat-thread-limit.patch similarity index 100% rename from patches/server/0895-Configurable-chat-thread-limit.patch rename to patches/server/0893-Configurable-chat-thread-limit.patch diff --git a/patches/server/0896-Mitigate-effects-of-WorldCreator-keepSpawnLoaded-ret.patch b/patches/server/0894-Mitigate-effects-of-WorldCreator-keepSpawnLoaded-ret.patch similarity index 100% rename from patches/server/0896-Mitigate-effects-of-WorldCreator-keepSpawnLoaded-ret.patch rename to patches/server/0894-Mitigate-effects-of-WorldCreator-keepSpawnLoaded-ret.patch diff --git a/patches/server/0897-Set-position-before-player-sending-on-dimension-chan.patch b/patches/server/0895-Set-position-before-player-sending-on-dimension-chan.patch similarity index 92% rename from patches/server/0897-Set-position-before-player-sending-on-dimension-chan.patch rename to patches/server/0895-Set-position-before-player-sending-on-dimension-chan.patch index d25f138b09..df2a0e624b 100644 --- a/patches/server/0897-Set-position-before-player-sending-on-dimension-chan.patch +++ b/patches/server/0895-Set-position-before-player-sending-on-dimension-chan.patch @@ -7,7 +7,7 @@ This causes a moment where the player entity is sent with the previous location, teleport packet which is sent shortly after is meant to correct that. diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 9ec0ae8fd404a595f4a659b10c5107421db8f1f8..40229b0dc295bcca956d8cc3c32834c6f1748bbc 100644 +index 472f4b8bbd609aa3776c38a6b8cbec61a73b4209..9187ac335e9e459df4832e95a5691db0644892e5 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1161,6 +1161,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0898-fix-Jigsaw-block-kicking-user.patch b/patches/server/0896-fix-Jigsaw-block-kicking-user.patch similarity index 100% rename from patches/server/0898-fix-Jigsaw-block-kicking-user.patch rename to patches/server/0896-fix-Jigsaw-block-kicking-user.patch diff --git a/patches/server/0899-use-BlockFormEvent-for-mud-converting-into-clay.patch b/patches/server/0897-use-BlockFormEvent-for-mud-converting-into-clay.patch similarity index 100% rename from patches/server/0899-use-BlockFormEvent-for-mud-converting-into-clay.patch rename to patches/server/0897-use-BlockFormEvent-for-mud-converting-into-clay.patch diff --git a/patches/server/0900-Add-getDrops-to-BlockState-and-isPreferredTool-to-Bl.patch b/patches/server/0898-Add-getDrops-to-BlockState.patch similarity index 66% rename from patches/server/0900-Add-getDrops-to-BlockState-and-isPreferredTool-to-Bl.patch rename to patches/server/0898-Add-getDrops-to-BlockState.patch index d11dd661b3..a83779ec9a 100644 --- a/patches/server/0900-Add-getDrops-to-BlockState-and-isPreferredTool-to-Bl.patch +++ b/patches/server/0898-Add-getDrops-to-BlockState.patch @@ -1,8 +1,10 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: MelnCat Date: Fri, 12 Aug 2022 23:24:37 -0700 -Subject: [PATCH] Add getDrops to BlockState and isPreferredTool to BlockData +Subject: [PATCH] Add getDrops to BlockState +Originally added isPreferredTool to BlockData but +upstream added that. diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java index 966ac60daebb7bb211ab8096fc0c5f33db67320a..a8ab1d3ee81664193be39d2735d6495136e0e310 100644 @@ -42,20 +44,3 @@ index 966ac60daebb7bb211ab8096fc0c5f33db67320a..a8ab1d3ee81664193be39d2735d64951 + } // Paper end } -diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java -index 6f7ee97e381e80d6e8cf6b9c3f40b5e25f6bf64b..1fefe185800dd48dd328697127405e0844543e5e 100644 ---- a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java -+++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java -@@ -623,4 +623,12 @@ public class CraftBlockData implements BlockData { - return this.state.isRandomlyTicking(); - } - // Paper end -+ -+ // Paper start - Preferred tool API -+ @Override -+ public boolean isPreferredTool(org.bukkit.inventory.ItemStack item) { -+ net.minecraft.world.item.ItemStack nms = org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(item); -+ return !state.requiresCorrectToolForDrops() || nms.isCorrectToolForDrops(state); -+ } -+ // Paper end - } diff --git a/patches/server/0901-Fix-a-bunch-of-vanilla-bugs.patch b/patches/server/0899-Fix-a-bunch-of-vanilla-bugs.patch similarity index 100% rename from patches/server/0901-Fix-a-bunch-of-vanilla-bugs.patch rename to patches/server/0899-Fix-a-bunch-of-vanilla-bugs.patch diff --git a/patches/server/0902-Remove-unnecessary-onTrackingStart-during-navigation.patch b/patches/server/0900-Remove-unnecessary-onTrackingStart-during-navigation.patch similarity index 100% rename from patches/server/0902-Remove-unnecessary-onTrackingStart-during-navigation.patch rename to patches/server/0900-Remove-unnecessary-onTrackingStart-during-navigation.patch diff --git a/patches/server/0903-Fix-custom-piglin-loved-items.patch b/patches/server/0901-Fix-custom-piglin-loved-items.patch similarity index 100% rename from patches/server/0903-Fix-custom-piglin-loved-items.patch rename to patches/server/0901-Fix-custom-piglin-loved-items.patch diff --git a/patches/server/0904-EntityPickupItemEvent-fixes.patch b/patches/server/0902-EntityPickupItemEvent-fixes.patch similarity index 100% rename from patches/server/0904-EntityPickupItemEvent-fixes.patch rename to patches/server/0902-EntityPickupItemEvent-fixes.patch diff --git a/patches/server/0905-Correctly-handle-interactions-with-items-on-cooldown.patch b/patches/server/0903-Correctly-handle-interactions-with-items-on-cooldown.patch similarity index 100% rename from patches/server/0905-Correctly-handle-interactions-with-items-on-cooldown.patch rename to patches/server/0903-Correctly-handle-interactions-with-items-on-cooldown.patch diff --git a/patches/server/0906-Add-PlayerInventorySlotChangeEvent.patch b/patches/server/0904-Add-PlayerInventorySlotChangeEvent.patch similarity index 94% rename from patches/server/0906-Add-PlayerInventorySlotChangeEvent.patch rename to patches/server/0904-Add-PlayerInventorySlotChangeEvent.patch index b1f2e86a94..07af25e2fc 100644 --- a/patches/server/0906-Add-PlayerInventorySlotChangeEvent.patch +++ b/patches/server/0904-Add-PlayerInventorySlotChangeEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerInventorySlotChangeEvent diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 40229b0dc295bcca956d8cc3c32834c6f1748bbc..85570b5c362033075114ed86746f23c24251827d 100644 +index 9187ac335e9e459df4832e95a5691db0644892e5..44c7f65d93b57cd3fff0b10c1d08a98250f3805f 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -321,6 +321,25 @@ public class ServerPlayer extends Player { @@ -35,7 +35,7 @@ index 40229b0dc295bcca956d8cc3c32834c6f1748bbc..85570b5c362033075114ed86746f23c2 @Override public void dataChanged(AbstractContainerMenu handler, int property, int value) {} diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java -index 495c605b36e2e1430988030d6c44675e0aaffd2f..4e471b19f1053bf6fd0979d4446a1361edf25aa2 100644 +index f7bce1cdad50aec0f8df9d996de7dbec38baec69..fcedd5afe138a97063d2fdd50edb1da16dcff9fd 100644 --- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java +++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java @@ -302,7 +302,7 @@ public abstract class AbstractContainerMenu { diff --git a/patches/server/0907-Elder-Guardian-appearance-API.patch b/patches/server/0905-Elder-Guardian-appearance-API.patch similarity index 84% rename from patches/server/0907-Elder-Guardian-appearance-API.patch rename to patches/server/0905-Elder-Guardian-appearance-API.patch index 269dd69fd7..5fdb02cd06 100644 --- a/patches/server/0907-Elder-Guardian-appearance-API.patch +++ b/patches/server/0905-Elder-Guardian-appearance-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Elder Guardian appearance API diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index cd439593d050fb157fae3575207a285a48d71783..009150ece99c039c7e92ac89c8069a2e378db34a 100644 +index 6d1309e811e299984823caab24325fa6970dee57..c932bc990dce99c8ce2eaf8563d0ae7859124795 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -3000,6 +3000,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -3019,6 +3019,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } // Paper end diff --git a/patches/server/0908-Allow-changing-bed-s-occupied-property.patch b/patches/server/0906-Allow-changing-bed-s-occupied-property.patch similarity index 100% rename from patches/server/0908-Allow-changing-bed-s-occupied-property.patch rename to patches/server/0906-Allow-changing-bed-s-occupied-property.patch diff --git a/patches/server/0909-Add-entity-knockback-API.patch b/patches/server/0907-Add-entity-knockback-API.patch similarity index 85% rename from patches/server/0909-Add-entity-knockback-API.patch rename to patches/server/0907-Add-entity-knockback-API.patch index 303eb5dc94..6acd2e7e66 100644 --- a/patches/server/0909-Add-entity-knockback-API.patch +++ b/patches/server/0907-Add-entity-knockback-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add entity knockback API diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index a4d916fcb12da37f9b75e844346578c160abea96..3076831b3d26c6dd3bf0c0d0618151ce6ad0df82 100644 +index 65f8d9b6a4ecffdf50b88c6924402bdf0668a8f2..2785c42b9b0a9e22ad544f8a4eb6cb77eaad0db6 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -@@ -988,5 +988,11 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { +@@ -994,5 +994,11 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { } throw new IllegalArgumentException(entityCategory + " is an unrecognized entity category"); } diff --git a/patches/server/0910-Detect-headless-JREs.patch b/patches/server/0908-Detect-headless-JREs.patch similarity index 94% rename from patches/server/0910-Detect-headless-JREs.patch rename to patches/server/0908-Detect-headless-JREs.patch index 547c655d70..e3c12df9b9 100644 --- a/patches/server/0910-Detect-headless-JREs.patch +++ b/patches/server/0908-Detect-headless-JREs.patch @@ -27,10 +27,10 @@ index 6bd0afddbcc461149dfe9a5c7a86fff6ea13a5f1..148d233f4f5278ff39eacdaa0f4f0e7d + } } diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java -index 6a5698f05a5f839e643e747c21834aacb90feec8..31faf2d6492696f7d0c99a48edbc0d6f15db1209 100644 +index c98a67de81439f6e5f8e2eedc7b9d8e3ddc5dc5b..a821cb33fbc29109aec68f9d6a0eb2efc121ee13 100644 --- a/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java -@@ -158,6 +158,18 @@ public class Main { +@@ -169,6 +169,18 @@ public class Main { return; } diff --git a/patches/server/0911-fixed-entity-vehicle-collision-event-not-called.patch b/patches/server/0909-fixed-entity-vehicle-collision-event-not-called.patch similarity index 100% rename from patches/server/0911-fixed-entity-vehicle-collision-event-not-called.patch rename to patches/server/0909-fixed-entity-vehicle-collision-event-not-called.patch diff --git a/patches/server/0912-optimized-dirt-and-snow-spreading.patch b/patches/server/0910-optimized-dirt-and-snow-spreading.patch similarity index 100% rename from patches/server/0912-optimized-dirt-and-snow-spreading.patch rename to patches/server/0910-optimized-dirt-and-snow-spreading.patch diff --git a/patches/server/0913-Added-EntityToggleSitEvent.patch b/patches/server/0911-Added-EntityToggleSitEvent.patch similarity index 100% rename from patches/server/0913-Added-EntityToggleSitEvent.patch rename to patches/server/0911-Added-EntityToggleSitEvent.patch diff --git a/patches/server/0914-Add-fire-tick-delay-option.patch b/patches/server/0912-Add-fire-tick-delay-option.patch similarity index 100% rename from patches/server/0914-Add-fire-tick-delay-option.patch rename to patches/server/0912-Add-fire-tick-delay-option.patch diff --git a/patches/server/0915-Add-Moving-Piston-API.patch b/patches/server/0913-Add-Moving-Piston-API.patch similarity index 100% rename from patches/server/0915-Add-Moving-Piston-API.patch rename to patches/server/0913-Add-Moving-Piston-API.patch diff --git a/patches/server/0916-Ignore-impossible-spawn-tick.patch b/patches/server/0914-Ignore-impossible-spawn-tick.patch similarity index 100% rename from patches/server/0916-Ignore-impossible-spawn-tick.patch rename to patches/server/0914-Ignore-impossible-spawn-tick.patch diff --git a/patches/server/0917-Track-projectile-source-for-fireworks-from-dispenser.patch b/patches/server/0915-Track-projectile-source-for-fireworks-from-dispenser.patch similarity index 100% rename from patches/server/0917-Track-projectile-source-for-fireworks-from-dispenser.patch rename to patches/server/0915-Track-projectile-source-for-fireworks-from-dispenser.patch diff --git a/patches/server/0918-Fix-EntityArgument-suggestion-permissions-to-align-w.patch b/patches/server/0916-Fix-EntityArgument-suggestion-permissions-to-align-w.patch similarity index 100% rename from patches/server/0918-Fix-EntityArgument-suggestion-permissions-to-align-w.patch rename to patches/server/0916-Fix-EntityArgument-suggestion-permissions-to-align-w.patch diff --git a/patches/server/0919-Fix-EntityCombustEvent-cancellation-cant-fully-preve.patch b/patches/server/0917-Fix-EntityCombustEvent-cancellation-cant-fully-preve.patch similarity index 100% rename from patches/server/0919-Fix-EntityCombustEvent-cancellation-cant-fully-preve.patch rename to patches/server/0917-Fix-EntityCombustEvent-cancellation-cant-fully-preve.patch diff --git a/patches/server/0920-Prevent-compass-from-loading-chunks.patch b/patches/server/0918-Prevent-compass-from-loading-chunks.patch similarity index 100% rename from patches/server/0920-Prevent-compass-from-loading-chunks.patch rename to patches/server/0918-Prevent-compass-from-loading-chunks.patch diff --git a/patches/server/0921-Add-PrePlayerAttackEntityEvent.patch b/patches/server/0919-Add-PrePlayerAttackEntityEvent.patch similarity index 93% rename from patches/server/0921-Add-PrePlayerAttackEntityEvent.patch rename to patches/server/0919-Add-PrePlayerAttackEntityEvent.patch index 8b93056f79..c23d845d08 100644 --- a/patches/server/0921-Add-PrePlayerAttackEntityEvent.patch +++ b/patches/server/0919-Add-PrePlayerAttackEntityEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add PrePlayerAttackEntityEvent diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index 23ef09683ff506996c45aa8a3b84c72055960f03..0dcae10fd05a8fe963fdedda8199aa09dc717c9a 100644 +index 69900f89e7c5f8c6e33025059d7248c7e9371fe9..875a7d2b2ecd75a51af7d158b7acee358b5082fe 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -1233,8 +1233,17 @@ public abstract class Player extends LivingEntity { diff --git a/patches/server/0922-ensure-reset-EnderDragon-boss-event-name.patch b/patches/server/0920-ensure-reset-EnderDragon-boss-event-name.patch similarity index 100% rename from patches/server/0922-ensure-reset-EnderDragon-boss-event-name.patch rename to patches/server/0920-ensure-reset-EnderDragon-boss-event-name.patch diff --git a/patches/server/0923-fix-MC-252817-green-map-markers-do-not-disappear.patch b/patches/server/0921-fix-MC-252817-green-map-markers-do-not-disappear.patch similarity index 100% rename from patches/server/0923-fix-MC-252817-green-map-markers-do-not-disappear.patch rename to patches/server/0921-fix-MC-252817-green-map-markers-do-not-disappear.patch diff --git a/patches/server/0924-Add-Player-Warden-Warning-API.patch b/patches/server/0922-Add-Player-Warden-Warning-API.patch similarity index 93% rename from patches/server/0924-Add-Player-Warden-Warning-API.patch rename to patches/server/0922-Add-Player-Warden-Warning-API.patch index 85ac22f070..a42bcbdbaf 100644 --- a/patches/server/0924-Add-Player-Warden-Warning-API.patch +++ b/patches/server/0922-Add-Player-Warden-Warning-API.patch @@ -10,10 +10,10 @@ public net.minecraft.world.entity.monster.warden.WardenSpawnTracker cooldownTick public net.minecraft.world.entity.monster.warden.WardenSpawnTracker increaseWarningLevel()V diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 009150ece99c039c7e92ac89c8069a2e378db34a..d87b6ccc57be06739a0105805735feb1800ada69 100644 +index c932bc990dce99c8ce2eaf8563d0ae7859124795..18c2c1454f8f3319b2a0b7649b99d25933cc18a6 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -3005,6 +3005,41 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -3024,6 +3024,41 @@ public class CraftPlayer extends CraftHumanEntity implements Player { public void showElderGuardian(boolean silent) { if (getHandle().connection != null) getHandle().connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.GUARDIAN_ELDER_EFFECT, silent ? 0F : 1F)); } diff --git a/patches/server/0925-More-vanilla-friendly-methods-to-update-trades.patch b/patches/server/0923-More-vanilla-friendly-methods-to-update-trades.patch similarity index 100% rename from patches/server/0925-More-vanilla-friendly-methods-to-update-trades.patch rename to patches/server/0923-More-vanilla-friendly-methods-to-update-trades.patch diff --git a/patches/server/0926-Add-paper-dumplisteners-command.patch b/patches/server/0924-Add-paper-dumplisteners-command.patch similarity index 98% rename from patches/server/0926-Add-paper-dumplisteners-command.patch rename to patches/server/0924-Add-paper-dumplisteners-command.patch index c59dba6293..e3b37840de 100644 --- a/patches/server/0926-Add-paper-dumplisteners-command.patch +++ b/patches/server/0924-Add-paper-dumplisteners-command.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Add /paper dumplisteners command Co-authored-by: TwoLeggedCat <80929284+TwoLeggedCat@users.noreply.github.com> diff --git a/src/main/java/io/papermc/paper/command/PaperCommand.java b/src/main/java/io/papermc/paper/command/PaperCommand.java -index 724592234e2a178a518f6ab7d09c3180780371a7..92154550b41b2e1d03deb1271b71bb3baa735e0a 100644 +index 5c0b02f1ca8f6594f8f94613edba2783087950f2..f7a92aba7c8b98c44839fd6687dd9b96df893399 100644 --- a/src/main/java/io/papermc/paper/command/PaperCommand.java +++ b/src/main/java/io/papermc/paper/command/PaperCommand.java @@ -2,6 +2,7 @@ package io.papermc.paper.command; @@ -17,7 +17,7 @@ index 724592234e2a178a518f6ab7d09c3180780371a7..92154550b41b2e1d03deb1271b71bb3b import io.papermc.paper.command.subcommands.EntityCommand; import io.papermc.paper.command.subcommands.FixLightCommand; import io.papermc.paper.command.subcommands.HeapDumpCommand; -@@ -50,6 +51,7 @@ public final class PaperCommand extends Command { +@@ -52,6 +53,7 @@ public final class PaperCommand extends Command { commands.put(Set.of("syncloadinfo"), new SyncLoadInfoCommand()); commands.put(Set.of("dumpitem"), new DumpItemCommand()); commands.put(Set.of("mobcaps", "playermobcaps"), new MobcapsCommand()); diff --git a/patches/server/0927-check-global-player-list-where-appropriate.patch b/patches/server/0925-check-global-player-list-where-appropriate.patch similarity index 100% rename from patches/server/0927-check-global-player-list-where-appropriate.patch rename to patches/server/0925-check-global-player-list-where-appropriate.patch diff --git a/patches/server/0928-Fix-async-entity-add-due-to-fungus-trees.patch b/patches/server/0926-Fix-async-entity-add-due-to-fungus-trees.patch similarity index 100% rename from patches/server/0928-Fix-async-entity-add-due-to-fungus-trees.patch rename to patches/server/0926-Fix-async-entity-add-due-to-fungus-trees.patch diff --git a/patches/server/0929-ItemStack-damage-API.patch b/patches/server/0927-ItemStack-damage-API.patch similarity index 95% rename from patches/server/0929-ItemStack-damage-API.patch rename to patches/server/0927-ItemStack-damage-API.patch index 2c5cdf53c4..29f8663b90 100644 --- a/patches/server/0929-ItemStack-damage-API.patch +++ b/patches/server/0927-ItemStack-damage-API.patch @@ -11,10 +11,10 @@ the logic associated with damaging them public net.minecraft.world.entity.LivingEntity entityEventForEquipmentBreak(Lnet/minecraft/world/entity/EquipmentSlot;)B diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index 3076831b3d26c6dd3bf0c0d0618151ce6ad0df82..fe9f52176d87944ac5743dced8cf4d0576089d06 100644 +index 2785c42b9b0a9e22ad544f8a4eb6cb77eaad0db6..7a7647fbe7dc4167c4e90fbd63e03a23e9b2729c 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -@@ -989,6 +989,53 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { +@@ -995,6 +995,53 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { throw new IllegalArgumentException(entityCategory + " is an unrecognized entity category"); } diff --git a/patches/server/0930-Friction-API.patch b/patches/server/0928-Friction-API.patch similarity index 97% rename from patches/server/0930-Friction-API.patch rename to patches/server/0928-Friction-API.patch index f34ea15234..e0835a582d 100644 --- a/patches/server/0930-Friction-API.patch +++ b/patches/server/0928-Friction-API.patch @@ -132,10 +132,10 @@ index fea44ba6a6584b4a510af6a58cab07eecec6b68b..ecec5e17807a760769fc0ea79c2a0161 public int getHealth() { return item.health; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index fe9f52176d87944ac5743dced8cf4d0576089d06..09da9d3c85e36c2a78663f58a97963dbc795a367 100644 +index 7a7647fbe7dc4167c4e90fbd63e03a23e9b2729c..f2a7a10df4c283ef3d7e44121c074156556c9cf2 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -@@ -1036,6 +1036,18 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { +@@ -1042,6 +1042,18 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { }); } diff --git a/patches/server/0931-Ability-to-control-player-s-insomnia-and-phantoms.patch b/patches/server/0929-Ability-to-control-player-s-insomnia-and-phantoms.patch similarity index 100% rename from patches/server/0931-Ability-to-control-player-s-insomnia-and-phantoms.patch rename to patches/server/0929-Ability-to-control-player-s-insomnia-and-phantoms.patch diff --git a/patches/server/0932-Fix-player-kick-on-shutdown.patch b/patches/server/0930-Fix-player-kick-on-shutdown.patch similarity index 100% rename from patches/server/0932-Fix-player-kick-on-shutdown.patch rename to patches/server/0930-Fix-player-kick-on-shutdown.patch diff --git a/patches/server/0933-Sync-offhand-slot-in-menus.patch b/patches/server/0931-Sync-offhand-slot-in-menus.patch similarity index 94% rename from patches/server/0933-Sync-offhand-slot-in-menus.patch rename to patches/server/0931-Sync-offhand-slot-in-menus.patch index a3d0b95a6a..2abdfc05cc 100644 --- a/patches/server/0933-Sync-offhand-slot-in-menus.patch +++ b/patches/server/0931-Sync-offhand-slot-in-menus.patch @@ -8,7 +8,7 @@ offhand slot isn't sent. This is not correct because you *can* put stuff into th by pressing the offhand swap item diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 85570b5c362033075114ed86746f23c24251827d..7d6d3c8556033d289fdadc489e73fba478fce41a 100644 +index 44c7f65d93b57cd3fff0b10c1d08a98250f3805f..9160725f031c9698a00229c3dfa19d39b4a826c1 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -290,6 +290,13 @@ public class ServerPlayer extends Player { @@ -26,7 +26,7 @@ index 85570b5c362033075114ed86746f23c24251827d..7d6d3c8556033d289fdadc489e73fba4 public void sendSlotChange(AbstractContainerMenu handler, int slot, ItemStack stack) { ServerPlayer.this.connection.send(new ClientboundContainerSetSlotPacket(handler.containerId, handler.incrementStateId(), slot, stack)); diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java -index 4e471b19f1053bf6fd0979d4446a1361edf25aa2..95ba37458e8154dbce6a8590508840d694fcbed1 100644 +index fcedd5afe138a97063d2fdd50edb1da16dcff9fd..143977055717c2fe27df76231da304e2863b8f1f 100644 --- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java +++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java @@ -200,6 +200,7 @@ public abstract class AbstractContainerMenu { diff --git a/patches/server/0934-Player-Entity-Tracking-Events.patch b/patches/server/0932-Player-Entity-Tracking-Events.patch similarity index 100% rename from patches/server/0934-Player-Entity-Tracking-Events.patch rename to patches/server/0932-Player-Entity-Tracking-Events.patch diff --git a/patches/server/0935-Limit-pet-look-distance.patch b/patches/server/0933-Limit-pet-look-distance.patch similarity index 100% rename from patches/server/0935-Limit-pet-look-distance.patch rename to patches/server/0933-Limit-pet-look-distance.patch diff --git a/patches/server/0936-Properly-resend-entities.patch b/patches/server/0934-Properly-resend-entities.patch similarity index 97% rename from patches/server/0936-Properly-resend-entities.patch rename to patches/server/0934-Properly-resend-entities.patch index 1afcbceb95..8938bb0092 100644 --- a/patches/server/0936-Properly-resend-entities.patch +++ b/patches/server/0934-Properly-resend-entities.patch @@ -66,10 +66,10 @@ index 755989780c955592e27cae2b4b5f0e90e13543b7..37e193f57938047c8b886ed7d2816411 public static class DataItem { diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 50c1d6dedcb7579ce5e83599b47016e4fc8d9d9a..08cb3db28f13c352a162009deeb28ee637e98d2a 100644 +index 834b899ec913def6fe4f517f5b76c9c0f92c970b..354b6e86b789ce80fe8f28384e4ca783c37c9007 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2770,7 +2770,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2776,7 +2776,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic // Entity in bucket - SPIGOT-4048 and SPIGOT-6859a if ((entity instanceof Bucketable && entity instanceof LivingEntity && origItem != null && origItem.asItem() == Items.WATER_BUCKET) && (event.isCancelled() || ServerGamePacketListenerImpl.this.player.getInventory().getSelected() == null || ServerGamePacketListenerImpl.this.player.getInventory().getSelected().getItem() != origItem)) { diff --git a/patches/server/0937-Fixes-and-additions-to-the-SpawnReason-API.patch b/patches/server/0935-Fixes-and-additions-to-the-SpawnReason-API.patch similarity index 100% rename from patches/server/0937-Fixes-and-additions-to-the-SpawnReason-API.patch rename to patches/server/0935-Fixes-and-additions-to-the-SpawnReason-API.patch diff --git a/patches/server/0938-fix-Instruments.patch b/patches/server/0936-fix-Instruments.patch similarity index 97% rename from patches/server/0938-fix-Instruments.patch rename to patches/server/0936-fix-Instruments.patch index 7d9a7d5a08..ebe7670451 100644 --- a/patches/server/0938-fix-Instruments.patch +++ b/patches/server/0936-fix-Instruments.patch @@ -6,7 +6,7 @@ Subject: [PATCH] fix Instruments properly handle Player#playNote diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index d87b6ccc57be06739a0105805735feb1800ada69..99bf1485ddecb5fc88850242e9c32850781c4b36 100644 +index 18c2c1454f8f3319b2a0b7649b99d25933cc18a6..ab11ed9d587b633f0f86f13dcb63adac63c3ff78 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -767,62 +767,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0939-Fix-chunk-snapshot-biome-getter.patch b/patches/server/0937-Fix-chunk-snapshot-biome-getter.patch similarity index 91% rename from patches/server/0939-Fix-chunk-snapshot-biome-getter.patch rename to patches/server/0937-Fix-chunk-snapshot-biome-getter.patch index 2028401dca..dad6f12e28 100644 --- a/patches/server/0939-Fix-chunk-snapshot-biome-getter.patch +++ b/patches/server/0937-Fix-chunk-snapshot-biome-getter.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Fix chunk snapshot biome getter Fixes SPIGOT-7188: https://hub.spigotmc.org/jira/browse/SPIGOT-7188 diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java b/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java -index 75193684a71d694736087d1a368b8fb6a8c8363b..f39cf8e90d955c83471363e7dc5097c04894785b 100644 +index 05512cc19eb213b6be5c869e133376ee42827806..c6416b3db0166374065d537e379d05da0f093b21 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java -@@ -135,7 +135,7 @@ public class CraftChunkSnapshot implements ChunkSnapshot { +@@ -149,7 +149,7 @@ public class CraftChunkSnapshot implements ChunkSnapshot { Preconditions.checkState(this.biome != null, "ChunkSnapshot created without biome. Please call getSnapshot with includeBiome=true"); this.validateChunkCoordinates(x, y, z); @@ -18,7 +18,7 @@ index 75193684a71d694736087d1a368b8fb6a8c8363b..f39cf8e90d955c83471363e7dc5097c0 return CraftBlock.biomeBaseToBiome(biomeRegistry, biome.get(x >> 2, (y & 0xF) >> 2, z >> 2)); } -@@ -149,7 +149,7 @@ public class CraftChunkSnapshot implements ChunkSnapshot { +@@ -163,7 +163,7 @@ public class CraftChunkSnapshot implements ChunkSnapshot { Preconditions.checkState(this.biome != null, "ChunkSnapshot created without biome. Please call getSnapshot with includeBiome=true"); this.validateChunkCoordinates(x, y, z); diff --git a/patches/server/0940-Improve-inlining-for-some-hot-BlockBehavior-and-Flui.patch b/patches/server/0938-Improve-inlining-for-some-hot-BlockBehavior-and-Flui.patch similarity index 100% rename from patches/server/0940-Improve-inlining-for-some-hot-BlockBehavior-and-Flui.patch rename to patches/server/0938-Improve-inlining-for-some-hot-BlockBehavior-and-Flui.patch diff --git a/patches/server/0941-Fix-MapLike-Codec-missing-key-selector.patch b/patches/server/0939-Fix-MapLike-Codec-missing-key-selector.patch similarity index 100% rename from patches/server/0941-Fix-MapLike-Codec-missing-key-selector.patch rename to patches/server/0939-Fix-MapLike-Codec-missing-key-selector.patch diff --git a/patches/server/0942-Fix-inconsistencies-in-dispense-events-regarding-sta.patch b/patches/server/0940-Fix-inconsistencies-in-dispense-events-regarding-sta.patch similarity index 100% rename from patches/server/0942-Fix-inconsistencies-in-dispense-events-regarding-sta.patch rename to patches/server/0940-Fix-inconsistencies-in-dispense-events-regarding-sta.patch diff --git a/patches/server/0943-Improve-logging-and-errors.patch b/patches/server/0941-Improve-logging-and-errors.patch similarity index 100% rename from patches/server/0943-Improve-logging-and-errors.patch rename to patches/server/0941-Improve-logging-and-errors.patch diff --git a/patches/server/0944-Fix-explosion-yield-with-new-gamerules.patch b/patches/server/0942-Fix-explosion-yield-with-new-gamerules.patch similarity index 100% rename from patches/server/0944-Fix-explosion-yield-with-new-gamerules.patch rename to patches/server/0942-Fix-explosion-yield-with-new-gamerules.patch diff --git a/patches/server/0945-Add-BlockLockCheckEvent.patch b/patches/server/0943-Add-BlockLockCheckEvent.patch similarity index 100% rename from patches/server/0945-Add-BlockLockCheckEvent.patch rename to patches/server/0943-Add-BlockLockCheckEvent.patch diff --git a/patches/server/0946-Add-Sneaking-API-for-Entities.patch b/patches/server/0944-Add-Sneaking-API-for-Entities.patch similarity index 100% rename from patches/server/0946-Add-Sneaking-API-for-Entities.patch rename to patches/server/0944-Add-Sneaking-API-for-Entities.patch diff --git a/patches/server/0947-Improve-PortalEvents.patch b/patches/server/0945-Improve-PortalEvents.patch similarity index 100% rename from patches/server/0947-Improve-PortalEvents.patch rename to patches/server/0945-Improve-PortalEvents.patch diff --git a/patches/server/0948-Add-exploded-block-state-to-BlockExplodeEvent.patch b/patches/server/0946-Add-exploded-block-state-to-BlockExplodeEvent.patch similarity index 100% rename from patches/server/0948-Add-exploded-block-state-to-BlockExplodeEvent.patch rename to patches/server/0946-Add-exploded-block-state-to-BlockExplodeEvent.patch diff --git a/patches/server/0949-Add-config-option-for-spider-worldborder-climbing.patch b/patches/server/0947-Add-config-option-for-spider-worldborder-climbing.patch similarity index 100% rename from patches/server/0949-Add-config-option-for-spider-worldborder-climbing.patch rename to patches/server/0947-Add-config-option-for-spider-worldborder-climbing.patch diff --git a/patches/server/0950-Add-missing-SpigotConfig-logCommands-check.patch b/patches/server/0948-Add-missing-SpigotConfig-logCommands-check.patch similarity index 92% rename from patches/server/0950-Add-missing-SpigotConfig-logCommands-check.patch rename to patches/server/0948-Add-missing-SpigotConfig-logCommands-check.patch index a6263d36bc..e08b24a9fb 100644 --- a/patches/server/0950-Add-missing-SpigotConfig-logCommands-check.patch +++ b/patches/server/0948-Add-missing-SpigotConfig-logCommands-check.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add missing SpigotConfig logCommands check diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 08cb3db28f13c352a162009deeb28ee637e98d2a..50d8d16b1856c0c875ccabbcfc240379a7669559 100644 +index 354b6e86b789ce80fe8f28384e4ca783c37c9007..aa11c64c74e1fd875161c9a80a16dbba6738bf1d 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -2256,7 +2256,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic diff --git a/patches/server/0951-Fix-NPE-on-Allay-stopDancing-while-not-dancing.patch b/patches/server/0949-Fix-NPE-on-Allay-stopDancing-while-not-dancing.patch similarity index 100% rename from patches/server/0951-Fix-NPE-on-Allay-stopDancing-while-not-dancing.patch rename to patches/server/0949-Fix-NPE-on-Allay-stopDancing-while-not-dancing.patch diff --git a/patches/server/0952-Flying-Fall-Damage.patch b/patches/server/0950-Flying-Fall-Damage.patch similarity index 89% rename from patches/server/0952-Flying-Fall-Damage.patch rename to patches/server/0950-Flying-Fall-Damage.patch index 5739229ed0..9d4defe90d 100644 --- a/patches/server/0952-Flying-Fall-Damage.patch +++ b/patches/server/0950-Flying-Fall-Damage.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Flying Fall Damage diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index 0dcae10fd05a8fe963fdedda8199aa09dc717c9a..61597ebe2f9faff43994c475074b87d11905e582 100644 +index 875a7d2b2ecd75a51af7d158b7acee358b5082fe..1116116e4ba6c5ecec400cd371b70b9e14efd92b 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -181,6 +181,7 @@ public abstract class Player extends LivingEntity { @@ -26,10 +26,10 @@ index 0dcae10fd05a8fe963fdedda8199aa09dc717c9a..61597ebe2f9faff43994c475074b87d1 } else { if (fallDistance >= 2.0F) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 99bf1485ddecb5fc88850242e9c32850781c4b36..b32f44beab2c9790ee2da8403e362e8b3ecc6175 100644 +index ab11ed9d587b633f0f86f13dcb63adac63c3ff78..b1d01555cb919edd16d46df28d6b09661317b233 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -2167,6 +2167,19 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -2186,6 +2186,19 @@ public class CraftPlayer extends CraftHumanEntity implements Player { this.getHandle().onUpdateAbilities(); } diff --git a/patches/server/0953-Expose-pre-collision-moving-velocity-to-VehicleBlock.patch b/patches/server/0951-Expose-pre-collision-moving-velocity-to-VehicleBlock.patch similarity index 100% rename from patches/server/0953-Expose-pre-collision-moving-velocity-to-VehicleBlock.patch rename to patches/server/0951-Expose-pre-collision-moving-velocity-to-VehicleBlock.patch diff --git a/patches/server/0954-config-for-disabling-entity-tag-tags.patch b/patches/server/0952-config-for-disabling-entity-tag-tags.patch similarity index 100% rename from patches/server/0954-config-for-disabling-entity-tag-tags.patch rename to patches/server/0952-config-for-disabling-entity-tag-tags.patch diff --git a/patches/server/0955-Use-single-player-info-update-packet-on-join.patch b/patches/server/0953-Use-single-player-info-update-packet-on-join.patch similarity index 96% rename from patches/server/0955-Use-single-player-info-update-packet-on-join.patch rename to patches/server/0953-Use-single-player-info-update-packet-on-join.patch index b68960dd6b..c54a7baa17 100644 --- a/patches/server/0955-Use-single-player-info-update-packet-on-join.patch +++ b/patches/server/0953-Use-single-player-info-update-packet-on-join.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Use single player info update packet on join diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 50d8d16b1856c0c875ccabbcfc240379a7669559..3472f7f9b98d6d9c9f6465872803ef17fa67486d 100644 +index aa11c64c74e1fd875161c9a80a16dbba6738bf1d..9b0b42add71172bd154226e51d62cebd8de3542e 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -3605,7 +3605,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3611,7 +3611,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic this.signedMessageDecoder = session.createMessageDecoder(this.player.getUUID()); this.chatMessageChain.append((executor) -> { this.player.setChatSession(session); diff --git a/patches/server/0956-Correctly-shrink-items-during-EntityResurrectEvent.patch b/patches/server/0954-Correctly-shrink-items-during-EntityResurrectEvent.patch similarity index 100% rename from patches/server/0956-Correctly-shrink-items-during-EntityResurrectEvent.patch rename to patches/server/0954-Correctly-shrink-items-during-EntityResurrectEvent.patch diff --git a/patches/server/0957-Add-Player-sendEquipmentChange-Map-API.patch b/patches/server/0955-Add-Player-sendEquipmentChange-Map-API.patch similarity index 93% rename from patches/server/0957-Add-Player-sendEquipmentChange-Map-API.patch rename to patches/server/0955-Add-Player-sendEquipmentChange-Map-API.patch index f0d56a5f8d..d57a7ebad4 100644 --- a/patches/server/0957-Add-Player-sendEquipmentChange-Map-API.patch +++ b/patches/server/0955-Add-Player-sendEquipmentChange-Map-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add Player#sendEquipmentChange(Map) API diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index b32f44beab2c9790ee2da8403e362e8b3ecc6175..7b795a8f23a617d1d80f72f3262e11a1c9f806be 100644 +index b1d01555cb919edd16d46df28d6b09661317b233..5ec97491d6c2888e360de1d53f3edcc75ccac95a 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1055,17 +1055,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1068,17 +1068,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player { this.sendSignChange0(components, loc, dyeColor, hasGlowingText); // Paper } diff --git a/patches/server/0958-Win-Screen-API.patch b/patches/server/0956-Win-Screen-API.patch similarity index 66% rename from patches/server/0958-Win-Screen-API.patch rename to patches/server/0956-Win-Screen-API.patch index 7444d0544e..07502c9fdf 100644 --- a/patches/server/0958-Win-Screen-API.patch +++ b/patches/server/0956-Win-Screen-API.patch @@ -3,12 +3,14 @@ From: Lama06 Date: Sat, 21 Jan 2023 13:53:23 +0100 Subject: [PATCH] Win Screen API +== AT == +public net.minecraft.server.level.ServerPlayer seenCredits diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 7b795a8f23a617d1d80f72f3262e11a1c9f806be..7c43de6ad6bd7259c6bcb2a55e312e8abfcf546b 100644 +index 5ec97491d6c2888e360de1d53f3edcc75ccac95a..03430916a8107c1b0f04d84e1dce494e2da06e7a 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1166,6 +1166,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1179,6 +1179,25 @@ public class CraftPlayer extends CraftHumanEntity implements Player { this.getHandle().connection.send(packet); } @@ -19,6 +21,16 @@ index 7b795a8f23a617d1d80f72f3262e11a1c9f806be..7c43de6ad6bd7259c6bcb2a55e312e8a + var packet = new ClientboundGameEventPacket(ClientboundGameEventPacket.WIN_GAME, 1); + getHandle().connection.send(packet); + } ++ ++ @Override ++ public boolean hasSeenWinScreen() { ++ return getHandle().seenCredits; ++ } ++ ++ @Override ++ public void setHasSeenWinScreen(boolean hasSeenWinScreen) { ++ getHandle().seenCredits = hasSeenWinScreen; ++ } + // Paper end + @Override diff --git a/patches/server/0959-Remove-CraftItemStack-setAmount-null-assignment.patch b/patches/server/0957-Remove-CraftItemStack-setAmount-null-assignment.patch similarity index 100% rename from patches/server/0959-Remove-CraftItemStack-setAmount-null-assignment.patch rename to patches/server/0957-Remove-CraftItemStack-setAmount-null-assignment.patch diff --git a/patches/server/0960-Fix-force-opening-enchantment-tables.patch b/patches/server/0958-Fix-force-opening-enchantment-tables.patch similarity index 94% rename from patches/server/0960-Fix-force-opening-enchantment-tables.patch rename to patches/server/0958-Fix-force-opening-enchantment-tables.patch index fe70d01f06..8f0bd48367 100644 --- a/patches/server/0960-Fix-force-opening-enchantment-tables.patch +++ b/patches/server/0958-Fix-force-opening-enchantment-tables.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix force-opening enchantment tables diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -index e779dcc4982ff51e4d450265fd61bc26e8e74d3a..ed22e6f17f48db71cc283afc8b71d85682cd7d3a 100644 +index d69c05223fca71fc5e282095d02bc39fee7ec757..11a06cd0a9cee01107941a2294fbcb493a11ab63 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java @@ -396,7 +396,18 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { diff --git a/patches/server/0959-Add-Entity-Body-Yaw-API.patch b/patches/server/0959-Add-Entity-Body-Yaw-API.patch new file mode 100644 index 0000000000..54c306ec99 --- /dev/null +++ b/patches/server/0959-Add-Entity-Body-Yaw-API.patch @@ -0,0 +1,27 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: TheTuso +Date: Thu, 2 Feb 2023 16:40:41 +0100 +Subject: [PATCH] Add Entity Body Yaw API + + +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +index f2a7a10df4c283ef3d7e44121c074156556c9cf2..2cff68a5c448c0e971d95e9264223eb943730968 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +@@ -1034,6 +1034,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { + this.damageItemStack0(this.getHandle().getItemBySlot(nmsSlot), amount, nmsSlot); + } + ++ @Override ++ public float getBodyYaw() { ++ return this.getHandle().getVisualRotationYInDegrees(); ++ } ++ ++ @Override ++ public void setBodyYaw(float bodyYaw) { ++ this.getHandle().setYBodyRot(bodyYaw); ++ } ++ + private void damageItemStack0(net.minecraft.world.item.ItemStack nmsStack, int amount, net.minecraft.world.entity.EquipmentSlot slot) { + nmsStack.hurtAndBreak(amount, this.getHandle(), livingEntity -> { + if (slot != null) { diff --git a/patches/server/0960-Add-missing-isFuel-Material-entries.patch b/patches/server/0960-Add-missing-isFuel-Material-entries.patch new file mode 100644 index 0000000000..a23eee50fd --- /dev/null +++ b/patches/server/0960-Add-missing-isFuel-Material-entries.patch @@ -0,0 +1,24 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Sun, 12 Feb 2023 10:52:35 -0800 +Subject: [PATCH] Add missing isFuel Material entries + + +diff --git a/src/test/java/org/bukkit/support/AbstractTestingBase.java b/src/test/java/org/bukkit/support/AbstractTestingBase.java +index a19c1e8253b0dd0da77008f892b68187acd17c4a..5b4c93bb313019ad44eb8283865be45c69d99984 100644 +--- a/src/test/java/org/bukkit/support/AbstractTestingBase.java ++++ b/src/test/java/org/bukkit/support/AbstractTestingBase.java +@@ -43,7 +43,12 @@ public abstract class AbstractTestingBase { + SharedConstants.tryDetectVersion(); + Bootstrap.bootStrap(); + // Set up resource manager +- MultiPackResourceManager resourceManager = new MultiPackResourceManager(PackType.SERVER_DATA, Collections.singletonList(new ServerPacksSource().getVanillaPack())); ++ // Paper start - make sure to actually load the packs you add API for ++ final List packs = new java.util.ArrayList<>(); ++ // don't worry about closing them, the only pack types should be VanillaPackResources (empty close) and PackPackResources (also empty close) ++ new ServerPacksSource().loadPacks(pack -> packs.add(pack.open())); ++ final MultiPackResourceManager resourceManager = new MultiPackResourceManager(PackType.SERVER_DATA, packs); ++ // Paper end + // add tags and loot tables for unit tests + LayeredRegistryAccess layers = RegistryLayer.createRegistryAccess(); + layers = WorldLoader.loadAndReplaceLayer(resourceManager, layers, RegistryLayer.WORLDGEN, RegistryDataLoader.WORLDGEN_REGISTRIES); diff --git a/patches/server/0961-Temp-fix-for-EntityType.translationKey.patch b/patches/server/0961-Temp-fix-for-EntityType.translationKey.patch new file mode 100644 index 0000000000..3ecdceaee2 --- /dev/null +++ b/patches/server/0961-Temp-fix-for-EntityType.translationKey.patch @@ -0,0 +1,24 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Shane Freeder +Date: Thu, 16 Feb 2023 03:19:19 +0000 +Subject: [PATCH] Temp fix for EntityType.translationKey() + + +diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +index 769efed4ce75231a5557e4723de5dc3121cedf3d..edc1a161cf509040fcaa12826743232f31d95bd7 100644 +--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java ++++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +@@ -440,7 +440,12 @@ public final class CraftMagicNumbers implements UnsafeValues { + + @Override + public String getTranslationKey(EntityType entityType) { +- return net.minecraft.world.entity.EntityType.byString(entityType.name()).map(net.minecraft.world.entity.EntityType::getDescriptionId).orElseThrow(); ++ // Paper start ++ if (entityType.getName() == null || entityType == EntityType.UNKNOWN) { ++ throw new IllegalArgumentException("Cannot lookup translation key of entity type " + entityType); ++ } ++ return net.minecraft.world.entity.EntityType.byString(entityType.getName()).map(net.minecraft.world.entity.EntityType::getDescriptionId).orElseThrow(); ++ // Paper end + } + + @Override diff --git a/patches/server/0961-Initialisation-improvements.patch b/patches/server/0962-Initialisation-improvements.patch similarity index 98% rename from patches/server/0961-Initialisation-improvements.patch rename to patches/server/0962-Initialisation-improvements.patch index 1cb2d99f57..c11d900d2b 100644 --- a/patches/server/0961-Initialisation-improvements.patch +++ b/patches/server/0962-Initialisation-improvements.patch @@ -58,10 +58,10 @@ index b8b17d046f836c8652ab094db00ab1af84971b2c..e5790e871c46f9d2b92237ed378ecea5 this.mappingsByObfName = maps.stream().collect(Collectors.toUnmodifiableMap(ClassMapping::obfName, map -> map)); this.mappingsByMojangName = maps.stream().collect(Collectors.toUnmodifiableMap(ClassMapping::mojangName, map -> map)); diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java -index 330f6c79417378da855326b4da665f9d240e748d..24a232c2483b5678ecc40a75a638259c3e935e93 100644 +index e92864ecf32dd984f6f87f7b05341e43af3a2977..e60a8eb7d0ff59cf3808020c84bae92a6824347c 100644 --- a/src/main/java/net/minecraft/commands/Commands.java +++ b/src/main/java/net/minecraft/commands/Commands.java -@@ -136,60 +136,60 @@ public class Commands { +@@ -137,60 +137,60 @@ public class Commands { public Commands(Commands.CommandSelection environment, CommandBuildContext commandRegistryAccess) { this(); // CraftBukkit @@ -161,7 +161,7 @@ index 330f6c79417378da855326b4da665f9d240e748d..24a232c2483b5678ecc40a75a638259c WeatherCommand.register(this.dispatcher); WorldBorderCommand.register(this.dispatcher); if (JvmProfiler.INSTANCE.isAvailable()) { -@@ -201,18 +201,18 @@ public class Commands { +@@ -202,18 +202,18 @@ public class Commands { } if (environment.includeDedicated) { @@ -190,7 +190,7 @@ index 330f6c79417378da855326b4da665f9d240e748d..24a232c2483b5678ecc40a75a638259c WhitelistCommand.register(this.dispatcher); } diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java -index 31faf2d6492696f7d0c99a48edbc0d6f15db1209..9281ba58a4b4d3387ff0fb2ba717582e5ffa2bf8 100644 +index a821cb33fbc29109aec68f9d6a0eb2efc121ee13..561bd260592de9096493068e1bf47d03d12ba9a4 100644 --- a/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java @@ -12,8 +12,11 @@ import java.io.File; @@ -232,7 +232,7 @@ index 31faf2d6492696f7d0c99a48edbc0d6f15db1209..9281ba58a4b4d3387ff0fb2ba717582e /* CraftBukkit start - Replace everything OptionParser optionparser = new OptionParser(); OptionSpec optionspec = optionparser.accepts("nogui"); -@@ -105,15 +115,13 @@ public class Main { +@@ -105,8 +115,6 @@ public class Main { */ // CraftBukkit end try { @@ -241,7 +241,8 @@ index 31faf2d6492696f7d0c99a48edbc0d6f15db1209..9281ba58a4b4d3387ff0fb2ba717582e if (optionset.has("jfrProfile")) { // CraftBukkit JvmProfiler.INSTANCE.start(Environment.SERVER); } - +@@ -124,7 +132,7 @@ public class Main { + // Paper end Bootstrap.bootStrap(); Bootstrap.validate(); - Util.startTimerHackThread(); @@ -249,7 +250,7 @@ index 31faf2d6492696f7d0c99a48edbc0d6f15db1209..9281ba58a4b4d3387ff0fb2ba717582e Path path = Paths.get("server.properties"); DedicatedServerSettings dedicatedserversettings = new DedicatedServerSettings(optionset); // CraftBukkit - CLI argument support -@@ -182,6 +190,10 @@ public class Main { +@@ -193,6 +201,10 @@ public class Main { } // Paper end - fix SPIGOT-5824 Services services = Services.create(new com.destroystokyo.paper.profile.PaperAuthenticationService(Proxy.NO_PROXY), file, userCacheFile, optionset); // Paper @@ -260,7 +261,7 @@ index 31faf2d6492696f7d0c99a48edbc0d6f15db1209..9281ba58a4b4d3387ff0fb2ba717582e // CraftBukkit start String s = (String) Optional.ofNullable((String) optionset.valueOf("world")).orElse(dedicatedserversettings.getProperties().levelName); LevelStorageSource convertable = LevelStorageSource.createDefault(file.toPath()); -@@ -208,7 +220,7 @@ public class Main { +@@ -219,7 +231,7 @@ public class Main { PackRepository resourcepackrepository = ServerPacksSource.createPackRepository(convertable_conversionsession.getLevelPath(LevelResource.DATAPACK_DIR)); // CraftBukkit start @@ -269,7 +270,7 @@ index 31faf2d6492696f7d0c99a48edbc0d6f15db1209..9281ba58a4b4d3387ff0fb2ba717582e if (!bukkitDataPackFolder.exists()) { bukkitDataPackFolder.mkdirs(); } -@@ -222,7 +234,7 @@ public class Main { +@@ -233,7 +245,7 @@ public class Main { + "}\n", mcMeta, com.google.common.base.Charsets.UTF_8); } catch (java.io.IOException ex) { throw new RuntimeException("Could not initialize Bukkit datapack", ex); @@ -306,7 +307,7 @@ index 710ca7d3a5659953f64bc6dccdd93b43300961cc..2f638447e1f21e93fc9dd07e3870e22b } diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -index 51b3db0b6c2cede95b584268e035c0fb36d38094..777e205f57c94e569e0d52293abe729743cc09c9 100644 +index a7e133f3495e9132a5fdae2c24f225e7b026295a..4efe15c981094134c11122d7566917f337be482d 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java @@ -17,6 +17,7 @@ import java.util.Collections; @@ -809,10 +810,10 @@ index 5049e969e06f4cc1826378249548064042c28410..4427ba72ab3963af71150e70aa6101ee } } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index bfc4ee36befb925ab4eb6b96f5c1aa6c76bf711f..31d33f590537703da7b5bee4c367cc51fe035732 100644 +index 621919a4a45caa73a43020fdca24764d95d89fd2..cb6e61f39e8847c6b15fe570fafac59241265e71 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -411,7 +411,7 @@ public final class CraftServer implements Server { +@@ -413,7 +413,7 @@ public final class CraftServer implements Server { try { this.configuration.save(this.getConfigFile()); } catch (IOException ex) { @@ -821,7 +822,7 @@ index bfc4ee36befb925ab4eb6b96f5c1aa6c76bf711f..31d33f590537703da7b5bee4c367cc51 } } -@@ -419,7 +419,7 @@ public final class CraftServer implements Server { +@@ -421,7 +421,7 @@ public final class CraftServer implements Server { try { this.commandsConfiguration.save(this.getCommandsConfigFile()); } catch (IOException ex) { @@ -830,7 +831,7 @@ index bfc4ee36befb925ab4eb6b96f5c1aa6c76bf711f..31d33f590537703da7b5bee4c367cc51 } } -@@ -503,7 +503,7 @@ public final class CraftServer implements Server { +@@ -483,7 +483,7 @@ public final class CraftServer implements Server { DefaultPermissions.registerCorePermissions(); CraftDefaultPermissions.registerCorePermissions(); if (!io.papermc.paper.configuration.GlobalConfiguration.get().misc.loadPermissionsYmlBeforePlugins) this.loadCustomPermissions(); // Paper diff --git a/patches/server/0962-TickFreeze.patch b/patches/server/0963-TickFreeze.patch similarity index 100% rename from patches/server/0962-TickFreeze.patch rename to patches/server/0963-TickFreeze.patch diff --git a/test-plugin/build.gradle.kts b/test-plugin/build.gradle.kts index 6bcdb356c5..e86b933408 100644 --- a/test-plugin/build.gradle.kts +++ b/test-plugin/build.gradle.kts @@ -13,7 +13,7 @@ tasks.processResources { "apiversion" to apiVersion, ) inputs.properties(props) - filesMatching("plugin.yml") { + filesMatching("paper-plugin.yml") { expand(props) } } diff --git a/test-plugin/src/main/java/io/papermc/paper/testplugin/TestPlugin.java b/test-plugin/src/main/java/io/papermc/testplugin/TestPlugin.java similarity index 88% rename from test-plugin/src/main/java/io/papermc/paper/testplugin/TestPlugin.java rename to test-plugin/src/main/java/io/papermc/testplugin/TestPlugin.java index a0c78b9d68..4e68423bb7 100644 --- a/test-plugin/src/main/java/io/papermc/paper/testplugin/TestPlugin.java +++ b/test-plugin/src/main/java/io/papermc/testplugin/TestPlugin.java @@ -1,9 +1,10 @@ -package io.papermc.paper.testplugin; +package io.papermc.testplugin; import org.bukkit.event.Listener; import org.bukkit.plugin.java.JavaPlugin; public final class TestPlugin extends JavaPlugin implements Listener { + @Override public void onEnable() { this.getServer().getPluginManager().registerEvents(this, this); diff --git a/test-plugin/src/main/java/io/papermc/testplugin/TestPluginBootstrap.java b/test-plugin/src/main/java/io/papermc/testplugin/TestPluginBootstrap.java new file mode 100644 index 0000000000..e464dac8ae --- /dev/null +++ b/test-plugin/src/main/java/io/papermc/testplugin/TestPluginBootstrap.java @@ -0,0 +1,13 @@ +package io.papermc.testplugin; + +import io.papermc.paper.plugin.bootstrap.PluginBootstrap; +import io.papermc.paper.plugin.bootstrap.PluginProviderContext; +import org.jetbrains.annotations.NotNull; + +public class TestPluginBootstrap implements PluginBootstrap { + + @Override + public void bootstrap(@NotNull PluginProviderContext context) { + } + +} diff --git a/test-plugin/src/main/java/io/papermc/testplugin/TestPluginLoader.java b/test-plugin/src/main/java/io/papermc/testplugin/TestPluginLoader.java new file mode 100644 index 0000000000..084899a9fe --- /dev/null +++ b/test-plugin/src/main/java/io/papermc/testplugin/TestPluginLoader.java @@ -0,0 +1,11 @@ +package io.papermc.testplugin; + +import io.papermc.paper.plugin.loader.PluginClasspathBuilder; +import io.papermc.paper.plugin.loader.PluginLoader; +import org.jetbrains.annotations.NotNull; + +public class TestPluginLoader implements PluginLoader { + @Override + public void classloader(@NotNull PluginClasspathBuilder classpathBuilder) { + } +} diff --git a/test-plugin/src/main/resources/paper-plugin.yml b/test-plugin/src/main/resources/paper-plugin.yml new file mode 100644 index 0000000000..459345d794 --- /dev/null +++ b/test-plugin/src/main/resources/paper-plugin.yml @@ -0,0 +1,12 @@ +name: Paper-Test-Plugin +version: ${version} +main: io.papermc.testplugin.TestPlugin +description: Paper Test Plugin +author: PaperMC +api-version: ${apiversion} +load: STARTUP +bootstrapper: io.papermc.testplugin.TestPluginBootstrap +loader: io.papermc.testplugin.TestPluginLoader +defaultPerm: FALSE +permissions: +dependencies: diff --git a/test-plugin/src/main/resources/plugin.yml b/test-plugin/src/main/resources/plugin.yml deleted file mode 100644 index 1e6adb9ff6..0000000000 --- a/test-plugin/src/main/resources/plugin.yml +++ /dev/null @@ -1,7 +0,0 @@ -name: Paper-Test-Plugin -version: ${version} -main: io.papermc.paper.testplugin.TestPlugin -description: Paper Test Plugin -author: PaperMC -api-version: ${apiversion} -load: STARTUP diff --git a/work/Bukkit b/work/Bukkit index 79e3967192..37262de84b 160000 --- a/work/Bukkit +++ b/work/Bukkit @@ -1 +1 @@ -Subproject commit 79e3967192566bce29eb6688fc3abafa69a2be24 +Subproject commit 37262de84b9613e61809f31691e6f9db48dce0a8 diff --git a/work/CraftBukkit b/work/CraftBukkit index ab8ace6857..a50301aa51 160000 --- a/work/CraftBukkit +++ b/work/CraftBukkit @@ -1 +1 @@ -Subproject commit ab8ace68577ab6c0eb2f84b19bbf1adf3ad4a01d +Subproject commit a50301aa51aab7aa25869d921fa0c6a65eeda547