mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@c1b4899 Fix dupe uuid check on entity add (#6735) PaperMC/Paper@3f043f7 Async catch modifications to critical entity state PaperMC/Paper@bc43f40 Update jline and TCA (#6829) PaperMC/Paper@d9e2817 Update paperweight to 1.1.13 (#6866) PaperMC/Paper@3e310e0 Remove redundant and unneeded repos, reorder repos (#6867) PaperMC/Paper@485d15f Update paperweight to 1.1.14 (#6868) PaperMC/Paper@09d50a9 Added missing mappings (#6810) PaperMC/Paper@0968cdd Move async catches back to where they were (#6869) PaperMC/Paper@6f71b7c Deduplicate strings in ObfHelper (#6841) PaperMC/Paper@ada930b Updated Upstream (Bukkit/CraftBukkit) (#6872) PaperMC/Paper@06d82e0 Cache palette array (#6767) PaperMC/Paper@70fe58d Expose the potential player cause of a lightning (#6782) PaperMC/Paper@c20c9d3 Fix CraftNamespacedKey shenanigans (#6825) PaperMC/Paper@29bb5a9 Add PlayerDeathEvent#getPlayer for clarity (#6859) PaperMC/Paper@124d079 Fix issues with mob conversion (#6831) PaperMC/Paper@22b0238 Add API for checking if a zombie has the option to break doors (#6855) PaperMC/Paper@5af80b0 Add isCollidable methods to various places (#6870) PaperMC/Paper@32ba088 Fix setPatternColor on tropical fish bucket meta (#6877) PaperMC/Paper@87121ce Move `getTrackedPlayers` up from Player to Entity (#6569) PaperMC/Paper@a923e33 Make despawn distance configs per-category, improve per category spawn limit config (#6717) PaperMC/Paper@3f17694 Goat ram API (#6336) PaperMC/Paper@cc2ecbc Add Raw Byte Entity Serialization (#6826) Airplane Changes: TECHNOVE/Airplane@e47949b Ty Penple <3 TECHNOVE/Airplane@86fee6b Update upstream
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 4909f57006af0c8bc69773952e93d5546c3d8cbf..61877f5ba0e54bbf046dabc067c79bf4df588278 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 9ad49a1cf4daa0a3c7f4a7360120d55be09a326b..47464536adb99db48f1e5d2c28ba371a11646812 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
@@ -291,7 +291,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);
|