From 8c042c5294d728183a739c325eebac5db4af3a12 Mon Sep 17 00:00:00 2001 From: Lumine1909 <133463833+Lumine1909@users.noreply.github.com> Date: Tue, 30 Jul 2024 00:38:18 +0800 Subject: [PATCH] fix CraftScheduler internal plugin logging issue --- patches/server/0010-Fakeplayer-support.patch | 21 +++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/patches/server/0010-Fakeplayer-support.patch b/patches/server/0010-Fakeplayer-support.patch index b07f5d18..a70f0c6d 100644 --- a/patches/server/0010-Fakeplayer-support.patch +++ b/patches/server/0010-Fakeplayer-support.patch @@ -497,7 +497,7 @@ index 0ab53d46f0b8f3f3791dd01766738522c86932e8..f60301047fc22fb72413fe95eb89e4d2 if (event.isCancelled()) { return event; diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java -index 22f1ed383313829b8af4badda9ef8dc85cae8fd1..03af280bffbd2070abaf1de4b0c963899a67854c 100644 +index 22f1ed383313829b8af4badda9ef8dc85cae8fd1..1c47e320e464af9651953ff308a2583fcb965891 100644 --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java @@ -1,7 +1,7 @@ @@ -534,6 +534,25 @@ index 22f1ed383313829b8af4badda9ef8dc85cae8fd1..03af280bffbd2070abaf1de4b0c96389 /** * The start ID for the counter. */ +@@ -478,10 +480,14 @@ public class CraftScheduler implements BukkitScheduler { + "Task #%s for %s generated an exception", + task.getTaskId(), + task.getOwner().getDescription().getFullName()); +- task.getOwner().getLogger().log( +- Level.WARNING, +- logMessage, +- throwable); ++ if (task.getOwner() instanceof MinecraftInternalPlugin) { ++ net.minecraft.server.MinecraftServer.LOGGER.error(logMessage, throwable); ++ } else { ++ task.getOwner().getLogger().log( ++ Level.WARNING, ++ logMessage, ++ throwable); ++ } + org.bukkit.Bukkit.getServer().getPluginManager().callEvent( + new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerSchedulerException(logMessage, throwable, task))); + // Paper end diff --git a/src/main/java/org/leavesmc/leaves/bot/BotCommand.java b/src/main/java/org/leavesmc/leaves/bot/BotCommand.java new file mode 100644 index 0000000000000000000000000000000000000000..b64361c4151659d5e3f8884562cb811d60776c38