diff options
author | Jason Penilla <[email protected]> | 2024-05-22 09:43:28 -0700 |
---|---|---|
committer | Jason Penilla <[email protected]> | 2024-05-22 09:43:28 -0700 |
commit | b7606fca6995498cf2fdb4432fffca680c1fdbbf (patch) | |
tree | b232c7eb5beeda7203980aecce8cc2fa7d52806a | |
parent | ec5437b24ee7380f12f70ce1ad593e8c0538e3d2 (diff) | |
download | Paper-b7606fca6995498cf2fdb4432fffca680c1fdbbf.tar.gz Paper-b7606fca6995498cf2fdb4432fffca680c1fdbbf.zip |
skip array conversion
-rw-r--r-- | patches/api/0478-Allow-Bukkit-plugin-to-use-Paper-PluginLoader-API.patch | 6 | ||||
-rw-r--r-- | patches/server/1046-Allow-Bukkit-plugin-to-use-Paper-PluginLoader-API.patch | 17 |
2 files changed, 12 insertions, 11 deletions
diff --git a/patches/api/0478-Allow-Bukkit-plugin-to-use-Paper-PluginLoader-API.patch b/patches/api/0478-Allow-Bukkit-plugin-to-use-Paper-PluginLoader-API.patch index a3aab59860..07f14d4048 100644 --- a/patches/api/0478-Allow-Bukkit-plugin-to-use-Paper-PluginLoader-API.patch +++ b/patches/api/0478-Allow-Bukkit-plugin-to-use-Paper-PluginLoader-API.patch @@ -31,7 +31,7 @@ index c0691a849831f99268fdcb7b0f471f80a1a2a70e..95df45f4042f80f25e923c2a170a7990 try { lazyPermissions = (Map<?, ?>) map.get("permissions"); diff --git a/src/main/java/org/bukkit/plugin/java/LibraryLoader.java b/src/main/java/org/bukkit/plugin/java/LibraryLoader.java -index 8e1b6be2462aaa692efa1f72986921a6dc357196..fb0a6fb6c1b7dfdbc567cb250535479537a2cfbb 100644 +index 8e1b6be2462aaa692efa1f72986921a6dc357196..c66252802c51174bc26f266cb5cdecdd856ff220 100644 --- a/src/main/java/org/bukkit/plugin/java/LibraryLoader.java +++ b/src/main/java/org/bukkit/plugin/java/LibraryLoader.java @@ -84,7 +84,13 @@ public class LibraryLoader @@ -43,7 +43,7 @@ index 8e1b6be2462aaa692efa1f72986921a6dc357196..fb0a6fb6c1b7dfdbc567cb2505354795 + return this.createLoader(desc, null); + } + @Nullable -+ public ClassLoader createLoader(@NotNull PluginDescriptionFile desc, java.nio.file.Path @Nullable [] paperLibraryPaths) { ++ public ClassLoader createLoader(@NotNull PluginDescriptionFile desc, java.util.@Nullable List<java.nio.file.Path> paperLibraryPaths) { + if ( desc.getLibraries().isEmpty() && paperLibraryPaths == null ) + // Paper end - plugin loader api { @@ -67,7 +67,7 @@ index 8e1b6be2462aaa692efa1f72986921a6dc357196..fb0a6fb6c1b7dfdbc567cb2505354795 List<java.nio.file.Path> jarPaths = new ArrayList<>(); // Paper - remap libraries - for ( ArtifactResult artifact : result.getArtifactResults() ) + // Paper start - plugin loader api -+ if (paperLibraryPaths != null) jarPaths.addAll(Arrays.asList(paperLibraryPaths)); ++ if (paperLibraryPaths != null) jarPaths.addAll(paperLibraryPaths); + if (result != null) for ( ArtifactResult artifact : result.getArtifactResults() ) + // Paper end - plugin loader api { diff --git a/patches/server/1046-Allow-Bukkit-plugin-to-use-Paper-PluginLoader-API.patch b/patches/server/1046-Allow-Bukkit-plugin-to-use-Paper-PluginLoader-API.patch index 6df4617ba9..858e08b881 100644 --- a/patches/server/1046-Allow-Bukkit-plugin-to-use-Paper-PluginLoader-API.patch +++ b/patches/server/1046-Allow-Bukkit-plugin-to-use-Paper-PluginLoader-API.patch @@ -101,20 +101,20 @@ index f9d4b33050a6fe8c2dabe8e5eec075d95dc513e0..dc106685ecb483c33c06e4f83eda27be + } } 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 -index 75a2b687d58d76b94f8bec111df8613f120ff74b..8c44c091233aa6335791ed9b9aca62e1f98eccd9 100644 +index 75a2b687d58d76b94f8bec111df8613f120ff74b..0fd1040ed376f19c6d5326767baaf3048ce1bfb4 100644 --- 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 @@ -40,15 +40,17 @@ public class SpigotPluginProvider implements PluginProvider<JavaPlugin>, Provide private final PluginDescriptionFile description; private final JarFile jarFile; private final Logger logger; -+ private final Path[] paperLibraryPaths; ++ private final List<Path> paperLibraryPaths; private final ComponentLogger componentLogger; private ProviderStatus status; private DependencyContext dependencyContext; - SpigotPluginProvider(Path path, JarFile file, PluginDescriptionFile description) { -+ SpigotPluginProvider(Path path, JarFile file, PluginDescriptionFile description, Path[] paperLibraryPaths) { ++ SpigotPluginProvider(Path path, JarFile file, PluginDescriptionFile description, List<Path> paperLibraryPaths) { this.path = path; this.jarFile = file; this.description = description; @@ -133,10 +133,10 @@ index 75a2b687d58d76b94f8bec111df8613f120ff74b..8c44c091233aa6335791ed9b9aca62e1 throw ex; } catch (Throwable ex) { 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 -index fdb52ad85cfaa1d53aadcad72cec3d3c8c12c058..a79e38499388f3baecc9896d38a3c64c5923b426 100644 +index fdb52ad85cfaa1d53aadcad72cec3d3c8c12c058..38075b7348ad7ca3cfece2bfae63e0cce827c694 100644 --- 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 -@@ -1,9 +1,17 @@ +@@ -1,9 +1,18 @@ package io.papermc.paper.plugin.provider.type.spigot; +import com.destroystokyo.paper.utils.PaperPluginLogger; @@ -149,17 +149,18 @@ index fdb52ad85cfaa1d53aadcad72cec3d3c8c12c058..a79e38499388f3baecc9896d38a3c64c import io.papermc.paper.plugin.provider.type.PluginTypeFactory; +import io.papermc.paper.plugin.provider.util.ProviderUtil; import io.papermc.paper.util.MappingEnvironment; ++import java.util.List; +import java.util.logging.Logger; +import net.kyori.adventure.text.logger.slf4j.ComponentLogger; import org.bukkit.plugin.InvalidDescriptionException; import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.plugin.java.LibraryLoader; -@@ -36,7 +44,28 @@ class SpigotPluginProviderFactory implements PluginTypeFactory<SpigotPluginProvi +@@ -36,7 +45,28 @@ class SpigotPluginProviderFactory implements PluginTypeFactory<SpigotPluginProvi throw new InvalidDescriptionException("Restricted name, cannot use 0x20 (space character) in a plugin name."); } - return new SpigotPluginProvider(source, file, configuration); -+ final Path[] paperLibraryPaths; ++ final List<Path> paperLibraryPaths; + if (configuration.getPaperPluginLoader() != null) { + final Logger logger = PaperPluginLogger.getLogger(configuration); + PaperClasspathBuilder builder = new PaperClasspathBuilder(PluginProviderContextImpl.create( @@ -175,7 +176,7 @@ index fdb52ad85cfaa1d53aadcad72cec3d3c8c12c058..a79e38499388f3baecc9896d38a3c64c + throw new RuntimeException(e); + } + -+ paperLibraryPaths = builder.buildLibraryPaths(false).toArray(Path[]::new); ++ paperLibraryPaths = builder.buildLibraryPaths(false); + } else { + paperLibraryPaths = null; + } |