mirror of
https://github.com/Dreeam-qwq/Gale.git
synced 2025-12-19 14:59:29 +00:00
85 lines
4.5 KiB
Diff
85 lines
4.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Martijn Muijsers <martijnmuijsers@live.nl>
|
|
Date: Tue, 8 Aug 2023 18:39:55 +0200
|
|
Subject: [PATCH] Do not log plugin library loads
|
|
|
|
License: MIT (https://opensource.org/licenses/MIT)
|
|
Gale - https://galemc.org
|
|
|
|
This patch is based on the following patch:
|
|
"Add log suppression for LibraryLoader"
|
|
By: Krakenied <Krakenied1@gmail.com>
|
|
As part of: Purpur (https://github.com/PurpurMC/Purpur)
|
|
Licensed under: MIT (https://opensource.org/licenses/MIT)
|
|
|
|
* Purpur copyright *
|
|
|
|
MIT License
|
|
|
|
Copyright (c) 2019-2022 PurpurMC
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
in the Software without restriction, including without limitation the rights
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
The above copyright notice and this permission notice shall be included in all
|
|
copies or substantial portions of the Software.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
SOFTWARE.
|
|
|
|
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
|
index b412aaf08901d169ac9fc89b36f9d6ccb95c53d3..8acf45815b5841e3b2082a8bc5b7974e85cdd7f9 100644
|
|
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
|
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
|
@@ -56,6 +56,13 @@ public final class JavaPluginLoader implements PluginLoader {
|
|
private final List<PluginClassLoader> loaders = new CopyOnWriteArrayList<PluginClassLoader>();
|
|
private final LibraryLoader libraryLoader;
|
|
|
|
+ // Gale start - Purpur - do not log plugin library loads
|
|
+ public static boolean SuppressLibraryLoaderLogger = false; // This is not set by Gale, but is included for compatibility with Purpur plugins
|
|
+ public static boolean logDownloads = true;
|
|
+ public static boolean logStartLoadLibrariesForPlugin = true;
|
|
+ public static boolean logLibraryLoaded = true;
|
|
+ // Gale end - Purpur - do not log plugin library loads
|
|
+
|
|
/**
|
|
* This class was not meant to be constructed explicitly
|
|
*
|
|
diff --git a/src/main/java/org/bukkit/plugin/java/LibraryLoader.java b/src/main/java/org/bukkit/plugin/java/LibraryLoader.java
|
|
index c66252802c51174bc26f266cb5cdecdd856ff220..211c093ce2253e918cd40725ebf1ef172d1b9bdf 100644
|
|
--- a/src/main/java/org/bukkit/plugin/java/LibraryLoader.java
|
|
+++ b/src/main/java/org/bukkit/plugin/java/LibraryLoader.java
|
|
@@ -68,6 +68,7 @@ public class LibraryLoader
|
|
@Override
|
|
public void transferStarted(@NotNull TransferEvent event) throws TransferCancelledException
|
|
{
|
|
+ if (JavaPluginLoader.logDownloads && !JavaPluginLoader.SuppressLibraryLoaderLogger) // Gale - Purpur - do not log plugin library loads
|
|
logger.log( Level.INFO, "Downloading {0}", event.getResource().getRepositoryUrl() + event.getResource().getResourceName() );
|
|
}
|
|
} );
|
|
@@ -94,6 +95,7 @@ public class LibraryLoader
|
|
{
|
|
return null;
|
|
}
|
|
+ if (JavaPluginLoader.logStartLoadLibrariesForPlugin && !JavaPluginLoader.SuppressLibraryLoaderLogger) // Gale - Purpur - do not log plugin library loads
|
|
logger.log( Level.INFO, "[{0}] Loading {1} libraries... please wait", new Object[]
|
|
{
|
|
java.util.Objects.requireNonNullElseGet(desc.getPrefix(), desc::getName), desc.getLibraries().size() // Paper - use configured log prefix
|
|
@@ -144,6 +146,7 @@ public class LibraryLoader
|
|
}
|
|
|
|
jarFiles.add( url );
|
|
+ if (JavaPluginLoader.logLibraryLoaded && !JavaPluginLoader.SuppressLibraryLoaderLogger) // Gale - Purpur - do not log plugin library loads
|
|
logger.log( Level.INFO, "[{0}] Loaded library {1}", new Object[]
|
|
{
|
|
java.util.Objects.requireNonNullElseGet(desc.getPrefix(), desc::getName), file // Paper - use configured log prefix
|