From d875bacc2867f3edca955320af715638e92f70e4 Mon Sep 17 00:00:00 2001 From: Riley Park Date: Sat, 15 May 2021 15:56:38 -0700 Subject: [PATCH] Activate warning by default when people are doing silly things (#5642) --- Spigot-Server-Patches/0010-Adventure.patch | 17 +++++++++++++++++ ...client-crashes-server-lists-and-Mojang.patch | 6 +++--- .../0103-Add-server-name-parameter.patch | 4 ++-- ...nsoleAppender-for-console-improvements.patch | 8 ++++---- .../0161-Fix-this-stupid-bullshit.patch | 4 ++-- ...llow-overriding-the-java-version-check.patch | 4 ++-- .../0437-Improved-Watchdog-Support.patch | 8 ++++---- ...DK-per-thread-native-byte-buffer-cache.patch | 8 ++++---- 8 files changed, 38 insertions(+), 21 deletions(-) diff --git a/Spigot-Server-Patches/0010-Adventure.patch b/Spigot-Server-Patches/0010-Adventure.patch index af195adf7..958606b45 100644 --- a/Spigot-Server-Patches/0010-Adventure.patch +++ b/Spigot-Server-Patches/0010-Adventure.patch @@ -1796,6 +1796,23 @@ index ce68a6cf845af640e03819c44860590655f74cb1..cb470baa3533e4502c13982ef4e03041 + } // Paper end } +diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java +index 3b48799d084f14722f815cb35cbd48b618380fca..bb8ddfae48526d9b6fdc64eecb6f655f6b7665de 100644 +--- a/src/main/java/org/bukkit/craftbukkit/Main.java ++++ b/src/main/java/org/bukkit/craftbukkit/Main.java +@@ -19,6 +19,12 @@ public class Main { + public static boolean useConsole = true; + + public static void main(String[] args) { ++ // Paper start ++ final String warnWhenLegacyFormattingDetected = String.join(".", "net", "kyori", "adventure", "text", "warnWhenLegacyFormattingDetected"); ++ if (System.getProperty(warnWhenLegacyFormattingDetected) == null) { ++ System.setProperty(warnWhenLegacyFormattingDetected, String.valueOf(true)); ++ } ++ // Paper end + // Todo: Installation script + OptionParser parser = new OptionParser() { + { diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBeacon.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBeacon.java index ae735836accc6bf6f0831f72ff882720b69df792..d3ae5cadd88f9012203d2c04cbe38af9b215ef0b 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBeacon.java diff --git a/Spigot-Server-Patches/0018-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch b/Spigot-Server-Patches/0018-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch index 07b5db16b..c038efb7b 100644 --- a/Spigot-Server-Patches/0018-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch +++ b/Spigot-Server-Patches/0018-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch @@ -32,7 +32,7 @@ index 511d6094403d17522212fcdda6903a13517c44fa..9ba05ab7ec97896349f4b754f2993cda public CrashReport b(CrashReport crashreport) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 2f6b49e3ae7a7407eaec9810af8bf72e3a4896de..1818a6af3a55d15be698d5219e0eea63e2077611 100644 +index cb470baa3533e4502c13982ef4e03041fac91ce5..c66be5b9f304878f9179faba433f2e844bcee72c 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -226,7 +226,7 @@ import org.yaml.snakeyaml.error.MarkedYAMLException; @@ -45,10 +45,10 @@ index 2f6b49e3ae7a7407eaec9810af8bf72e3a4896de..1818a6af3a55d15be698d5219e0eea63 private final String bukkitVersion = Versioning.getBukkitVersion(); private final Logger logger = Logger.getLogger("Minecraft"); diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 3b48799d084f14722f815cb35cbd48b618380fca..8efd3919bec5f497ce4bee041586c0a313931211 100644 +index bb8ddfae48526d9b6fdc64eecb6f655f6b7665de..8507f9a81b6068eb2f50e6390e3b4afe6d04fbbb 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java -@@ -200,12 +200,25 @@ public class Main { +@@ -206,12 +206,25 @@ public class Main { deadline.add(Calendar.DAY_OF_YEAR, -28); if (buildDate.before(deadline.getTime())) { System.err.println("*** Error, this build is outdated ***"); diff --git a/Spigot-Server-Patches/0103-Add-server-name-parameter.patch b/Spigot-Server-Patches/0103-Add-server-name-parameter.patch index 41ceffad6..84270eddc 100644 --- a/Spigot-Server-Patches/0103-Add-server-name-parameter.patch +++ b/Spigot-Server-Patches/0103-Add-server-name-parameter.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add server-name parameter diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index a34b1ba17e6f7121ed70c3d95ec8f4aa24f1ef5c..78b6d00ea40e8d7c450e08e444c5231e7c99969b 100644 +index 8507f9a81b6068eb2f50e6390e3b4afe6d04fbbb..89abd046dc4043e2a138fd93cbf55b96cd90f890 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java -@@ -137,6 +137,14 @@ public class Main { +@@ -143,6 +143,14 @@ public class Main { .defaultsTo(new File("paper.yml")) .describedAs("Yml file"); // Paper end diff --git a/Spigot-Server-Patches/0146-Use-TerminalConsoleAppender-for-console-improvements.patch b/Spigot-Server-Patches/0146-Use-TerminalConsoleAppender-for-console-improvements.patch index 6e22c611c..27a636d47 100644 --- a/Spigot-Server-Patches/0146-Use-TerminalConsoleAppender-for-console-improvements.patch +++ b/Spigot-Server-Patches/0146-Use-TerminalConsoleAppender-for-console-improvements.patch @@ -300,7 +300,7 @@ index e2062f2a86cd764c86e69709b370f54b7fb5e15c..268d56859a0de3b2ca39155f882991b5 @Override public PluginCommand getPluginCommand(String name) { diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 0c069673437d97aff29b3a30caa22fcf62d0d7db..fb49dd66e40e8376e9d6141b97350e16b5d0215e 100644 +index 89abd046dc4043e2a138fd93cbf55b96cd90f890..bed1208223e4213dec2c246675c11f2a1965a4ee 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -12,7 +12,7 @@ import java.util.logging.Level; @@ -312,7 +312,7 @@ index 0c069673437d97aff29b3a30caa22fcf62d0d7db..fb49dd66e40e8376e9d6141b97350e16 public class Main { public static boolean useJline = true; -@@ -179,6 +179,8 @@ public class Main { +@@ -185,6 +185,8 @@ public class Main { } try { @@ -321,7 +321,7 @@ index 0c069673437d97aff29b3a30caa22fcf62d0d7db..fb49dd66e40e8376e9d6141b97350e16 // This trick bypasses Maven Shade's clever rewriting of our getProperty call when using String literals String jline_UnsupportedTerminal = new String(new char[]{'j', 'l', 'i', 'n', 'e', '.', 'U', 'n', 's', 'u', 'p', 'p', 'o', 'r', 't', 'e', 'd', 'T', 'e', 'r', 'm', 'i', 'n', 'a', 'l'}); String jline_terminal = new String(new char[]{'j', 'l', 'i', 'n', 'e', '.', 't', 'e', 'r', 'm', 'i', 'n', 'a', 'l'}); -@@ -196,9 +198,18 @@ public class Main { +@@ -202,9 +204,18 @@ public class Main { // This ensures the terminal literal will always match the jline implementation System.setProperty(jline.TerminalFactory.JLINE_TERMINAL, jline.UnsupportedTerminal.class.getName()); } @@ -340,7 +340,7 @@ index 0c069673437d97aff29b3a30caa22fcf62d0d7db..fb49dd66e40e8376e9d6141b97350e16 } if (Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) { -@@ -226,7 +237,7 @@ public class Main { +@@ -232,7 +243,7 @@ public class Main { System.out.println("Unable to read system info"); } // Paper end diff --git a/Spigot-Server-Patches/0161-Fix-this-stupid-bullshit.patch b/Spigot-Server-Patches/0161-Fix-this-stupid-bullshit.patch index 7364b66cc..ee1686533 100644 --- a/Spigot-Server-Patches/0161-Fix-this-stupid-bullshit.patch +++ b/Spigot-Server-Patches/0161-Fix-this-stupid-bullshit.patch @@ -9,10 +9,10 @@ modified in order to prevent merge conflicts when Spigot changes/disables the wa and to provide some level of hint without being disruptive. diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 78fad8d06540a0cf41302f12bf25e08e49f589d9..6095e6ef45f6e2c1188a623192362f8879f5fcd9 100644 +index bed1208223e4213dec2c246675c11f2a1965a4ee..463c41454d96e823d1ffd62619fc3b83af3bf168 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java -@@ -218,10 +218,12 @@ public class Main { +@@ -224,10 +224,12 @@ public class Main { Calendar deadline = Calendar.getInstance(); deadline.add(Calendar.DAY_OF_YEAR, -28); if (buildDate.before(deadline.getTime())) { diff --git a/Spigot-Server-Patches/0405-Allow-overriding-the-java-version-check.patch b/Spigot-Server-Patches/0405-Allow-overriding-the-java-version-check.patch index 3f15011d1..a57683123 100644 --- a/Spigot-Server-Patches/0405-Allow-overriding-the-java-version-check.patch +++ b/Spigot-Server-Patches/0405-Allow-overriding-the-java-version-check.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Allow overriding the java version check -DPaper.IgnoreJavaVersion=true diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 7d7b9984b867461b0a1025e5ec21ff7798281b8f..100772ba60cb7e717c5e626a4d7b44c15375b0e5 100644 +index 463c41454d96e823d1ffd62619fc3b83af3bf168..c3e2d9c4d0ef3de80f5206c6bd234121ee1316cc 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java -@@ -175,7 +175,7 @@ public class Main { +@@ -181,7 +181,7 @@ public class Main { float javaVersion = Float.parseFloat(System.getProperty("java.class.version")); if (javaVersion > 60.0) { System.err.println("Unsupported Java detected (" + javaVersion + "). Only up to Java 16 is supported."); diff --git a/Spigot-Server-Patches/0437-Improved-Watchdog-Support.patch b/Spigot-Server-Patches/0437-Improved-Watchdog-Support.patch index 9fdd260c3..93119e26e 100644 --- a/Spigot-Server-Patches/0437-Improved-Watchdog-Support.patch +++ b/Spigot-Server-Patches/0437-Improved-Watchdog-Support.patch @@ -300,7 +300,7 @@ index cfe784560ea4c368d6e3a0797d09c0a717eb146e..795c4a9e3e33660af888ff80204bfd47 List afterEntityTickingTasks = Lists.newArrayList(); public void doIfNotEntityTicking(java.lang.Runnable run) { diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index f35825d4a8574ea75b46be36b9929f8e12405217..48d4f8310d79d0eb78f4ace42c8778ee4addf7d0 100644 +index bd272d6fe86c30c3f22418802f98609410f947f8..9eec320ca5a63a313138dc84367e93038b457c0d 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -507,7 +507,7 @@ public abstract class PlayerList { @@ -358,7 +358,7 @@ index fbc5d62d1ac2affc5240b114ee88375ff0199ef4..b55b2a27adba357faee0f260c8d7cc24 // Paper start diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 100772ba60cb7e717c5e626a4d7b44c15375b0e5..f9a1f1a83be91e302e9a2d29fefc5b21d9f0e590 100644 +index c3e2d9c4d0ef3de80f5206c6bd234121ee1316cc..777116a0a0be6a5a00b1443204d6c53803af8051 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -12,6 +12,8 @@ import java.util.logging.Level; @@ -370,7 +370,7 @@ index 100772ba60cb7e717c5e626a4d7b44c15375b0e5..f9a1f1a83be91e302e9a2d29fefc5b21 import net.minecrell.terminalconsole.TerminalConsoleAppender; // Paper public class Main { -@@ -150,6 +152,36 @@ public class Main { +@@ -156,6 +158,36 @@ public class Main { OptionSet options = null; @@ -407,7 +407,7 @@ index 100772ba60cb7e717c5e626a4d7b44c15375b0e5..f9a1f1a83be91e302e9a2d29fefc5b21 try { options = parser.parse(args); } catch (joptsimple.OptionException ex) { -@@ -245,8 +277,64 @@ public class Main { +@@ -251,8 +283,64 @@ public class Main { } catch (Throwable t) { t.printStackTrace(); } diff --git a/Spigot-Server-Patches/0464-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch b/Spigot-Server-Patches/0464-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch index d031bd1af..8676a856f 100644 --- a/Spigot-Server-Patches/0464-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch +++ b/Spigot-Server-Patches/0464-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch @@ -17,12 +17,12 @@ keeping long lived large direct buffers in cache. Set system properly at server startup if not set already to help protect from this. diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index f9a1f1a83be91e302e9a2d29fefc5b21d9f0e590..154f3a6a3d37b94c40cb29c305e3aa5fb494850c 100644 +index 777116a0a0be6a5a00b1443204d6c53803af8051..6cae7454f3cf5b246300bac489b38ea65e2185c9 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java -@@ -22,6 +22,7 @@ public class Main { - - public static void main(String[] args) { +@@ -28,6 +28,7 @@ public class Main { + } + // Paper end // Todo: Installation script + if (System.getProperty("jdk.nio.maxCachedBufferSize") == null) System.setProperty("jdk.nio.maxCachedBufferSize", "262144"); // Paper - cap per-thread NIO cache size OptionParser parser = new OptionParser() {