From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com> Date: Mon, 30 Jun 2025 02:41:48 +0800 Subject: [PATCH] Use warning instead of direct throw Dreeam's Note: We use soft warning which in Paper is directly exception throw, Only print warning to avoid break plugins directly. Also see `Configurable LibraryLoader maven repos` patch, able to match googleapi mirror urls, to replace to repo url we custom defined. This able to switch back to maven central repo, to prevent situation that dependencies exist in maven central, but not in mirror. 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 index c1fccd64b1329e31ccf7e6a11853ce3a749b7ea4..b0069a05c322e058f0df668908f0918c0b85a814 100644 --- 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 @@ -121,10 +121,13 @@ public class MavenLibraryResolver implements ClassPathLibrary { */ public void addRepository(final RemoteRepository remoteRepository) { if (MAVEN_CENTRAL_URLS.stream().anyMatch(remoteRepository.getUrl()::startsWith)) { - LOGGER.warn( - "Use of Maven Central as a CDN is against the Maven Central Terms of Service. Use MavenLibraryResolver.MAVEN_CENTRAL_DEFAULT_MIRROR instead.", - new RuntimeException("Plugin used Maven Central for library resolution") - ); + // Leaf start - Use warning instead of direct throw + try { + throw new RuntimeException("Plugin used Maven Central for library resolution"); + } catch (RuntimeException e) { + LOGGER.error("Use of Maven Central as a CDN is against the Maven Central Terms of Service. Use MavenLibraryResolver.MAVEN_CENTRAL_DEFAULT_MIRROR instead. Please contact plugin's support for help.", e); + } + // Leaf end - Use warning instead of direct throw } this.repositories.add(remoteRepository); }