mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 08:27:43 +01:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@f7e3976 Revert "Legacy data should look for legacy materials (Fixes #6618)" (Fixes #6664) PaperMC/Paper@ce1e7e8 Fix jline relocation (#6677) PaperMC/Paper@3e8fb21 Suggest PlayerPostRespawnEvent if changing player state (#6679) PaperMC/Paper@2b404b0 Fix nullability on Block#breakNaturally (#6651) PaperMC/Paper@8ee9bdd Fix stacktrace deobf where thrownProxy got initialized before rewriting (#6684) PaperMC/Paper@fce7905 Option to prevent NBT copy in smithing recipes (#6671) PaperMC/Paper@3b2b835 Fix click event when vanilla scoreboard name coloring is enabled (#6652) PaperMC/Paper@425edfa More CommandBlock API (#5746) PaperMC/Paper@6847f57 Improve ItemStack#editMeta (#6502) PaperMC/Paper@6703c13 Preserve overstacked loot (#5943) PaperMC/Paper@0032236 Make Levels Use Correct Spawn Settings (#6419) PaperMC/Paper@4a27a4a Update head rotation in missing places (#5481) PaperMC/Paper@ebfd70b Use null for null resource pack prompts (#6572) PaperMC/Paper@826acaf Fix plugin provides load order (#6687) PaperMC/Paper@f905057 Prevent unintended light block manipulation (#6601) PaperMC/Paper@45c4f90 Readd root/admin user detection (#6593) PaperMC/Paper@e8830b2 Revert "Readd root/admin user detection (#6593)" (#6699) PaperMC/Paper@cc38c16 Updated Upstream (Bukkit/CraftBukkit) (#6638) PaperMC/Paper@7dd7c0c [ci skip] update issue template to remove checkboxes and add datapacks (#6702) PaperMC/Paper@bde7b98 Make legacyRenderer a ViewerUnaware renderer (#6691) PaperMC/Paper@e391591 Update paperweight to 1.1.12 (#6653) PaperMC/Paper@e14aff9 Don't count named piglins and hoglins towards mob cap (#6452) PaperMC/Paper@a978f41 Start console thread after PaperConfig & MinecraftServer.console are initialized (#6716) PaperMC/Paper@b1f0cbd [ci skip] Remove redundant/broken readme badges (#6715) PaperMC/Paper@e3ef498 [ci skip] remove markdown from issue template (#6705) PaperMC/Paper@7ebf08a Handle missing Spawn Egg item meta for 1.17 mobs (#6700) PaperMC/Paper@90f717f Add missing team sidebar display slots (#6690)
106 lines
5.3 KiB
Diff
106 lines
5.3 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
|
Date: Mon, 28 Jun 2021 13:33:12 -0500
|
|
Subject: [PATCH] Redirect System.out calls to plugin loggers
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
|
index 9cff21030215ab60a219fa719e8140c0c331a06b..f2e6676cbcf66e3334d5a76a03b1c1e8862504d3 100644
|
|
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
|
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
|
@@ -178,8 +178,8 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
|
*/
|
|
// Paper end
|
|
|
|
- System.setOut(IoBuilder.forLogger(logger).setLevel(Level.INFO).buildPrintStream());
|
|
- System.setErr(IoBuilder.forLogger(logger).setLevel(Level.WARN).buildPrintStream());
|
|
+ System.setOut(new net.pl3x.purpur.PurpurPrintStream(IoBuilder.forLogger(logger).setLevel(Level.INFO).buildPrintStream(), java.util.logging.Logger::info)); // Purpur
|
|
+ System.setErr(new net.pl3x.purpur.PurpurPrintStream(IoBuilder.forLogger(logger).setLevel(Level.WARN).buildPrintStream(), java.util.logging.Logger::severe)); // Purpur
|
|
// CraftBukkit end
|
|
|
|
thread.setDaemon(true);
|
|
diff --git a/src/main/java/net/pl3x/purpur/PurpurPrintStream.java b/src/main/java/net/pl3x/purpur/PurpurPrintStream.java
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..f88da0b86a683b25d429ceea4a36d6dde12b2b56
|
|
--- /dev/null
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurPrintStream.java
|
|
@@ -0,0 +1,65 @@
|
|
+/*
|
|
+ * MIT License
|
|
+ *
|
|
+ * Copyright (c) 2020 Josh (Vicarious)
|
|
+ *
|
|
+ * 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.
|
|
+ */
|
|
+package net.pl3x.purpur;
|
|
+
|
|
+import org.bukkit.Bukkit;
|
|
+import org.bukkit.plugin.java.JavaPlugin;
|
|
+import org.jetbrains.annotations.NotNull;
|
|
+
|
|
+import java.io.OutputStream;
|
|
+import java.io.PrintStream;
|
|
+import java.util.function.BiConsumer;
|
|
+import java.util.logging.Logger;
|
|
+
|
|
+/**
|
|
+ * Logic borrowed from SysoutCatcher
|
|
+ * <p>
|
|
+ * https://www.spigotmc.org/resources/sysoutcatcher.79076/
|
|
+ */
|
|
+
|
|
+public class PurpurPrintStream extends PrintStream {
|
|
+ private static final StackWalker STACKWALKER = StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE);
|
|
+ private final BiConsumer<Logger, String> consumer;
|
|
+
|
|
+ public PurpurPrintStream(@NotNull OutputStream out, BiConsumer<Logger, String> consumer) {
|
|
+ super(out);
|
|
+ this.consumer = consumer;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void println(String line) {
|
|
+ try {
|
|
+ // Get the JavaPlugin that "owns" the calling class
|
|
+ JavaPlugin plugin = JavaPlugin.getProvidingPlugin(STACKWALKER.getCallerClass());
|
|
+
|
|
+ // Instead of just printing the message, send it to the plugin's logger
|
|
+ consumer.accept(plugin.getLogger(), line);
|
|
+ } catch (Throwable ignore) {
|
|
+ // If anything happens, the calling class doesn't exist, there is no JavaPlugin that "owns" the calling class, etc
|
|
+ // Just print out normally, with some added information
|
|
+ StackTraceElement element = Thread.currentThread().getStackTrace()[2];
|
|
+ consumer.accept(Bukkit.getLogger(), String.format("(%s:%d) %s", element.getClassName(), element.getLineNumber(), line));
|
|
+ }
|
|
+ }
|
|
+}
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
index da98b04c22086df03a330cf747b2bf40182d2dea..eadbc98e5833fca311ad5b52ba7a576d6e093039 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
@@ -287,7 +287,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
|
|
- private final SysoutCatcher sysoutCatcher = new SysoutCatcher(); // Paper
|
|
+ //private final SysoutCatcher sysoutCatcher = new SysoutCatcher(); // Paper // Purpur - we have our own implementation that doesnt nag or prefix output
|
|
|
|
static {
|
|
ConfigurationSerialization.registerClass(CraftOfflinePlayer.class);
|